|
@@ -230,4 +230,108 @@
|
|
|
order by s.tag_time desc
|
|
|
</select>
|
|
|
|
|
|
+
|
|
|
+ <select id="getAllForExport" resultType="java.lang.String">
|
|
|
+ select DISTINCT(s.summary_origin_id)
|
|
|
+ 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
|
|
|
+ <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 > #{beginTime} </if>
|
|
|
+ <if test="endTime != null"> and s.tag_time < #{endTime} </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getOneInfoForExport" resultType="org.jeecg.modules.history.vo.InterlockSummaryHistoryVO">
|
|
|
+ select s.*
|
|
|
+ from
|
|
|
+ (
|
|
|
+ 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,
|
|
|
+ h1.interlock_status_name, h2.bypass_name,
|
|
|
+ h3.instrument_status_name, h4.control_system_status_name,
|
|
|
+ ROW_NUMBER() OVER (PARTITION BY s.summary_origin_id ORDER BY s.tag_time DESC) AS mm
|
|
|
+ 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
|
|
|
+ <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 <![CDATA[ <= ]]> #{dto.beginTime} </if>
|
|
|
+ <if test="summaryOriginId != null and summaryOriginId != ''"> and s.summary_origin_id = #{summaryOriginId} </if>
|
|
|
+ </where>
|
|
|
+ ) s
|
|
|
+ where mm = 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getAllForExport1" resultType="java.lang.String">
|
|
|
+ select DISTINCT(s.summary_origin_id)
|
|
|
+ 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
|
|
|
+ <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 = #{beginTime} </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getForExport1" resultType="org.jeecg.modules.history.vo.InterlockSummaryHistoryVO">
|
|
|
+ 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,
|
|
|
+ h1.interlock_status_name, h2.bypass_name,
|
|
|
+ h3.instrument_status_name, h4.control_system_status_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
|
|
|
+ <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 = #{beginTime} </if>
|
|
|
+ </where>
|
|
|
+ order by s.tag_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|