赞
踩
- /*
- * 未开始 start_time>= 当前时间
- * 进行中 start_time<= 当前时间 AND end_time>= 当前时间
- */
- LocalDateTime now = LocalDateTime.now();
- QueryWrapper<Activity> activityQueryWrapper = new QueryWrapper<>();
- activityQueryWrapper.and(
- queryWrapper -> queryWrapper.ge("start_time", now)
- .or(
- qw -> qw.le("start_time", now).ge("end_time", now)
- )
- );
- activityQueryWrapper.eq("del_flag", 0);
- SELECT
- id,
- title,
- start_time,
- end_time,
- del_flag
- FROM
- `activity`
- WHERE (
- start_time >= '2022-08-30T15:04:04.452'
- OR (
- start_time <= '2022-08-30T15:04:04.452'
- AND end_time >= '2022-08-30T15:04:04.452'
- )
- )
- AND del_flag = 0 ;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。