From 591e3b8a10ed15023f3ad9e5a72a887ef89b0bb2 Mon Sep 17 00:00:00 2001
From: 刘小明 <liuxm_a@163.com>
Date: 星期一, 26 八月 2024 20:47:46 +0800
Subject: [PATCH] 修改判空方式

---
 pms-parent/pms-global/src/main/resources/mapper/PrDeviceMapper.xml |   48 ++++++++++++++++++++++++------------------------
 1 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrDeviceMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrDeviceMapper.xml
index e80217e..0f7b0df 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PrDeviceMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrDeviceMapper.xml
@@ -42,18 +42,18 @@
     <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPr.PrDevice" useGeneratedKeys="true">
         insert into pr_device
         <trim prefix="(" suffix=")" suffixOverrides=",">
-                <if test="id != null">id,</if>
-                <if test="proId != null">pro_id,</if>
-                <if test="batchId != null">batch_id,</if>
-                <if test="deviceNo != null">device_no,</if>
-                <if test="status != null">status,</if>
+                <if test="id != null and id !=''">id,</if>
+                <if test="proId != null and proId !=''">pro_id,</if>
+                <if test="batchId != null and batchId !=''">batch_id,</if>
+                <if test="deviceNo != null and deviceNo !=''">device_no,</if>
+                <if test="status != null and status !=''">status,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-                <if test="id != null">#{id,jdbcType=BIGINT},</if>
-                <if test="proId != null">#{proId,jdbcType=BIGINT},</if>
-                <if test="batchId != null">#{batchId,jdbcType=BIGINT},</if>
-                <if test="deviceNo != null">#{deviceNo},</if>
-                <if test="status != null">#{status,jdbcType=TINYINT},</if>
+                <if test="id != null and id !=''">#{id,jdbcType=BIGINT},</if>
+                <if test="proId != null and proId !=''">#{proId,jdbcType=BIGINT},</if>
+                <if test="batchId != null and batchId !=''">#{batchId,jdbcType=BIGINT},</if>
+                <if test="deviceNo != null and deviceNo !=''">#{deviceNo},</if>
+                <if test="status != null and status !=''">#{status,jdbcType=TINYINT},</if>
         </trim>
     </insert>
     <insert id="insertBatch" parameterType="java.util.List">
@@ -72,16 +72,16 @@
     <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoPr.PrDevice">
         update pr_device
         <set>
-                <if test="proId != null">
+                <if test="proId != null and proId !=''">
                     pro_id = #{proId,jdbcType=BIGINT},
                 </if>
-                <if test="batchId != null">
+                <if test="batchId != null and batchId !=''">
                     batch_id = #{batchId,jdbcType=BIGINT},
                 </if>
-                <if test="deviceNo != null">
+                <if test="deviceNo != null and deviceNo !=''">
                     device_no = #{deviceNo},
                 </if>
-                <if test="status != null">
+                <if test="status != null and status !=''">
                     status = #{status,jdbcType=TINYINT}
                 </if>
         </set>
@@ -102,19 +102,19 @@
         <include refid="Base_Column_List" />
         from pr_device
         <trim prefix="where" suffixOverrides="and">
-                <if test="id != null">
+                <if test="id != null and id !=''">
                     id = #{id,jdbcType=BIGINT} and
                 </if>
-                <if test="proId != null">
+                <if test="proId != null and proId !=''">
                     pro_id = #{proId,jdbcType=BIGINT} and
                 </if>
-                <if test="batchId != null">
+                <if test="batchId != null and batchId !=''">
                     batch_id = #{batchId,jdbcType=BIGINT} and
                 </if>
-                <if test="deviceNo != null">
+                <if test="deviceNo != null and deviceNo !=''">
                     device_no = #{deviceNo,jdbcType=BIGINT} and
                 </if>
-                <if test="status != null">
+                <if test="status != null and status !=''">
                     status = #{status,jdbcType=TINYINT} and
                 </if>
         </trim>
@@ -130,19 +130,19 @@
         select count(1)
         from pr_device
         <trim prefix="where" suffixOverrides="and">
-                <if test="id != null">
+                <if test="id != null and id !=''">
                     id = #{id,jdbcType=BIGINT} and
                 </if>
-                <if test="proId != null">
+                <if test="proId != null and proId !=''">
                     pro_id = #{proId,jdbcType=BIGINT} and
                 </if>
-                <if test="batchId != null">
+                <if test="batchId != null and batchId !=''">
                     batch_id = #{batchId,jdbcType=BIGINT} and
                 </if>
-                <if test="deviceNo != null">
+                <if test="deviceNo != null and deviceNo !=''">
                     device_no = #{deviceNo,jdbcType=BIGINT} and
                 </if>
-                <if test="status != null">
+                <if test="status != null and status !=''">
                     status = #{status,jdbcType=TINYINT} and
                 </if>
         </trim>

--
Gitblit v1.8.0