mybatis 的 example 的 andGreaterThanOrEqualTo 和 andLessThanOrEqualTo

 

  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的  解析    正好相反      

 

记录一下 遇到的坑  

 

 

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值