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/OpeReagentStatusDao.xml | 115 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 93 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/nanometer/smartlab/dao/OpeReagentStatusDao.xml b/src/main/java/com/nanometer/smartlab/dao/OpeReagentStatusDao.xml index 4a1f6f1..1decb18 100644 --- a/src/main/java/com/nanometer/smartlab/dao/OpeReagentStatusDao.xml +++ b/src/main/java/com/nanometer/smartlab/dao/OpeReagentStatusDao.xml @@ -6,9 +6,9 @@ <result property="reagentId" column="reagent_id"></result> <result property="articleNumber" column="article_number"></result> <result property="reagentCode" column="reagent_code"></result> - <result property="status" column="status" typeHandler="com.nanometer.smartlab.entity.handler.ArrivalStatusHandler"></result> - <result property="realstatus" column="realstatus" typeHandler="com.nanometer.smartlab.entity.handler.RealStatusHandler"></result> - <result property="validFlag" column="valid_flag" typeHandler="com.nanometer.smartlab.entity.handler.ValidFlagHandler"></result> + <result property="status" column="status" ></result> + <result property="realstatus" column="realstatus" ></result> + <result property="validFlag" column="valid_flag" ></result> <result property="houseId" column="house_id"></result> <result property="containerId" column="container_id"></result> <result property="userId" column="user_id"></result> @@ -16,8 +16,8 @@ <result property="updateTime" column="update_time"></result> <result property="remainder" column="remainder"></result> <result property="place" column="place"></result> - <result property="storeType" column="store_type" typeHandler="com.nanometer.smartlab.entity.handler.StoreTypeHandler"></result> - <result property="projectNum" column="project_num"></result> + <result property="storeType" column="store_type"></result> + <result property="projectId" column="project_id"></result> <result property="containerCode" column="containerCode"></result> <result property="houseName" column="houseName"></result> @@ -36,7 +36,7 @@ <result property="price" column="price"></result> <result property="perBox" column="per_box"></result> <result property="memo" column="memo"></result> - <result property="validFlag" column="valid_flag" typeHandler="com.nanometer.smartlab.entity.handler.ValidFlagHandler"></result> + <result property="validFlag" column="valid_flag"></result> <result property="createTime" column="create_time"></result> <result property="updateTime" column="update_time"></result> <result property="supplierName" column="supplierName"></result> @@ -157,7 +157,7 @@ </if> </sql> - <select id="getOpeReagentStatus" parameterType="java.lang.String" resultMap="OpeReagentStatus" > + <select id="getOpeReagentStatusById" resultMap="OpeReagentStatus" > select oa.*, sr.*, sr.id as reagentId, @@ -173,6 +173,23 @@ left join sys_user as su on oa.user_id = su.id where oa.id = #{id} and oa.valid_flag = 1 </select> + + <select id="getOpeReagentStatusByCode" resultMap="OpeReagentStatus" > + select oa.*, + sr.*, + sr.id as reagentId, + su.name as userName, + (case when oa.status=1 then (select sw.container_code from sys_warehouse_container sw where sw.id=oa.container_id) + when oa.status=2 then (select sw.container_code from sys_laboratory_container sw where sw.id=oa.container_id) else '' END)as containerCode, + (case when oa.status=1 then (select sw.name from sys_warehouse sw where sw.id=oa.house_id) + when oa.status=2 then (select sw.name from sys_laboratory sw where sw.id=oa.house_id) else '' END)as houseName, + ss.name as supplierName + from ope_reagent_status as oa + left join sys_reagent sr on oa.reagent_id = sr.id + left join sys_supplier as ss on sr.supplier_id = ss.id + left join sys_user as su on oa.user_id = su.id + where oa.reagent_code = #{reagentCode} and oa.valid_flag = 1 + </select> <select id="getOpeReagentStatusInfoList" parameterType="java.util.Map" resultMap="OpeReagentStatus"> select s.id ,name,cas, deadline,reagent_code,bm3.meta_value reagent_format,r.main_metering,bm1.meta_value reagent_type,bm2.meta_value product_home, @@ -214,7 +231,6 @@ left join sys_reagent sr on oa.reagent_id = sr.id left join sys_supplier as ss on sr.supplier_id = ss.id left join sys_user as su on oa.user_id = su.id - <if test="status != null"> <choose> <when test="status == 1"> @@ -227,9 +243,24 @@ </when> </choose> </if> - where oa.valid_flag = 1 - <include refid="queryWhereSql"/> - + <where> + oa.valid_flag = 1 + <if test="reagentId != null and reagentId != ''"> + and oa.reagent_id = #{reagentId} + </if> + <if test="articleNumber != null and articleNumber != ''"> + and oa.article_number = #{articleNumber} + </if> + <if test="reagentCode != null and reagentCode != ''"> + and oa.reagent_code like #{reagentCode} + </if> + <if test="status != null"> + and oa.status = #{status} + </if> + <if test="applyCode != null and applyCode != ''"> + and oa.apply_code = #{applyCode} + </if> + </where> order by oa.reagent_code asc <if test="first != null and pageSize != null"> limit #{first}, #{pageSize} @@ -309,6 +340,13 @@ <if test="first != null and pageSize != null"> limit #{first}, #{pageSize} </if> + </select> + + <select id="getLabNoContainerByProjectId" parameterType="java.util.Map" resultMap="OpeReagentStatus"> + select oa.*,sr.*,sr.id as reagent_id,sl.name as house_name from sys_laboratory sl + left join ope_reagent_status as oa on oa.house_id=sl.id + left join sys_reagent sr on sr.id=oa.reagent_id + where find_in_set(#{projectId},sl.project) </select> <select id="getPersonReagentStatusList" parameterType="java.util.Map" resultMap="OpeReagentStatus"> @@ -419,16 +457,26 @@ </select> - <insert id="insertOpeReagentStatus" parameterType="com.nanometer.smartlab.entity.OpeReagentStatus"> - insert into ope_reagent_status(id, reagent_id, article_number, reagent_code, status, house_id, container_id, user_id, remainder, place, store_type, valid_flag, update_time,project_num) - values (#{id}, #{reagentId}, #{articleNumber}, #{reagentCode}, #{status}, #{houseId}, #{containerId}, #{userId}, #{remainder}, #{place}, #{storeType}, 1, now(),#{projectNum}) + <insert id="insertOpeReagentStatus" parameterType="com.nanometer.smartlab.entity.OpeReagentStatus" useGeneratedKeys = "true" keyProperty = "id"> + insert into ope_reagent_status( reagent_id, article_number, reagent_code, status, house_id, container_id, user_id, remainder, place, store_type, valid_flag, update_time,project_id) + values ( #{reagentId}, #{articleNumber}, #{reagentCode}, #{status}, #{houseId}, #{containerId}, #{userId}, #{remainder}, #{place}, #{storeType}, 1, now(),#{projectId}) </insert> + + <insert id="insertOpeReagentStatus2" parameterType="com.nanometer.smartlab.entity.OpeReagentStatus"> - insert into ope_reagent_status(id, reagent_id, article_number, reagent_code, status, house_id, container_id, user_id, remainder, place, store_type, valid_flag, update_time,project_num,apply_code,order_code) - values (#{id}, #{reagentId}, #{articleNumber}, #{reagentCode}, #{status}, #{houseId}, #{containerId}, #{userId}, #{remainder}, #{place}, #{storeType}, 1, now(),#{projectNum},#{applyCode},#{orderCode}) + insert into ope_reagent_status( reagent_id, article_number, reagent_code, status, house_id, container_id, user_id, remainder, place, store_type, valid_flag, update_time,project_id,apply_code,order_code) + values (#{reagentId}, #{articleNumber}, #{reagentCode}, #{status}, #{houseId}, #{containerId}, #{userId}, #{remainder}, #{place}, #{storeType}, 1, now(),#{projectId},#{applyCode},#{orderCode}) </insert> - <select id="getOpeReagentStatusByReagentCode" parameterType="java.lang.String" resultMap="OpeReagentStatus"> + <insert id="batchInsertOpeReagentStatus"> + insert into ope_reagent_status( reagent_id, article_number, reagent_code, status, house_id, container_id, user_id, remainder, place, store_type, valid_flag, update_time,project_id,apply_code,order_code) + values + <foreach collection ="list" item="reagentStatus" separator =","> + (#{reagentStatus.reagentId}, #{reagentStatus.articleNumber}, #{reagentStatus.reagentCode}, #{reagentStatus.status}, #{reagentStatus.houseId}, #{reagentStatus.containerId}, #{reagentStatus.userId}, #{reagentStatus.remainder}, #{reagentStatus.place}, #{reagentStatus.storeType}, 1, now(),#{reagentStatus.projectId},#{reagentStatus.applyCode},#{reagentStatus.orderCode}) + </foreach > + </insert> + + <select id="getOpeReagentStatusByReagentCode" resultMap="OpeReagentStatus"> select * from ope_reagent_status where valid_flag = 1 and reagent_code = #{reagentCode} @@ -437,11 +485,17 @@ <select id="getOpeReagentStatusByReagentCode2" parameterType="com.nanometer.smartlab.entity.OpeReagentStatus" resultMap="OpeReagentStatus"> select * from ope_reagent_status - where valid_flag = 1 and reagent_code = #{reagentCode} and status=#{status} + <where> + valid_flag = 1 and reagent_code = #{reagentCode} + <if test="status!=null"> + and status=#{status} + </if> + </where> + limit 1 </select> <update id="updateOpeReagentStatusDao" parameterType="com.nanometer.smartlab.entity.OpeReagentStatus"> - update ope_reagent_status set status=#{status},house_id=#{houseId},container_id=#{containerId}, user_id=#{userId}, place=#{place}, update_time=now(),project_num=#{projectNum} + update ope_reagent_status set status=#{status},house_id=#{houseId},container_id=#{containerId}, user_id=#{userId}, place=#{place}, update_time=now(),project_id=#{projectId} where id=#{id} </update> @@ -470,13 +524,13 @@ </update> - <delete id="deleteByReagentCode" parameterType="java.lang.String" > + <delete id="deleteByReagentCode" > delete from ope_reagent_status where reagent_code=#{reagentCode} </delete> - <select id="getReagentStatusByContainerId" parameterType="java.lang.String" resultMap="OpeReagentStatus"> + <select id="getReagentStatusByContainerId" resultMap="OpeReagentStatus"> select * from ope_reagent_status ors LEFT JOIN sys_reagent sr on sr.id = ors.reagent_id @@ -574,7 +628,7 @@ where reagent_code = #{0} </update> - <select id="selectReagentCodesByReId" parameterType="java.lang.String" resultType="java.lang.String"> + <select id="selectReagentCodesByReId" resultType="string"> select reagent_code from ope_reagent_status WHERE reagent_id = #{reagentId} and valid_flag = 1 @@ -678,4 +732,21 @@ and reagent_code = #{reagentCode} and reagent_id = #{reagentId} </select> + + <update id="updateOpeReagentStatusByCode" parameterType="com.nanometer.smartlab.entity.OpeReagentStatus"> + update ope_reagent_status set status=#{status} + where reagent_code=#{reagentCode} + </update> + + <update id="batchUpdateReagentStatusByIds"> + update ope_reagent_status set house_id=#{houseId} , container_id=#{containerId},status=#{status} + where id in + <foreach collection="ids" item="id" separator="," open="(" close=")"> + #{id} + </foreach> + </update> + + <select id="getReagentStatusCountByApplyCode" resultType="integer"> + select count(1) from ope_reagent_status where apply_code=#{applyCode} and status!=1 + </select> </mapper> -- Gitblit v1.9.2