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/OpeApplyDao.xml | 511 ++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 314 insertions(+), 197 deletions(-) diff --git a/src/main/java/com/nanometer/smartlab/dao/OpeApplyDao.xml b/src/main/java/com/nanometer/smartlab/dao/OpeApplyDao.xml index 5f262f3..4d09ba4 100644 --- a/src/main/java/com/nanometer/smartlab/dao/OpeApplyDao.xml +++ b/src/main/java/com/nanometer/smartlab/dao/OpeApplyDao.xml @@ -4,13 +4,14 @@ <resultMap id="OpeApply" type="com.nanometer.smartlab.entity.OpeApply"> <id property="id" column="id"/> <result property="firstUser" column="first_user"></result> - <result property="firName" column="firName"></result> - <result property="secondUserName" column="secondUserName"></result> + <result property="reagentId" column="reagent_id"></result> + <result property="firName" column="fir_name"></result> + <result property="secondUserName" column="second_user_name"></result> <result property="applyCode" column="apply_code"></result> <result property="num" column="num"></result> <result property="deadline" column="deadline"></result> <result property="applyUserId" column="apply_user_id"></result> - <result property="objective" column="objective"></result> + <result property="projectId" column="project_id"></result> <result property="status" column="status" typeHandler="com.nanometer.smartlab.entity.handler.ApplyStatusHandler"></result> <result property="createTime" column="create_time"></result> <result property="updateTime" column="update_time"></result> @@ -18,45 +19,49 @@ <result property="approveUserId" column="approve_user_id"></result> <result property="beforeApproveUserId" column="before_approve_user_id"></result> <result property="memo" column="memo"></result> - <result property="applyUserName" column="applyUserName"></result> - <result property="applyUserProject" column="applyUserProject"></result> - <result property="applyUserDepartment" column="applyUserDepartment"></result> - <result property="approveUserName" column="approveUserName"></result> + <result property="applyUserName" column="apply_user_name"></result> + <result property="applyUserProject" column="apply_user_project"></result> + <result property="applyUserDepartment" column="apply_user_department"></result> + <result property="approveUserName" column="approve_user_name"></result> <result property="startReagentCode" column="start_reagent_code"></result> <result property="endReagentCode" column="end_reagent_code"></result> <result property="arrivalNum" column="arrival_num"></result> <result property="articleNumber" column="article_number"></result> <result property="houseId" column="house_id"></result> <result property="containerId" column="container_id"></result> - <result property="placeId" column="place"></result> + <result property="place" column="place"></result> <result property="applyGoal" column="apply_goal"></result> <result property="applyPrice" column="apply_price"></result> <result property="stockFlag" column="stock_flag"></result> <association property="reagent" javaType="com.nanometer.smartlab.entity.SysReagent"> <id property="id" column="reagent_id"></id> - <result property="name" column="reagentName"></result> - <result property="cas" column="reagentCas"></result> - <result property="reagentType" column="reagentType"></result> - <result property="reagentCharacter" column="reagentCharacter"></result> - <result property="supplierId" column="reagentSupplierId"></result> - <result property="reagentFormat" column="reagentFormat"></result> - <result property="mainMetering" column="reagentMainMetering"></result> - <result property="reagentUnit" column="reagentUnit"></result> - <result property="price" column="reagentPrice"></result> - <result property="perBox" column="reagentPerBox"></result> - <result property="memo" column="reagentMemo"></result> - <result property="validFlag" column="reagentValidFlag"></result> - <result property="createTime" column="reagentCreateTime"></result> - <result property="updateTime" column="reagentUpdateTime"></result> - <result property="supplierName" column="supplierName"></result> - <result property="productSn" column="reagentProductSn"></result> - <result property="controlProducts" column="controlProducts"></result> - <result property="dangerousFlag" column="reagentDangerousFlag" typeHandler="com.nanometer.smartlab.entity.handler.DangerousFlagHandler"></result> - <result property="productHome" column="productHome"></result> - <result property="productHomeName" column="productHomeName"></result> + <result property="name" column="reagent_name"></result> + <result property="cas" column="reagent_cas"></result> + <result property="reagentType" column="reagent_type"></result> + <result property="reagentCharacter" column="reagent_character"></result> + <result property="supplierId" column="reagent_supplier_id"></result> + <result property="reagentFormat" column="reagent_format"></result> + <result property="mainMetering" column="reagent_main_metering"></result> + <result property="reagentUnit" column="reagent_unit"></result> + <result property="price" column="reagent_price"></result> + <result property="perBox" column="reagent_per_box"></result> + <result property="memo" column="reagent_memo"></result> + <result property="validFlag" column="reagent_valid_flag"></result> + <result property="createTime" column="reagent_create_time"></result> + <result property="updateTime" column="reagent_update_time"></result> + <result property="supplierName" column="supplier_name"></result> + <result property="productSn" column="reagent_product_sn"></result> + <result property="controlProducts" column="control_products"></result> + <result property="dangerousFlag" column="reagent_dangerous_flag" typeHandler="com.nanometer.smartlab.entity.handler.DangerousFlagHandler"></result> + <result property="productHome" column="product_home"></result> <result property="type" column="type"></result> - <result property="supplierFlag" column="supplierFlag"></result> + <result property="supplierFlag" column="supplier_flag"></result> </association> + <association property="order" javaType="com.nanometer.smartlab.entity.OpeOrder"> + <id property="id" column="order_id"></id> + <result property="orderName" column="order_name"></result> + <result property="orderCode" column="order_code"></result> + </association> </resultMap> <resultMap id="OpeApplyReserve" type="com.nanometer.smartlab.entity.OpeApplyReserve"> @@ -69,31 +74,32 @@ <result property="applyUserId" column="apply_user_id"></result> <result property="applyUser" column="apply_user"></result> <result property="arrivalTime" column="arrival_time"></result> - <result property="articleNumber" column="articleNumber"></result> - <result property="projectManage" column="projectManage"/> - <result property="project" column="project"/> + <result property="articleNumber" column="article_number"></result> + <result property="projectManage" column="project_manage"/> + <result property="projectName" column="project_name"/> + <result property="startReagentCode" column="start_reagent_code"></result> + <result property="endReagentCode" column="end_reagent_code"></result> <association property="reagent" javaType="com.nanometer.smartlab.entity.SysReagent"> - <id property="id" column="reagent_id"></id> - <result property="name" column="reagentName"></result> - <result property="cas" column="reagentCas"></result> - <result property="reagentType" column="reagentType"></result> - <result property="reagentCharacter" column="reagentCharacter"></result> - <result property="supplierId" column="reagentSupplierId"></result> - <result property="reagentFormat" column="reagentFormat"></result> - <result property="mainMetering" column="reagentMainMetering"></result> - <result property="reagentUnit" column="reagentUnit"></result> - <result property="price" column="reagentPrice"></result> - <result property="perBox" column="reagentPerBox"></result> - <result property="memo" column="reagentMemo"></result> - <result property="validFlag" column="reagentValidFlag"></result> - <result property="createTime" column="reagentCreateTime"></result> - <result property="updateTime" column="reagentUpdateTime"></result> - <result property="supplierName" column="supplierName"></result> - <result property="productSn" column="reagentProductSn"></result> - <result property="controlProducts" column="controlProducts"></result> - <result property="dangerousFlag" column="reagentDangerousFlag" typeHandler="com.nanometer.smartlab.entity.handler.DangerousFlagHandler"></result> - <result property="productHome" column="productHome"></result> - <result property="productHomeName" column="productHomeName"></result> + <id property="id" column="reagent_id"></id> + <result property="name" column="reagent_name"></result> + <result property="cas" column="reagent_cas"></result> + <result property="reagentType" column="reagent_type"></result> + <result property="reagentCharacter" column="reagent_character"></result> + <result property="supplierId" column="reagent_supplier_id"></result> + <result property="reagentFormat" column="reagent_format"></result> + <result property="mainMetering" column="reagent_main_metering"></result> + <result property="reagentUnit" column="reagent_unit"></result> + <result property="price" column="reagent_price"></result> + <result property="perBox" column="reagent_per_box"></result> + <result property="memo" column="reagent_memo"></result> + <result property="validFlag" column="reagent_valid_flag"></result> + <result property="createTime" column="reagent_create_time"></result> + <result property="updateTime" column="reagent_update_time"></result> + <result property="supplierName" column="supplier_name"></result> + <result property="productSn" column="reagent_product_sn"></result> + <result property="controlProducts" column="control_products"></result> + <result property="dangerousFlag" column="reagent_dangerous_flag" typeHandler="com.nanometer.smartlab.entity.handler.DangerousFlagHandler"></result> + <result property="productHome" column="product_home"></result> </association> </resultMap> @@ -139,19 +145,21 @@ </if> </sql> - <select id="getOpeApply" parameterType="java.lang.String" resultMap="OpeApply" > + <select id="getOpeApply" resultMap="OpeApply" > select oa.*,sys.name as secondUserName, - sr.name as reagentName, sr.cas as reagentCas, sr.reagent_type as reagentType, sr.reagent_character as reagentCharacter, sr.supplier_id as reagentSupplierId, sr.dangerous_flag as reagentDangerousFlag, - sr.reagent_format as reagentFormat, sr.main_metering as reagentMainMetering, sr.reagent_unit as reagentUnit, sr.price as reagentPrice, sr.per_box as reagentPerBox, - sr.memo as reagentMemo, sr.valid_flag as reagentValidFlag, sr.create_time as reagentCreateTime, sr.update_time as reagentUpdateTime,sr.control_products as controlProducts,sr.product_sn as reagentProductSn,sr.product_home as productHome, - ss.name as supplierName, - su.name as applyUserName, - su.project as applyUserProject, - bm2.meta_value as applyUserDepartment, + sr.name as reagent_name, sr.cas as reagent_cas ,sr.reagent_type as reagent_type, sr.reagent_character as reagent_character, + sr.supplier_id as reagent_supplier_id, sr.dangerous_flag as reagent_dangerous_flag, + sr.reagent_format as reagent_format, sr.main_metering as reagent_main_metering, sr.reagent_unit as reagent_unit, + sr.price as reagent_price, sr.per_box as reagent_per_box,sr.memo as reagent_memo, sr.valid_flag as reagent_valid_flag, + sr.create_time as reagent_create_time, sr.update_time as reagent_update_time,sr.control_products as control_products, + sr.product_sn as reagent_product_sn,sr.product_home as product_home, + ss.name as supplier_name, + su.name as apply_user_name, + sp.project_name as apply_user_project, + bm2.meta_value as apply_user_department, fir.name as firName, - suApprove.name as approveUserName, - bm.meta_value as productHomeName, - ss.valid_flag as supplierFlag, + suApprove.name as approve_user_name, + ss.valid_flag as supplier_flag, sr.type as type from ope_apply as oa left join sys_reagent sr on oa.reagent_id = sr.id @@ -160,25 +168,26 @@ left join sys_user as suApprove on oa.approve_user_id = suApprove.id left join sys_user as sys on sys.id=oa.before_approve_user_id left join sys_user as fir on fir.id=oa.first_user - left join base_meta as bm on sr.product_home = bm.id left join base_meta as bm2 on bm2.id = su.department + left join sys_project sp on sp.id=su.project_id=sp.id where oa.id = #{id} and oa.valid_flag = 1 </select> <select id="getOpeApplyList" parameterType="java.util.Map" resultMap="OpeApply"> - select oa.*,sys.name as secondUserName, - sr.name as reagentName,sr.price as reagentPrice ,sr.cas as reagentCas, sr.reagent_type as reagentType, sr.reagent_character as reagentCharacter, sr.supplier_id as reagentSupplierId, - sr.reagent_format as reagentFormat, sr.main_metering as reagentMainMetering, sr.reagent_unit as reagentUnit, sr.per_box as reagentPerBox, - sr.memo as reagentMemo, sr.valid_flag as reagentValidFlag, sr.create_time as reagentCreateTime, sr.update_time as reagentUpdateTime, sr.product_sn as reagentProductSn, - sr.dangerous_flag as reagentDangerousFlag,sr.control_products as controlProducts,sr.product_home as productHome, - ss.name as supplierName, - su.name as applyUserName, - su.project as applyUserProject, - bm2.meta_value as applyUserDepartment, - suApprove.name as approveUserName, - bm.meta_value as productHomeName, - fir.name as firName, - ss.valid_flag as supplierFlag, + select oa.*,sys.name as second_user_name, + sr.name as reagent_name,sr.price as reagent_price ,sr.cas as reagent_cas, sr.reagent_type as reagent_type, + sr.reagent_character as reagent_character, sr.supplier_id as reagent_supplier_id, + sr.reagent_format as reagent_format, sr.main_metering as reagent_main_metering, sr.reagent_unit as reagent_unit, + sr.per_box as reagent_per_box,sr.memo as reagent_memo, sr.valid_flag as reagent_valid_flag, sr.create_time as reagent_create_time, + sr.update_time as reagent_update_time, sr.product_sn as reagent_product_sn, + sr.dangerous_flag as reagent_dangerous_flag,sr.control_products as control_products,sr.product_home as product_home, + ss.name as supplier_name, + su.name as apply_user_name, + sp.project_name as apply_user_project, + bm2.meta_value as apply_user_department, + suApprove.name as approve_user_name, + fir.name as fir_name, + ss.valid_flag as supplier_flag, sr.type as type from ope_apply as oa left join sys_reagent sr on oa.reagent_id = sr.id @@ -187,15 +196,14 @@ left join sys_user as suApprove on oa.approve_user_id = suApprove.id left join sys_user as sys on sys.id=oa.before_approve_user_id left join sys_user as fir on fir.id=oa.first_user - left join base_meta as bm on sr.product_home = bm.id - left join base_meta as bm1 on bm1.id = sr.control_products left join base_meta as bm2 on bm2.id = su.department + left join sys_project as sp on sp.id=su.project_id where oa.valid_flag = 1 <if test="isShow != null and isShow ==0"> and (ss.valid_flag = 1 or sr.type = 0) </if> <if test="controlProduct != null and controlProduct != ''"> - and bm1.meta_value like concat("%",#{controlProduct},"%") + and sr.control_products like concat("%",#{controlProduct},"%") </if> <include refid="queryWhereSql"/> order by oa.create_time desc @@ -213,39 +221,37 @@ left join sys_user as suApprove on oa.approve_user_id = suApprove.id left join sys_user as sys on sys.id=oa.before_approve_user_id left join sys_user as fir on fir.id=oa.first_user - left join base_meta as bm on sr.product_home = bm.id - left join base_meta as bm1 on bm1.id = sr.control_products where oa.valid_flag = 1 <if test="isShow != null and isShow ==0"> and (ss.valid_flag = 1 or sr.type = 0) </if> <if test="controlProduct != null and controlProduct != ''"> - and bm1.meta_value like concat("%",#{controlProduct},"%") + and sr.control_products like concat("%",#{controlProduct},"%") </if> <include refid="queryWhereSql"/> </select> - <insert id="insertOpeApply" parameterType="com.nanometer.smartlab.entity.OpeApply"> - insert into ope_apply(id, apply_code, reagent_id, num, deadline, apply_user_id, objective, status, approve_user_id, memo, valid_flag, create_time, update_time) - values (#{id}, #{applyCode}, #{reagent.id}, #{num}, #{deadline}, #{applyUserId}, #{objective}, #{status}, #{approveUserId}, #{memo}, 1, now(), now()) + <insert id="insertOpeApply" parameterType="com.nanometer.smartlab.entity.OpeApply" useGeneratedKeys = "true" keyProperty = "id"> + insert into ope_apply( apply_code, reagent_id, num, deadline, apply_user_id, project_id, status, approve_user_id, memo, valid_flag, create_time, update_time) + values ( #{applyCode}, #{reagent.id}, #{num}, #{deadline}, #{applyUserId}, #{projectId}, #{status}, #{approveUserId}, #{memo}, 1, now(), now()) </insert> - <insert id="insertOpeApplyList" parameterType="java.util.List"> + <insert id="insertOpeApplyList" parameterType="java.util.List" > insert into ope_apply - (id, apply_code, reagent_id, num, deadline, apply_user_id, objective, status, approve_user_id, memo, valid_flag, create_time, update_time,apply_goal,apply_price,first_user) + (apply_code, reagent_id, num, deadline, apply_user_id, project_id, status, approve_user_id, memo, valid_flag, create_time, update_time,apply_goal,apply_price,first_user) values - <foreach collection="list" item="opeApply" separator=","> - (#{opeApply.id}, #{opeApply.applyCode}, #{opeApply.reagent.id}, #{opeApply.num}, #{opeApply.deadline}, - #{opeApply.applyUserId}, #{opeApply.objective}, #{opeApply.status}, #{opeApply.approveUserId}, #{opeApply.memo}, 1, now(), now(),#{opeApply.applyGoal},#{opeApply.reagent.price},#{opeApply.approveUserId}) + <foreach collection="opeApplyList" item="opeApply" separator=","> + ( #{opeApply.applyCode}, #{opeApply.reagent.id}, #{opeApply.num}, #{opeApply.deadline}, + #{opeApply.applyUserId}, #{opeApply.projectId}, #{opeApply.status}, #{opeApply.approveUserId}, #{opeApply.memo}, 1, now(), now(),#{opeApply.applyGoal},#{opeApply.reagent.price},#{opeApply.approveUserId}) </foreach> </insert> - <insert id="insertList"> + <insert id="insertList" parameterType="java.util.List" useGeneratedKeys = "true" keyProperty = "id"> insert into ope_apply - (id, apply_code, reagent_id, num, deadline, apply_user_id, objective, status, approve_user_id, memo, valid_flag, create_time, update_time,apply_goal,apply_price,first_user) + (apply_code, reagent_id, num, deadline, apply_user_id, project_id, status, approve_user_id, memo, valid_flag, create_time, update_time,apply_goal,apply_price,first_user) values <foreach collection="list" item="opeApply" separator=","> - (#{opeApply.id}, #{opeApply.applyCode}, #{opeApply.reagent.id}, #{opeApply.num}, #{opeApply.deadline}, - #{opeApply.applyUserId}, #{opeApply.objective}, #{opeApply.status}, #{opeApply.approveUserId}, #{opeApply.memo}, 1, #{opeApply.createTime}, #{opeApply.updateTime},#{opeApply.applyGoal},#{opeApply.reagent.price},#{opeApply.approveUserId}) + ( #{opeApply.applyCode}, #{opeApply.reagent.id}, #{opeApply.num}, #{opeApply.deadline}, + #{opeApply.applyUserId}, #{opeApply.projectId}, #{opeApply.status}, #{opeApply.approveUserId}, #{opeApply.memo}, 1, #{opeApply.createTime}, #{opeApply.updateTime},#{opeApply.applyGoal},#{opeApply.reagent.price},#{opeApply.approveUserId}) </foreach> </insert> @@ -256,14 +262,60 @@ update ope_apply set first_user=before_approve_user_id where id=#{id} </update> <update id="updateOpeApply" parameterType="com.nanometer.smartlab.entity.OpeApply"> - update ope_apply set apply_code=#{applyCode}, reagent_id=#{reagent.id}, num=#{num}, deadline=#{deadline}, apply_user_id=#{applyUserId}, objective=#{objective}, - status=#{status}, approve_user_id=#{approveUserId}, memo=#{memo}, update_time=now(),start_reagent_code=#{startReagentCode},end_reagent_code=#{endReagentCode}, + update ope_apply + <set> + <if test="applyCode!=null and applyCode!=''"> + apply_code=#{applyCode}, + </if> + <if test="reagent!=null and reagent.id!=null"> + reagent_id=#{reagent.id}, + </if> + <if test="num!=null and num!=''"> + num=#{num}, + </if> + <if test="deadline!=null"> + deadline=#{deadline}, + </if> + <if test="applyUserId!=null and applyUserId!=''"> + apply_user_id=#{applyUserId}, + </if> + <if test="projectId!=null and projectId!=''"> + project_id=#{projectId}, + </if> + <if test="status!=null"> + status=#{status}, + </if> + <if test="approveUserId!=null and approveUserId!=''"> + approve_user_id=#{approveUserId}, + </if> + <if test="memo!=null and memo!=''"> + memo=#{memo}, + </if> + update_time=now(), + <if test="startReagentCode!=null and startReagentCode!=''"> + start_reagent_code=#{startReagentCode}, + </if> + <if test="endReagentCode!=null and endReagentCode!=''"> + end_reagent_code=#{endReagentCode}, + </if> + <if test="arrivalNum!=null and arrivalNum!=''"> arrival_num=#{arrivalNum}, + </if> + <if test="houseId!=null and houseId!=''"> house_id=#{houseId}, - place=#{placeId}, + </if> + <if test="place!=null and place!=''"> + place=#{place}, + </if> + <if test="containerId!=null and containerId!=''"> container_id=#{containerId}, + </if> + <if test="articleNumber!=null and articleNumber!=''"> article_number=#{articleNumber} + </if> + </set> where id=#{id} + </update> <update id="updateOpeApplyStatus" parameterType="java.util.Map" > @@ -278,8 +330,13 @@ </foreach> </update> + <update id="updateOpeApplyStatusById" > + update ope_apply set status=#{status},update_time=now() + where id =#{id} + </update> + <update id="updateOpeApplyProject" parameterType="java.util.Map"> - update ope_apply set objective =#{newObjective} where objective=#{oldObjective} + update ope_apply set project_id =#{newObjective} where project_id=#{oldObjective} </update> @@ -304,7 +361,6 @@ update ope_apply set before_memo=#{memo}, before_approve_user_id=#{beforeUserId}, approve_user_id=#{userId}, update_time=now() where id =#{id} - </update> @@ -327,16 +383,16 @@ select oa.id, oa.apply_code, sr.id reagent_id, oa.status, - sr.product_sn reagentProductSn, - sr.`name` reagentName, - bm2.meta_value controlProducts, - bm3.meta_value reagentFormat, - sr.main_metering reagentMainMetering, - sr.price reagentPrice, - sr.cas reagentCas, - oa.article_number articleNumber, - bm4.meta_value reagentCharacter, - bm1.meta_value productHome, + sr.product_sn reagent_product_sn, + sr.`name` reagent_name, + sr.control_products, + sr.reagent_format, + sr.main_metering reagent_main_metering, + sr.price reagent_price, + sr.cas reagent_cas, + oa.article_number article_number, + sr.reagentCharacter, + sr.product_home, sr.dangerous_flag, oa.num, oa.used, @@ -348,12 +404,12 @@ left JOIN sys_user su on su.id = oa.apply_user_id </sql> - <sql id="getOpeApplyReserveList_queryJoins2"> - left join base_meta as bm2 on sr.control_products = bm2.id - left join base_meta as bm3 on sr.reagent_format = bm3.id - left join base_meta as bm4 on sr.reagent_character = bm4.id - left join base_meta as bm1 on sr.product_home = bm1.id - </sql> +<!-- <sql id="getOpeApplyReserveList_queryJoins2">--> +<!-- left join base_meta as bm2 on sr.control_products = bm2.id--> +<!-- left join base_meta as bm3 on sr.reagent_format = bm3.id--> +<!-- left join base_meta as bm4 on sr.reagent_character = bm4.id--> +<!-- left join base_meta as bm1 on sr.product_home = bm1.id--> +<!-- </sql>--> <sql id="getOpeApplyReserveList_queryWhereSql"> <if test="reagentName != null and reagentName != ''"> @@ -393,11 +449,7 @@ from ope_apply as oa LEFT JOIN sys_reagent sr ON sr.id = oa.reagent_id LEFT JOIN sys_user su ON su.id = oa.apply_user_id - LEFT JOIN base_meta AS bm2 ON sr.control_products = bm2.id - LEFT JOIN base_meta AS bm3 ON sr.reagent_format = bm3.id - LEFT JOIN base_meta AS bm4 ON sr.reagent_character = bm4.id - LEFT JOIN base_meta AS bm1 ON sr.product_home = bm1.id - LEFT JOIN sys_project as project on project.project = su.project + LEFT JOIN sys_project as project on project.id = su.project_id LEFT JOIN sys_user as su1 on su1.id = project.sys_user_id where oa.valid_flag = 1 and ( <choose> @@ -405,7 +457,7 @@ oa.status = 10 </when> <otherwise> - oa.status=4 or oa.status=6 + oa.status=4 or oa.status=6 or oa.status=9 </otherwise> </choose> ) @@ -429,7 +481,6 @@ <include refid="getOpeApplyReserveList_queryColumns" /> from ope_apply as oa <include refid="getOpeApplyReserveList_queryJoins1" /> - <include refid="getOpeApplyReserveList_queryJoins2" /> where oa.valid_flag = 1 <include refid="getOpeApplyReserveList_queryWhereSql" /> GROUP BY oa.id @@ -445,34 +496,32 @@ oa.id, oa.apply_code, sr.id reagent_id, - oa. STATUS, - sr.product_sn reagentProductSn, - sr.`name` reagentName, - bm2.meta_value controlProducts, - bm3.meta_value reagentFormat, - sr.main_metering reagentMainMetering, - sr.price reagentPrice, - sr.cas reagentCas, - oa.article_number articleNumber, - bm4.meta_value reagentCharacter, - bm1.meta_value productHome, + oa.status, + sr.product_sn reagent_product_sn, + sr.`name` reagent_name, + sr.main_metering reagent_main_metering, + sr.price reagent_price, + sr.cas reagent_cas, + sr.reagent_unit, + oa.article_number article_number, sr.dangerous_flag, + sr.control_products control_products, + sr.reagent_character, + sr.reagent_format, + sr.product_home, oa.num, - oa.apply_user_id apply_user, + su.name apply_user, + oa.apply_user_id, oa.used, - su.`name` apply_user_id, - su.project, - su1.`name` as projectManage, + su.`name` apply_user_name, + project.project_name as project_name, + su1.`name` as project_manage, oa.arrival_time FROM ope_apply AS oa LEFT JOIN sys_reagent sr ON sr.id = oa.reagent_id LEFT JOIN sys_user su ON su.id = oa.apply_user_id - LEFT JOIN base_meta AS bm2 ON sr.control_products = bm2.id - LEFT JOIN base_meta AS bm3 ON sr.reagent_format = bm3.id - LEFT JOIN base_meta AS bm4 ON sr.reagent_character = bm4.id - LEFT JOIN base_meta AS bm1 ON sr.product_home = bm1.id - LEFT JOIN sys_project as project on project.project = su.project + LEFT JOIN sys_project as project on project.id = su.project_id LEFT JOIN sys_user as su1 on su1.id = project.sys_user_id where oa.valid_flag = 1 and ( <choose> @@ -480,7 +529,7 @@ oa.status = 10 </when> <otherwise> - oa.status=4 or oa.status=6 + oa.status=4 or oa.status=6 or oa.status=9 </otherwise> </choose> ) @@ -534,28 +583,27 @@ select oa.id, oa.apply_code, sr.id reagent_id, oa.status, - sr.product_sn reagentProductSn, - sr.`name` reagentName, - bm2.meta_value controlProducts, - bm3.meta_value reagentFormat, - sr.main_metering reagentMainMetering, - sr.price reagentPrice, - sr.cas reagentCas, - oa.article_number articleNumber, - bm4.meta_value reagentCharacter, - bm1.meta_value productHome, + sr.product_sn reagent_product_sn, + sr.`name` reagent_name, + sr.control_products, + sr.reagent_format, + sr.main_metering reagent_main_metering, + sr.price reagent_price, + sr.cas reagent_cas, + oa.article_number article_number, + sr.reagent_character, + sr.product_home, sr.dangerous_flag, oa.num, oa.used, oa.arrival_num, - su.id apply_user_id + su.id apply_user_id, + CONCAT(rc.code_prex,LPAD(rc.start_code,4,'0')) as start_reagent_code, + CONCAT(rc.code_prex,LPAD(rc.end_code,4,'0')) as end_reagent_code from ope_apply as oa left JOIN sys_reagent sr on sr.id = oa.reagent_id left JOIN sys_user su on su.id = oa.apply_user_id - left join base_meta as bm2 on sr.control_products = bm2.id - left join base_meta as bm3 on sr.reagent_format = bm3.id - left join base_meta as bm4 on sr.reagent_character = bm4.id - left join base_meta as bm1 on sr.product_home = bm1.id + left join ope_reagent_code rc on rc.apply_id=oa.id where oa.valid_flag = 1 and oa.id = #{0} </select> @@ -566,33 +614,30 @@ oa.apply_code, sr.id reagent_id, oa. STATUS, - sr.product_sn reagentProductSn, - sr.`name` reagentName, - bm2.meta_value controlProducts, - bm3.meta_value reagentFormat, - sr.main_metering reagentMainMetering, - sr.price reagentPrice, - sr.cas reagentCas, - oa.article_number articleNumber, - bm4.meta_value reagentCharacter, - bm1.meta_value productHome, + sr.product_sn reagent_product_sn, + sr.`name` reagent_name, + sr.control_products, + sr.reagent_format, + sr.reagent_unit, + sr.main_metering reagent_main_metering, + sr.price reagent_price, + sr.cas reagent_cas, + oa.article_number article_number, + sr.reagent_character, + sr.product_home, sr.dangerous_flag, oa.num, - oa.apply_user_id apply_user, + oa.apply_user_id apply_user_id, oa.used, - su.`name` apply_user_id, - su.project, - su1.`name` as projectManage, + su.`name` apply_user, + project.project_name apply_user_project, + su1.`name` as project_manage, oa.arrival_time FROM ope_apply AS oa LEFT JOIN sys_reagent sr ON sr.id = oa.reagent_id LEFT JOIN sys_user su ON su.id = oa.apply_user_id - LEFT JOIN base_meta AS bm2 ON sr.control_products = bm2.id - LEFT JOIN base_meta AS bm3 ON sr.reagent_format = bm3.id - LEFT JOIN base_meta AS bm4 ON sr.reagent_character = bm4.id - LEFT JOIN base_meta AS bm1 ON sr.product_home = bm1.id - LEFT JOIN sys_project as project on project.project = su.project + LEFT JOIN sys_project as project on project.id = su.project_id LEFT JOIN sys_user as su1 on su1.id = project.sys_user_id where oa.id = #{id} @@ -601,24 +646,22 @@ <select id="getApplyControlInfo" resultType="java.util.Map"> (SELECT sum(oa.num) sum,"易制毒" name from ope_apply oa LEFT JOIN sys_reagent sr on oa.reagent_id = sr.id - LEFT JOIN base_meta bm on bm.id = sr.control_products where oa.valid_flag = 1 and sr.valid_flag = 1 and YEAR(oa.create_time)=YEAR(NOW()) and oa.status in(2,3,4,6) and - meta_value like "%易制毒%") UNION ALL( + sr.control_products like "%易制毒%") UNION ALL( SELECT sum(oa.num) sum,"易制爆" name from ope_apply oa LEFT JOIN sys_reagent sr on oa.reagent_id = sr.id - LEFT JOIN base_meta bm on bm.id = sr.control_products where oa.valid_flag = 1 and sr.valid_flag = 1 and YEAR(oa.create_time)=YEAR(NOW()) and oa.status in(2,3,4,6) - and meta_value like "%易制爆%")UNION ALL( + and sr.control_products like "%易制爆%")UNION ALL( SELECT sum(oa.num) sum,"总数" name from ope_apply oa LEFT JOIN sys_reagent sr on oa.reagent_id = sr.id @@ -639,8 +682,6 @@ left join sys_user as suApprove on oa.approve_user_id = suApprove.id left join sys_user as sys on sys.id=oa.before_approve_user_id left join sys_user as fir on fir.id=oa.first_user - left join base_meta as bm on sr.product_home = bm.id - left join base_meta as bm1 on bm1.id = sr.control_products where oa.valid_flag = 1 <if test="isShow != null and isShow ==0"> and (ss.valid_flag = 1 or sr.type = 0) @@ -665,16 +706,17 @@ <select id="getOpeApplySupplerRequireMngList" parameterType="java.util.Map" resultMap="OpeApply"> select oa.*,sys.name as secondUserName, - sr.name as reagentName,sr.price as reagentPrice ,sr.cas as reagentCas, sr.reagent_type as reagentType, sr.reagent_character as reagentCharacter, sr.supplier_id as reagentSupplierId, - sr.reagent_format as reagentFormat, sr.main_metering as reagentMainMetering, sr.reagent_unit as reagentUnit, sr.per_box as reagentPerBox, - sr.memo as reagentMemo, sr.valid_flag as reagentValidFlag, sr.create_time as reagentCreateTime, sr.update_time as reagentUpdateTime, sr.product_sn as reagentProductSn, - sr.dangerous_flag as reagentDangerousFlag,sr.control_products as controlProducts,sr.product_home as productHome, - ss.name as supplierName, - su.name as applyUserName, - suApprove.name as approveUserName, - bm.meta_value as productHomeName, - fir.name as firName, - ss.valid_flag as supplierFlag, + sr.name as reagent_name,sr.price as reagent_price ,sr.cas as reagent_cas, sr.reagent_type as reagent_type, sr.reagent_character as reagent_character, + sr.supplier_id as reagentSupplierId,sr.reagent_format as reagent_format, sr.main_metering as reagent_main_metering, + sr.reagent_unit as reagent_unit, sr.per_box as reagent_per_box,sr.memo as reagent_memo, sr.valid_flag as reagent_valid_flag, + sr.create_time as reagent_create_time, sr.update_time as reagent_update_time, sr.product_sn as reagent_product_sn, + sr.dangerous_flag as reagent_dangerous_flag,sr.control_products as control_products,sr.product_home as product_home, + ss.name as supplier_name, + su.name as applyUser_name, + suApprove.name as approve_user_name, + sr.product_home as apply_user_project, + fir.name as fir_name, + ss.valid_flag as supplier_flag, sr.type as type from ope_apply as oa left join sys_reagent sr on oa.reagent_id = sr.id @@ -683,8 +725,6 @@ left join sys_user as suApprove on oa.approve_user_id = suApprove.id left join sys_user as sys on sys.id=oa.before_approve_user_id left join sys_user as fir on fir.id=oa.first_user - left join base_meta as bm on sr.product_home = bm.id - left join base_meta as bm1 on bm1.id = sr.control_products where oa.valid_flag = 1 <if test="isShow != null and isShow ==0"> and (ss.valid_flag = 1 or sr.type = 0) @@ -725,7 +765,84 @@ <if test="consigneeId!=null" > ,consignee_id = #{consigneeId} </if> + <if test="arrivalNum!=null" > + ,arrival_num = #{arrivalNum} + </if> where valid_flag = 1 and id = #{applyId} </update> + + <select id="getOpeApplyByOrderId" resultMap="OpeApply"> + select distinct a.id,a.apply_code,a.reagent_id,a.used,a.num,a.arrival_num,a.apply_user_id,a.status,a.project_id,a.deadline,a.approve_user_id,a.apply_price,a.create_time,a.memo,a.article_number,a.place, + CONCAT(c.code_prex,LPAD(c.start_code,4,'0')) as start_reagent_code,CONCAT(c.code_prex,LPAD(c.end_code,4,'0')) as end_reagent_code, + d.name as reagent_name, d.cas as reagent_cas, d.reagent_type as reagent_type, d.reagent_character as reagent_character, + d.supplier_id as reagent_supplier_id,d.product_home as product_home,d.product_sn as reagent_product_sn, + d.reagent_format as reagent_format, d.main_metering as reagent_main_metering, d.reagent_unit as reagent_unit, + d.price as reagent_price, d.per_box as reagent_per_box,d.control_products, + e.name as apply_user_name + from ope_apply a + left join ope_apply_order b on b.ope_apply_id=a.id + left join ope_reagent_code c on c.apply_id=a.id + left join sys_reagent d on a.reagent_id = d.id + left join sys_user e on a.apply_user_id = e.id + where b.ope_order_id=#{orderId} + </select> + + + <select id="getReagentByApplyId" resultType="com.nanometer.smartlab.entity.SysReagent"> + select sa.* from sys_reagent sa + left join ope_apply oa on oa.reagent_id=sa.id + where oa.id=#{applyId} + </select> + + + <select id="getOpeApplyCountWithOrder" resultType="int"> + select count(1) + from ope_apply as oa + inner join ope_apply_order ao on ao.ope_apply_id=oa.id + inner join ope_order oo on oo.id=ao.ope_order_id + <where> + oa.valid_flag = 1 and oo.valid_flag=1 + <if test="applyCode!=null and applyCode!=''"> + and oa.apply_code=#{applyCode} + </if> + </where> + </select> + + <select id="getOpeApplyListWithOrder" resultMap="OpeApply"> + select oa.*, + sr.name as reagent_name,sr.cas as reagent_cas, sr.reagent_type as reagent_type, + sr.reagent_character as reagent_character,sr.product_sn as reagent_product_sn,sr.product_home as product_home, + ss.name as supplier_name, + su.name as apply_user_name, + oo.id as order_id,oo.order_name,oo.order_code + from ope_apply as oa + inner join ope_apply_order ao on ao.ope_apply_id=oa.id + inner join ope_order oo on oo.id=ao.ope_order_id + 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.apply_user_id = su.id + <where> + oa.valid_flag = 1 and oo.valid_flag=1 + <if test="applyCode!=null and applyCode!=''"> + and oa.apply_code=#{applyCode} + </if> + <if test="orderCode!=null and orderCode!=''"> + and oo.order_code=#{orderCode} + </if> + <if test="orderName!=null and orderName!=''"> + and oo.order_name like concat('%',#{orderName},'%') + </if> + </where> + order by oo.create_time desc + <if test="first != null and pageSize != null"> + limit #{first}, #{pageSize} + </if> + </select> + + + <select id="getArrivalNumById" resultType="int"> + select ifnull(arrival_num ,0)from ope_apply where id=#{applyId} + </select> + </mapper> -- Gitblit v1.9.2