diff --git a/src/main/java/club/joylink/xiannccda/constants/EventLogType.java b/src/main/java/club/joylink/xiannccda/constants/EventLogType.java new file mode 100644 index 0000000..be68ada --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/constants/EventLogType.java @@ -0,0 +1,14 @@ +package club.joylink.xiannccda.constants; + +import club.joylink.xiannccda.ats.message.line3.device.ScheduleSubIdType; +import java.util.Arrays; + +public enum EventLogType { + //登录 + LOGIN, + //登出 + LOGOUT, + + ; + +} diff --git a/src/main/java/club/joylink/xiannccda/controller/EventLogController.java b/src/main/java/club/joylink/xiannccda/controller/EventLogController.java new file mode 100644 index 0000000..5db3c0d --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/controller/EventLogController.java @@ -0,0 +1,52 @@ +package club.joylink.xiannccda.controller; + +import club.joylink.xiannccda.dto.LoginInfoDTO; +import club.joylink.xiannccda.dto.event.EventLogPageDTO; +import club.joylink.xiannccda.dto.event.EventLogQueryDTO; +import club.joylink.xiannccda.dto.user.UserDetailDTO; +import club.joylink.xiannccda.dto.user.UserEditDTO; +import club.joylink.xiannccda.dto.user.UserQueryDTO; +import club.joylink.xiannccda.entity.User; +import club.joylink.xiannccda.entity.User.Register; +import club.joylink.xiannccda.repository.IEventLogRepository; +import club.joylink.xiannccda.repository.IUserRepository; +import club.joylink.xiannccda.service.UserService; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 用户管理接口 + * + * @author walker-sheng + * @since 2023-06-01 + */ +@RestController +@RequestMapping("/api/log") +@Tag(name = "事件查看") +public class EventLogController { + + private IEventLogRepository eventLogRepository; + + public EventLogController(IEventLogRepository eventLogRepository) { + this.eventLogRepository = eventLogRepository; + } + + @GetMapping("/paging") + @Operation(summary = "分页数据") + @ApiResponse(description = "事件操作") + @SecurityRequirement(name = "jwt") + public Page register(EventLogQueryDTO dto) { + return this.eventLogRepository.detailPage(dto); + } + + +} diff --git a/src/main/java/club/joylink/xiannccda/dto/event/EventLogPageDTO.java b/src/main/java/club/joylink/xiannccda/dto/event/EventLogPageDTO.java new file mode 100644 index 0000000..96697fa --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/dto/event/EventLogPageDTO.java @@ -0,0 +1,16 @@ +package club.joylink.xiannccda.dto.event; + +import club.joylink.xiannccda.constants.EventLogType; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class EventLogPageDTO { + + private Long id; + private EventLogType eventType; + private String userName; + private Long fromUserId; + private String mobile; + private LocalDateTime createDateTime; +} diff --git a/src/main/java/club/joylink/xiannccda/dto/event/EventLogQueryDTO.java b/src/main/java/club/joylink/xiannccda/dto/event/EventLogQueryDTO.java new file mode 100644 index 0000000..11ed526 --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/dto/event/EventLogQueryDTO.java @@ -0,0 +1,8 @@ +package club.joylink.xiannccda.dto.event; + +import club.joylink.xiannccda.entity.EventLog; +import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; + +public class EventLogQueryDTO extends PageDTO { + +} diff --git a/src/main/java/club/joylink/xiannccda/entity/EventLog.java b/src/main/java/club/joylink/xiannccda/entity/EventLog.java new file mode 100644 index 0000000..a44b168 --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/entity/EventLog.java @@ -0,0 +1,47 @@ +package club.joylink.xiannccda.entity; + +import club.joylink.xiannccda.alert.core.AlertDeviceType; +import club.joylink.xiannccda.constants.EventLogType; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import java.time.LocalDateTime; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + *

+ * + *

+ * + * @author walker-sheng + * @since 2023-10-19 + */ +@Getter +@Setter +@Accessors(chain = true) +@TableName("event_log") +@Schema(name = "eventLog", description = "时间日志") +public class EventLog { + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @Schema(description = "设备类型") + private EventLogType eventType; + + @Schema(description = "设备告警") + private Long fromUserId; + + @Schema(description = "开始时间(小时)") + private LocalDateTime createDateTime; + + public static final String ID = "id"; + public static final String EVENT_TYPE = "event_Type"; + public static final String FROM_USER_ID = "from_User_Id"; + + public static final String CREATE_DATE_TIME = "create_Date_Time"; + +} diff --git a/src/main/java/club/joylink/xiannccda/mapper/EventLogMapper.java b/src/main/java/club/joylink/xiannccda/mapper/EventLogMapper.java new file mode 100644 index 0000000..622c6f9 --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/mapper/EventLogMapper.java @@ -0,0 +1,25 @@ +package club.joylink.xiannccda.mapper; + +import club.joylink.xiannccda.dto.event.EventLogPageDTO; +import club.joylink.xiannccda.dto.event.EventLogQueryDTO; +import club.joylink.xiannccda.dto.user.UserDetailDTO; +import club.joylink.xiannccda.dto.user.UserQueryDTO; +import club.joylink.xiannccda.entity.EventLog; +import club.joylink.xiannccda.entity.User; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 用户 Mapper 接口 + *

+ * + * @author walker-sheng + * @since 2023-06-01 + */ +@Mapper +public interface EventLogMapper extends BaseMapper { + + Page detailPage(EventLogQueryDTO dto); +} diff --git a/src/main/java/club/joylink/xiannccda/repository/IEventLogRepository.java b/src/main/java/club/joylink/xiannccda/repository/IEventLogRepository.java new file mode 100644 index 0000000..482de2c --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/repository/IEventLogRepository.java @@ -0,0 +1,23 @@ +package club.joylink.xiannccda.repository; + +import club.joylink.xiannccda.dto.event.EventLogPageDTO; +import club.joylink.xiannccda.dto.event.EventLogQueryDTO; +import club.joylink.xiannccda.dto.user.UserDetailDTO; +import club.joylink.xiannccda.dto.user.UserQueryDTO; +import club.joylink.xiannccda.entity.EventLog; +import club.joylink.xiannccda.entity.User; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 用户 服务类 + *

+ * + * @author walker-sheng + * @since 2023-06-01 + */ +public interface IEventLogRepository extends IService { + + Page detailPage(EventLogQueryDTO dto); +} diff --git a/src/main/java/club/joylink/xiannccda/repository/impl/EventLogRepository.java b/src/main/java/club/joylink/xiannccda/repository/impl/EventLogRepository.java new file mode 100644 index 0000000..9c1d35e --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/repository/impl/EventLogRepository.java @@ -0,0 +1,35 @@ +package club.joylink.xiannccda.repository.impl; + +import club.joylink.xiannccda.dto.LineInfoQueryDTO; +import club.joylink.xiannccda.dto.event.EventLogPageDTO; +import club.joylink.xiannccda.dto.event.EventLogQueryDTO; +import club.joylink.xiannccda.entity.EventLog; +import club.joylink.xiannccda.entity.LineInfo; +import club.joylink.xiannccda.mapper.EventLogMapper; +import club.joylink.xiannccda.mapper.LineInfoMapper; +import club.joylink.xiannccda.repository.IEventLogRepository; +import club.joylink.xiannccda.repository.ILineInfoRepository; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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 org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author walker-sheng + * @since 2023-06-06 + */ +@Service +public class EventLogRepository extends ServiceImpl implements IEventLogRepository { + + @Override + public Page detailPage(EventLogQueryDTO dto) { + return this.baseMapper.detailPage(dto); + } +} diff --git a/src/main/resources/mybatis/mapper/EventLogMapper.xml b/src/main/resources/mybatis/mapper/EventLogMapper.xml new file mode 100644 index 0000000..20ab545 --- /dev/null +++ b/src/main/resources/mybatis/mapper/EventLogMapper.xml @@ -0,0 +1,11 @@ + + + + +