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/DangerousEncodeMapper.xml |  135 +++++++++++++++++++++++++++++++-------------
 1 files changed, 94 insertions(+), 41 deletions(-)

diff --git a/src/main/java/com/nanometer/smartlab/dao/DangerousEncodeMapper.xml b/src/main/java/com/nanometer/smartlab/dao/DangerousEncodeMapper.xml
index 5bb352b..97b497c 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"  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,43 +23,40 @@
   </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 id="selectByPrimaryKey"  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 id="insert" parameterType="com.nanometer.smartlab.entity.DangerousEncode" useGeneratedKeys = "true" keyProperty = "id">
     <!--          -->
-    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 ( 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 ( #{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">
+  <insert id="insertSelective" parameterType="com.nanometer.smartlab.entity.DangerousEncode" useGeneratedKeys = "true" keyProperty = "id">
     <!--          -->
     insert into sys_dangerous_encode
     <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
       <if test="containerNumber != null">
         container_number,
       </if>
@@ -107,9 +104,6 @@
       </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=VARCHAR},
-      </if>
       <if test="containerNumber != null">
         #{containerNumber,jdbcType=VARCHAR},
       </if>
@@ -207,7 +201,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 +221,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,37 +229,42 @@
     <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>
   </select>
 
   <select id="countAll" parameterType="java.util.Map" resultType="java.lang.Integer">
     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>
@@ -276,18 +275,72 @@
     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
+    id,
+      container_number containerNumber, reagent_code reagentCode, reagent_name reagentName, cas, memo, property, feature, avoid,
+      status, fire, random, code, update_time, creator, count
+    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 like concat("%",#{cas},"%")
+      </if>
+      <if test="code != null and code != ''">
+        and code = #{code}
+      </if>
+    </where>
+  </select>
+  <select id="selectByReagentName" resultMap="BaseResultMap">
+    select
+      container_number containerNumber, reagent_code reagentCode, reagent_name reagentName, cas, memo, property, feature, avoid,
+      status, fire, random, code, update_time, creator, count
+    from sys_dangerous_encode
+    <where>
+        1=1
+        <if test="reagentname != null and reagentname != ''">
+            and reagent_name like concat("%",#{reagentname},"%")
+        </if>
+        <if test="cas != null and cas != ''">
+            and cas like concat("%",#{cas},"%")
+        </if>
+    </where>
+  </select>
+  <select id="selectByName" resultMap="BaseResultMap">
+      select
+      id,container_number, reagent_code, reagent_name, cas, memo,
+      property, feature, avoid, status, fire, random, code, update_time, creator, count
+      from sys_dangerous_encode
+      <where>
+          1=1 and reagent_name = #{reagentname}
+      </where>
+  </select>
+  <select id="selectById" resultType="com.nanometer.smartlab.entity.DangerousEncode">
+    select
+    id,container_number containerNumber, reagent_code reagentCode, reagent_name reagentName, cas, memo,
+      property, feature, avoid, status, fire, random, code, update_time, creator, count
+    from sys_dangerous_encode
+    where id = #{id}
+  </select>
+</mapper>

--
Gitblit v1.9.2