时间:2021-07-01 10:21:17 帮助过:334人阅读
6.测试
@Document(collection = "login_log") @Data public class LoginLog { @Id private String id; private String customerId; private String deviceId; private String deviceName; private long lastLoginTime; }
@Api(value = "MongodbController", description = "Test接口") @RestController @RequestMapping("/loginLog") @Slf4j public class MongodbController { @Autowired private MongoTemplate template; @ApiOperation(value = "用户登录日志", notes = "用户登录日志") @RequestMapping(value = "/list", method = RequestMethod.GET) public String list(String key) { Query query = new Query(); query.addCriteria(Criteria.where("customerId").is(Integer.parseInt(key))); List<ClientDevice> clientDevices = template.find(query, LoginLog.class); return clientDevices.toString(); } }
MongoTemplate 操作 mongodb
标签:tde res ppi ati ret autowire doc not turn