Browse Source

scada报警列表功能调整

xlr 1 year ago
parent
commit
41188bfc06

+ 1 - 1
hnls-scada/src/main/java/com/tofly/scada/entity/TfScadaReportList.java

@@ -165,6 +165,6 @@ public class TfScadaReportList extends Model<TfScadaReportList> {
 
     @ApiModelProperty(value = "是否查询自己可以处理的数据,0 否,1 是")
     @TableField(exist = false)
-    private Integer searchOwn=0;
+    private Integer searchOwn;
 }
 

+ 3 - 0
hnls-scada/src/main/java/com/tofly/scada/mapper/TfScadaReportListMapper.java

@@ -2,6 +2,7 @@ package com.tofly.scada.mapper;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.tofly.scada.entity.TfScadaReportList;
 import org.apache.ibatis.annotations.Param;
 
@@ -34,5 +35,7 @@ public interface TfScadaReportListMapper extends BaseMapper<TfScadaReportList> {
     int insertOrUpdateBatch(@Param("entities") List<TfScadaReportList> entities);
 
     List<Map<String, String>> getReportLevel(@Param("query")TfScadaReportList query);
+
+    Page<TfScadaReportList> pageList(Page<TfScadaReportList> page, TfScadaReportList tfScadaReportList, Long userId);
 }
 

+ 1 - 27
hnls-scada/src/main/java/com/tofly/scada/service/impl/TfScadaReportListServiceImpl.java

@@ -114,33 +114,7 @@ public class TfScadaReportListServiceImpl extends ServiceImpl<TfScadaReportListM
      */
     @Override
     public Page<TfScadaReportList> pageList(Page<TfScadaReportList> page, TfScadaReportList tfScadaReportList) {
-        List<String> codes = new ArrayList<>();
-        if (tfScadaReportList != null && StringUtils.hasText(tfScadaReportList.getCodes())) {
-            codes = Arrays.asList(tfScadaReportList.getCodes().split(","));
-        }
-        if(!StringUtil.isEmpty(tfScadaReportList.getDealStatus())){
-            tfScadaReportList.setStatus(tfScadaReportList.getDealStatus());
-            tfScadaReportList.setDealStatus(null);
-        }
-
-        List<Long> listIds=new ArrayList<>();
-
-        //只查询自己相关的数据
-        if(tfScadaReportList.getSearchOwn().equals(1)){
-            listIds=tfScadaReportDealService.list(Wrappers.<TfScadaReportDeal>lambdaQuery()
-                            .eq(TfScadaReportDeal::getDealUserId, SecurityUtils.getUserId()))
-                    .stream().map(TfScadaReportDeal::getReportId).collect(Collectors.toList());
-            if(listIds==null || listIds.size()==0){
-                listIds=new ArrayList<>();
-                listIds.add(0L);
-            }
-
-        }
-        return page(page, new QueryWrapper<>(tfScadaReportList).lambda()
-                .between(tfScadaReportList != null && tfScadaReportList.getStart() != null && tfScadaReportList.getEnd() != null,
-                        TfScadaReportList::getScadaTime, tfScadaReportList.getStart(), tfScadaReportList.getEnd())
-                .in(!CollectionUtils.isEmpty(codes), TfScadaReportList::getCode, codes)
-                .in(listIds.size()>0,TfScadaReportList::getId,listIds));
+        return baseMapper.pageList(page,tfScadaReportList,SecurityUtils.getUserId());
     }
 
     /**

+ 58 - 0
hnls-scada/src/main/resources/mapper/TfScadaReportListMapper.xml

@@ -78,6 +78,64 @@
         values(UPDATE_TIME) , REPORT_LEVEL = values(REPORT_LEVEL) , REPORT_UPPER = values(REPORT_UPPER) , REPORT_LOWER =
         values(REPORT_LOWER) , STATUS = values(STATUS) , DISPLAY_NAME = values(DISPLAY_NAME)
     </insert>
+    <select id="pageList" resultMap="TfScadaReportListMap">
+        select * from TF_SCADA_REPORT_LIST t1
+        where 1=1
+        <if test="dto.codes!=null and dto.codes.trim()!=''">
+            and t1.code in
+            <foreach item="nodeCodestr" collection="dto.codes.split(',')" open="(" separator="," close=")">
+                #{nodeCodestr}
+            </foreach>
+
+        </if>
+        <if test="dto.code != null and dto.code.trim()!=''">
+            and t1.code=#{dto.code}
+        </if>
+        <if test="dto.dealStatus!=null and dto.dealStatus.trim()!=''">
+            and t1.status in
+            <foreach item="nodeCodestr" collection="dto.dealStatus.split(',')" open="(" separator="," close=")">
+                #{nodeCodestr}
+            </foreach>
 
+        </if>
+        <if test="dto.status!=null and dto.status.trim()!=''">
+            and t1.status in
+            <foreach item="nodeCodestr" collection="dto.status.split(',')" open="(" separator="," close=")">
+                #{nodeCodestr}
+            </foreach>
+
+        </if>
+        <if test="dto.reportLevel != null and dto.reportLevel.trim()!=''">
+            and t1.report_Level=#{dto.reportLevel}
+        </if>
+        <if test="dto.displayName != null and dto.displayName.trim()!=''">
+            and t1.display_Name like '%'||#{dto.displayName}||'%'
+        </if>
+
+        <if test="dto.start != null ">
+            and t1.SCADA_TIME >= #{dto.start}
+        </if>
+        <if test="dto.end != null ">
+            <![CDATA[ and t1.SCADA_TIME <= #{dto.end}]]>
+        </if>
+
+        <if test="dto.dealUserId != null ">
+            and t1.deal_user_id = #{dto.dealUserId}
+        </if>
+
+        <if test="dto.dealUserName != null and dto.dealUserName.trim()!=''">
+            and t1.deal_user_name like '%'||#{dto.dealUserName}||'%'
+        </if>
+        <if test="dto.dealRemark != null and dto.dealRemark.trim()!=''">
+            and t1.DEAL_REMARK like '%'||#{dto.dealRemark}||'%'
+        </if>
+        <if test="dto.searchOwn != null and dto.searchOwn==1">
+            and  t1.id in(
+            select report_Id from TF_SCADA_REPORT_DEAL where deal_User_Id=#{dealUserId}
+
+            )
+        </if>
+
+    </select>
 </mapper>