From 3cc43725fa2e4b8ed4b4b00b845a7dc83f99f39a Mon Sep 17 00:00:00 2001 From: gdg <764716047@qq.com> Date: 星期二, 23 二月 2021 16:53:35 +0800 Subject: [PATCH] Merge remote-tracking branch 'remotes/origin/yufei' into master --- src/main/java/com/nanometer/smartlab/dao/OpeUseFlowDao.xml | 213 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 207 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/nanometer/smartlab/dao/OpeUseFlowDao.xml b/src/main/java/com/nanometer/smartlab/dao/OpeUseFlowDao.xml index 6fb9af4..5b5b10b 100644 --- a/src/main/java/com/nanometer/smartlab/dao/OpeUseFlowDao.xml +++ b/src/main/java/com/nanometer/smartlab/dao/OpeUseFlowDao.xml @@ -24,6 +24,7 @@ <result column="laboratoryContainerName" jdbcType="VARCHAR" property="laboratoryContainerName" /> <result column="laboratoryContainerCode" jdbcType="VARCHAR" property="laboratoryContainerCode" /> <result column="operatestateName" jdbcType="VARCHAR" property="operatestateName" /> + <result column="receipt_number" jdbcType="VARCHAR" property="receiptNumber" /> <association property="reagent" javaType="com.nanometer.smartlab.entity.SysReagent"> <id property="id" column="reagentId"/> @@ -48,7 +49,12 @@ <update id="updateTimeByCode" parameterType="java.util.Map"> update ope_use_flow set create_time=now() where reagent_code=#{code} and status=#{status} </update> - <sql id="queryWhereSql"> + <update id="updateReceiptNumber"> + update ope_use_flow + set receipt_number = #{1} + where reagent_code = #{0} + </update> + <sql id="queryWhereSql"> <if test="reagentId != null and reagentId != ''"> and ors.reagent_id = #{reagentId} </if> @@ -78,6 +84,10 @@ </if> <if test="endDate != null and endDate !=''"> and oa.create_time <= #{endDate} + </if> + <if test="containerCode != null and containerCode !=''"> + and wc.container_code = #{containerCode} + or lc.container_code =#{containerCode} </if> </sql> @@ -110,9 +120,29 @@ </sql> <select id="getOpeUseFlowList" parameterType="java.util.Map" resultMap="OpeUseFlow"> - <include refid="queryColumns"/> + select oa.*, + sr.*, + ors.article_number as articleNumber, + sr.id as reagentId, + su.name as userName, + ss.name as supplierName, + l.name as laboratoryName, + w.name as warehouseName, + wc.name as warehouseContainerName, + lc.name as laboratoryContainerName, + wc.container_code as warehouseContainerCode, + lc.container_code as laboratoryContainerCode, + bm1.meta_value as operatestateName from ope_use_flow as oa - <include refid="queryJoins"/> + left join ope_reagent_status ors on ors.reagent_code = oa.reagent_code + left join sys_reagent sr on ors.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 + left join sys_warehouse_container wc on wc.id = oa.container_id + left join sys_warehouse w on w.id = wc.warehouse_id + left join sys_laboratory_container lc on lc.id = oa.container_id + left join sys_laboratory l on l.id = lc.laboratory_id + left join base_meta bm1 on bm1.id = oa.operatestate where oa.valid_flag = 1 <include refid="queryWhereSql"/> order by oa.create_time desc @@ -138,9 +168,180 @@ ORDER BY create_time DESC LIMIT 1 </select> - <insert id="insertOpeUseFlow" parameterType="com.nanometer.smartlab.entity.OpeUseFlow"> - insert into ope_use_flow(id, reagent_code, status, house_id, container_id, user_id, remainder, place, store_type, valid_flag, create_time, realstatus, operatestate) - values (#{id}, #{reagentCode}, #{status}, #{houseId}, #{containerId}, #{userId}, #{remainder}, #{place}, #{storeType}, 1, #{createTime}, #{realstatus},#{operateState}) + <select id="getRegentInfoFromReceiptNumber" resultType="java.util.Map"> + SELECT ors.reagent_id reagentId,count(ors.reagent_id) count + from ope_use_flow ouf + LEFT JOIN ope_reagent_status ors on ors.reagent_code = ouf.reagent_code + WHERE ouf.receipt_number = #{0} + GROUP BY ors.reagent_id + </select> + <select id="getUserIdByReagentCode" resultType="java.util.Map"> + select user_id,create_time + from ope_use_flow + where reagent_code =#{0} + and operatestate =#{1} + and valid_flag = 1 + limit 1 + </select> + <select id="countPersonalUseInfo" resultType="java.lang.Integer"> + select count(0) from ( + SELECT count(0) + FROM + ope_use_flow ouf + LEFT JOIN sys_user su on su.id = ouf.user_id + LEFT JOIN base_meta bm on bm.id = ouf.operatestate + LEFT JOIN ope_reagent_status ors on ors.reagent_code = ouf.reagent_code + LEFT JOIN sys_reagent sr on sr.id = ors.reagent_id + left join base_meta bm1 on bm1.id = su.department + <if test="userId !=null and userId != ''"> + LEFT JOIN sys_reagent sr2 on sr2.id = ouf.user_id + </if> + WHERE ouf.operatestate = #{operatestate} + and LENGTH(trim(ouf.receipt_number))>0 + and ouf.valid_flag = 1 + <if test="reagentCode !=null and reagentCode != ''"> + and ouf.reagent_code like concat("%",#{reagentCode},"%") + </if> + <if test="startTime !=null and startTime != ''"> + and ouf.create_time >#{startTime} + </if> + <if test="endTime !=null and endTime != ''"> + and ouf.create_time <#{endTime} + </if> + <if test="project !=null and project != ''"> + and su.project like concat("%",#{project},"%") + </if> + <if test="department !=null and department != ''"> + and su.bm1.meta_value like concat("%",#{department},"%") + </if> + <if test="receiptNumber !=null and receiptNumber != ''"> + and ouf.receipt_number like concat("%",#{receiptNumber},"%") + </if> + <if test="reagentName !=null and reagentName != ''"> + and sr.name like concat("%",#{reagentName},"%") + </if> + <if test="applyPerson !=null and applyPerson != ''"> + and su.name like concat("%",#{applyPerson},"%") + </if> + group by ouf.receipt_number) a + + + + </select> + <select id="selectPersonalUseInfo" resultType="com.nanometer.smartlab.entity.OpeUseFlow"> + SELECT ouf.receipt_number receiptNumber, + count(ouf.reagent_code) applyNum, + su.name username, + su.project , + su.phone, + bm1.meta_value department, + sl.name laboratoryName, + ouf.create_time createTime, + ouf.house_id houseId + FROM + ope_use_flow ouf + LEFT JOIN sys_user su on su.id = ouf.user_id + LEFT JOIN base_meta bm on bm.id = ouf.operatestate + LEFT JOIN ope_reagent_status ors on ors.reagent_code = ouf.reagent_code + LEFT JOIN sys_reagent sr on sr.id = ors.reagent_id + left join base_meta bm1 on bm1.id = su.department + left join sys_laboratory sl on sl.id = ouf.house_id + <if test="userId !=null and userId != ''"> + LEFT JOIN sys_reagent sr2 on sr2.id = ouf.user_id + </if> + WHERE ouf.operatestate = #{operatestate} + and LENGTH(trim(ouf.receipt_number))>0 + and ouf.valid_flag = 1 + <if test="reagentCode !=null and reagentCode != ''"> + and ouf.reagent_code like concat("%",#{reagentCode},"%") + </if> + <if test="startTime !=null and startTime != ''"> + and ouf.create_time >#{startTime} + </if> + <if test="endTime !=null and endTime != ''"> + and ouf.create_time <#{endTime} + </if> + <if test="project !=null and project != ''"> + and su.project like concat("%",#{project},"%") + </if> + <if test="department !=null and department != ''"> + and su.bm1.meta_value like concat("%",#{department},"%") + </if> + <if test="receiptNumber !=null and receiptNumber != ''"> + and ouf.receipt_number like concat("%",#{receiptNumber},"%") + </if> + <if test="reagentName !=null and reagentName != ''"> + and sr.name like concat("%",#{reagentName},"%") + </if> + <if test="applyPerson !=null and applyPerson != ''"> + and su.name like concat("%",#{applyPerson},"%") + </if> + group by ouf.receipt_number + ORDER BY ouf.create_time desc + <if test="first != null and pageSize != null"> + limit #{first}, #{pageSize} + </if> + </select> + <select id="getApplyInfo" resultType="com.nanometer.smartlab.entity.dto.PersonUseDetail"> + SELECT + ors.reagent_id reagentId, + ors.article_number articleNumber, + ouf.reagent_code reagentCode, + sr.product_sn productSn, + sr.NAME reagentName, + bm.meta_value reagentFormat, + CONCAT(sr.main_metering,bm1.meta_value) perInfo, + bm2.meta_value productHome, + bm3.meta_value controlProducts + from `ope_use_flow` ouf + LEFT JOIN ope_reagent_status ors ON ors.reagent_code = ouf.reagent_code + LEFT join sys_reagent sr ON ors.reagent_id = sr.id + LEFT JOIN base_meta bm ON bm.id = sr.reagent_format + LEFT JOIN base_meta bm1 on bm1.id = sr.reagent_unit + LEFT JOIN base_meta bm2 on bm2.id = sr.product_home + LEFT JOIN base_meta bm3 on bm3.id = sr.control_products + WHERE ouf.operatestate = #{operatestate} + and ouf.receipt_number = #{receiptNumber} + and ouf.valid_flag = 1 + </select> + + + <select id="getApplyInfoSize" resultType="java.lang.Integer"> + SELECT + count(0) + from `ope_use_flow` ouf + LEFT JOIN ope_reagent_status ors ON ors.reagent_code = ouf.reagent_code + LEFT join sys_reagent sr ON ors.reagent_id = sr.id + LEFT JOIN base_meta bm ON bm.id = sr.reagent_format + LEFT JOIN base_meta bm1 on bm1.id = sr.reagent_unit + LEFT JOIN base_meta bm2 on bm2.id = sr.product_home + LEFT JOIN base_meta bm3 on bm3.id = sr.control_products + WHERE ouf.operatestate = #{operatestate} + and ouf.receipt_number = #{receiptNumber} + and ouf.valid_flag = 1 + </select> + <select id="countOpeUseFlow" resultType="java.lang.Integer" parameterType="com.nanometer.smartlab.entity.OpeUseFlow"> + select count(0) + from ope_use_flow + where reagent_code = #{reagentCode} + and status = #{status} + and house_id = #{houseId} + and container_id = #{containerId} + and create_time = #{createTime} + and operatestate =#{operateState} + and valid_flag = 1 + </select> + + <insert id="insertOpeUseFlow" parameterType="com.nanometer.smartlab.entity.OpeUseFlow"> + insert into ope_use_flow(id, reagent_code, status, house_id, container_id, user_id, remainder, place, store_type, valid_flag, create_time, realstatus, operatestate + <if test="receipt_number != null"> + ,receipt_number + </if> + ) + values (#{id}, #{reagentCode}, #{status}, #{houseId}, #{containerId}, #{userId}, #{remainder}, #{place}, #{storeType}, 1, #{createTime}, #{realstatus},#{operateState} + <if test="receipt_number != null"> + ,#{receiptNumber} + </if>) </insert> -- Gitblit v1.9.2