|
|
@@ -3,7 +3,6 @@
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.zd.laboratory.mapper.LabRiskPlanMapper">
|
|
|
-
|
|
|
<resultMap type="com.zd.laboratory.domain.LabRiskPlan" id="LabRiskPlanResult">
|
|
|
<result property="id" column="id"/>
|
|
|
<result property="name" column="name"/>
|
|
|
@@ -17,6 +16,7 @@
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
<result property="remark" column="remark"/>
|
|
|
+ <result property="startCondition" column="start_condition"/>
|
|
|
<result property="message" column="message"/>
|
|
|
<result property="voicebroadcast" column="voicebroadcast"/>
|
|
|
<result property="information" column="information"/>
|
|
|
@@ -37,14 +37,17 @@
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
<result property="remark" column="remark"/>
|
|
|
+ <result property="startCondition" column="start_condition"/>
|
|
|
<result property="message" column="message"/>
|
|
|
<result property="voicebroadcast" column="voicebroadcast"/>
|
|
|
<result property="information" column="information"/>
|
|
|
<result property="level" column="level"/>
|
|
|
<result property="evacuation" column="evacuation"/>
|
|
|
- <collection property="riskPlanHardwareList" column="id" ofType="com.zd.laboratory.domain.LabRiskPlanHardwareRelation"
|
|
|
+ <collection property="riskPlanHardwareList" column="id"
|
|
|
+ ofType="com.zd.laboratory.domain.LabRiskPlanHardwareRelation"
|
|
|
select="com.zd.laboratory.mapper.LabRiskPlanHardwareRelationMapper.selectLabRiskPlanHardwareRelationByRiskPlanIdId"/>
|
|
|
- <collection property="riskPlanSensorList" column="id" ofType="com.zd.laboratory.domain.LabRiskPlanSensorRelation"
|
|
|
+ <collection property="riskPlanSensorList" column="id"
|
|
|
+ ofType="com.zd.laboratory.domain.LabRiskPlanSensorRelation"
|
|
|
select="com.zd.laboratory.mapper.LabRiskPlanSensorRelationMapper.selectLabRiskPlanSensorRelationByRiskPlanIdId"/>
|
|
|
<collection property="labRiskPlanjoinsubList" column="id" ofType="com.zd.laboratory.domain.LabRiskPlanjoinsub"
|
|
|
select="com.zd.laboratory.mapper.LabRiskPlanjoinsubMapper.selectLabRiskPlanjoinsubByPlanId"/>
|
|
|
@@ -63,6 +66,7 @@
|
|
|
update_time,
|
|
|
update_by,
|
|
|
remark,
|
|
|
+ start_condition,
|
|
|
message,
|
|
|
voicebroadcast,
|
|
|
information,
|
|
|
@@ -75,35 +79,74 @@
|
|
|
resultMap="LabRiskPlanResult">
|
|
|
<include refid="selectLabRiskPlanVo"/>
|
|
|
<where>
|
|
|
- <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
|
|
- <if test="hazardId != null ">and hazard_id = #{hazardId}</if>
|
|
|
- <if test="containerId != null ">and container_id = #{containerId}</if>
|
|
|
- <if test="deptId != null ">and dept_id = #{deptId}</if>
|
|
|
- <if test="deptName != null and deptName != ''">and dept_name like concat('%', #{deptName}, '%')</if>
|
|
|
- <if test="userId != null ">and user_id = #{userId}</if>
|
|
|
- <if test="message != null and message != ''">and message = #{message}</if>
|
|
|
- <if test="voicebroadcast != null and voicebroadcast != ''">and voicebroadcast = #{voicebroadcast}</if>
|
|
|
- <if test="information != null and information != ''">and information = #{information}</if>
|
|
|
- <if test="level != null and level != ''">and level = #{level}</if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and name like concat('%', #{name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="hazardId != null">
|
|
|
+ and hazard_id = #{hazardId}
|
|
|
+ </if>
|
|
|
+ <if test="containerId != null">
|
|
|
+ and container_id = #{containerId}
|
|
|
+ </if>
|
|
|
+ <if test="deptId != null">
|
|
|
+ and dept_id = #{deptId}
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ and dept_name like concat('%', #{deptName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="userId != null">
|
|
|
+ and user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="message != null and message != ''">
|
|
|
+ and message = #{message}
|
|
|
+ </if>
|
|
|
+ <if test="startCondition != null and startCondition != ''">
|
|
|
+ and start_condition = #{message}
|
|
|
+ </if>
|
|
|
+ <if test="voicebroadcast != null and voicebroadcast != ''">
|
|
|
+ and voicebroadcast = #{voicebroadcast}
|
|
|
+ </if>
|
|
|
+ <if test="information != null and information != ''">
|
|
|
+ and information = #{information}
|
|
|
+ </if>
|
|
|
+ <if test="level != null and level != ''">
|
|
|
+ and level = #{level}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectLabRiskPlanById" resultMap="LabRiskPlanAndRelationResult">
|
|
|
+ <select id="selectLabRiskPlanById" resultMap="LabRiskPlanAndRelationResult">
|
|
|
<include refid="selectLabRiskPlanVo"/>
|
|
|
where id = #{id}
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectLabRiskPlanStatisticList" resultType="com.zd.laboratory.domain.dto.LabRiskPlanDTO" parameterType="com.zd.laboratory.domain.dto.LabRiskPlanDTO">
|
|
|
- select rp.id, rp.name, rp.remark, case when rp.hazard_id is not null then 1 when rp.container_id is not null then 2 else 0 end as type,
|
|
|
- floor((select (select count(1) from lab_risk_plan_abnormal_log where risk_plan_id = rp.id and risk_status = 1)/(select count(1) from lab_risk_plan_abnormal_log where risk_status = 1) * 100)) as startUpScale,
|
|
|
- floor((select (select count(1) from lab_hazard_subject_relation where hazard_id = rp.hazard_id)/(select count(DISTINCT subject_id) from lab_hazard_subject_relation) * 100)) as labDisScale,
|
|
|
- (SELECT GROUP_CONCAT(sr.fun_num) FROM lab_risk_plan_sensor_relation sr WHERE rp.id = sr.risk_plan_id) fun_num,
|
|
|
- (SELECT GROUP_CONCAT('(',sr.min_monitor,'-',sr.max_monitor,')') FROM lab_risk_plan_sensor_relation sr WHERE rp.id = sr.risk_plan_id) fun_monitor,
|
|
|
- rp.create_by,
|
|
|
- rp.create_time,
|
|
|
- rp.user_id,
|
|
|
- rp.evacuation
|
|
|
- from lab_risk_plan rp INNER JOIN sys_user ur ON rp.user_id = ur.user_id
|
|
|
+ <select id="selectLabRiskPlanStatisticList" resultType="com.zd.laboratory.domain.dto.LabRiskPlanDTO"
|
|
|
+ parameterType="com.zd.laboratory.domain.dto.LabRiskPlanDTO">
|
|
|
+ select rp.id,
|
|
|
+ rp.name,
|
|
|
+ rp.remark,
|
|
|
+ case when rp.hazard_id is not null then 1 when rp.container_id is not null then 2 else 0 end as type,
|
|
|
+ floor((select (select count(1)
|
|
|
+ from lab_risk_plan_abnormal_log
|
|
|
+ where risk_plan_id = rp.id
|
|
|
+ and risk_status = 1) /
|
|
|
+ (select count(1) from lab_risk_plan_abnormal_log where risk_status = 1) *
|
|
|
+ 100)) as startUpScale,
|
|
|
+ floor((select (select count(1) from lab_hazard_subject_relation where hazard_id = rp.hazard_id) /
|
|
|
+ (select count(DISTINCT subject_id) from lab_hazard_subject_relation) *
|
|
|
+ 100)) as labDisScale,
|
|
|
+ (SELECT GROUP_CONCAT(sr.fun_num)
|
|
|
+ FROM lab_risk_plan_sensor_relation sr
|
|
|
+ WHERE rp.id = sr.risk_plan_id) fun_num,
|
|
|
+ (SELECT GROUP_CONCAT('(', sr.min_monitor, '-', sr.max_monitor, ')')
|
|
|
+ FROM lab_risk_plan_sensor_relation sr
|
|
|
+ WHERE rp.id = sr.risk_plan_id) fun_monitor,
|
|
|
+ rp.create_by,
|
|
|
+ rp.create_time,
|
|
|
+ rp.user_id,
|
|
|
+ rp.evacuation
|
|
|
+ from lab_risk_plan rp
|
|
|
+ INNER JOIN sys_user ur ON rp.user_id = ur.user_id
|
|
|
<where>
|
|
|
<if test="type != null and type != ''">
|
|
|
<if test="type == 1">
|
|
|
@@ -114,58 +157,66 @@
|
|
|
</if>
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
- and rp.name like concat('%',#{name} ,'%')
|
|
|
+ and rp.name like concat('%', #{name}, '%')
|
|
|
</if>
|
|
|
<if test="createName != null and createName != ''">
|
|
|
- and rp.create_by like concat('%',#{createName} ,'%')
|
|
|
+ and rp.create_by like concat('%', #{createName}, '%')
|
|
|
</if>
|
|
|
- <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
|
|
- AND date_format(rp.create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
|
|
|
+ <if test="beginTime != null and beginTime != ''">
|
|
|
+ <!-- 开始时间检索 -->
|
|
|
+ AND date_format(rp.create_time, '%y%m%d') >= date_format(#{beginTime}, '%y%m%d')
|
|
|
</if>
|
|
|
- <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
|
- AND date_format(rp.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
+ <!-- 结束时间检索 -->
|
|
|
+ AND date_format(rp.create_time, '%y%m%d') <= date_format(#{endTime}, '%y%m%d')
|
|
|
</if>
|
|
|
<if test="deptId != null and deptId != ''">
|
|
|
- and (ur.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = #{deptId} OR FIND_IN_SET( #{deptId} , ancestors ) )
|
|
|
- OR ur.dept_id IN (
|
|
|
- SELECT d2.parent_id FROM sys_dept d2 WHERE d2.dept_id = #{deptId}
|
|
|
- UNION ALL
|
|
|
- SELECT d3.parent_id FROM sys_dept d3 WHERE d3.dept_id IN (SELECT d2.parent_id FROM sys_dept d2 WHERE d2.dept_id = #{deptId})
|
|
|
- ))
|
|
|
+ and (ur.dept_id IN
|
|
|
+ (SELECT dept_id FROM sys_dept WHERE dept_id = #{deptId} OR FIND_IN_SET(#{deptId}, ancestors))
|
|
|
+ OR ur.dept_id IN (SELECT d2.parent_id
|
|
|
+ FROM sys_dept d2
|
|
|
+ WHERE d2.dept_id = #{deptId}
|
|
|
+ UNION ALL
|
|
|
+ SELECT d3.parent_id
|
|
|
+ FROM sys_dept d3
|
|
|
+ WHERE d3.dept_id IN
|
|
|
+ (SELECT d2.parent_id FROM sys_dept d2 WHERE d2.dept_id = #{deptId})))
|
|
|
</if>
|
|
|
<if test="searchValue != null and searchValue != ''">
|
|
|
and (
|
|
|
- rp.name like concat('%',#{searchValue} ,'%') or
|
|
|
- rp.create_by like concat('%',#{searchValue} ,'%')
|
|
|
- )
|
|
|
+ rp.name like concat('%', #{searchValue}, '%') or
|
|
|
+ rp.create_by like concat('%', #{searchValue}, '%')
|
|
|
+ )
|
|
|
</if>
|
|
|
</where>
|
|
|
- ORDER BY rp.create_time DESC,rp.update_time DESC
|
|
|
+ ORDER BY rp.create_time DESC, rp.update_time DESC
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectLabRiskPlanBySubjectList" parameterType="com.zd.laboratory.domain.vo.LabRiskPlanVO" resultMap="LabRiskPlanAndRelationResult">
|
|
|
+ <select id="selectLabRiskPlanBySubjectList" parameterType="com.zd.laboratory.domain.vo.LabRiskPlanVO"
|
|
|
+ resultMap="LabRiskPlanAndRelationResult">
|
|
|
SELECT DISTINCT p.id,
|
|
|
- p.name,
|
|
|
- p.hazard_id,
|
|
|
- p.container_id,
|
|
|
- p.dept_id,
|
|
|
- p.create_time,
|
|
|
- p.dept_name,
|
|
|
- p.user_id,
|
|
|
- p.create_by,
|
|
|
- p.update_time,
|
|
|
- p.update_by,
|
|
|
- p.remark,
|
|
|
- p.message,
|
|
|
- p.voicebroadcast,
|
|
|
- p.information,
|
|
|
- p.level,
|
|
|
- p.evacuation,
|
|
|
- (CONCAT(d.dept_class_name,d.`dept_name`,s.`name`)) topName,
|
|
|
- s.`floor_id` floorId
|
|
|
- FROM lab_risk_plan p INNER JOIN lab_risk_planjoinsub rp ON p.`id` = rp.`risk_plan_id`
|
|
|
- INNER JOIN lab_subject s ON s.`id` = rp.`subject_id`
|
|
|
- INNER JOIN sys_dept d ON d.dept_id = s.build_id
|
|
|
+ p.name,
|
|
|
+ p.hazard_id,
|
|
|
+ p.container_id,
|
|
|
+ p.dept_id,
|
|
|
+ p.create_time,
|
|
|
+ p.dept_name,
|
|
|
+ p.user_id,
|
|
|
+ p.create_by,
|
|
|
+ p.update_time,
|
|
|
+ p.update_by,
|
|
|
+ p.remark,
|
|
|
+ p.message,
|
|
|
+ p.voicebroadcast,
|
|
|
+ p.information,
|
|
|
+ p.level,
|
|
|
+ p.evacuation,
|
|
|
+ (CONCAT(d.dept_class_name, d.`dept_name`, s.`name`)) topName,
|
|
|
+ s.`floor_id` floorId
|
|
|
+ FROM lab_risk_plan p
|
|
|
+ INNER JOIN lab_risk_planjoinsub rp ON p.`id` = rp.`risk_plan_id`
|
|
|
+ INNER JOIN lab_subject s ON s.`id` = rp.`subject_id`
|
|
|
+ INNER JOIN sys_dept d ON d.dept_id = s.build_id
|
|
|
<where>
|
|
|
<if test="subjectId != null and subjectId != ''">
|
|
|
and rp.`subject_id` = #{subjectId}
|
|
|
@@ -189,97 +240,312 @@
|
|
|
<!--p.level-->
|
|
|
<!--FROM lab_risk_plan p INNER JOIN lab_hazard_subject_relation hsr ON p.hazard_id = hsr.`hazard_id`-->
|
|
|
<!--<where>-->
|
|
|
- <!--<if test="subjectId != null and subjectId != ''">-->
|
|
|
- <!--and hsr.`subject_id` = #{subjectId}-->
|
|
|
- <!--</if>-->
|
|
|
+ <!--<if test="subjectId != null and subjectId != ''">-->
|
|
|
+ <!--and hsr.`subject_id` = #{subjectId}-->
|
|
|
+ <!--</if>-->
|
|
|
<!--</where>-->
|
|
|
</select>
|
|
|
<select id="selectRiskPlanCountBySubId"
|
|
|
resultType="com.zd.laboratory.api.vo.LabRiskVO">
|
|
|
- select
|
|
|
- p.name as planName,
|
|
|
- (select count(1) from lab_risk_plan_abnormal_log pl where pl.risk_plan_id = p.id and pl.subject_id = pj.subject_id and pl.risk_status = 1) as planCount,
|
|
|
- (select create_time from lab_risk_plan_abnormal_log pl where pl.risk_plan_id = p.id and pl.subject_id = pj.subject_id and pl.risk_status = 1 order by create_time desc limit 1) as lastTime
|
|
|
- from lab_risk_plan p right join lab_risk_planjoinsub pj on p.id = pj.risk_plan_id
|
|
|
+ select p.name as planName,
|
|
|
+ (select count(1)
|
|
|
+ from lab_risk_plan_abnormal_log pl
|
|
|
+ where pl.risk_plan_id = p.id
|
|
|
+ and pl.subject_id = pj.subject_id
|
|
|
+ and pl.risk_status = 1) as planCount,
|
|
|
+ (select create_time
|
|
|
+ from lab_risk_plan_abnormal_log pl
|
|
|
+ where pl.risk_plan_id = p.id
|
|
|
+ and pl.subject_id = pj.subject_id
|
|
|
+ and pl.risk_status = 1
|
|
|
+ order by create_time desc limit 1) as lastTime
|
|
|
+ from lab_risk_plan p right join lab_risk_planjoinsub pj
|
|
|
+ on p.id = pj.risk_plan_id
|
|
|
|
|
|
where pj.subject_id = #{subId}
|
|
|
</select>
|
|
|
|
|
|
- <insert id="insertLabRiskPlan" parameterType="com.zd.laboratory.domain.LabRiskPlan" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ <insert id="insertLabRiskPlan" parameterType="com.zd.laboratory.domain.LabRiskPlan" keyProperty="id"
|
|
|
+ useGeneratedKeys="true">
|
|
|
insert into lab_risk_plan
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="id != null">id,</if>
|
|
|
- <if test="name != null">name,</if>
|
|
|
- <if test="hazardId != null">hazard_id,</if>
|
|
|
- <if test="containerId != null">container_id,</if>
|
|
|
- <if test="deptId != null">dept_id,</if>
|
|
|
- <if test="createTime != null">create_time,</if>
|
|
|
- <if test="deptName != null">dept_name,</if>
|
|
|
- <if test="userId != null">user_id,</if>
|
|
|
- <if test="createBy != null">create_by,</if>
|
|
|
- <if test="updateTime != null">update_time,</if>
|
|
|
- <if test="updateBy != null">update_by,</if>
|
|
|
- <if test="remark != null">remark,</if>
|
|
|
- <if test="message != null">message,</if>
|
|
|
- <if test="voicebroadcast != null">voicebroadcast,</if>
|
|
|
- <if test="information != null">information,</if>
|
|
|
- <if test="level != null">level,</if>
|
|
|
- <if test="evacuation != null">evacuation,</if>
|
|
|
+ <if test="id != null">
|
|
|
+ id,
|
|
|
+ </if>
|
|
|
+ <if test="name != null">
|
|
|
+ name,
|
|
|
+ </if>
|
|
|
+ <if test="hazardId != null">
|
|
|
+ hazard_id,
|
|
|
+ </if>
|
|
|
+ <if test="containerId != null">
|
|
|
+ container_id,
|
|
|
+ </if>
|
|
|
+ <if test="deptId != null">
|
|
|
+ dept_id,
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time,
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null">
|
|
|
+ dept_name,
|
|
|
+ </if>
|
|
|
+ <if test="userId != null">
|
|
|
+ user_id,
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">
|
|
|
+ create_by,
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ update_time,
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">
|
|
|
+ update_by,
|
|
|
+ </if>
|
|
|
+ <if test="remark != null">
|
|
|
+ remark,
|
|
|
+ </if>
|
|
|
+ <if test="message != null">
|
|
|
+ message,
|
|
|
+ </if>
|
|
|
+ <if test="voicebroadcast != null">
|
|
|
+ voicebroadcast,
|
|
|
+ </if>
|
|
|
+ <if test="information != null">
|
|
|
+ information,
|
|
|
+ </if>
|
|
|
+ <if test="level != null">
|
|
|
+ level,
|
|
|
+ </if>
|
|
|
+ <if test="evacuation != null">
|
|
|
+ evacuation,
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
- <if test="id != null">#{id},</if>
|
|
|
- <if test="name != null">#{name},</if>
|
|
|
- <if test="hazardId != null">#{hazardId},</if>
|
|
|
- <if test="containerId != null">#{containerId},</if>
|
|
|
- <if test="deptId != null">#{deptId},</if>
|
|
|
- <if test="createTime != null">#{createTime},</if>
|
|
|
- <if test="deptName != null">#{deptName},</if>
|
|
|
- <if test="userId != null">#{userId},</if>
|
|
|
- <if test="createBy != null">#{createBy},</if>
|
|
|
- <if test="updateTime != null">#{updateTime},</if>
|
|
|
- <if test="updateBy != null">#{updateBy},</if>
|
|
|
- <if test="remark != null">#{remark},</if>
|
|
|
- <if test="message != null">#{message},</if>
|
|
|
- <if test="voicebroadcast != null">#{voicebroadcast},</if>
|
|
|
- <if test="information != null">#{information},</if>
|
|
|
- <if test="level != null">#{level},</if>
|
|
|
- <if test="evacuation != null">#{evacuation},</if>
|
|
|
+ <if test="id != null">
|
|
|
+ #{id},
|
|
|
+ </if>
|
|
|
+ <if test="name != null">
|
|
|
+ #{name},
|
|
|
+ </if>
|
|
|
+ <if test="hazardId != null">
|
|
|
+ #{hazardId},
|
|
|
+ </if>
|
|
|
+ <if test="containerId != null">
|
|
|
+ #{containerId},
|
|
|
+ </if>
|
|
|
+ <if test="deptId != null">
|
|
|
+ #{deptId},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ #{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null">
|
|
|
+ #{deptName},
|
|
|
+ </if>
|
|
|
+ <if test="userId != null">
|
|
|
+ #{userId},
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">
|
|
|
+ #{createBy},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ #{updateTime},
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">
|
|
|
+ #{updateBy},
|
|
|
+ </if>
|
|
|
+ <if test="remark != null">
|
|
|
+ #{remark},
|
|
|
+ </if>
|
|
|
+ <if test="message != null">
|
|
|
+ #{message},
|
|
|
+ </if>
|
|
|
+ <if test="voicebroadcast != null">
|
|
|
+ #{voicebroadcast},
|
|
|
+ </if>
|
|
|
+ <if test="information != null">
|
|
|
+ #{information},
|
|
|
+ </if>
|
|
|
+ <if test="level != null">
|
|
|
+ #{level},
|
|
|
+ </if>
|
|
|
+ <if test="evacuation != null">
|
|
|
+ #{evacuation},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateLabRiskPlan" parameterType="com.zd.laboratory.domain.LabRiskPlan">
|
|
|
update lab_risk_plan
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
- <if test="name != null">name = #{name},</if>
|
|
|
- <if test="hazardId != null">hazard_id = #{hazardId},</if>
|
|
|
- <if test="containerId != null ">container_id = #{containerId},</if>
|
|
|
- <if test="deptId != null">dept_id = #{deptId},</if>
|
|
|
- <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
- <if test="deptName != null">dept_name = #{deptName},</if>
|
|
|
- <if test="userId != null">user_id = #{userId},</if>
|
|
|
- <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
- <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
- <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
- <if test="remark != null">remark = #{remark},</if>
|
|
|
- <if test="message != null">message = #{message},</if>
|
|
|
- <if test="voicebroadcast != null">voicebroadcast = #{voicebroadcast},</if>
|
|
|
- <if test="information != null">information = #{information},</if>
|
|
|
- <if test="level != null">level = #{level},</if>
|
|
|
- <if test="evacuation != null">evacuation = #{evacuation},</if>
|
|
|
+ <if test="name != null">
|
|
|
+ name = #{name},
|
|
|
+ </if>
|
|
|
+ <if test="hazardId != null">
|
|
|
+ hazard_id = #{hazardId},
|
|
|
+ </if>
|
|
|
+ <if test="containerId != null">
|
|
|
+ container_id = #{containerId},
|
|
|
+ </if>
|
|
|
+ <if test="deptId != null">
|
|
|
+ dept_id = #{deptId},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time = #{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null">
|
|
|
+ dept_name = #{deptName},
|
|
|
+ </if>
|
|
|
+ <if test="userId != null">
|
|
|
+ user_id = #{userId},
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">
|
|
|
+ create_by = #{createBy},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ update_time = #{updateTime},
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">
|
|
|
+ update_by = #{updateBy},
|
|
|
+ </if>
|
|
|
+ <if test="remark != null">
|
|
|
+ remark = #{remark},
|
|
|
+ </if>
|
|
|
+ <if test="message != null">
|
|
|
+ message = #{message},
|
|
|
+ </if>
|
|
|
+ <if test="voicebroadcast != null">
|
|
|
+ voicebroadcast = #{voicebroadcast},
|
|
|
+ </if>
|
|
|
+ <if test="information != null">
|
|
|
+ information = #{information},
|
|
|
+ </if>
|
|
|
+ <if test="level != null">
|
|
|
+ level = #{level},
|
|
|
+ </if>
|
|
|
+ <if test="evacuation != null">
|
|
|
+ evacuation = #{evacuation},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
where id = #{id}
|
|
|
</update>
|
|
|
|
|
|
- <delete id="deleteLabRiskPlanById" >
|
|
|
+ <delete id="deleteLabRiskPlanById">
|
|
|
delete
|
|
|
from lab_risk_plan
|
|
|
where id = #{id}
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteLabRiskPlanByIds">
|
|
|
- delete from lab_risk_plan where id in
|
|
|
- <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
- #{id}
|
|
|
- </foreach>
|
|
|
+ delete
|
|
|
+ from lab_risk_plan
|
|
|
+ where id in (#{ids})
|
|
|
</delete>
|
|
|
+ <select id="selectLabRiskPlanByName" resultType="int">
|
|
|
+ select count(*)
|
|
|
+ from lab_risk_plan
|
|
|
+ where name = #{name}
|
|
|
+ </select>
|
|
|
+ <select id="queryRiskPlanList" resultType="com.zd.laboratory.domain.LabRiskPlan"
|
|
|
+ parameterType="com.zd.laboratory.domain.vo.RiskPlanVo">
|
|
|
+ <include refid="selectLabRiskPlanVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="riskPlanVo.searchValue != null and riskPlanVo.searchValue != ''">
|
|
|
+ and (name like concat('%', #{riskPlanVo.searchValue}, '%')
|
|
|
+ or create_by like concat('%', #{riskPlanVo.searchValue}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="riskPlanVo.startCondition != null">
|
|
|
+ and start_condition = #{riskPlanVo.startCondition}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by create_time desc
|
|
|
+ </select>
|
|
|
+ <select id="selectSensorType" resultType="java.lang.Integer">
|
|
|
+ SELECT lrps.sensor_type
|
|
|
+ FROM lab_risk_plan lrp
|
|
|
+ LEFT JOIN lab_risk_plan_sensor_relation lrps on lrp.id = lrps.risk_plan_id
|
|
|
+ where lrp.id = #{riskPlanId}
|
|
|
+ </select>
|
|
|
+ <select id="selectRelationSubList" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
|
|
|
+ select ls.*, lrp.create_time relationTime
|
|
|
+ from lab_subject ls
|
|
|
+ LEFT JOIN lab_risk_planjoinsub lrp on ls.id = lrp.subject_id
|
|
|
+ <where>
|
|
|
+ <if test="labRiskPlanSubVo.riskPlanId != null">
|
|
|
+ and lrp.risk_plan_id = #{labRiskPlanSubVo.riskPlanId}
|
|
|
+ </if>
|
|
|
+ <if test="labRiskPlanSubVo.searchValue != null and labRiskPlanSubVo.searchValue != ''">
|
|
|
+ and ls.name = like concat('%', #{labRiskPlanSubVo.searchValue}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="labRiskPlanSubVo.level != null">
|
|
|
+ and ls.level = #{labRiskPlanSubVo.level}
|
|
|
+ </if>
|
|
|
+ <if test="labRiskPlanSubVo.typeId != null">
|
|
|
+ and ls.type_id = #{labRiskPlanSubVo.typeId}
|
|
|
+ </if>
|
|
|
+ <if test="labRiskPlanSubVo.startTime != null and labRiskPlanSubVo.endTime != null">
|
|
|
+ and lrp.create_time between #{labRiskPlanSubVo.startTime}
|
|
|
+ and #{labRiskPlanSubVo.endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by lrp.create_time desc
|
|
|
+ </select>
|
|
|
+ <select id="getLabRiskPlanNoJoinSub" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
|
|
|
+ select DISTINCT ls.*
|
|
|
+ from lab_subject ls
|
|
|
+ LEFT JOIN lab_sensor lsr ON lsr.subject_id = ls.id
|
|
|
+ <where>
|
|
|
+ <if test="labRiskPlanSubVo.riskPlanId != null">
|
|
|
+ and ls.id not in
|
|
|
+ (select ls.id
|
|
|
+ from lab_subject ls
|
|
|
+ LEFT JOIN lab_risk_planjoinsub lrp on ls.id = lrp.subject_id
|
|
|
+ where lrp.risk_plan_id = #{labRiskPlanSubVo.riskPlanId})
|
|
|
+ AND lsr.type in (SELECT lrps.sensor_type
|
|
|
+ FROM lab_risk_plan lrp
|
|
|
+ LEFT JOIN lab_risk_plan_sensor_relation lrps on lrp.id = lrps.risk_plan_id
|
|
|
+ where lrp.id = #{labRiskPlanSubVo.riskPlanId})
|
|
|
+ </if>
|
|
|
+ <if test="labRiskPlanSubVo.searchValue != null and labRiskPlanSubVo.searchValue != ''">
|
|
|
+ and ls.name = like concat('%', #{labRiskPlanSubVo.searchValue}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="labRiskPlanSubVo.level != null">
|
|
|
+ #{labRiskPlanSubVo.level}
|
|
|
+ </if>
|
|
|
+ <if test="labRiskPlanSubVo.typeId != null">
|
|
|
+ and ls.type_id = #{labRiskPlanSubVo.typeId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <select id="selectLabRiskPlanByRiskPlanId" resultType="com.zd.laboratory.domain.LabRiskPlan">
|
|
|
+ SELECT DISTINCT p.id,
|
|
|
+ p.name,
|
|
|
+ p.hazard_id,
|
|
|
+ p.container_id,
|
|
|
+ p.dept_id,
|
|
|
+ p.create_time,
|
|
|
+ p.dept_name,
|
|
|
+ p.user_id,
|
|
|
+ p.create_by,
|
|
|
+ p.update_time,
|
|
|
+ p.update_by,
|
|
|
+ p.remark,
|
|
|
+ p.message,
|
|
|
+ p.voicebroadcast,
|
|
|
+ p.information,
|
|
|
+ p.level,
|
|
|
+ p.evacuation,
|
|
|
+ (CONCAT(d.dept_class_name, d.`dept_name`, s.`name`)) topName,
|
|
|
+ s.`floor_id` floorId
|
|
|
+ FROM lab_risk_plan p
|
|
|
+ INNER JOIN lab_risk_planjoinsub rp ON p.`id` = rp.`risk_plan_id`
|
|
|
+ INNER JOIN lab_subject s ON s.`id` = rp.`subject_id`
|
|
|
+ INNER JOIN sys_dept d ON d.dept_id = s.build_id
|
|
|
+ <where>
|
|
|
+ <if test="riskPlanId != null">
|
|
|
+ and p.`id` = #{riskPlanId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
</mapper>
|