MybatisPlus按时间段进行查询

String startDate = "2022-10-10";
String endDate = "2022-10-30";

QueryWrapper<BpSubscribe> queryWrapper = new QueryWrapper<>();
queryWrapper.select().apply(StrUtil.isNotBlank(startDate),
                        "date_format (create_date,'%Y-%m-%d') >= date_format('" + startDate + "','%Y-%m-%d')")
                .apply(StrUtil.isNotBlank(endDate),
                        "date_format (create_date,'%Y-%m-%d') <= date_format('" + endDate + "','%Y-%m-%d')");
List<BpSubscribe> bpSubscribes = bpSubscribeService.list(queryWrapper);

猜你喜欢

转载自blog.csdn.net/weixin_43192102/article/details/127517798
今日推荐