//有很多中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)