Example example = new Example(Notice.class);
Example.Criteria criteria = example.createCriteria();
//当前时间
String currentDate = LocalDate.now().toString();
//时间检查
criteria.andGreaterThanOrEqualTo("noticeStartTime",currentDate);
criteria.andLessThanOrEqualTo("noticeEndTime",currentDate);
List<Notice> noticeList = noticeMapper.selectByExample(example);
//按照更新时间降序获取
noticeList.sort((e1, e2) -> e2.getNoticeUpdateTime().compareTo(e1.getNoticeUpdateTime()));
按照我的理解 andGreaterThanOrEqualTo 应该是 大于等于 然后 currentDate>=noticeStartTime
然而 事实不是这样的 看一下 Druid的 解析 正好相反
记录一下 遇到的坑