|
|
@@ -16,7 +16,9 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeParseException;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -36,6 +38,17 @@ public class DisEventGradeServiceImpl extends ServiceImpl<DisEventGradeMapper, D
|
|
|
wrapper.eq(StringUtils.isNotBlank(dto.getEventType()), DisEventGrade::getEventType, dto.getEventType());
|
|
|
wrapper.eq(StringUtils.isNotBlank(dto.getEventLevel()), DisEventGrade::getEventLevel, dto.getEventLevel());
|
|
|
wrapper.eq(dto.getStatus() != null, DisEventGrade::getStatus, dto.getStatus());
|
|
|
+ // 创建时间区间过滤(含边界:结束日期取次日零点前),格式非法时忽略该条件不阻断查询
|
|
|
+ try {
|
|
|
+ if (StringUtils.isNotBlank(dto.getStartDate())) {
|
|
|
+ wrapper.ge(DisEventGrade::getCreateTime, LocalDate.parse(dto.getStartDate()).atStartOfDay());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(dto.getEndDate())) {
|
|
|
+ wrapper.lt(DisEventGrade::getCreateTime, LocalDate.parse(dto.getEndDate()).plusDays(1).atStartOfDay());
|
|
|
+ }
|
|
|
+ } catch (DateTimeParseException e) {
|
|
|
+ log.warn("分级标准查询日期格式错误: {} ~ {}", dto.getStartDate(), dto.getEndDate());
|
|
|
+ }
|
|
|
wrapper.orderByAsc(DisEventGrade::getEventCategory).orderByAsc(DisEventGrade::getEventLevel);
|
|
|
wrapper.orderByAsc(DisEventGrade::getId);
|
|
|
Page<DisEventGrade> result = page(page, wrapper);
|