From 1b0cec788ca49a6c641f84c2bf0e616049c22e70 Mon Sep 17 00:00:00 2001
From: lyfO_o <764716047@qq.com>
Date: 星期五, 25 六月 2021 14:22:40 +0800
Subject: [PATCH] 导入申购修改导入字段

---
 src/main/java/com/nanometer/smartlab/dao/OpeApplyDao.xml |   55 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 44 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/nanometer/smartlab/dao/OpeApplyDao.xml b/src/main/java/com/nanometer/smartlab/dao/OpeApplyDao.xml
index d6b7303..e852f9f 100644
--- a/src/main/java/com/nanometer/smartlab/dao/OpeApplyDao.xml
+++ b/src/main/java/com/nanometer/smartlab/dao/OpeApplyDao.xml
@@ -205,14 +205,17 @@
   </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>
+    <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}
@@ -232,7 +235,11 @@
   </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}
@@ -360,7 +367,7 @@
         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 (oa.status=4 or oa.status=6 or oa.status = 10)
         <include refid="getOpeApplyReserveList_queryWhereSql" />
         <if test="isAllApply != null">
             <choose>
@@ -426,8 +433,34 @@
         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 == @com.nanometer.smartlab.entity.enumtype.ApplyStatus@EXPIRED">
+                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 status != ''">
+            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">

--
Gitblit v1.9.2