| | |
| | | <result property="updateTime" column="update_time"></result> |
| | | <result property="validFlag" column="valid_flag" typeHandler="com.nanometer.smartlab.entity.handler.ValidFlagHandler"></result> |
| | | <result property="approveUserId" column="approve_user_id"></result> |
| | | <result property="beforeApproveUserId" column="before_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="startReagentCode" column="start_reagent_code"></result> |
| | | <result property="endReagentCode" column="end_reagent_code"></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="productHome" column="productHome"></result> |
| | | <result property="productHomeName" column="productHomeName"></result> |
| | | <result property="type" column="type"></result> |
| | | <result property="supplierFlag" column="supplierFlag"></result> |
| | | </association> |
| | | </resultMap> |
| | | |
| | |
| | | <result property="arrivalNum" column="arrival_num"></result> |
| | | <result property="status" column="status" typeHandler="com.nanometer.smartlab.entity.handler.ApplyStatusHandler"></result> |
| | | <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"/> |
| | | <association property="reagent" javaType="com.nanometer.smartlab.entity.SysReagent"> |
| | |
| | | and (oa.approve_user_id = #{searchApproval} or oa.before_approve_user_id = #{searchApproval}) |
| | | </if> |
| | | |
| | | <if test="applyUserName != null and applyUserName != ''"> |
| | | and su.name like #{applyUserName} |
| | | </if> |
| | | |
| | | <if test="approvaUserName != null and approvaUserName != ''"> |
| | | and (suApprove.name like #{approvaUserName} or sys.name like #{approvaUserName}) |
| | | and (suApprove.name like concat('%',#{approvaUserName},'%') |
| | | or sys.name like concat('%',#{approvaUserName},'%') ) |
| | | </if> |
| | | |
| | | <if test="editId != null and editId != ''"> |
| | |
| | | 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, |
| | | fir.name as firName, |
| | | suApprove.name as approveUserName, |
| | | bm.meta_value as productHomeName |
| | | bm.meta_value as productHomeName, |
| | | ss.valid_flag as supplierFlag, |
| | | sr.type as type |
| | | from ope_apply 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.apply_user_id = su.id |
| | | 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 |
| | | where oa.id = #{id} and oa.valid_flag = 1 |
| | | </select> |
| | | |
| | |
| | | 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 |
| | | fir.name as firName, |
| | | ss.valid_flag as supplierFlag, |
| | | sr.type as type |
| | | from ope_apply 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.apply_user_id = su.id |
| | | 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 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 |
| | | 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},"%") |
| | | </if> |
| | | <include refid="queryWhereSql"/> |
| | | order by oa.create_time desc |
| | | <if test="first != null and pageSize != null"> |
| | |
| | | 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},"%") |
| | | </if> |
| | | <include refid="queryWhereSql"/> |
| | | </select> |
| | | |
| | |
| | | </insert> |
| | | |
| | | <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) |
| | | 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> |
| | | 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) |
| | | 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> |
| | | </insert> |
| | | <insert id="insertList"> |
| | | 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) |
| | | 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}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <update id="updateFirst" parameterType="java.util.Map"> |
| | | update ope_apply set first_user=approve_user_id where id=#{id} |
| | |
| | | </update> |
| | | |
| | | <update id="updateOpeApplyStatus" parameterType="java.util.Map" > |
| | | update ope_apply set status=#{status}, memo=#{memo}, update_time=now() |
| | | update ope_apply set status=#{status}, |
| | | <if test="memo !=null and memo != ''"> |
| | | memo=#{memo}, |
| | | </if> |
| | | update_time=now() |
| | | where id in |
| | | <foreach collection="applyIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | |
| | | <if test="userId != null and userId != ''"> |
| | | and oa.apply_user_id =#{userId} |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | <if test="status != null "> |
| | | and oa.status =#{status} |
| | | </if> |
| | | <if test="productSn != null and productSn != ''"> |
| | |
| | | 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_user as su1 on su1.id = project.sys_user_id |
| | | where oa.valid_flag = 1 and (oa.status=4 or oa.status=6) |
| | | where oa.valid_flag = 1 and ( |
| | | <choose> |
| | | <when test="status != null and status == 10"> |
| | | oa.status = 10 |
| | | </when> |
| | | <otherwise> |
| | | oa.status=4 or oa.status=6 |
| | | </otherwise> |
| | | </choose> |
| | | ) |
| | | <include refid="getOpeApplyReserveList_queryWhereSql" /> |
| | | <if test="isAllApply != null"> |
| | | <choose> |
| | | <when test="isAllApply == 1"> |
| | | and oa.used = oa.num |
| | | </when> |
| | | <otherwise> |
| | | and oa.used != oa.num |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | GROUP BY oa.id |
| | | )as oaa |
| | | </select> |
| | |
| | | bm1.meta_value productHome, |
| | | sr.dangerous_flag, |
| | | oa.num, |
| | | oa.apply_user_id apply_user, |
| | | oa.used, |
| | | su.`name` apply_user_id, |
| | | su.project, |
| | |
| | | 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_user as su1 on su1.id = project.sys_user_id |
| | | where oa.valid_flag = 1 and (oa.status=4 or oa.status=6) |
| | | <include refid="getOpeApplyReserveList_queryWhereSql" /> |
| | | where oa.valid_flag = 1 and ( |
| | | <choose> |
| | | <when test="status != null and status == 10"> |
| | | oa.status = 10 |
| | | </when> |
| | | <otherwise> |
| | | oa.status=4 or oa.status=6 |
| | | </otherwise> |
| | | </choose> |
| | | ) |
| | | <if test="reagentName != null and reagentName != ''"> |
| | | and sr.name like concat('%',#{reagentName},'%') |
| | | </if> |
| | | <if test="personName != null and personName != ''"> |
| | | and su.name like concat('%',#{personName},'%') |
| | | </if> |
| | | <if test="userId != null and userId != ''"> |
| | | and oa.apply_user_id =#{userId} |
| | | </if> |
| | | <if test="status != null "> |
| | | and oa.status =#{status} |
| | | </if> |
| | | <if test="productSn != null and productSn != ''"> |
| | | and sr.product_sn like concat('%',#{productSn},'%') |
| | | </if> |
| | | <if test="applyCode != null and applyCode != ''"> |
| | | and oa.apply_code = #{applyCode} |
| | | </if> |
| | | <if test="isAllApply != null"> |
| | | <choose> |
| | | <when test="isAllApply == 1"> |
| | | and oa.used = oa.num |
| | | </when> |
| | | <otherwise> |
| | | and oa.used != oa.num |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | GROUP BY oa.id |
| | | order by oa.update_time desc |
| | | <if test="first != null and pageSize != null"> |
| | |
| | | where oa.valid_flag = 1 |
| | | and oa.id = #{0} |
| | | </select> |
| | | <select id="getOpeApplyReserveListByNameForRowData" |
| | | resultMap="OpeApplyReserve"> |
| | | 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.dangerous_flag, |
| | | oa.num, |
| | | oa.apply_user_id apply_user, |
| | | oa.used, |
| | | su.`name` apply_user_id, |
| | | su.project, |
| | | su1.`name` as projectManage, |
| | | 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_user as su1 on su1.id = project.sys_user_id |
| | | where oa.id = #{id} |
| | | |
| | | |
| | | </select> |
| | | <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( |
| | | |
| | | 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( |
| | | |
| | | SELECT sum(oa.num) sum,"总数" name from ope_apply oa |
| | | LEFT JOIN sys_reagent sr on oa.reagent_id = sr.id |
| | | 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) |
| | | ) |
| | | |
| | | </select> |
| | | <select id="getOpeApplySupplerRequireMngTotalCount" resultType="java.lang.Integer"> |
| | | select count(1) |
| | | from ope_apply 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.apply_user_id = su.id |
| | | 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="reagentName != null and reagentName != ''"> |
| | | and sr.name like concat("%",#{reagentName},"%") |
| | | </if> |
| | | <if test="startDeadline != null"> |
| | | and oa.deadline >= #{startDeadline} |
| | | </if> |
| | | <if test="endDeadline != null"> |
| | | and #{endDeadline} >= oa.deadline |
| | | </if> |
| | | <if test="status != null"> |
| | | and oa.status = #{status} |
| | | </if> |
| | | <if test="company != null and company != ''"> |
| | | and ss.name = #{company} |
| | | </if> |
| | | |
| | | </select> |
| | | <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.type as type |
| | | from ope_apply 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.apply_user_id = su.id |
| | | 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="company != null and company != ''"> |
| | | and ss.name = #{company} |
| | | </if> |
| | | <if test="reagentName != null and reagentName != ''"> |
| | | and sr.name like concat("%",#{reagentName},"%") |
| | | </if> |
| | | <if test="startDeadline != null"> |
| | | and oa.deadline >= #{startDeadline} |
| | | </if> |
| | | <if test="endDeadline != null"> |
| | | and #{endDeadline} >= oa.deadline |
| | | </if> |
| | | <if test="status != null"> |
| | | and oa.status = #{status} |
| | | </if> |
| | | order by oa.create_time desc |
| | | <if test="first != null and pageSize != null"> |
| | | limit #{first}, #{pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <update id="updateByReId" parameterType="java.util.Map"> |
| | |
| | | <update id="updateOpeApplyInfo" parameterType="java.util.Map"> |
| | | update |
| | | ope_apply |
| | | set status = #{status}, |
| | | arrival_time = #{arrivalTime}, |
| | | consignee_id = #{consigneeId} |
| | | set status = #{status} |
| | | <if test="arrivalTime!=null" > |
| | | ,arrival_time = #{arrivalTime} |
| | | </if> |
| | | <if test="consigneeId!=null" > |
| | | ,consignee_id = #{consigneeId} |
| | | </if> |
| | | where valid_flag = 1 |
| | | and id = #{applyId} |
| | | </update> |