|
@@ -31,6 +31,29 @@
|
|
|
order by d.create_time desc
|
|
|
</select>
|
|
|
|
|
|
+ <!--联锁历史数据详细信息-分页查询 读取含义从详细历史数据表中读取-->
|
|
|
+ <select id="getPage22" parameterType="org.jeecg.modules.detail.dto.InterlockDetailQueryDTO" resultType="org.jeecg.modules.history.vo.InterlockDetailHistoryQueryVO">
|
|
|
+ select d.id, d.summaryid, d.interlockname, d.interlock_condition, d.interlock_condition_tag, d.description,
|
|
|
+ d.instrument_status, d.interlock_set_value, d.current_value, d.if_bypass, d.bypass, d.input_status,
|
|
|
+ d.output_status, d.mp_status, s.ljgx, s.interlock_out_value, s.tag_time, d.summary_origin_id,
|
|
|
+ d.control_system_status_name as mp_status_name,
|
|
|
+ d.control_system_status_name as input_status_name,
|
|
|
+ d.control_system_status_name as output_status_name,
|
|
|
+ d.bypass_name,
|
|
|
+ d.instrument_status_name,
|
|
|
+ d.instrument_status_normal, d.bypass_yes, s.interlock_status_ty, d.control_system_status_normal,
|
|
|
+ d.interlock_current_unit, d.interlock_set_unit,
|
|
|
+ d.bypass_tag, d.input_status_tag, d.output_status_tag, d.mp_status_tag, s.interlock_out_value_tag, d.instrument_status_tag
|
|
|
+ from interlock_detail_history d
|
|
|
+ left join interlock_summary_history s on d.summaryid = s.id
|
|
|
+ <where>
|
|
|
+ <if test="dto.summaryid != null and dto.summaryid != ''"> and d.summaryid = #{dto.summaryid}</if>
|
|
|
+ <if test="dto.summaryOriginId != null and dto.summaryOriginId != ''"> and d.summary_origin_id = #{dto.summaryOriginId}</if>
|
|
|
+ <if test="dto.interlockConditionTag != null and dto.interlockConditionTag != ''"> and d.interlock_condition_tag like concat('%',#{dto.interlockConditionTag},'%')</if>
|
|
|
+ </where>
|
|
|
+ order by d.create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
<!-- <!–联锁历史数据详细信息-分页查询 sl修改之前版本–>-->
|
|
|
<!-- <select id="getPage2" parameterType="org.jeecg.modules.detail.dto.InterlockDetailQueryDTO" resultType="org.jeecg.modules.history.vo.InterlockDetailHistoryQueryVO">-->
|
|
|
<!-- select d.id, d.summaryid, d.interlockname, d.interlock_condition, d.interlock_condition_tag, d.description,-->
|
|
@@ -140,8 +163,8 @@
|
|
|
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="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>
|
|
@@ -198,6 +221,39 @@
|
|
|
order by s.tag_time desc
|
|
|
</select>
|
|
|
|
|
|
+ <!-- 联锁总历史数据表-分页列表查询(各种逻辑状态) 添加权限 普通用户权限 含义读取从详细历史数据表中读取-->
|
|
|
+ <select id="getPageByPtUser1" 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,
|
|
|
+ s.interlock_status_name, d.bypass_name,
|
|
|
+ d.instrument_status_name, d.control_system_status_name,
|
|
|
+ d.instrument_status_normal, d.bypass_yes, s.interlock_status_ty, d.control_system_status_normal,
|
|
|
+ b.interlock_name as interlock_system_name, b1.interlock_name as interlock_apparatus_name
|
|
|
+ from interlock_detail_history d
|
|
|
+ left join interlock_summary_history s on d.summaryid = s.id
|
|
|
+ inner join interlock_base b on b.id = s.interlock_system_id
|
|
|
+ inner join interlock_base b1 on b1.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>
|
|
|
+ and (qxnr.limit_type='0' or qxnr.limit_type='1')
|
|
|
+ <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 > #{dto.beginTime} </if>
|
|
|
+ <if test="dto.endTime != null"> and s.tag_time < #{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>
|
|
|
+
|
|
|
<!-- 联锁总历史数据表-分页列表查询(各种逻辑状态) 添加权限 系统管理员权限-->
|
|
|
<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,
|
|
@@ -231,6 +287,34 @@
|
|
|
</where>
|
|
|
order by s.tag_time desc
|
|
|
</select>
|
|
|
+ <!-- 联锁总历史数据表-分页列表查询(各种逻辑状态) 添加权限 系统管理员权限 含义读取从详细历史数据表中读取-->
|
|
|
+ <select id="getPageByAdminUser1" 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,
|
|
|
+ s.interlock_status_name, d.bypass_name,
|
|
|
+ d.instrument_status_name, d.control_system_status_name,
|
|
|
+ d.instrument_status_normal, d.bypass_yes, s.interlock_status_ty, d.control_system_status_normal,
|
|
|
+ b.interlock_name as interlock_system_name, b1.interlock_name as interlock_apparatus_name
|
|
|
+ from interlock_detail_history d
|
|
|
+ left join interlock_summary_history s on d.summaryid = s.id
|
|
|
+ inner join interlock_base b on b.id = s.interlock_system_id
|
|
|
+ inner join interlock_base b1 on b1.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 > #{dto.beginTime} </if>
|
|
|
+ <if test="dto.endTime != null"> and s.tag_time < #{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>
|
|
|
|
|
|
|
|
|
<select id="getAllForExport" resultType="java.lang.String">
|
|
@@ -336,4 +420,77 @@
|
|
|
order by s.tag_time desc
|
|
|
</select>
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 手动导出 获取历史数据表中数据的原联锁总表id集合-->
|
|
|
+ <select id="getAllForExport11" parameterType="org.jeecg.modules.history.dto.InterlockHistoryQueryDTO" 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
|
|
|
+ <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 > #{dto.beginTime} </if>
|
|
|
+ <if test="dto.endTime != null"> and s.tag_time < #{dto.endTime} </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 联锁总历史数据表查询(各种逻辑状态)——用于手动导出 含义从详细历史数据表中获取 -->
|
|
|
+ <!-- 每个系统的数据 先按联锁总表的生成时间倒序排序,s.create_time desc, ??保证新增的联锁在最前面; 再按tag_time倒序排序,使最新发生变化的数据在最前面 -->
|
|
|
+ <select id="getForExport11" parameterType="org.jeecg.modules.history.dto.InterlockHistoryQueryDTO" 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,
|
|
|
+ s.interlock_status_name, d.bypass_name,
|
|
|
+ d.instrument_status_name, d.control_system_status_name
|
|
|
+ from interlock_detail_history d left join interlock_summary_history s on d.summaryid = s.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 TO_TIMESTAMP(s.tag_time, 'YYYY-MM-DD HH24:MI:SS') <![CDATA[ >= ]]> #{dto.beginTime} </if>
|
|
|
+ <if test="dto.endTime != null"> and TO_TIMESTAMP(s.tag_time, 'YYYY-MM-DD HH24:MI:SS') <![CDATA[ <= ]]> #{dto.endTime} </if>
|
|
|
+ </where>
|
|
|
+ order by s.tag_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 如果 联锁 不存在 历史数据中 查询距离begintime最近的一条历史数据 含义从详细历史数据表中获取 -->
|
|
|
+ <select id="getOneInfoForExport11" 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,
|
|
|
+ s.interlock_status_name, d.bypass_name,
|
|
|
+ d.instrument_status_name, d.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
|
|
|
+ <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>
|
|
|
+
|
|
|
</mapper>
|