瀏覽代碼

fix 导出

LLL 2 月之前
父節點
當前提交
231e561102

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

@@ -1,17 +1,18 @@
 package org.jeecg.modules.history.mapper;
 
-import java.util.List;
-
+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.jeecg.modules.detail.dto.InterlockDetailQueryDTO;
 import org.jeecg.modules.history.dto.InterlockHistoryQueryDTO;
 import org.jeecg.modules.history.entity.InterlockDetailHistory;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.jeecg.modules.history.vo.InterlockDetailHistoryQueryVO;
 import org.jeecg.modules.history.vo.InterlockSummaryHistoryVO;
 
+import java.util.Date;
+import java.util.List;
+
 /**
  * @Description: 联锁详细信息历史数据表
  * @Author: jeecg-boot
@@ -35,6 +36,9 @@ public interface InterlockDetailHistoryMapper extends BaseMapper<InterlockDetail
      */
     List<InterlockSummaryHistoryVO> getForExport(InterlockHistoryQueryDTO dto);
 
+    Date getMaxTagTime(InterlockHistoryQueryDTO dto);
+    Date getMinTagTime(InterlockHistoryQueryDTO dto);
+
     /**
      *   author: dzc
      *   version: 1.0

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

@@ -84,6 +84,44 @@
         order by s.tag_time desc
     </select>
 
+    <select id="getMaxTagTime" parameterType="org.jeecg.modules.history.dto.InterlockHistoryQueryDTO" resultType="java.util.Date">
+        select max(s.tag_time) as max_tag_time
+        from interlock_detail_history d left join interlock_summary_history s on d.summaryid = s.id
+        <where>
+            <if test="interlockSystemId != null and interlockSystemId != ''"> and s.interlock_system_id =  #{interlockSystemId}</if>
+            <if test="interlockApparatusId != null and interlockApparatusId != ''"> and s.interlock_apparatus_id =  #{interlockApparatusId}</if>
+
+            <if test="interlockname != null and interlockname != ''"> and d.interlockname like concat('%', #{interlockname}, '%')</if>
+            <if test="interlockCondition != null and interlockCondition != ''"> and d.interlock_condition = #{interlockCondition}</if>
+            <if test="interlockConditionTag != null and interlockConditionTag != ''"> and d.interlock_condition_tag like concat('%',#{interlockConditionTag},'%')</if>
+            <if test="instrumentStatus != null and instrumentStatus != ''"> and d.instrument_status = #{instrumentStatus}</if>
+            <if test="controlSystemStatus != null and controlSystemStatus != ''"> and d.control_system_status = #{controlSystemStatus}</if>
+            <if test="interlockStatus != null and interlockStatus != ''"> and s.interlock_status = #{interlockStatus}</if>
+            <if test="loopHealthLevel != null and loopHealthLevel != ''"> and s.loop_health_level = #{loopHealthLevel}</if>
+            <if test="beginTime != null"> and s.tag_time &gt; #{beginTime} </if>
+            <if test="endTime != null"> and s.tag_time &lt; #{endTime} </if>
+        </where>
+    </select>
+
+    <select id="getMinTagTime" parameterType="org.jeecg.modules.history.dto.InterlockHistoryQueryDTO" resultType="java.util.Date">
+        select min(s.tag_time) as min_tag_time
+        from interlock_detail_history d left join interlock_summary_history s on d.summaryid = s.id
+        <where>
+            <if test="interlockSystemId != null and interlockSystemId != ''"> and s.interlock_system_id =  #{interlockSystemId}</if>
+            <if test="interlockApparatusId != null and interlockApparatusId != ''"> and s.interlock_apparatus_id =  #{interlockApparatusId}</if>
+
+            <if test="interlockname != null and interlockname != ''"> and d.interlockname like concat('%', #{interlockname}, '%')</if>
+            <if test="interlockCondition != null and interlockCondition != ''"> and d.interlock_condition = #{interlockCondition}</if>
+            <if test="interlockConditionTag != null and interlockConditionTag != ''"> and d.interlock_condition_tag like concat('%',#{interlockConditionTag},'%')</if>
+            <if test="instrumentStatus != null and instrumentStatus != ''"> and d.instrument_status = #{instrumentStatus}</if>
+            <if test="controlSystemStatus != null and controlSystemStatus != ''"> and d.control_system_status = #{controlSystemStatus}</if>
+            <if test="interlockStatus != null and interlockStatus != ''"> and s.interlock_status = #{interlockStatus}</if>
+            <if test="loopHealthLevel != null and loopHealthLevel != ''"> and s.loop_health_level = #{loopHealthLevel}</if>
+            <if test="beginTime != null"> and s.tag_time &gt; #{beginTime} </if>
+            <if test="endTime != null"> and s.tag_time &lt; #{endTime} </if>
+        </where>
+    </select>
+
     <!-- 日统计 仪表状态(根据联锁id查询对应时间下的联锁条件) -->
     <select id="getYbStatusListBySummaryIdAndTagTime" resultType="org.jeecg.modules.history.entity.InterlockDetailHistory">
         select * from interlock_detail_history where summaryid = #{id} and tag_time like TO_CHAR(#{yesterday}::timestamp, 'YYYY-MM-DD') || '%'

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

@@ -22,8 +22,10 @@ import org.springframework.stereotype.Service;
 
 import java.io.IOException;
 import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 联锁详细信息历史数据表
@@ -80,6 +82,15 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
 
             for (InterlockHistoryDistinctZZXTVO zzxtvo : zzxtvoList) {
 
+                if(dto.getBeginTime()==null){
+                    Date minTagTime = interlockDetailHistoryMapper.getMinTagTime(dto);
+                    if(minTagTime!=null) dto.setBeginTime(minTagTime);
+                }
+                if(dto.getEndTime()==null){
+                    Date maxTagTime = interlockDetailHistoryMapper.getMaxTagTime(dto);
+                    if(maxTagTime!=null) dto.setEndTime(maxTagTime);
+                }
+
                 String sheetName =generateSheetName(zzxtvo) ;
                 processSheet(workbook, cellStyleMap, sheetName, dto, zzxtvo);