package com.malk.mcli.test; import com.malk.mcli.repository.dao.AyUserAttachmentRelRepository; import com.malk.server.common.McR; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Profile; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * 指定运行环境 [参考TestController] * 1. # MongoDB配置 [yml文件] * data: mongodb: uri: mongodb://tbread:Teambition999@192.168.31.201:27017/teambition # 固定格式 [连接成功后, 需要为 teambition 库添加 admin 权限才可查询] * 2. 添加pom依赖 [未全局添加, 子项目单独依赖] * 3. 添加对应的entity与Dao, 实体通过@Document注解 */ @Profile({"dev", "test"}) @Validated @RestController @Slf4j @RequestMapping("/test/mg") public class MGTestController { @Autowired private AyUserAttachmentRelRepository ayUserAttachmentRelRepository; @PostMapping("test") McR test() { return McR.success(ayUserAttachmentRelRepository.findAll()); } }