@Test public void listDaily() { Long millis = System.currentTimeMillis(); Date start = new Date(millis + 30 * 24 * 60 * 60 * 1000); Date end = new Date(millis); List<Daily> dailies = dailyService.listDaily(getUser().getId(), start, end); Assert.assertNotNull(dailies); System.out.println(dailies); }
@Override @LogMethod("列出日程记录") public List<Daily> listDaily(String userId, Date startDate, Date endDate) { Query query = new Query(); Criteria criteria = Criteria.where("userId").is(userId); BeeUtils.betweenStartAndEnd(criteria, startDate, endDate); query.addCriteria(criteria); query.with(new Sort(Sort.Direction.ASC, "date")); return mongoTemplate.find(query, Daily.class); }
DailyServiceImpl implements DailyService { @Override @LogMethod("列出日程记录") public List<Daily> listDaily(String userId, Date startDate, Date endDate) { Query query = new Query(); Criteria criteria = Criteria.where("userId").is(userId); BeeUtils.betweenStartAndEnd(criteria, startDate, endDate); query.addCriteria(criteria); query.with(new Sort(Sort.Direction.ASC, "date")); return mongoTemplate.find(query, Daily.class); } }
DailyServiceImpl implements DailyService { @Override @LogMethod("列出日程记录") public List<Daily> listDaily(String userId, Date startDate, Date endDate) { Query query = new Query(); Criteria criteria = Criteria.where("userId").is(userId); BeeUtils.betweenStartAndEnd(criteria, startDate, endDate); query.addCriteria(criteria); query.with(new Sort(Sort.Direction.ASC, "date")); return mongoTemplate.find(query, Daily.class); } @Autowired  DailyServiceImpl(DailyDAO dailyDAO, MongoTemplate mongoTemplate); }
DailyServiceImpl implements DailyService { @Override @LogMethod("列出日程记录") public List<Daily> listDaily(String userId, Date startDate, Date endDate) { Query query = new Query(); Criteria criteria = Criteria.where("userId").is(userId); BeeUtils.betweenStartAndEnd(criteria, startDate, endDate); query.addCriteria(criteria); query.with(new Sort(Sort.Direction.ASC, "date")); return mongoTemplate.find(query, Daily.class); } @Autowired  DailyServiceImpl(DailyDAO dailyDAO, MongoTemplate mongoTemplate); @Override @LogMethod("检测日程记录是否存在") boolean exists(String dailyId); @Override @LogMethod("查找日程记录") Daily getDaily(String userId, Date date); @Override @LogMethod("列出日程记录") List<Daily> listDaily(String userId, Date startDate, Date endDate); @Override @LogMethod("删除日程记录") void remove(String dailyId); @Override @LogMethod("添加日程记录") Daily saveDaily(String userId, DailyVO dailyVO); @Override @LogMethod("检测日程记录是否存在") boolean exists(String userId, String dailyId, Date date); @Override @LogMethod("更新日程记录") Daily updateDaily(String userId, String dailyId, DailyVO dailyVO); }
DailyServiceImpl implements DailyService { @Override @LogMethod("列出日程记录") public List<Daily> listDaily(String userId, Date startDate, Date endDate) { Query query = new Query(); Criteria criteria = Criteria.where("userId").is(userId); BeeUtils.betweenStartAndEnd(criteria, startDate, endDate); query.addCriteria(criteria); query.with(new Sort(Sort.Direction.ASC, "date")); return mongoTemplate.find(query, Daily.class); } @Autowired  DailyServiceImpl(DailyDAO dailyDAO, MongoTemplate mongoTemplate); @Override @LogMethod("检测日程记录是否存在") boolean exists(String dailyId); @Override @LogMethod("查找日程记录") Daily getDaily(String userId, Date date); @Override @LogMethod("列出日程记录") List<Daily> listDaily(String userId, Date startDate, Date endDate); @Override @LogMethod("删除日程记录") void remove(String dailyId); @Override @LogMethod("添加日程记录") Daily saveDaily(String userId, DailyVO dailyVO); @Override @LogMethod("检测日程记录是否存在") boolean exists(String userId, String dailyId, Date date); @Override @LogMethod("更新日程记录") Daily updateDaily(String userId, String dailyId, DailyVO dailyVO);  }