diff --git a/src/main/java/club/joylink/xiannccda/dto/event/EventLogQueryDTO.java b/src/main/java/club/joylink/xiannccda/dto/event/EventLogQueryDTO.java index 61fb824..09c6a20 100644 --- a/src/main/java/club/joylink/xiannccda/dto/event/EventLogQueryDTO.java +++ b/src/main/java/club/joylink/xiannccda/dto/event/EventLogQueryDTO.java @@ -3,10 +3,18 @@ package club.joylink.xiannccda.dto.event; import club.joylink.xiannccda.constants.common.CommonLogTypeEnum; import club.joylink.xiannccda.entity.EventLog; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; +import java.time.LocalDateTime; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; @Data public class EventLogQueryDTO extends PageDTO { private CommonLogTypeEnum logType; + + private String name; + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime beginDate; + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime endDate; } diff --git a/src/main/java/club/joylink/xiannccda/dto/record/AlertRecordQueryDTO.java b/src/main/java/club/joylink/xiannccda/dto/record/AlertRecordQueryDTO.java index dcb18bf..cd022ab 100644 --- a/src/main/java/club/joylink/xiannccda/dto/record/AlertRecordQueryDTO.java +++ b/src/main/java/club/joylink/xiannccda/dto/record/AlertRecordQueryDTO.java @@ -4,9 +4,12 @@ import club.joylink.xiannccda.constants.common.LineTypeEnum; import club.joylink.xiannccda.dto.CommonPage; import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType; import club.joylink.xiannccda.entity.AlertRecord; +import com.alibaba.fastjson2.annotation.JSONField; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; +import com.fasterxml.jackson.annotation.JsonFormat; import java.time.LocalDateTime; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; @Data public class AlertRecordQueryDTO extends CommonPage { @@ -16,7 +19,10 @@ public class AlertRecordQueryDTO extends CommonPage { private Integer lineId; private LineTypeEnum lineType; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime beginDateTime; + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime endDateTime; private Integer alertStatus; diff --git a/src/main/java/club/joylink/xiannccda/repository/impl/EventLogRepository.java b/src/main/java/club/joylink/xiannccda/repository/impl/EventLogRepository.java index 586f4fb..42877a9 100644 --- a/src/main/java/club/joylink/xiannccda/repository/impl/EventLogRepository.java +++ b/src/main/java/club/joylink/xiannccda/repository/impl/EventLogRepository.java @@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import java.util.List; +import java.util.Objects; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -32,8 +33,15 @@ public class EventLogRepository extends ServiceImpl im @Override public Page detailPage(EventLogQueryDTO dto) { QueryWrapper qw = new QueryWrapper<>(); - qw.eq("A.event_type", dto.getLogType()); + qw.like(StringUtils.isNotEmpty(dto.getName()), "B.name", dto.getName()); + if (Objects.nonNull(dto.getBeginDate()) && Objects.nonNull(dto.getEndDate())) { + qw.between("A.create_date_time", dto.getBeginDate(), dto.getEndDate()); + } else if (Objects.nonNull(dto.getBeginDate())) { + qw.ge("A.create_date_time", dto.getBeginDate()); + } else if (Objects.nonNull(dto.getEndDate())) { + qw.le("A.create_date_time", dto.getEndDate()); + } qw.orderByDesc("A.id"); return this.baseMapper.detailPage(dto, qw); }