Pārlūkot izejas kodu

'事件管理表-列表接口'

james 11 mēneši atpakaļ
vecāks
revīzija
7f93ce3542

+ 55 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionEventController.java

@@ -0,0 +1,55 @@
+package com.usky.fire.controller.web;
+
+
+import com.usky.common.core.bean.ApiResult;
+import com.usky.common.core.bean.CommonPage;
+import com.usky.fire.domain.PatrolInspectionEvent;
+import com.usky.fire.domain.PatrolInspectionPlan;
+import com.usky.fire.service.PatrolInspectionEventService;
+import com.usky.fire.service.PatrolInspectionPlanService;
+import com.usky.fire.service.vo.PatrolInspectionPlanRequestVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * <p>
+ * 事件管理表 前端控制器
+ * </p>
+ *
+ * @author han
+ * @since 2024-05-09
+ */
+@RestController
+@RequestMapping("/patrolInspectionEvent")
+public class PatrolInspectionEventController {
+    @Autowired
+    private PatrolInspectionEventService patrolInspectionEventService;
+
+    /**
+     * 列表
+     * @param requestVO
+     * @return
+     */
+    @PostMapping("patrolInspectionEventList")
+    public ApiResult<CommonPage<PatrolInspectionEvent>> patrolInspectionEventList(@RequestBody PatrolInspectionPlanRequestVO requestVO){
+        return ApiResult.success(patrolInspectionEventService.patrolInspectionEventList(requestVO));
+    }
+
+    /**
+     * 新增
+     * @param patrolInspectionEvent
+     * @return
+     */
+    @PostMapping("add")
+    public ApiResult<Void> add(@RequestBody PatrolInspectionEvent patrolInspectionEvent){
+        patrolInspectionEventService.add(patrolInspectionEvent);
+        return ApiResult.success();
+    }
+
+    @PutMapping("edit")
+    public ApiResult<Void> edit(@RequestBody PatrolInspectionEvent patrolInspectionEvent){
+        patrolInspectionEventService.edit(patrolInspectionEvent);
+        return ApiResult.success();
+    }
+}
+

+ 107 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionEvent.java

@@ -0,0 +1,107 @@
+package com.usky.fire.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 事件管理表
+ * </p>
+ *
+ * @author han
+ * @since 2024-05-09
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class PatrolInspectionEvent implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 巡检人ID
+     */
+    private Integer personnelId;
+
+    /**
+     * 巡检人名称
+     */
+    private String personnelName;
+
+    /**
+     * 事件名称
+     */
+    private String eventName;
+
+    /**
+     * 事件类型
+     */
+    private Integer eventType;
+
+    /**
+     * 事件等级
+     */
+    private Integer eventLevel;
+
+    /**
+     * 事件分类
+     */
+    private Integer eventCategory;
+
+    /**
+     * 处置状态
+     */
+    private Integer handleStatus;
+
+    /**
+     * 设备ID
+     */
+    private String deviceId;
+
+    /**
+     * 处置人
+     */
+    private String handleName;
+
+    /**
+     * 处置时间
+     */
+    private LocalDateTime handleTime;
+
+    /**
+     * 租户号
+     */
+    private Integer tenantId;
+
+    /**
+     * 组织机构ID
+     */
+    private Integer deptId;
+
+    /**
+     * 创建人
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 主计划ID
+     */
+    @TableField(exist = false)
+    private Integer planId;
+
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionEventMapper.java

@@ -0,0 +1,16 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.PatrolInspectionEvent;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ * 事件管理表 Mapper 接口
+ * </p>
+ *
+ * @author han
+ * @since 2024-05-09
+ */
+public interface PatrolInspectionEventMapper extends CrudMapper<PatrolInspectionEvent> {
+
+}

+ 24 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionEventService.java

@@ -0,0 +1,24 @@
+package com.usky.fire.service;
+
+import com.usky.common.core.bean.CommonPage;
+import com.usky.fire.domain.PatrolInspectionEvent;
+import com.usky.common.mybatis.core.CrudService;
+import com.usky.fire.service.vo.PatrolInspectionPlanRequestVO;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * <p>
+ * 事件管理表 服务类
+ * </p>
+ *
+ * @author han
+ * @since 2024-05-09
+ */
+public interface PatrolInspectionEventService extends CrudService<PatrolInspectionEvent> {
+
+    CommonPage<PatrolInspectionEvent> patrolInspectionEventList(PatrolInspectionPlanRequestVO requestVO);
+
+    void add(PatrolInspectionEvent patrolInspectionEvent);
+    void edit(PatrolInspectionEvent patrolInspectionEvent);
+
+}

+ 53 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionEventServiceImpl.java

@@ -0,0 +1,53 @@
+package com.usky.fire.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.usky.common.core.bean.CommonPage;
+import com.usky.common.security.utils.SecurityUtils;
+import com.usky.fire.domain.PatrolInspectionEvent;
+import com.usky.fire.mapper.PatrolInspectionEventMapper;
+import com.usky.fire.service.PatrolInspectionEventService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import com.usky.fire.service.vo.PatrolInspectionPlanRequestVO;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 事件管理表 服务实现类
+ * </p>
+ *
+ * @author han
+ * @since 2024-05-09
+ */
+@Service
+public class PatrolInspectionEventServiceImpl extends AbstractCrudService<PatrolInspectionEventMapper, PatrolInspectionEvent> implements PatrolInspectionEventService {
+
+    @Override
+    public CommonPage<PatrolInspectionEvent> patrolInspectionEventList(PatrolInspectionPlanRequestVO requestVO){
+        Integer current = requestVO.getPageNum();
+        Integer size = requestVO.getPageSize();
+        IPage<PatrolInspectionEvent> page = new Page<>(current,size);
+        LambdaQueryWrapper<PatrolInspectionEvent> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(StringUtils.isNotBlank(requestVO.getDeviceId()),PatrolInspectionEvent::getDeviceId,requestVO.getDeviceId())
+                .eq(requestVO.getEventLevel() != null,PatrolInspectionEvent::getEventLevel,requestVO.getEventLevel())
+                .eq(PatrolInspectionEvent::getTenantId, SecurityUtils.getTenantId())
+                .orderByDesc(PatrolInspectionEvent::getId);
+        page = this.page(page,queryWrapper);
+
+        return new CommonPage<>(page.getRecords(),page.getTotal(),size,current);
+    }
+
+    @Override
+    public void add(PatrolInspectionEvent patrolInspectionEvent){
+
+    }
+
+    @Override
+    public void edit(PatrolInspectionEvent patrolInspectionEvent){
+
+    }
+
+}

+ 26 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionPlanRequestVO.java

@@ -0,0 +1,26 @@
+package com.usky.fire.service.vo;
+
+import lombok.Data;
+
+@Data
+public class PatrolInspectionPlanRequestVO {
+    /**
+     * 设备Id
+     */
+    private String deviceId;
+
+    /**
+     * 事件等级
+     */
+    private Integer eventLevel;
+
+    /**
+     * 当前页
+     */
+    private Integer pageNum;
+
+    /**
+     * 每页个数
+     */
+    private Integer pageSize;
+}

+ 24 - 0
service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionEventMapper.xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usky.fire.mapper.PatrolInspectionEventMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.PatrolInspectionEvent">
+        <id column="id" property="id" />
+        <result column="personnel_id" property="personnelId" />
+        <result column="personnel_name" property="personnelName" />
+        <result column="event_name" property="eventName" />
+        <result column="event_type" property="eventType" />
+        <result column="event_level" property="eventLevel" />
+        <result column="event_category" property="eventCategory" />
+        <result column="handle_status" property="handleStatus" />
+        <result column="device_id" property="deviceId" />
+        <result column="handle_name" property="handleName" />
+        <result column="handle_time" property="handleTime" />
+        <result column="tenant_id" property="tenantId" />
+        <result column="dept_id" property="deptId" />
+        <result column="create_by" property="createBy" />
+        <result column="create_time" property="createTime" />
+    </resultMap>
+
+</mapper>