From 0ece929cad95dbe0bb4c8be5e03ddccacec5a935 Mon Sep 17 00:00:00 2001
From: 李宇 <986321569@qq.com>
Date: 星期二, 22 十二月 2020 12:17:25 +0800
Subject: [PATCH] 修改危化品编码

---
 src/main/java/com/nanometer/smartlab/dao/DangerousEncodeMapper.xml |   89 ++++++++++++++++++++++++++++----------------
 1 files changed, 56 insertions(+), 33 deletions(-)

diff --git a/src/main/java/com/nanometer/smartlab/dao/DangerousEncodeMapper.xml b/src/main/java/com/nanometer/smartlab/dao/DangerousEncodeMapper.xml
index b00b7a5..84d2724 100644
--- a/src/main/java/com/nanometer/smartlab/dao/DangerousEncodeMapper.xml
+++ b/src/main/java/com/nanometer/smartlab/dao/DangerousEncodeMapper.xml
@@ -4,7 +4,7 @@
 
   <resultMap id="BaseResultMap" type="com.nanometer.smartlab.entity.DangerousEncode">
     <!--          -->
-    <id column="id" jdbcType="VARCHAR" property="id" />
+    <id column="id" jdbcType="BIGINT" property="id" />
     <result column="container_number" jdbcType="VARCHAR" property="containerNumber" />
     <result column="reagent_code" jdbcType="VARCHAR" property="reagentCode" />
     <result column="reagent_name" jdbcType="VARCHAR" property="reagentName" />
@@ -23,34 +23,34 @@
   </resultMap>
   <sql id="Base_Column_List">
     <!--          -->
-    id, container_number, reagent_code, reagent_name, cas, memo, property, feature, avoid, 
+    id, container_number, reagent_code, reagent_name, cas, memo, property, feature, avoid,
     status, fire, random, code, update_time, creator, count
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
     <!--          -->
-    select 
+    select
     <include refid="Base_Column_List" />
     from sys_dangerous_encode
-    where id = #{id,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=BIGINT}
   </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     <!--          -->
     delete from sys_dangerous_encode
-    where id = #{id,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=BIGINT}
   </delete>
   <insert id="insert" parameterType="com.nanometer.smartlab.entity.DangerousEncode">
     <!--          -->
-    insert into sys_dangerous_encode (id, container_number, reagent_code, 
-      reagent_name, cas, memo, 
-      property, feature, avoid, 
-      status, fire, random, 
-      code, update_time, creator, 
+    insert into sys_dangerous_encode (id, container_number, reagent_code,
+      reagent_name, cas, memo,
+      property, feature, avoid,
+      status, fire, random,
+      code, update_time, creator,
       count)
-    values (#{id,jdbcType=VARCHAR}, #{containerNumber,jdbcType=VARCHAR}, #{reagentCode,jdbcType=VARCHAR}, 
-      #{reagentName,jdbcType=VARCHAR}, #{cas,jdbcType=VARCHAR}, #{memo,jdbcType=VARCHAR}, 
-      #{property,jdbcType=VARCHAR}, #{feature,jdbcType=VARCHAR}, #{avoid,jdbcType=VARCHAR}, 
-      #{status,jdbcType=VARCHAR}, #{fire,jdbcType=VARCHAR}, #{random,jdbcType=VARCHAR}, 
-      #{code,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{creator,jdbcType=VARCHAR}, 
+    values (#{id,jdbcType=BIGINT}, #{containerNumber,jdbcType=VARCHAR}, #{reagentCode,jdbcType=VARCHAR},
+      #{reagentName,jdbcType=VARCHAR}, #{cas,jdbcType=VARCHAR}, #{memo,jdbcType=VARCHAR},
+      #{property,jdbcType=VARCHAR}, #{feature,jdbcType=VARCHAR}, #{avoid,jdbcType=VARCHAR},
+      #{status,jdbcType=VARCHAR}, #{fire,jdbcType=VARCHAR}, #{random,jdbcType=VARCHAR},
+      #{code,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{creator,jdbcType=VARCHAR},
       #{count,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective" parameterType="com.nanometer.smartlab.entity.DangerousEncode">
@@ -108,7 +108,7 @@
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
-        #{id,jdbcType=VARCHAR},
+        #{id,jdbcType=BIGINT},
       </if>
       <if test="containerNumber != null">
         #{containerNumber,jdbcType=VARCHAR},
@@ -207,7 +207,7 @@
         count = #{count,jdbcType=INTEGER},
       </if>
     </set>
-    where id = #{id,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=BIGINT}
   </update>
   <update id="updateByPrimaryKey" parameterType="com.nanometer.smartlab.entity.DangerousEncode">
     <!--          -->
@@ -227,7 +227,7 @@
       update_time = #{updateTime,jdbcType=TIMESTAMP},
       creator = #{creator,jdbcType=VARCHAR},
       count = #{count,jdbcType=INTEGER}
-    where id = #{id,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=BIGINT}
   </update>
 
   <select id="selectAll" parameterType="java.util.Map" resultMap="BaseResultMap">
@@ -235,20 +235,21 @@
     <include refid="Base_Column_List" />
     from sys_dangerous_encode
     <where>
+        1=1
       <if test="reagentName !=null and reagentName != ''">
-        reagent_name like concat("%",#{reagentName},"%")
+        and reagent_name like concat("%",#{reagentName},"%")
       </if>
       <if test="cas !=null and cas != ''">
-        cas like concat("%",#{cas},"%")
+        and cas like concat("%",#{cas},"%")
       </if>
       <if test="reagentCode!=null and reagentCode != ''">
-        reagent_code like concat("%",#{reagentCode},"%")
+        and reagent_code like concat("%",#{reagentCode},"%")
       </if>
       <if test="containerNumber !=null and containerNumber != ''">
-        container_number like concat("%",#{containerNumber},"%")
+        and container_number like concat("%",#{containerNumber},"%")
       </if>
     </where>
-    order by update_time
+    order by update_time desc
     <if test="offset !=null and pageSize != null">
       limit #{offset},#{pageSize}
     </if>
@@ -258,17 +259,18 @@
     select count(1)
     from sys_dangerous_encode
     <where>
+        1=1
       <if test="reagentName !=null and reagentName != ''">
-        reagent_name like concat("%",#{reagentName},"%")
+        and reagent_name like concat("%",#{reagentName},"%")
       </if>
       <if test="cas !=null and cas != ''">
-        cas like concat("%",#{cas},"%")
+        and cas like concat("%",#{cas},"%")
       </if>
       <if test="reagentCode!=null and reagentCode != ''">
-        reagent_code like concat("%",#{reagentCode},"%")
+        and reagent_code like concat("%",#{reagentCode},"%")
       </if>
       <if test="containerNumber !=null and containerNumber != ''">
-        container_number like concat("%",#{containerNumber},"%")
+        and container_number like concat("%",#{containerNumber},"%")
       </if>
     </where>
   </select>
@@ -279,18 +281,39 @@
     status, fire, random, code, update_time, creator, count
     from sys_dangerous_encode
     <where>
+      1=1
       <if test="reagentName !=null and reagentName != ''">
-        reagent_name like concat("%",#{reagentName},"%")
+        and reagent_name like concat("%",#{reagentName},"%")
       </if>
       <if test="cas !=null and cas != ''">
-        cas like concat("%",#{cas},"%")
+        and cas like concat("%",#{cas},"%")
       </if>
       <if test="reagentCode!=null and reagentCode != ''">
-        reagent_code like concat("%",#{reagentCode},"%")
+        and reagent_code like concat("%",#{reagentCode},"%")
       </if>
       <if test="containerNumber !=null and containerNumber != ''">
-        container_number like concat("%",#{containerNumber},"%")
+        and container_number like concat("%",#{containerNumber},"%")
       </if>
     </where>
   </select>
-</mapper>
\ No newline at end of file
+  <select id="selectByCodeAndName" resultType="com.nanometer.smartlab.entity.DangerousEncode">
+    select
+    <include refid="Base_Column_List" />
+    from sys_dangerous_encode
+    <where>
+      1=1
+      <if test="reagentcode != null and reagentcode != ''">
+        and reagent_code =  #{reagentcode}
+      </if>
+      <if test="reagentname != null and reagentname != ''">
+        and reagent_name =  #{reagentname}
+      </if>
+      <if test="cas != null and cas != ''">
+        and cas = #{cas}
+      </if>
+      <if test="code != null and code != ''">
+        and code = #{code}
+      </if>
+    </where>
+  </select>
+</mapper>

--
Gitblit v1.9.2