|
@@ -117,18 +117,78 @@
|
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectLabSubjectVo">
|
|
<sql id="selectLabSubjectVo">
|
|
|
- select
|
|
|
|
|
- id, name, floor_id,layout_id,build_id,sub_dept,level, check_out,check_in,room,dept_id,
|
|
|
|
|
- (SELECT d.dept_name FROM sys_dept d WHERE s.dept_id = d.dept_id) dept_name,
|
|
|
|
|
- admin_id, is_del, create_time, user_id,
|
|
|
|
|
- create_by, update_time, update_by, remark, sub_dept,
|
|
|
|
|
- check_out, check_in, safe_user_id, safe_signs, hazard_category, risk_measure,
|
|
|
|
|
- outfire, qr_code,safe_user_id, skipped, check_count,sign_time,
|
|
|
|
|
- (SELECT GROUP_CONCAT(ur.nick_name) FROM sys_user ur WHERE FIND_IN_SET(ur.user_id, s.`safe_user_id`)) AS safeUserNames,
|
|
|
|
|
- (select d.dept_name from sys_dept d where s.build_id = d.dept_id) build_name,
|
|
|
|
|
- (select b.name from lab_building b where b.id = s.floor_id) floorName,
|
|
|
|
|
- (SELECT l.room FROM lab_subject_layout l WHERE l.id = s.layout_id ) roomName,
|
|
|
|
|
- (select GROUP_CONCAT(phonenumber) from sys_user where find_in_set(user_id, s.safe_user_id)) safeUserPhone
|
|
|
|
|
|
|
+ select id,
|
|
|
|
|
+ name,
|
|
|
|
|
+ floor_id,
|
|
|
|
|
+ layout_id,
|
|
|
|
|
+ build_id,
|
|
|
|
|
+ sub_dept,
|
|
|
|
|
+ level,
|
|
|
|
|
+ check_out,
|
|
|
|
|
+ check_in,
|
|
|
|
|
+ room,
|
|
|
|
|
+ dept_id,
|
|
|
|
|
+ (SELECT d.dept_name FROM sys_dept d WHERE s.dept_id = d.dept_id) dept_name,
|
|
|
|
|
+ admin_id,
|
|
|
|
|
+ is_del,
|
|
|
|
|
+ create_time,
|
|
|
|
|
+ user_id,
|
|
|
|
|
+ create_by,
|
|
|
|
|
+ update_time,
|
|
|
|
|
+ update_by,
|
|
|
|
|
+ remark,
|
|
|
|
|
+ sub_dept,
|
|
|
|
|
+ check_out,
|
|
|
|
|
+ check_in,
|
|
|
|
|
+ safe_user_id,
|
|
|
|
|
+ safe_signs,
|
|
|
|
|
+ hazard_category,
|
|
|
|
|
+ risk_measure,
|
|
|
|
|
+ outfire,
|
|
|
|
|
+ qr_code,
|
|
|
|
|
+ safe_user_id,
|
|
|
|
|
+ skipped,
|
|
|
|
|
+ check_count,
|
|
|
|
|
+ sign_time,
|
|
|
|
|
+ (SELECT GROUP_CONCAT(ur.nick_name)
|
|
|
|
|
+ FROM sys_user ur
|
|
|
|
|
+ WHERE ur.`user_id`
|
|
|
|
|
+ IN (
|
|
|
|
|
+ SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(s.safe_user_id, ',', b.help_topic_id + 1), ',',
|
|
|
|
|
+ -1) result
|
|
|
|
|
+ FROM mysql.help_topic b
|
|
|
|
|
+ WHERE b.help_topic_id <
|
|
|
|
|
+ (LENGTH(s.safe_user_id) - LENGTH(REPLACE(s.safe_user_id, ',', '')) + 1)
|
|
|
|
|
+ )
|
|
|
|
|
+ ) safeUserNames,
|
|
|
|
|
+ (select f.`name`
|
|
|
|
|
+ from lab_build_floor f
|
|
|
|
|
+ where f.type = 2
|
|
|
|
|
+ and f.id =
|
|
|
|
|
+ (select bfl.build_id
|
|
|
|
|
+ from lab_build_floor_layout bfl
|
|
|
|
|
+ where bfl.sub_id = s.id)) build_name,
|
|
|
|
|
+ (select f.`name`
|
|
|
|
|
+ from lab_build_floor f
|
|
|
|
|
+ where f.type = 3
|
|
|
|
|
+ and f.id =
|
|
|
|
|
+ (select bfl.floor_id
|
|
|
|
|
+ from lab_build_floor_layout bfl
|
|
|
|
|
+ where bfl.sub_id = s.id)) floorName,
|
|
|
|
|
+ (select bfl.room_num
|
|
|
|
|
+ from lab_build_floor_layout bfl
|
|
|
|
|
+ where bfl.sub_id = s.id) roomName,
|
|
|
|
|
+ (SELECT GROUP_CONCAT(phonenumber)
|
|
|
|
|
+ FROM sys_user ur
|
|
|
|
|
+ WHERE ur.`user_id`
|
|
|
|
|
+ IN (
|
|
|
|
|
+ SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(s.safe_user_id, ',', b.help_topic_id + 1), ',',
|
|
|
|
|
+ -1) result
|
|
|
|
|
+ FROM mysql.help_topic b
|
|
|
|
|
+ WHERE b.help_topic_id <
|
|
|
|
|
+ (LENGTH(s.safe_user_id) - LENGTH(REPLACE(s.safe_user_id, ',', '')) + 1)
|
|
|
|
|
+ )
|
|
|
|
|
+ ) safeUserPhone
|
|
|
from lab_subject s
|
|
from lab_subject s
|
|
|
</sql>
|
|
</sql>
|
|
|
<sql id="selectLabSubjectListVo">
|
|
<sql id="selectLabSubjectListVo">
|
|
@@ -137,7 +197,7 @@
|
|
|
bfl.floor_id,
|
|
bfl.floor_id,
|
|
|
lb.room,
|
|
lb.room,
|
|
|
t.dept_id,
|
|
t.dept_id,
|
|
|
- IFNULL(su.user_id,-1) admin_id,
|
|
|
|
|
|
|
+ IFNULL(su.user_id, -1) admin_id,
|
|
|
t.is_del,
|
|
t.is_del,
|
|
|
t.create_time,
|
|
t.create_time,
|
|
|
t.user_id,
|
|
t.user_id,
|
|
@@ -145,38 +205,43 @@
|
|
|
t.update_time,
|
|
t.update_time,
|
|
|
t.update_by,
|
|
t.update_by,
|
|
|
t.sub_dept,
|
|
t.sub_dept,
|
|
|
- bfl.id layout_id,
|
|
|
|
|
|
|
+ bfl.id layout_id,
|
|
|
t.build_id,
|
|
t.build_id,
|
|
|
t.remark,
|
|
t.remark,
|
|
|
t.level,
|
|
t.level,
|
|
|
t.diy_order,
|
|
t.diy_order,
|
|
|
- cf.classified_name levelName,
|
|
|
|
|
- cf.classified_color fiedColor,
|
|
|
|
|
|
|
+ cf.classified_name levelName,
|
|
|
|
|
+ cf.classified_color fiedColor,
|
|
|
t.type_id,
|
|
t.type_id,
|
|
|
(SELECT ct.type_name FROM lab_safe_classtype ct WHERE ct.id = t.`type_id`) typeName,
|
|
(SELECT ct.type_name FROM lab_safe_classtype ct WHERE ct.id = t.`type_id`) typeName,
|
|
|
t.mold_id,
|
|
t.mold_id,
|
|
|
- (select lm.mold_name from lab_mold lm where t.mold_id = lm.id) as moldName,
|
|
|
|
|
- t.check_out, t.check_in, t.safe_user_id, t.safe_signs, t.hazard_category, t.risk_measure,
|
|
|
|
|
- t.outfire, t.qr_code,
|
|
|
|
|
- su.nick_name as admin_name,
|
|
|
|
|
- su.phonenumber as adminPhone,
|
|
|
|
|
- sd.dept_name as dept_name,
|
|
|
|
|
|
|
+ (select lm.mold_name from lab_mold lm where t.mold_id = lm.id) as moldName,
|
|
|
|
|
+ t.check_out,
|
|
|
|
|
+ t.check_in,
|
|
|
|
|
+ t.safe_user_id,
|
|
|
|
|
+ t.safe_signs,
|
|
|
|
|
+ t.hazard_category,
|
|
|
|
|
+ t.risk_measure,
|
|
|
|
|
+ t.outfire,
|
|
|
|
|
+ t.qr_code,
|
|
|
|
|
+ su.nick_name as admin_name,
|
|
|
|
|
+ su.phonenumber as adminPhone,
|
|
|
|
|
+ sd.dept_name as dept_name,
|
|
|
t.skipped,
|
|
t.skipped,
|
|
|
t.check_count,
|
|
t.check_count,
|
|
|
t.sign_time,
|
|
t.sign_time,
|
|
|
- t.mold_id,
|
|
|
|
|
- CONCAT(su.nick_name,'@',su.phonenumber) AS adminNameAndPhone,
|
|
|
|
|
|
|
+ CONCAT(su.nick_name, '@', su.phonenumber) AS adminNameAndPhone,
|
|
|
|
|
|
|
|
- (select d.dept_name from sys_dept d where t.build_id = d.dept_id) buildName,
|
|
|
|
|
- (select b.name from lab_building b where b.id = t.floor_id) floorName,
|
|
|
|
|
- (SELECT l.room FROM lab_subject_layout l WHERE l.id = t.layout_id ) roomName
|
|
|
|
|
|
|
+ (select d.dept_name from sys_dept d where t.build_id = d.dept_id) buildName,
|
|
|
|
|
+ (select b.name from lab_building b where b.id = t.floor_id) floorName,
|
|
|
|
|
+ (SELECT l.room_num FROM lab_build_floor_layout l WHERE l.sub_id = t.id) roomName
|
|
|
|
|
|
|
|
from lab_subject t
|
|
from lab_subject t
|
|
|
- left join sys_user su on su.user_id = t.admin_id AND su.`del_flag`=0
|
|
|
|
|
- left join sys_dept sd on sd.dept_id = t.dept_id
|
|
|
|
|
- left join lab_subject_layout lb on lb.id = t.layout_id
|
|
|
|
|
- left join lab_safe_classified cf on cf.id = t.level
|
|
|
|
|
- LEFT JOIN lab_build_floor_layout bfl ON t.`id` = bfl.`sub_id`
|
|
|
|
|
|
|
+ left join sys_user su on su.user_id = t.admin_id AND su.`del_flag` = 0
|
|
|
|
|
+ left join sys_dept sd on sd.dept_id = t.dept_id
|
|
|
|
|
+ left join lab_subject_layout lb on lb.id = t.layout_id
|
|
|
|
|
+ left join lab_safe_classified cf on cf.id = t.level
|
|
|
|
|
+ LEFT JOIN lab_build_floor_layout bfl ON t.`id` = bfl.`sub_id`
|
|
|
</sql>
|
|
</sql>
|
|
|
<sql id="selectLabSubjectListVoIFPhone">
|
|
<sql id="selectLabSubjectListVoIFPhone">
|
|
|
select t.id,
|
|
select t.id,
|
|
@@ -192,28 +257,34 @@
|
|
|
t.update_time,
|
|
t.update_time,
|
|
|
t.update_by,
|
|
t.update_by,
|
|
|
t.sub_dept,
|
|
t.sub_dept,
|
|
|
- bfl.id layout_id,
|
|
|
|
|
|
|
+ bfl.id layout_id,
|
|
|
t.build_id,
|
|
t.build_id,
|
|
|
t.check_out,
|
|
t.check_out,
|
|
|
t.check_in,
|
|
t.check_in,
|
|
|
t.remark,
|
|
t.remark,
|
|
|
t.sub_dept,
|
|
t.sub_dept,
|
|
|
t.level,
|
|
t.level,
|
|
|
- t.skipped,
|
|
|
|
|
- t.check_count,
|
|
|
|
|
- (SELECT cf.classified_name FROM lab_safe_classified cf WHERE cf.id = t.`level`) levelName,
|
|
|
|
|
- (SELECT cf.classified_color FROM lab_safe_classified cf WHERE cf.id = t.`level`) fiedColor,
|
|
|
|
|
- t.type_id,
|
|
|
|
|
- (SELECT ct.type_name FROM lab_safe_classtype ct WHERE ct.id = t.`type_id`) typeName,
|
|
|
|
|
- t.check_out, t.check_in, t.safe_user_id, t.safe_signs, t.hazard_category, t.risk_measure,
|
|
|
|
|
- t.outfire, t.qr_code,
|
|
|
|
|
- su.nick_name as admin_name,
|
|
|
|
|
- su.phonenumber as adminPhone,
|
|
|
|
|
- sd.dept_name as dept_name
|
|
|
|
|
|
|
+ t.skipped,
|
|
|
|
|
+ t.check_count,
|
|
|
|
|
+ (SELECT cf.classified_name FROM lab_safe_classified cf WHERE cf.id = t.`level`) levelName,
|
|
|
|
|
+ (SELECT cf.classified_color FROM lab_safe_classified cf WHERE cf.id = t.`level`) fiedColor,
|
|
|
|
|
+ t.type_id,
|
|
|
|
|
+ (SELECT ct.type_name FROM lab_safe_classtype ct WHERE ct.id = t.`type_id`) typeName,
|
|
|
|
|
+ t.check_out,
|
|
|
|
|
+ t.check_in,
|
|
|
|
|
+ t.safe_user_id,
|
|
|
|
|
+ t.safe_signs,
|
|
|
|
|
+ t.hazard_category,
|
|
|
|
|
+ t.risk_measure,
|
|
|
|
|
+ t.outfire,
|
|
|
|
|
+ t.qr_code,
|
|
|
|
|
+ su.nick_name as admin_name,
|
|
|
|
|
+ su.phonenumber as adminPhone,
|
|
|
|
|
+ sd.dept_name as dept_name
|
|
|
from lab_subject t
|
|
from lab_subject t
|
|
|
- left join sys_user su on su.user_id = t.admin_id
|
|
|
|
|
- left join sys_dept sd on sd.dept_id = t.dept_id
|
|
|
|
|
- left join lab_subject_layout lb on lb.id = t.layout_id
|
|
|
|
|
|
|
+ left join sys_user su on su.user_id = t.admin_id
|
|
|
|
|
+ left join sys_dept sd on sd.dept_id = t.dept_id
|
|
|
|
|
+ left join lab_subject_layout lb on lb.id = t.layout_id
|
|
|
LEFT JOIN lab_build_floor_layout bfl ON t.`id` = bfl.`sub_id`
|
|
LEFT JOIN lab_build_floor_layout bfl ON t.`id` = bfl.`sub_id`
|
|
|
</sql>
|
|
</sql>
|
|
|
<select id="selectLabSubjectList" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
|
|
<select id="selectLabSubjectList" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
|
|
@@ -233,77 +304,91 @@
|
|
|
</where>
|
|
</where>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- <select id="selectLabSubjectListSecurity" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
|
|
|
|
|
|
|
+ <select id="selectLabSubjectListSecurity" parameterType="com.zd.laboratory.domain.LabSubject"
|
|
|
|
|
+ resultMap="LabSubjectResult">
|
|
|
<include refid="selectLabSubjectVo"/>
|
|
<include refid="selectLabSubjectVo"/>
|
|
|
<where>
|
|
<where>
|
|
|
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
|
|
|
- <if test="floorId != null "> and floor_id = #{floorId}</if>
|
|
|
|
|
- <if test="room != null and room != ''"> and room = #{room}</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="adminId != null "> and admin_id = #{adminId}</if>
|
|
|
|
|
- <if test="isDel != null "> and is_del = #{isDel}</if>
|
|
|
|
|
- <if test="userId != null "> and user_id = #{userId}</if>
|
|
|
|
|
|
|
+ <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
|
|
|
|
+ <if test="floorId != null ">and floor_id = #{floorId}</if>
|
|
|
|
|
+ <if test="room != null and room != ''">and room = #{room}</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="adminId != null ">and admin_id = #{adminId}</if>
|
|
|
|
|
+ <if test="isDel != null ">and is_del = #{isDel}</if>
|
|
|
|
|
+ <if test="userId != null ">and user_id = #{userId}</if>
|
|
|
</where>
|
|
</where>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="queryUserNameBySafeUserByOnepc" parameterType="string" resultType="string">
|
|
<select id="queryUserNameBySafeUserByOnepc" parameterType="string" resultType="string">
|
|
|
- SELECT GROUP_CONCAT(CONCAT(nick_name,' ',phonenumber) SEPARATOR '、') safeUserName FROM sys_user WHERE FIND_IN_SET(user_id, #{safeUserId})
|
|
|
|
|
|
|
+ SELECT GROUP_CONCAT(CONCAT(nick_name, ' ', phonenumber) SEPARATOR '、') safeUserName
|
|
|
|
|
+ FROM sys_user
|
|
|
|
|
+ WHERE FIND_IN_SET(user_id, #{safeUserId})
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="queryUserNameBySafeUserInfo" parameterType="string" resultType="string">
|
|
<select id="queryUserNameBySafeUserInfo" parameterType="string" resultType="string">
|
|
|
- SELECT GROUP_CONCAT(CONCAT(nick_name,'@',phonenumber)) safeUserName FROM sys_user WHERE FIND_IN_SET(user_id, #{safeUserId})
|
|
|
|
|
|
|
+ SELECT GROUP_CONCAT(CONCAT(nick_name, '@', phonenumber)) safeUserName
|
|
|
|
|
+ FROM sys_user
|
|
|
|
|
+ WHERE FIND_IN_SET(user_id, #{safeUserId})
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="queryUserNameBySafeUserId" parameterType="string" resultType="string">
|
|
<select id="queryUserNameBySafeUserId" parameterType="string" resultType="string">
|
|
|
- SELECT GROUP_CONCAT(nick_name) safeUserName FROM sys_user WHERE FIND_IN_SET(user_id, #{safeUserId})
|
|
|
|
|
|
|
+ SELECT GROUP_CONCAT(nick_name) safeUserName
|
|
|
|
|
+ FROM sys_user
|
|
|
|
|
+ WHERE FIND_IN_SET(user_id, #{safeUserId})
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="queryUserPhoneBySafeUserId" parameterType="string" resultType="string">
|
|
<select id="queryUserPhoneBySafeUserId" parameterType="string" resultType="string">
|
|
|
- SELECT GROUP_CONCAT(phonenumber) safeUserPhone FROM sys_user WHERE FIND_IN_SET(user_id, #{safeUserId})
|
|
|
|
|
|
|
+ SELECT GROUP_CONCAT(phonenumber) safeUserPhone
|
|
|
|
|
+ FROM sys_user
|
|
|
|
|
+ WHERE FIND_IN_SET(user_id, #{safeUserId})
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- <select id="selectLabSubjectListByadminidNotnull" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
|
|
|
|
|
|
|
+ <select id="selectLabSubjectListByadminidNotnull" parameterType="com.zd.laboratory.domain.LabSubject"
|
|
|
|
|
+ resultMap="LabSubjectResult">
|
|
|
<include refid="selectLabSubjectVo"/>
|
|
<include refid="selectLabSubjectVo"/>
|
|
|
- where admin_id != -1
|
|
|
|
|
|
|
+ where admin_id != -1
|
|
|
<if test="deptIds != null and deptIds.size()>0"> <!-- 部门集合id-->
|
|
<if test="deptIds != null and deptIds.size()>0"> <!-- 部门集合id-->
|
|
|
and s.dept_id in
|
|
and s.dept_id in
|
|
|
<foreach item="item" collection="deptIds" separator="," open="(" close=")" index="">'${item}'</foreach>
|
|
<foreach item="item" collection="deptIds" separator="," open="(" close=")" index="">'${item}'</foreach>
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
|
|
|
- <if test="floorId != null "> and floor_id = #{floorId}</if>
|
|
|
|
|
- <if test="room != null and room != ''"> and room = #{room}</if>
|
|
|
|
|
- <if test="deptId != null "> and ( dept_id in (SELECT dt.dept_id FROM sys_dept dt WHERE find_in_set(#{deptId} ,ancestors )) or dept_id = #{deptId} )</if>
|
|
|
|
|
- <if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
|
|
|
|
|
- <if test="adminId != null "> and admin_id = #{adminId}</if>
|
|
|
|
|
- <if test="isDel != null "> and is_del = #{isDel}</if>
|
|
|
|
|
- <if test="userId != null "> and user_id = #{userId}</if>
|
|
|
|
|
|
|
+ <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
|
|
|
|
+ <if test="floorId != null ">and floor_id = #{floorId}</if>
|
|
|
|
|
+ <if test="room != null and room != ''">and room = #{room}</if>
|
|
|
|
|
+ <if test="deptId != null ">and ( dept_id in (SELECT dt.dept_id FROM sys_dept dt WHERE find_in_set(#{deptId}
|
|
|
|
|
+ ,ancestors )) or dept_id = #{deptId} )
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="deptName != null and deptName != ''">and dept_name like concat('%', #{deptName}, '%')</if>
|
|
|
|
|
+ <if test="adminId != null ">and admin_id = #{adminId}</if>
|
|
|
|
|
+ <if test="isDel != null ">and is_del = #{isDel}</if>
|
|
|
|
|
+ <if test="userId != null ">and user_id = #{userId}</if>
|
|
|
|
|
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- <select id="selectLabSubjectVOList" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResultVO">
|
|
|
|
|
|
|
+ <select id="selectLabSubjectVOList" parameterType="com.zd.laboratory.domain.LabSubject"
|
|
|
|
|
+ resultMap="LabSubjectResultVO">
|
|
|
<include refid="selectLabSubjectListVo"/>
|
|
<include refid="selectLabSubjectListVo"/>
|
|
|
<where>
|
|
<where>
|
|
|
- <if test="name != null and name != ''"> and t.name like concat('%', #{name}, '%')</if>
|
|
|
|
|
- <if test="adminName != null and adminName != ''"> and su.nick_name like concat('%', #{adminName}, '%')</if>
|
|
|
|
|
-
|
|
|
|
|
- <if test="buildId != null "> and t.build_id = #{buildId}</if>
|
|
|
|
|
- <if test="deptId != null "> and t.dept_id = #{deptId}</if>
|
|
|
|
|
- <if test="id != null "> and t.id = #{id}</if>
|
|
|
|
|
- <if test="subIds != null and subIds != ''"> and find_in_set(t.id, #{subIds})</if>
|
|
|
|
|
-
|
|
|
|
|
- <if test="adminId != null "> and t.admin_id = #{adminId}</if>
|
|
|
|
|
- <if test="level != null "> and t.level = #{level}</if>
|
|
|
|
|
- <if test="typeId != null "> and t.type_id = #{typeId}</if>
|
|
|
|
|
- <if test="subDept != null and subDept != ''"> and t.sub_dept = #{subDept}</if>
|
|
|
|
|
|
|
+ <if test="name != null and name != ''">and t.name like concat('%', #{name}, '%')</if>
|
|
|
|
|
+ <if test="adminName != null and adminName != ''">and su.nick_name like concat('%', #{adminName}, '%')</if>
|
|
|
|
|
+
|
|
|
|
|
+ <if test="buildId != null ">and t.build_id = #{buildId}</if>
|
|
|
|
|
+ <if test="deptId != null ">and t.dept_id = #{deptId}</if>
|
|
|
|
|
+ <if test="id != null ">and t.id = #{id}</if>
|
|
|
|
|
+ <if test="subIds != null and subIds != ''">and find_in_set(t.id, #{subIds})</if>
|
|
|
|
|
+
|
|
|
|
|
+ <if test="adminId != null ">and t.admin_id = #{adminId}</if>
|
|
|
|
|
+ <if test="level != null ">and t.level = #{level}</if>
|
|
|
|
|
+ <if test="typeId != null ">and t.type_id = #{typeId}</if>
|
|
|
|
|
+ <if test="subDept != null and subDept != ''">and t.sub_dept = #{subDept}</if>
|
|
|
<!-- 数据范围过滤 -->
|
|
<!-- 数据范围过滤 -->
|
|
|
${params.dataScope}
|
|
${params.dataScope}
|
|
|
</where>
|
|
</where>
|
|
|
order by t.diy_order desc , t.create_time desc
|
|
order by t.diy_order desc , t.create_time desc
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- <select id="selectLabSubjectVOListByPc" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResultVO">
|
|
|
|
|
|
|
+ <select id="selectLabSubjectVOListByPc" parameterType="com.zd.laboratory.domain.LabSubject"
|
|
|
|
|
+ resultMap="LabSubjectResultVO">
|
|
|
select t.id,
|
|
select t.id,
|
|
|
t.name,
|
|
t.name,
|
|
|
t.floor_id,
|
|
t.floor_id,
|
|
@@ -336,7 +421,6 @@
|
|
|
t.skipped,
|
|
t.skipped,
|
|
|
t.check_count,
|
|
t.check_count,
|
|
|
t.sign_time,
|
|
t.sign_time,
|
|
|
- t.mold_id,
|
|
|
|
|
CONCAT(su.nick_name,'@',su.phonenumber) AS adminNameAndPhone,
|
|
CONCAT(su.nick_name,'@',su.phonenumber) AS adminNameAndPhone,
|
|
|
|
|
|
|
|
(select d.dept_name from sys_dept d where t.build_id = d.dept_id) buildName,
|
|
(select d.dept_name from sys_dept d where t.build_id = d.dept_id) buildName,
|
|
@@ -344,31 +428,31 @@
|
|
|
(SELECT l.room FROM lab_subject_layout l WHERE l.id = t.layout_id ) roomName
|
|
(SELECT l.room FROM lab_subject_layout l WHERE l.id = t.layout_id ) roomName
|
|
|
|
|
|
|
|
from lab_subject t
|
|
from lab_subject t
|
|
|
- left join sys_user su on su.user_id = t.admin_id AND su.`del_flag`=0
|
|
|
|
|
- left join sys_dept sd on sd.dept_id = t.dept_id
|
|
|
|
|
- left join lab_subject_layout lb on lb.id = t.layout_id
|
|
|
|
|
|
|
+ left join sys_user su on su.user_id = t.admin_id AND su.`del_flag`=0
|
|
|
|
|
+ left join sys_dept sd on sd.dept_id = t.dept_id
|
|
|
|
|
+ left join lab_subject_layout lb on lb.id = t.layout_id
|
|
|
left join lab_safe_classified cf on cf.id = t.level
|
|
left join lab_safe_classified cf on cf.id = t.level
|
|
|
<where>
|
|
<where>
|
|
|
- <if test="name != null and name != ''"> and t.name like concat('%', #{name}, '%')</if>
|
|
|
|
|
- <if test="adminName != null and adminName != ''"> and su.nick_name like concat('%', #{adminName}, '%')</if>
|
|
|
|
|
-
|
|
|
|
|
- <if test="buildId != null "> and t.build_id = #{buildId}</if>
|
|
|
|
|
- <if test="deptId != null "> and t.dept_id = #{deptId}</if>
|
|
|
|
|
- <if test="id != null "> and t.id = #{id}</if>
|
|
|
|
|
- <if test="subIds != null and subIds != ''"> and find_in_set(t.id, #{subIds})</if>
|
|
|
|
|
-
|
|
|
|
|
- <if test="adminId != null "> and t.admin_id = #{adminId}</if>
|
|
|
|
|
- <if test="level != null "> and t.level = #{level}</if>
|
|
|
|
|
- <if test="typeId != null "> and t.type_id = #{typeId}</if>
|
|
|
|
|
- <if test="subDept != null and subDept != ''"> and t.sub_dept = #{subDept}</if>
|
|
|
|
|
|
|
+ <if test="name != null and name != ''">and t.name like concat('%', #{name}, '%')</if>
|
|
|
|
|
+ <if test="adminName != null and adminName != ''">and su.nick_name like concat('%', #{adminName}, '%')</if>
|
|
|
|
|
+
|
|
|
|
|
+ <if test="buildId != null ">and t.build_id = #{buildId}</if>
|
|
|
|
|
+ <if test="deptId != null ">and t.dept_id = #{deptId}</if>
|
|
|
|
|
+ <if test="id != null ">and t.id = #{id}</if>
|
|
|
|
|
+ <if test="subIds != null and subIds != ''">and find_in_set(t.id, #{subIds})</if>
|
|
|
|
|
+
|
|
|
|
|
+ <if test="adminId != null ">and t.admin_id = #{adminId}</if>
|
|
|
|
|
+ <if test="level != null ">and t.level = #{level}</if>
|
|
|
|
|
+ <if test="typeId != null ">and t.type_id = #{typeId}</if>
|
|
|
|
|
+ <if test="subDept != null and subDept != ''">and t.sub_dept = #{subDept}</if>
|
|
|
<!-- 数据范围过滤 -->
|
|
<!-- 数据范围过滤 -->
|
|
|
${params.dataScope}
|
|
${params.dataScope}
|
|
|
</where>
|
|
</where>
|
|
|
order by t.diy_order desc , t.create_time desc
|
|
order by t.diy_order desc , t.create_time desc
|
|
|
</select>
|
|
</select>
|
|
|
-<!-- 我管理的实验室数量 管理的意思是数据权限加业务权限 -->
|
|
|
|
|
|
|
+ <!-- 我管理的实验室数量 管理的意思是数据权限加业务权限 -->
|
|
|
<select id="myAdminSubCount" parameterType="com.zd.laboratory.domain.LabSubject" resultType="int">
|
|
<select id="myAdminSubCount" parameterType="com.zd.laboratory.domain.LabSubject" resultType="int">
|
|
|
- select count(id) from lab_subject t
|
|
|
|
|
|
|
+ select count(id) from lab_subject t
|
|
|
<where>
|
|
<where>
|
|
|
<if test="deptId != null">
|
|
<if test="deptId != null">
|
|
|
and dept_id = #{deptId}
|
|
and dept_id = #{deptId}
|
|
@@ -379,8 +463,8 @@
|
|
|
|
|
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
-<!-- 通过实验室IDS 查询 不需要数据权限 -->
|
|
|
|
|
- <select id="selectLabSubjectVOListByIds" resultMap="LabSubjectResultVO">
|
|
|
|
|
|
|
+ <!-- 通过实验室IDS 查询 不需要数据权限 -->
|
|
|
|
|
+ <select id="selectLabSubjectVOListByIds" resultMap="LabSubjectResultVO">
|
|
|
<include refid="selectLabSubjectListVoIFPhone"/>
|
|
<include refid="selectLabSubjectListVoIFPhone"/>
|
|
|
where t.id in
|
|
where t.id in
|
|
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
@@ -390,9 +474,9 @@
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 通过实验室IDS 查询 安全信息 不需要数据权限 -->
|
|
<!-- 通过实验室IDS 查询 安全信息 不需要数据权限 -->
|
|
|
- <select id="selectLabSubSafeInfoByIds" resultMap="LabSubjectResultVO">
|
|
|
|
|
|
|
+ <select id="selectLabSubSafeInfoByIds" resultMap="LabSubjectResultVO">
|
|
|
select t.id,
|
|
select t.id,
|
|
|
- t.level,
|
|
|
|
|
|
|
+ t.level,
|
|
|
t.safe_signs, t.hazard_category, t.risk_measure,
|
|
t.safe_signs, t.hazard_category, t.risk_measure,
|
|
|
t.outfire, t.qr_code,
|
|
t.outfire, t.qr_code,
|
|
|
su.nick_name as admin_name,
|
|
su.nick_name as admin_name,
|
|
@@ -401,11 +485,12 @@
|
|
|
,(select GROUP_CONCAT(nick_name) from sys_user where find_in_set(user_id, t.safe_user_id)) safeUserName
|
|
,(select GROUP_CONCAT(nick_name) from sys_user where find_in_set(user_id, t.safe_user_id)) safeUserName
|
|
|
,(select GROUP_CONCAT(phonenumber) from sys_user where find_in_set(user_id, t.safe_user_id)) safeUserPhone,
|
|
,(select GROUP_CONCAT(phonenumber) from sys_user where find_in_set(user_id, t.safe_user_id)) safeUserPhone,
|
|
|
concat(su.nick_name,'@',su.phonenumber) adminNameAndPhone,
|
|
concat(su.nick_name,'@',su.phonenumber) adminNameAndPhone,
|
|
|
- (select GROUP_CONCAT(concat(nick_name,'@',phonenumber)) from sys_user where find_in_set(user_id, t.safe_user_id)) safeUserNameAdminPhone
|
|
|
|
|
|
|
+ (select GROUP_CONCAT(concat(nick_name,'@',phonenumber)) from sys_user where find_in_set(user_id,
|
|
|
|
|
+ t.safe_user_id)) safeUserNameAdminPhone
|
|
|
from lab_subject t
|
|
from lab_subject t
|
|
|
- left join sys_user su on su.user_id = t.admin_id
|
|
|
|
|
- left join sys_dept sd on sd.dept_id = t.dept_id
|
|
|
|
|
- left join lab_subject_layout lb on lb.id = t.layout_id
|
|
|
|
|
|
|
+ left join sys_user su on su.user_id = t.admin_id
|
|
|
|
|
+ left join sys_dept sd on sd.dept_id = t.dept_id
|
|
|
|
|
+ left join lab_subject_layout lb on lb.id = t.layout_id
|
|
|
where t.id in
|
|
where t.id in
|
|
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
|
#{id}
|
|
#{id}
|
|
@@ -543,27 +628,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
<delete id="deleteLabSubjectById" parameterType="Long">
|
|
<delete id="deleteLabSubjectById" parameterType="Long">
|
|
|
- delete from lab_subject where id = #{id}
|
|
|
|
|
|
|
+ delete
|
|
|
|
|
+ from lab_subject
|
|
|
|
|
+ where id = #{id}
|
|
|
</delete>
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteLabSubjectByIds" parameterType="String">
|
|
<delete id="deleteLabSubjectByIds" parameterType="String">
|
|
|
- update lab_subject set is_del = 1 where id in
|
|
|
|
|
|
|
+ update lab_subject set is_del = 1 where id in
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
#{id}
|
|
#{id}
|
|
|
</foreach>
|
|
</foreach>
|
|
|
</delete>
|
|
</delete>
|
|
|
<!-- 根据多层ID个 -->
|
|
<!-- 根据多层ID个 -->
|
|
|
- <select id="selectLabSubjectListByIds" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResultVO">
|
|
|
|
|
- select id, name, floor_id, room, dept_id, dept_name, admin_id, is_del, create_time, user_id, create_by, update_time, update_by, remark
|
|
|
|
|
- from lab_subject
|
|
|
|
|
|
|
+ <select id="selectLabSubjectListByIds" parameterType="com.zd.laboratory.domain.LabSubject"
|
|
|
|
|
+ resultMap="LabSubjectResultVO">
|
|
|
|
|
+ select id, name, floor_id, room, dept_id, dept_name, admin_id, is_del, create_time, user_id, create_by,
|
|
|
|
|
+ update_time, update_by, remark
|
|
|
|
|
+ from lab_subject
|
|
|
where floor_id in
|
|
where floor_id in
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
#{id}
|
|
#{id}
|
|
|
</foreach>
|
|
</foreach>
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 根据负责人查询 -->
|
|
<!-- 根据负责人查询 -->
|
|
|
- <select id="selectLabSubjectListByAdminIds" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResultVO">
|
|
|
|
|
- select id, name, floor_id, room, dept_id, dept_name, admin_id, is_del, create_time, user_id, create_by, update_time, update_by, remark from lab_subject
|
|
|
|
|
|
|
+ <select id="selectLabSubjectListByAdminIds" parameterType="com.zd.laboratory.domain.LabSubject"
|
|
|
|
|
+ resultMap="LabSubjectResultVO">
|
|
|
|
|
+ select id, name, floor_id, room, dept_id, dept_name, admin_id, is_del, create_time, user_id, create_by,
|
|
|
|
|
+ update_time, update_by, remark from lab_subject
|
|
|
where admin_id in
|
|
where admin_id in
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
#{id}
|
|
#{id}
|
|
@@ -573,10 +664,11 @@
|
|
|
<select id="getSubjectDict" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
|
|
<select id="getSubjectDict" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
|
|
|
select s.id, s.name `name`
|
|
select s.id, s.name `name`
|
|
|
from
|
|
from
|
|
|
- lab_subject s inner join lab_building b on s.`floor_id` = b.`id`
|
|
|
|
|
|
|
+ lab_subject s inner join lab_building b on s.`floor_id` = b.`id`
|
|
|
<where>
|
|
<where>
|
|
|
<if test="deptId != null ">
|
|
<if test="deptId != null ">
|
|
|
- and (b.dept_id =#{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET(#{deptId},
|
|
|
|
|
|
|
+ and (b.dept_id =#{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
|
|
|
|
|
+ FIND_IN_SET(#{deptId},
|
|
|
ancestors) ))
|
|
ancestors) ))
|
|
|
</if>
|
|
</if>
|
|
|
<if test="buildId != null">
|
|
<if test="buildId != null">
|
|
@@ -587,13 +679,15 @@
|
|
|
</where>
|
|
</where>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- <select id="getSubjectDictByViolation" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
|
|
|
|
|
|
|
+ <select id="getSubjectDictByViolation" parameterType="com.zd.laboratory.domain.LabSubject"
|
|
|
|
|
+ resultMap="LabSubjectResult">
|
|
|
select s.id, s.name `name`
|
|
select s.id, s.name `name`
|
|
|
from
|
|
from
|
|
|
lab_subject s inner join lab_building b on s.`floor_id` = b.`id`
|
|
lab_subject s inner join lab_building b on s.`floor_id` = b.`id`
|
|
|
<where>
|
|
<where>
|
|
|
<if test="deptId != null ">
|
|
<if test="deptId != null ">
|
|
|
- and (b.dept_id =#{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET(#{deptId},
|
|
|
|
|
|
|
+ and (b.dept_id =#{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
|
|
|
|
|
+ FIND_IN_SET(#{deptId},
|
|
|
ancestors) ))
|
|
ancestors) ))
|
|
|
</if>
|
|
</if>
|
|
|
<if test="buildId != null">
|
|
<if test="buildId != null">
|
|
@@ -602,21 +696,23 @@
|
|
|
</where>
|
|
</where>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- <select id="getFilterSubjectDict" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO" resultMap="LabSubjectResult">
|
|
|
|
|
|
|
+ <select id="getFilterSubjectDict" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO"
|
|
|
|
|
+ resultMap="LabSubjectResult">
|
|
|
select s.id, s.name `name`
|
|
select s.id, s.name `name`
|
|
|
from
|
|
from
|
|
|
lab_subject s inner join lab_building b on s.`floor_id` = b.`id`
|
|
lab_subject s inner join lab_building b on s.`floor_id` = b.`id`
|
|
|
<where>
|
|
<where>
|
|
|
(NOT EXISTS(SELECT fg.`subject_id` FROM lab_subject_securityconfigure fg WHERE fg.`subject_id` = s.`id`)
|
|
(NOT EXISTS(SELECT fg.`subject_id` FROM lab_subject_securityconfigure fg WHERE fg.`subject_id` = s.`id`)
|
|
|
<if test="subjectIds != null ">
|
|
<if test="subjectIds != null ">
|
|
|
- OR s.`id` IN
|
|
|
|
|
- <foreach item="subId" collection="subjectIds" open="(" separator="," close=")">
|
|
|
|
|
- #{subId}
|
|
|
|
|
- </foreach>
|
|
|
|
|
|
|
+ OR s.`id` IN
|
|
|
|
|
+ <foreach item="subId" collection="subjectIds" open="(" separator="," close=")">
|
|
|
|
|
+ #{subId}
|
|
|
|
|
+ </foreach>
|
|
|
</if>
|
|
</if>
|
|
|
)
|
|
)
|
|
|
<if test="deptId != null ">
|
|
<if test="deptId != null ">
|
|
|
- and (b.dept_id =#{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET(#{deptId},
|
|
|
|
|
|
|
+ and (b.dept_id =#{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
|
|
|
|
|
+ FIND_IN_SET(#{deptId},
|
|
|
ancestors) ))
|
|
ancestors) ))
|
|
|
</if>
|
|
</if>
|
|
|
<if test="buildId != null">
|
|
<if test="buildId != null">
|
|
@@ -625,7 +721,8 @@
|
|
|
</where>
|
|
</where>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- <select id="getUserRoleBySub" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
|
|
|
|
|
|
|
+ <select id="getUserRoleBySub" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO"
|
|
|
|
|
+ resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
|
|
|
SELECT s.id, s.name `name`,d.`dept_name` deptName,
|
|
SELECT s.id, s.name `name`,d.`dept_name` deptName,
|
|
|
sc.classified_name AS levelName,
|
|
sc.classified_name AS levelName,
|
|
|
st.type_name AS typeName,
|
|
st.type_name AS typeName,
|
|
@@ -643,10 +740,10 @@
|
|
|
<if test="floorId != null ">
|
|
<if test="floorId != null ">
|
|
|
and s.floor_id = #{floorId}
|
|
and s.floor_id = #{floorId}
|
|
|
</if>
|
|
</if>
|
|
|
-<!-- <if test="searchValue != null ">-->
|
|
|
|
|
-<!-- and (s.name like concat('%', #{searchValue}, '%')-->
|
|
|
|
|
-<!-- or u.nick_name like concat('%', #{adminName}, '%'))-->
|
|
|
|
|
-<!-- </if>-->
|
|
|
|
|
|
|
+ <!-- <if test="searchValue != null ">-->
|
|
|
|
|
+ <!-- and (s.name like concat('%', #{searchValue}, '%')-->
|
|
|
|
|
+ <!-- or u.nick_name like concat('%', #{adminName}, '%'))-->
|
|
|
|
|
+ <!-- </if>-->
|
|
|
<if test="buildId != null ">
|
|
<if test="buildId != null ">
|
|
|
and s.build_id = #{buildId}
|
|
and s.build_id = #{buildId}
|
|
|
</if>
|
|
</if>
|
|
@@ -672,7 +769,8 @@
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
- <select id="getUserRoleBySubBindRisk" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
|
|
|
|
|
|
|
+ <select id="getUserRoleBySubBindRisk" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO"
|
|
|
|
|
+ resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
|
|
|
SELECT s.id, s.name `name`,d.`dept_name` deptName,
|
|
SELECT s.id, s.name `name`,d.`dept_name` deptName,
|
|
|
sc.classified_name AS levelName,
|
|
sc.classified_name AS levelName,
|
|
|
st.type_name AS typeName,
|
|
st.type_name AS typeName,
|
|
@@ -721,7 +819,8 @@
|
|
|
</where>
|
|
</where>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- <select id="getAllSubjectByParame" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
|
|
|
|
|
|
|
+ <select id="getAllSubjectByParame" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO"
|
|
|
|
|
+ resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
|
|
|
SELECT s.id subjectId, s.name `name`,d.`dept_name` deptName,
|
|
SELECT s.id subjectId, s.name `name`,d.`dept_name` deptName,
|
|
|
sc.classified_name AS levelName,
|
|
sc.classified_name AS levelName,
|
|
|
st.type_name AS typeName,
|
|
st.type_name AS typeName,
|
|
@@ -755,7 +854,8 @@
|
|
|
and s.name like concat('%', #{name}, '%')
|
|
and s.name like concat('%', #{name}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="deptId != null">
|
|
<if test="deptId != null">
|
|
|
- and ( s.dept_id in (SELECT dt.dept_id FROM sys_dept dt WHERE find_in_set(#{deptId} ,ancestors )) or s.dept_id = #{deptId} )
|
|
|
|
|
|
|
+ and ( s.dept_id in (SELECT dt.dept_id FROM sys_dept dt WHERE find_in_set(#{deptId} ,ancestors )) or
|
|
|
|
|
+ s.dept_id = #{deptId} )
|
|
|
</if>
|
|
</if>
|
|
|
<if test="level != null">
|
|
<if test="level != null">
|
|
|
and s.level = #{level}
|
|
and s.level = #{level}
|
|
@@ -773,27 +873,41 @@
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="mySubjectList" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResultVO">
|
|
<select id="mySubjectList" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResultVO">
|
|
|
- select s.`id`,s.name,s.`room`, b.`name` build_name,d.`dept_name`,s.`sub_dept`,u.nick_name as admin_name,
|
|
|
|
|
|
|
+ select s.`id`,s.name,s.`room`,
|
|
|
|
|
+ (select f.`name`
|
|
|
|
|
+ from lab_build_floor f
|
|
|
|
|
+ where f.type = 3
|
|
|
|
|
+ and f.id =bfl.floor_id) build_name,
|
|
|
|
|
+ (select f.`name`
|
|
|
|
|
+ from lab_build_floor f
|
|
|
|
|
+ where f.type = 2
|
|
|
|
|
+ and f.id =bfl.build_id) dept_name,
|
|
|
|
|
+ s.`sub_dept`,u.nick_name as admin_name,
|
|
|
(SELECT ct.type_name FROM lab_safe_classtype ct WHERE ct.id=s.`type_id`) danger_name,
|
|
(SELECT ct.type_name FROM lab_safe_classtype ct WHERE ct.id=s.`type_id`) danger_name,
|
|
|
- IFNULL((SELECT CASE a.record_content WHEN 0 THEN 0 WHEN 4 THEN 0 ELSE 1 END FROM lab_approval a
|
|
|
|
|
|
|
+ IFNULL((SELECT CASE a.record_content WHEN 0 THEN 0 WHEN 4 THEN 0 ELSE 1 END FROM lab_approval a
|
|
|
WHERE a.join_user_id = #{userId} AND a.subject_id = s.`id` limit 1),0) is_apply,
|
|
WHERE a.join_user_id = #{userId} AND a.subject_id = s.`id` limit 1),0) is_apply,
|
|
|
(SELECT a.record_content FROM lab_approval a
|
|
(SELECT a.record_content FROM lab_approval a
|
|
|
WHERE a.join_user_id = 2 AND a.subject_id = s.`id` LIMIT 1) record_content,
|
|
WHERE a.join_user_id = 2 AND a.subject_id = s.`id` LIMIT 1) record_content,
|
|
|
(SELECT a.id FROM lab_approval a
|
|
(SELECT a.id FROM lab_approval a
|
|
|
WHERE a.join_user_id = 2 AND a.subject_id = s.`id` LIMIT 1) app_id
|
|
WHERE a.join_user_id = 2 AND a.subject_id = s.`id` LIMIT 1) app_id
|
|
|
- from lab_subject s inner join lab_building b on s.`floor_id` = b.`id` inner join sys_dept d on b.`dept_id` = d.`dept_id`
|
|
|
|
|
|
|
+ from lab_subject s inner join lab_building b on s.`floor_id` = b.`id` inner join sys_dept d on b.`dept_id` =
|
|
|
|
|
+ d.`dept_id`
|
|
|
LEFT JOIN sys_user u ON u.user_id = s.admin_id
|
|
LEFT JOIN sys_user u ON u.user_id = s.admin_id
|
|
|
|
|
+ LEFT JOIN lab_build_floor_layout bfl ON bfl.sub_id=s.id
|
|
|
<where>
|
|
<where>
|
|
|
<if test="deptId != null ">
|
|
<if test="deptId != null ">
|
|
|
- AND (b.dept_id = #{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
|
|
|
|
|
|
|
+ AND (b.dept_id = #{deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
|
|
|
|
|
+ find_in_set(#{deptId},
|
|
|
ancestors) ))
|
|
ancestors) ))
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
- <select id="getTypeCount" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO" resultType="com.zd.laboratory.domain.vo.LabClasstypeVo">
|
|
|
|
|
- SELECT sc.id,sc.type_name typeName,SUM(CASE WHEN st.id IS NULL THEN 0 ELSE 1 END) totalNum FROM lab_safe_classtype sc
|
|
|
|
|
|
|
+ <select id="getTypeCount" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO"
|
|
|
|
|
+ resultType="com.zd.laboratory.domain.vo.LabClasstypeVo">
|
|
|
|
|
+ SELECT sc.id,sc.type_name typeName,SUM(CASE WHEN st.id IS NULL THEN 0 ELSE 1 END) totalNum FROM
|
|
|
|
|
+ lab_safe_classtype sc
|
|
|
LEFT JOIN lab_subject st ON sc.id = st.type_id
|
|
LEFT JOIN lab_subject st ON sc.id = st.type_id
|
|
|
<where>
|
|
<where>
|
|
|
1=1
|
|
1=1
|
|
@@ -803,8 +917,10 @@
|
|
|
GROUP BY sc.id,sc.type_name
|
|
GROUP BY sc.id,sc.type_name
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- <select id="getFiedCount" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO" resultType="com.zd.laboratory.domain.vo.LabClassifiedVo">
|
|
|
|
|
- SELECT sc.id,sc.classified_name classifiedName,SUM(CASE WHEN st.id IS NULL THEN 0 ELSE 1 END) totalNum FROM lab_safe_classified sc
|
|
|
|
|
|
|
+ <select id="getFiedCount" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO"
|
|
|
|
|
+ resultType="com.zd.laboratory.domain.vo.LabClassifiedVo">
|
|
|
|
|
+ SELECT sc.id,sc.classified_name classifiedName,SUM(CASE WHEN st.id IS NULL THEN 0 ELSE 1 END) totalNum FROM
|
|
|
|
|
+ lab_safe_classified sc
|
|
|
LEFT JOIN lab_subject st ON sc.id = st.level
|
|
LEFT JOIN lab_subject st ON sc.id = st.level
|
|
|
<where>
|
|
<where>
|
|
|
1=1
|
|
1=1
|
|
@@ -828,7 +944,7 @@
|
|
|
WHERE
|
|
WHERE
|
|
|
a.id IN
|
|
a.id IN
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
- #{id}
|
|
|
|
|
|
|
+ #{id}
|
|
|
</foreach>
|
|
</foreach>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
@@ -851,21 +967,25 @@
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectLabSubjectCheckById" resultType="com.zd.laboratory.domain.LabSubject">
|
|
<select id="selectLabSubjectCheckById" resultType="com.zd.laboratory.domain.LabSubject">
|
|
|
- select s.check_in,s.skipped,s.check_count,
|
|
|
|
|
- (SELECT sl.room FROM lab_subject_layout sl WHERE sl.id = s.`layout_id`) room,
|
|
|
|
|
- (SELECT dt.dept_name FROM sys_dept dt WHERE dt.dept_id = s.`dept_id`) dept_name
|
|
|
|
|
- from lab_subject s where s.id=#{id}
|
|
|
|
|
|
|
+ select s.check_in,
|
|
|
|
|
+ s.skipped,
|
|
|
|
|
+ s.check_count,
|
|
|
|
|
+ (SELECT sl.room FROM lab_subject_layout sl WHERE sl.id = s.`layout_id`) room,
|
|
|
|
|
+ (SELECT dt.dept_name FROM sys_dept dt WHERE dt.dept_id = s.`dept_id`) dept_name
|
|
|
|
|
+ from lab_subject s
|
|
|
|
|
+ where s.id = #{id}
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectSubInfoByMyGradeManageWork"
|
|
<select id="selectSubInfoByMyGradeManageWork"
|
|
|
resultType="com.zd.laboratory.api.vo.LabGradeManageWorkVO">
|
|
resultType="com.zd.laboratory.api.vo.LabGradeManageWorkVO">
|
|
|
|
|
|
|
|
- select s.id as subId, s.name as subName,
|
|
|
|
|
|
|
+ select s.id as subId,
|
|
|
|
|
+ s.name as subName,
|
|
|
s.level,
|
|
s.level,
|
|
|
ifnull(sc.classified_name, "") as levelName,
|
|
ifnull(sc.classified_name, "") as levelName,
|
|
|
- sc.classified_color as levelColor,
|
|
|
|
|
- s.type_id as typeId,
|
|
|
|
|
- ifnull(st.type_name, "") as typeName,
|
|
|
|
|
|
|
+ sc.classified_color as levelColor,
|
|
|
|
|
+ s.type_id as typeId,
|
|
|
|
|
+ ifnull(st.type_name, "") as typeName,
|
|
|
s.dept_id,
|
|
s.dept_id,
|
|
|
sd.dept_name
|
|
sd.dept_name
|
|
|
from lab_subject as s
|
|
from lab_subject as s
|
|
@@ -881,11 +1001,13 @@
|
|
|
</foreach>
|
|
</foreach>
|
|
|
</select>
|
|
</select>
|
|
|
<select id="selectSubIdByAdminId" resultType="java.lang.Long">
|
|
<select id="selectSubIdByAdminId" resultType="java.lang.Long">
|
|
|
- select id from lab_subject where admin_id = #{adminId}
|
|
|
|
|
|
|
+ select id
|
|
|
|
|
+ from lab_subject
|
|
|
|
|
+ where admin_id = #{adminId}
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectLabAdminByIds" resultType="java.util.Map">
|
|
<select id="selectLabAdminByIds" resultType="java.util.Map">
|
|
|
- select admin_id as adminId, id as subId from lab_subject where id in
|
|
|
|
|
|
|
+ select admin_id as adminId, id as subId from lab_subject where id in
|
|
|
<foreach item="id" collection="list" open="(" separator="," close=")">
|
|
<foreach item="id" collection="list" open="(" separator="," close=")">
|
|
|
#{id}
|
|
#{id}
|
|
|
</foreach>
|
|
</foreach>
|
|
@@ -919,10 +1041,12 @@
|
|
|
|
|
|
|
|
</select>
|
|
</select>
|
|
|
<select id="selectLabSubjectListPage" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
|
|
<select id="selectLabSubjectListPage" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
|
|
|
- select * from lab_subject
|
|
|
|
|
|
|
+ select *
|
|
|
|
|
+ from lab_subject
|
|
|
|
|
|
|
|
</select>
|
|
</select>
|
|
|
- <select id="selectLabSubjectListByLayout" parameterType="com.zd.laboratory.domain.LabSubject" resultMap="LabSubjectResult">
|
|
|
|
|
|
|
+ <select id="selectLabSubjectListByLayout" parameterType="com.zd.laboratory.domain.LabSubject"
|
|
|
|
|
+ resultMap="LabSubjectResult">
|
|
|
select
|
|
select
|
|
|
id, name, floor_id,layout_id,build_id,sub_dept,level, check_out,check_in,room,dept_id,
|
|
id, name, floor_id,layout_id,build_id,sub_dept,level, check_out,check_in,room,dept_id,
|
|
|
(SELECT d.dept_name FROM sys_dept d WHERE s.dept_id = d.dept_id) dept_name,
|
|
(SELECT d.dept_name FROM sys_dept d WHERE s.dept_id = d.dept_id) dept_name,
|
|
@@ -930,11 +1054,45 @@
|
|
|
create_by, update_time, update_by, remark, sub_dept,
|
|
create_by, update_time, update_by, remark, sub_dept,
|
|
|
check_out, check_in, safe_user_id, safe_signs, hazard_category, risk_measure,
|
|
check_out, check_in, safe_user_id, safe_signs, hazard_category, risk_measure,
|
|
|
outfire, qr_code,safe_user_id, skipped, check_count,sign_time,
|
|
outfire, qr_code,safe_user_id, skipped, check_count,sign_time,
|
|
|
- (SELECT GROUP_CONCAT(ur.nick_name) FROM sys_user ur WHERE FIND_IN_SET(ur.user_id, s.`safe_user_id`)) AS safeUserNames,
|
|
|
|
|
- (select d.dept_name from sys_dept d where s.build_id = d.dept_id) build_name,
|
|
|
|
|
- (select b.name from lab_building b where b.id = s.floor_id) floorName,
|
|
|
|
|
- (SELECT l.room FROM lab_subject_layout l WHERE l.id = s.layout_id ) roomName,
|
|
|
|
|
- (select GROUP_CONCAT(phonenumber) from sys_user where find_in_set(user_id, s.safe_user_id)) safeUserPhone
|
|
|
|
|
|
|
+ (SELECT GROUP_CONCAT(ur.nick_name) FROM sys_user ur
|
|
|
|
|
+ WHERE ur.`user_id`
|
|
|
|
|
+ IN (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ SUBSTRING_INDEX(SUBSTRING_INDEX(s.safe_user_id,',', b.help_topic_id + 1), ',', -1) result
|
|
|
|
|
+ FROM
|
|
|
|
|
+ mysql.help_topic b
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ b.help_topic_id < (LENGTH(s.safe_user_id) - LENGTH(REPLACE(s.safe_user_id, ',', '')) + 1)
|
|
|
|
|
+ )
|
|
|
|
|
+ ) AS safeUserNames,
|
|
|
|
|
+ (select f.`name`
|
|
|
|
|
+ from lab_build_floor f
|
|
|
|
|
+ where f.type = 2
|
|
|
|
|
+ and f.id =
|
|
|
|
|
+ (select bfl.build_id
|
|
|
|
|
+ from lab_build_floor_layout bfl
|
|
|
|
|
+ where bfl.sub_id = s.id)) build_name,
|
|
|
|
|
+ (select f.`name`
|
|
|
|
|
+ from lab_build_floor f
|
|
|
|
|
+ where f.type = 3
|
|
|
|
|
+ and f.id =
|
|
|
|
|
+ (select bfl.floor_id
|
|
|
|
|
+ from lab_build_floor_layout bfl
|
|
|
|
|
+ where bfl.sub_id = s.id)) floorName,
|
|
|
|
|
+ (select bfl.room_num
|
|
|
|
|
+ from lab_build_floor_layout bfl
|
|
|
|
|
+ where bfl.sub_id = s.id ) roomName,
|
|
|
|
|
+ (SELECT GROUP_CONCAT(phonenumber) FROM sys_user ur
|
|
|
|
|
+ WHERE ur.`user_id`
|
|
|
|
|
+ IN (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ SUBSTRING_INDEX(SUBSTRING_INDEX(s.safe_user_id,',', b.help_topic_id + 1), ',', -1) result
|
|
|
|
|
+ FROM
|
|
|
|
|
+ mysql.help_topic b
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ b.help_topic_id < (LENGTH(s.safe_user_id) - LENGTH(REPLACE(s.safe_user_id, ',', '')) + 1)
|
|
|
|
|
+ )
|
|
|
|
|
+ ) safeUserPhone
|
|
|
from lab_subject s
|
|
from lab_subject s
|
|
|
<where>
|
|
<where>
|
|
|
s.`id` NOT IN(SELECT bfl.`sub_id` FROM lab_build_floor_layout bfl)
|
|
s.`id` NOT IN(SELECT bfl.`sub_id` FROM lab_build_floor_layout bfl)
|
|
@@ -942,14 +1100,16 @@
|
|
|
and s.dept_id in
|
|
and s.dept_id in
|
|
|
<foreach item="item" collection="deptIds" separator="," open="(" close=")" index="">'${item}'</foreach>
|
|
<foreach item="item" collection="deptIds" separator="," open="(" close=")" index="">'${item}'</foreach>
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
|
|
|
- <if test="floorId != null "> and floor_id = #{floorId}</if>
|
|
|
|
|
- <if test="room != null and room != ''"> and room = #{room}</if>
|
|
|
|
|
- <if test="deptId != null "> and ( dept_id in (SELECT dt.dept_id FROM sys_dept dt WHERE find_in_set(#{deptId} ,ancestors )) or dept_id = #{deptId} )</if>
|
|
|
|
|
- <if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
|
|
|
|
|
- <if test="adminId != null "> and admin_id = #{adminId}</if>
|
|
|
|
|
- <if test="isDel != null "> and is_del = #{isDel}</if>
|
|
|
|
|
- <if test="userId != null "> and user_id = #{userId}</if>
|
|
|
|
|
|
|
+ <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
|
|
|
|
+ <if test="floorId != null ">and floor_id = #{floorId}</if>
|
|
|
|
|
+ <if test="room != null and room != ''">and room = #{room}</if>
|
|
|
|
|
+ <if test="deptId != null ">and ( dept_id in (SELECT dt.dept_id FROM sys_dept dt WHERE find_in_set(#{deptId}
|
|
|
|
|
+ ,ancestors )) or dept_id = #{deptId} )
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="deptName != null and deptName != ''">and dept_name like concat('%', #{deptName}, '%')</if>
|
|
|
|
|
+ <if test="adminId != null ">and admin_id = #{adminId}</if>
|
|
|
|
|
+ <if test="isDel != null ">and is_del = #{isDel}</if>
|
|
|
|
|
+ <if test="userId != null ">and user_id = #{userId}</if>
|
|
|
</where>
|
|
</where>
|
|
|
</select>
|
|
</select>
|
|
|
</mapper>
|
|
</mapper>
|