From 47a751cb301d05276ae5d75145d57b2d090fe4e1 Mon Sep 17 00:00:00 2001 From: kongzy <kongzy> Date: 星期一, 01 七月 2024 10:58:35 +0800 Subject: [PATCH] change --- src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml | 75 ++++++++++++++++++++++++++----------- 1 files changed, 53 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml b/src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml index 7b9520c..8878e15 100644 --- a/src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml +++ b/src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml @@ -24,12 +24,18 @@ <update id="updateInfo" parameterType="java.util.Map"> update sys_laboratory_container set temp=#{temp},humidity=#{humidity},voc1=#{voc1},flag=#{flag} where id=#{containerId} </update> - + <update id="delSlcIds" parameterType="java.util.List"> + update sys_laboratory_container set valid_flag=0, update_time=now() + where laboratory_id in + <foreach collection="list" item="item" index="index" open="(" separator="," close=")"> + #{item} + </foreach> + </update> <select id="getSysLaboratoryContainerInfoList" parameterType="java.util.Map" resultMap="SysLaboratoryContainer" > select container_code,name,valid_flag,type,character_left,character_right from sys_laboratory_container where update_time >= #{startTime} and #{endTime} > update_time </select> - <select id="getSysLaboratoryContainer" parameterType="java.lang.String" resultMap="SysLaboratoryContainer" > + <select id="getSysLaboratoryContainer" resultMap="SysLaboratoryContainer" > select su.*,ss.name as laboratoryName, ss.type as laboratoryType ,su.project project from sys_laboratory_container as su left join sys_laboratory as ss on su.laboratory_id = ss.id @@ -38,7 +44,7 @@ and ss.valid_flag = 1 </select> - <select id="getSysLaboratoryContainerByContainerCode" parameterType="java.lang.String" resultMap="SysLaboratoryContainer"> + <select id="getSysLaboratoryContainerByContainerCode" resultMap="SysLaboratoryContainer"> SELECT sys_laboratory_container.* FROM @@ -62,11 +68,9 @@ </select> <select id="getSysLaboratoryContainerList" parameterType="java.util.Map" resultMap="SysLaboratoryContainer"> - select su.*,ss.name as laboratoryName, ss.type as laboratoryType,sc.controller_name as controllerName,su.project as project from sys_laboratory_container as su + select su.*,ss.name as laboratoryName, ss.type as laboratoryType,su.project as project from sys_laboratory_container as su left join sys_laboratory as ss on su.laboratory_id = ss.id - left join sys_controller sc on sc.controller_code=su.controller_code where su.valid_flag = 1 - AND sc.valid_flag = 1 AND ss.valid_flag = 1 <if test="laboratoryType != null and laboratoryType != ''"> and ss.type = #{laboratoryType} @@ -80,10 +84,25 @@ <if test="project != null and project != ''"> and su.project like concat("%",#{project},"%") </if> - <if test="controllerName != null and controllerName != ''"> - and sc.controller_name like concat("%",#{controllerName},"%") + order by ss.name ASC,su.container_code,su.name + <if test="first != null and pageSize != null"> + limit #{first}, #{pageSize} </if> - order by ss.name ASC,sc.controller_name,su.container_code,su.name + </select> + + + <select id="getSysLaboratoryContainerSimpleInfoList" parameterType="java.util.Map" resultMap="SysLaboratoryContainer"> + select su.id,su.name,su.container_code,su.info_code,su.project as project,bm1.meta_value as type,bm2.meta_value as structure, + ss.name as laboratoryName from sys_laboratory_container as su + left join sys_laboratory as ss on su.laboratory_id = ss.id + left join base_meta bm1 ON bm1.id = su.type + left join base_meta bm2 ON bm2.id = su.structure + where su.valid_flag = 1 + AND ss.valid_flag = 1 + <if test="laboratoryName != null and laboratoryName != ''"> + and ss.name like #{laboratoryName} + </if> + order by su.create_time desc <if test="first != null and pageSize != null"> limit #{first}, #{pageSize} </if> @@ -131,9 +150,7 @@ <select id="getSysLaboratoryContainerTotalCount" parameterType="java.util.Map" resultType="int"> select count(1) from sys_laboratory_container as su left join sys_laboratory as ss on su.laboratory_id = ss.id - left join sys_controller sc on sc.controller_code=su.controller_code where su.valid_flag = 1 - AND sc.valid_flag = 1 AND ss.valid_flag = 1 <if test="laboratoryType != null and laboratoryType != ''"> and ss.type = #{laboratoryType} @@ -153,14 +170,11 @@ <if test="project != null and project != ''"> and su.project like concat("%",#{project},"%") </if> - <if test="controllerName != null and controllerName != ''"> - and sc.controller_name like concat("%",#{controllerName},"%") - </if> </select> - <insert id="insertSysLaboratoryContainer" parameterType="com.nanometer.smartlab.entity.SysLaboratoryContainer"> - insert into sys_laboratory_container(id, laboratory_id, type, container_code, info_code, structure, name, valid_flag, character_left, character_right, create_time, update_time, controller_code,project) - values (#{id}, #{laboratoryId}, #{type}, #{containerCode}, #{infoCode}, #{structure}, #{name}, 1, #{characterLeft}, #{characterRight}, now(), now(), #{controllerCode},#{project}) + <insert id="insertSysLaboratoryContainer" parameterType="com.nanometer.smartlab.entity.SysLaboratoryContainer" useGeneratedKeys = "true" keyProperty = "id"> + insert into sys_laboratory_container( laboratory_id, type, container_code, info_code, structure, name, valid_flag, character_left, character_right, create_time, update_time, controller_code,project) + values ( #{laboratoryId}, #{type}, #{containerCode}, #{infoCode}, #{structure}, #{name}, 1, #{characterLeft}, #{characterRight}, now(), now(), #{controllerCode},#{project}) </insert> <update id="updateSysLaboratoryContainer" parameterType="com.nanometer.smartlab.entity.SysLaboratoryContainer"> @@ -199,13 +213,13 @@ </foreach> </select> - <update id="updateSysLaboratoryContainerClearControllerCode" parameterType="java.lang.String" > + <update id="updateSysLaboratoryContainerClearControllerCode"> update sys_laboratory_container set controller_code=null where controller_code=#{controllerCode} </update> - <select id="getSysLaboratoryContainerByControllerCode" parameterType="java.lang.String" resultMap="SysLaboratoryContainer"> + <select id="getSysLaboratoryContainerByControllerCode" resultMap="SysLaboratoryContainer"> select * from sys_laboratory_container where controller_code = #{controllerCode} </select> @@ -216,7 +230,7 @@ </update> - <select id="getContainerPersonInCharge" parameterType="java.lang.String" resultType="java.util.Map"> + <select id="getContainerPersonInCharge" resultType="java.util.Map"> SELECT slc.container_code containCode,su.name name,su.phone phone, CONCAT(sl.location1,"-",sl.location2) location FROM sys_laboratory_container slc @@ -232,8 +246,9 @@ - <select id="selectLocationByContainerCode" parameterType="java.lang.String" resultType="java.util.Map"> + <select id="selectLocationByContainerCode" resultType="java.util.Map"> SELECT + sl.name, CONCAT(sl.location1,"-",sl.location2) location,sl.bar_code barCode FROM sys_laboratory_container slc @@ -243,7 +258,7 @@ and sl.valid_flag = 1 </select> - <select id="selectProjectsByContainerCode" resultType="java.lang.String"> + <select id="selectProjectsByContainerCode" resultType="string"> SELECT slc.project FROM @@ -254,4 +269,20 @@ AND slc.valid_flag = 1 AND sl.valid_flag = 1 </select> + <select id="getSysLaboratoryContainerExist" resultType="java.lang.Integer"> + select count(1) + from sys_laboratory_container as su + where su.valid_flag = 1 + <if test="containerCode != null and containerCode != ''"> + and su.container_code = #{containerCode} + </if> + <if test="editId != null and editId != ''"> + and su.id != #{editId} + </if> + </select> + + <select id="getLaboratoryByProjectId" resultMap="SysLaboratoryContainer"> + select * from sys_laboratory_container + where find_in_set(#{projectId},project) + </select> </mapper> -- Gitblit v1.9.2