mybatis-plus 版本:2.X
java语句:
//有很多中Wrapper实现类,我也不是很了解,这里我使用的是EntityWrapper
EntityWrapper wrapper = new EntityWrapper();
wrapper.eq("status", status);
wrapper.andNew().gt("gmt_end", now).or().isNotNull("days");
Integer count = couponMapper.selectCount(wrapper);
查询sql:
SELECT COUNT(1) FROM unimall_coupon WHERE (status = 1) AND (gmt_end > '2019-07-14 16:14:23.51' OR days IS NOT NULL)