| | |
| | | ter.dept_id, |
| | | ter.create_time, |
| | | ter.construction_type, |
| | | ter.demerit |
| | | ter.demerit, |
| | | ter.record_time |
| | | from t_demerit_record ter where ter.deleted = 0 |
| | | <if test="query.deptId != null and query.deptId != ''"> |
| | | AND ter.dept_id = #{query.deptId} |
| | |
| | | </if> |
| | | <!-- 时间范围筛选:按日查询 --> |
| | | <if test="query.searchType == 'day' and query.dayDate != null"> |
| | | AND ter.create_time >= #{query.dayDate} <!-- 当天00:00:00 --> |
| | | AND ter.create_time <DATE_ADD(#{query.dayDate}, INTERVAL 1 DAY) <!-- 次日00:00:00(不包含) --> |
| | | AND ter.record_time >= #{query.dayDate} <!-- 当天00:00:00 --> |
| | | AND ter.record_time <DATE_ADD(#{query.dayDate}, INTERVAL 1 DAY) <!-- 次日00:00:00(不包含) --> |
| | | </if> |
| | | <!-- 时间范围筛选:按月查询 --> |
| | | <if test="query.searchType == 'month' and query.monthDate != null"> |
| | | AND ter.create_time >= #{query.monthDate} <!-- 当月1日00:00:00 --> |
| | | AND ter.create_time <DATE_ADD(LAST_DAY(#{query.monthDate}), INTERVAL 1 DAY) <!-- 下月1日00:00:00(不包含) --> |
| | | </if> |
| | | ORDER BY ter.record_time DESC |
| | | </select> |
| | | </mapper> |