DB db = DbManager.getInstance().getDataDb(); Jongo jongo = new Jongo(db); MongoCollection sysLogs = jongo.getCollection("sys_logs"); Map<String, Object> map = new HashMap<>(); Criteria criteria = new Criteria(); try { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date start = simpleDateFormat.parse(startTime); Date end = simpleDateFormat.parse(endTime); criteria.and("handleTime").gte(10l).lte(10000000000000l); } catch (ParseException e) { e.printStackTrace(); } if (Objects.nonNull(username)) { // map.put("username", username); criteria.and("username").equals(username); } String query = new org.springframework.data.mongodb.core.query.Query(criteria).getQueryObject().toJson(); MongoCursor<Map> as = sysLogs.find(query).skip((pagination.getCurrent() - 1) * pagination.getPageSize()) .limit(pagination.getPageSize()).as(Map.class);