Bladeren bron

修改历史数据查询接口,新增装置系统参数,新增管理员查询逻辑

sl 9 maanden geleden
bovenliggende
commit
5725e0190a

+ 7 - 6
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/controller/InterlockDetailHistoryController.java

@@ -20,6 +20,7 @@ import org.jeecg.modules.history.mapper.InterlockSummaryHistoryMapper;
 import org.jeecg.modules.history.service.IInterlockDetailHistoryService;
 import org.jeecg.modules.history.vo.InterlockDetailHistoryQueryVO;
 import org.jeecg.modules.history.vo.InterlockHistoryDistinctZZXTVO;
+import org.jeecg.modules.history.vo.InterlockSummaryHistoryLimitVO;
 import org.jeecg.modules.history.vo.InterlockSummaryHistoryVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -287,13 +288,13 @@ public class InterlockDetailHistoryController extends JeecgController<InterlockD
 	 */
 	@ApiOperation(".联锁历史数据——各种逻辑状态分页查询  添加权限")
 	@GetMapping("/listHistoryByUser")
-	public Result<IPage<InterlockSummaryHistoryVO>> listHistoryByUser(InterlockHistoryQueryDTO dto,
-														 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-														 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-														 HttpServletRequest request){
+	public Result<IPage<InterlockSummaryHistoryLimitVO>> listHistoryByUser(InterlockHistoryQueryDTO dto,
+																		   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+																		   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+																		   HttpServletRequest request){
 		long startTime = System.currentTimeMillis();
-		Page<InterlockSummaryHistoryVO> page = new Page<>(pageNo,pageSize);
-		IPage<InterlockSummaryHistoryVO> pageList = interlockDetailHistoryService.getPageByUser(request, page, dto);
+		Page<InterlockSummaryHistoryLimitVO> page = new Page<>(pageNo,pageSize);
+		IPage<InterlockSummaryHistoryLimitVO> pageList = interlockDetailHistoryService.getPageByUser(request, page, dto);
 		long endTime = System.currentTimeMillis();
 		long duration = endTime - startTime;
 		String log = "联锁历史数据各种逻辑状态程序运行时间(毫秒):" + duration;

+ 12 - 2
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/mapper/InterlockDetailHistoryMapper.java

@@ -4,11 +4,14 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import org.jeecg.modules.detail.dto.InterlockDetailQueryDTO;
 import org.jeecg.modules.history.dto.InterlockHistoryQueryDTO;
 import org.jeecg.modules.history.entity.InterlockDetailHistory;
 import org.jeecg.modules.history.vo.InterlockDetailHistoryQueryVO;
+import org.jeecg.modules.history.vo.InterlockSummaryHistoryLimitVO;
 import org.jeecg.modules.history.vo.InterlockSummaryHistoryVO;
+import org.jeecg.modules.interlockUser.entity.InterlockUser;
 
 import java.util.Date;
 import java.util.List;
@@ -48,8 +51,15 @@ public interface InterlockDetailHistoryMapper extends BaseMapper<InterlockDetail
     List<InterlockDetailHistory> getYbStatusListBySummaryIdAndTagTime(@Param("id") String id,@Param("yesterday") String yesterday);
 
     /**
-     * 联锁历史数据——各种逻辑状态分页查询   添加权限
+     * 联锁历史数据——各种逻辑状态分页查询   添加权限  普通用户权限
      */
-    IPage<InterlockSummaryHistoryVO> getPageByUser(Page<InterlockSummaryHistoryVO> page, InterlockHistoryQueryDTO dto, String wiseUser);
+    IPage<InterlockSummaryHistoryLimitVO> getPageByPtUser(Page<InterlockSummaryHistoryLimitVO> page, InterlockHistoryQueryDTO dto, String wiseUser);
+    /**
+     * 联锁历史数据——各种逻辑状态分页查询   添加权限  普通用户权限
+     */
+    IPage<InterlockSummaryHistoryLimitVO> getPageByAdminUser(Page<InterlockSummaryHistoryLimitVO> page, InterlockHistoryQueryDTO dto);
+
+    @Select("select * from interlock_user where username=#{wiseUser}")
+    InterlockUser getUserInfoByName(@Param("wiseUser") String wiseUser);
 
 }

+ 39 - 3
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/mapper/xml/InterlockDetailHistoryMapper.xml

@@ -159,13 +159,14 @@
     </select>
 
 
-    <!-- 联锁总历史数据表-分页列表查询(各种逻辑状态)   添加权限-->
-    <select id="getPageByUser" resultType="org.jeecg.modules.history.vo.InterlockSummaryHistoryVO">
+    <!-- 联锁总历史数据表-分页列表查询(各种逻辑状态)   添加权限  普通用户权限-->
+    <select id="getPageByPtUser" resultType="org.jeecg.modules.history.vo.InterlockSummaryHistoryLimitVO">
         select d.id, d.summaryid, d.interlockname, d.interlock_condition, d.interlock_condition_tag, d.instrument_status, d.control_system_status,
         s.interlock_status, s.loop_health_level, d.bypass, s.tag_time, d.summary_origin_id, s.interlock_apparatus_id, s.interlock_system_id,
         h1.interlock_status_name, h2.bypass_name,
         h3.instrument_status_name, h4.control_system_status_name,
-        h.instrument_status_normal, h.bypass_yes, h.interlock_status_ty, h.control_system_status_normal
+        h.instrument_status_normal, h.bypass_yes, h.interlock_status_ty, h.control_system_status_normal,
+        h.interlock_name as interlock_system_name, h5.interlock_name as interlock_apparatus_name
         from interlock_detail_history d
         left join interlock_summary_history s on d.summaryid = s.id
         left join interlock_base_hy h1 on h1.interlock_status = s.interlock_status and h1.interlock_system_id = s.interlock_system_id
@@ -173,6 +174,7 @@
         left join interlock_base_hy h3 on h3.instrument_status = d.instrument_status and h3.interlock_system_id = s.interlock_system_id
         left join interlock_base_hy h4 on h4.control_system_status = d.control_system_status and h4.interlock_system_id = s.interlock_system_id
         left join interlock_base h on h.id = s.interlock_system_id
+        left join interlock_base h5 on h5.id = s.interlock_apparatus_id
         left join (select l.* from interlock_system_limit l where l.interlock_user_id in
         (select u.id from interlock_user u where u.username=#{wiseUser})) qxnr on qxnr.interlock_system_id = s.interlock_system_id
         <where>
@@ -194,4 +196,38 @@
         order by s.tag_time desc
     </select>
 
+    <!-- 联锁总历史数据表-分页列表查询(各种逻辑状态)   添加权限  系统管理员权限-->
+    <select id="getPageByAdminUser" resultType="org.jeecg.modules.history.vo.InterlockSummaryHistoryLimitVO">
+        select d.id, d.summaryid, d.interlockname, d.interlock_condition, d.interlock_condition_tag, d.instrument_status, d.control_system_status,
+        s.interlock_status, s.loop_health_level, d.bypass, s.tag_time, d.summary_origin_id, s.interlock_apparatus_id, s.interlock_system_id,
+        h1.interlock_status_name, h2.bypass_name,
+        h3.instrument_status_name, h4.control_system_status_name,
+        h.instrument_status_normal, h.bypass_yes, h.interlock_status_ty, h.control_system_status_normal,
+        h.interlock_name as interlock_system_name, h5.interlock_name as interlock_apparatus_name
+        from interlock_detail_history d
+        left join interlock_summary_history s on d.summaryid = s.id
+        left join interlock_base_hy h1 on h1.interlock_status = s.interlock_status and h1.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h2 on h2.bypass = d.bypass and h2.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h3 on h3.instrument_status = d.instrument_status and h3.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h4 on h4.control_system_status = d.control_system_status and h4.interlock_system_id = s.interlock_system_id
+        left join interlock_base h on h.id = s.interlock_system_id
+        left join interlock_base h5 on h5.id = s.interlock_apparatus_id
+        <where>
+            <if test="dto.interlockSystemId != null and dto.interlockSystemId != ''"> and s.interlock_system_id =  #{dto.interlockSystemId}</if>
+            <if test="dto.interlockApparatusId != null and dto.interlockApparatusId != ''"> and s.interlock_apparatus_id =  #{dto.interlockApparatusId}</if>
+
+            <if test="dto.interlockname != null and dto.interlockname != ''"> and d.interlockname like concat('%', #{dto.interlockname}, '%')</if>
+            <if test="dto.interlockCondition != null and dto.interlockCondition != ''"> and d.interlock_condition = #{dto.interlockCondition}</if>
+            <if test="dto.interlockConditionTag != null and dto.interlockConditionTag != ''"> and d.interlock_condition_tag like concat('%',#{dto.interlockConditionTag},'%')</if>
+            <if test="dto.instrumentStatus != null and dto.instrumentStatus != ''"> and d.instrument_status = #{dto.instrumentStatus}</if>
+            <if test="dto.controlSystemStatus != null and dto.controlSystemStatus != ''"> and d.control_system_status = #{dto.controlSystemStatus}</if>
+            <if test="dto.interlockStatus != null and dto.interlockStatus != ''"> and s.interlock_status = #{dto.interlockStatus}</if>
+            <if test="dto.loopHealthLevel != null and dto.loopHealthLevel != ''"> and s.loop_health_level = #{dto.loopHealthLevel}</if>
+            <if test="dto.beginTime != null"> and s.tag_time &gt; #{dto.beginTime} </if>
+            <if test="dto.endTime != null"> and s.tag_time &lt; #{dto.endTime} </if>
+            <if test="dto.bypass != null and dto.bypass != ''"> and d.bypass = #{dto.bypass}</if>
+        </where>
+        order by s.tag_time desc
+    </select>
+
 </mapper>

+ 2 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/service/IInterlockDetailHistoryService.java

@@ -9,6 +9,7 @@ import org.jeecg.modules.history.entity.InterlockDetailHistory;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.history.vo.InterlockDetailHistoryQueryVO;
 import org.jeecg.modules.history.vo.InterlockHistoryDistinctZZXTVO;
+import org.jeecg.modules.history.vo.InterlockSummaryHistoryLimitVO;
 import org.jeecg.modules.history.vo.InterlockSummaryHistoryVO;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.servlet.ModelAndView;
@@ -61,5 +62,5 @@ public interface IInterlockDetailHistoryService extends IService<InterlockDetail
     /**
      * 联锁历史数据——各种逻辑状态分页查询  添加权限
      */
-    IPage<InterlockSummaryHistoryVO> getPageByUser(HttpServletRequest request, Page<InterlockSummaryHistoryVO> page, InterlockHistoryQueryDTO dto);
+    IPage<InterlockSummaryHistoryLimitVO> getPageByUser(HttpServletRequest request, Page<InterlockSummaryHistoryLimitVO> page, InterlockHistoryQueryDTO dto);
 }

+ 11 - 2
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/service/impl/InterlockDetailHistoryServiceImpl.java

@@ -16,7 +16,9 @@ import org.jeecg.modules.history.mapper.InterlockSummaryHistoryMapper;
 import org.jeecg.modules.history.service.IInterlockDetailHistoryService;
 import org.jeecg.modules.history.vo.InterlockDetailHistoryQueryVO;
 import org.jeecg.modules.history.vo.InterlockHistoryDistinctZZXTVO;
+import org.jeecg.modules.history.vo.InterlockSummaryHistoryLimitVO;
 import org.jeecg.modules.history.vo.InterlockSummaryHistoryVO;
+import org.jeecg.modules.interlockUser.entity.InterlockUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -427,7 +429,7 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
     /**
      * 联锁历史数据——各种逻辑状态分页查询   添加权限
      */
-    public IPage<InterlockSummaryHistoryVO> getPageByUser(HttpServletRequest request, Page<InterlockSummaryHistoryVO> page, InterlockHistoryQueryDTO dto){
+    public IPage<InterlockSummaryHistoryLimitVO> getPageByUser(HttpServletRequest request, Page<InterlockSummaryHistoryLimitVO> page, InterlockHistoryQueryDTO dto){
         String wiseUser = "";
         //获取当前用户名
         Cookie[] cookies = request.getCookies();
@@ -438,8 +440,15 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
                 }
             }
         }
+//        wiseUser = "admin";
+        InterlockUser interlockUser = interlockDetailHistoryMapper.getUserInfoByName(wiseUser);
+        if(interlockUser.getRole().equals("0")){//如果是系统管理员
+            return interlockDetailHistoryMapper.getPageByAdminUser(page, dto);
+        }else{
+            return interlockDetailHistoryMapper.getPageByPtUser(page, dto, wiseUser);
+        }
+
 
-        return interlockDetailHistoryMapper.getPageByUser(page, dto, wiseUser);
     }
 
 }

+ 96 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/vo/InterlockSummaryHistoryLimitVO.java

@@ -0,0 +1,96 @@
+package org.jeecg.modules.history.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * ClassName: InterlockSummaryHistoryLimitVO
+ * Package: org.jeecg.modules.history.vo
+ * Description:
+ *
+ * @Author sl
+ * @Create 2024/8/8 17:05
+ * @Version 1.0
+ */
+@Data
+public class InterlockSummaryHistoryLimitVO {
+    /**id*/
+    @TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "id")
+    private java.lang.String id;
+    /**联锁总表id*/
+    @ApiModelProperty(value = "联锁总表id")
+    private java.lang.String summaryid;
+    /**采集时间*/
+    @Excel(name = "采集时间", width = 30, mergeVertical = true)
+    @ApiModelProperty(value = "采集时间")
+    private java.lang.String tagTime;
+    /**联锁名称*/
+    @Excel(name = "联锁名称", width = 30, mergeVertical = true)
+    @ApiModelProperty(value = "联锁名称")
+    private java.lang.String interlockname;
+    /**联锁条件值*/
+    @ApiModelProperty(value = "联锁条件值")
+    private java.lang.String interlockCondition;
+    /**联锁条件点位*/
+    @Excel(name = "联锁条件点位", width = 30)
+    @ApiModelProperty(value = "联锁条件点位")
+    private java.lang.String interlockConditionTag;
+    /**仪表状态*/
+    @Excel(name = "仪表状态", width = 15,dicCode="instrument_status")
+    @ApiModelProperty(value = "仪表状态")
+//    @Dict(dicCode = "instrument_status")
+    private java.lang.String instrumentStatus;
+    private java.lang.String instrumentStatusName;
+    /**联锁状态*/
+    @Excel(name = "联锁状态", width = 15,dicCode="interlock_status", mergeVertical = true, mergeRely = {0})
+    @ApiModelProperty(value = "联锁状态")
+//    @Dict(dicCode = "interlock_status")
+    private java.lang.String interlockStatus;
+    private java.lang.String interlockStatusName;
+    /**旁路状态*/
+    @Excel(name = "旁路状态", width = 15,dicCode="bypass")
+//    @Dict(dicCode = "bypass")
+    @ApiModelProperty(value = "旁路状态")
+    private java.lang.String bypass;
+    private java.lang.String bypassName;
+    /**控制系统状态*/
+    @Excel(name = "控制系统状态", width = 15,dicCode="control_system_status")
+    @ApiModelProperty(value = "控制系统状态")
+//    @Dict(dicCode = "control_system_status")
+    private java.lang.String controlSystemStatus;
+    private java.lang.String controlSystemStatusName;
+    /**回路健康级别*/
+    @Excel(name = "回路健康级别", width = 15, mergeVertical = true, mergeRely = {0})
+    @ApiModelProperty(value = "回路健康级别")
+    private java.lang.String loopHealthLevel;
+    /**该联锁在原联锁总表的id*/
+    @Excel(name = "该联锁在原联锁总表的id", width = 15)
+    @ApiModelProperty(value = "该联锁在原联锁总表的id")
+    private java.lang.String summaryOriginId;
+
+    /**装置id*/
+    @Excel(name = "装置id", width = 15)
+    @ApiModelProperty(value = "装置id")
+    private java.lang.String interlockApparatusId;
+    /**系统id*/
+    @Excel(name = "系统id", width = 15)
+    @ApiModelProperty(value = "系统id")
+    private java.lang.String interlockSystemId;
+    /**系统名称*/
+    @Excel(name = "系统名称", width = 15)
+    @ApiModelProperty(value = "系统名称")
+    private java.lang.String interlockSystemName;
+    /**装置名称*/
+    @Excel(name = "装置名称", width = 15)
+    @ApiModelProperty(value = "装置名称")
+    private java.lang.String interlockApparatusName;
+
+    private java.lang.String instrumentStatusNormal;
+    private java.lang.String controlSystemStatusNormal;
+    private java.lang.String interlockStatusTy;
+    private java.lang.String bypassYes;
+}