Explorar o código

修改换表BUG

lin %!s(int64=4) %!d(string=hai) anos
pai
achega
e24876ac8d

+ 6 - 4
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/WaterMeterMaintenanceLogServiceImpl.java

@@ -199,12 +199,14 @@ public class WaterMeterMaintenanceLogServiceImpl implements WaterMeterMaintenanc
                         newDevice.setRegisterStatus(1);
                     }
                 }
-                ChannelDeviceTypeUse use = channelDeviceTypeUseMapper.findByDeviceId(waterMeterMaintenanceLog.getNewDeviceTypeId());
-                if (use != null) {
-                    newDevice.setSysId(use.getChannelId());
+                if(device.getSysId()!=-99){
+                    ChannelDeviceTypeUse use = channelDeviceTypeUseMapper.findByDeviceId(waterMeterMaintenanceLog.getNewDeviceTypeId());
+                    if (use != null) {
+                        newDevice.setSysId(use.getChannelId());
+                    }
                 }
-
                 newDevice.setDeviceType(waterMeterMaintenanceLog.getNewDeviceTypeId());
+
             }
             newDevice.setDateUpdate(LocalDateTime.now());
             deviceMapper.updateByPrimaryKeySelective(newDevice);

+ 6 - 4
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/WaterMeterReplaceLogServiceImpl.java

@@ -220,12 +220,14 @@ public class WaterMeterReplaceLogServiceImpl implements WaterMeterReplaceLogServ
                     newDevice.setRegisterStatus(1);
                 }
             }
-            ChannelDeviceTypeUse use = channelDeviceTypeUseMapper.findByDeviceId(waterMeterReplaceInputDto.getNewDeviceTypeId());
-            if (use != null) {
-                newDevice.setSysId(use.getChannelId());
+            if(device.getSysId()!=-99){
+                ChannelDeviceTypeUse use = channelDeviceTypeUseMapper.findByDeviceId(waterMeterReplaceInputDto.getNewDeviceTypeId());
+                if (use != null) {
+                    newDevice.setSysId(use.getChannelId());
+                }
             }
-
             newDevice.setDeviceType(waterMeterReplaceInputDto.getNewDeviceTypeId());
+
         }
         newDevice.setDateUpdate(LocalDateTime.now());
         deviceMapper.updateByPrimaryKeySelective(newDevice);

+ 7 - 7
smart-city-platform/src/main/resources/mapper/WaterMeterReplaceLogMapper.xml

@@ -306,7 +306,7 @@
         d.loc_desc,
         sc.customer_name,
         sb.name as building_name,
-        sil.is_accepted,
+        IFNULL(sil.is_accepted,1) as is_accepted,
         sdt1.equipment_type as new_equipment_type,
         sdt1.model as new_model,
         sdm1.name as new_manufacturer_name,
@@ -334,8 +334,8 @@
         <if test="replaceMethod != null"> and rl.replace_method = #{replaceMethod}</if>
         <if test="customerId != null"> and d.customer_id = #{customerId}</if>
         <if test="replaceUsername != null and replaceUsername != ''"> and rl.replace_username LIKE concat('%',#{replaceUsername},'%')</if>
-        <if test="isAccepted != null and isAccepted == 1"> and sil.is_accepted = #{isAccepted}</if>
-        <if test="isAccepted != null and isAccepted == 0"> and (sil.is_accepted = #{isAccepted} or sil.is_accepted is null)</if>
+        <if test="isAccepted != null and isAccepted == 1"> and (sil.is_accepted = #{isAccepted} or sil.is_accepted is null)</if>
+        <if test="isAccepted != null and isAccepted == 0"> and sil.is_accepted = #{isAccepted} </if>
         <if test="provinceId != null"> and sb.province = #{provinceId}</if>
         <if test="cityId != null"> and sb.city = #{cityId}</if>
         <if test="regionId != null"> and sb.region = #{regionId}</if>
@@ -370,8 +370,8 @@
         <if test="replaceMethod != null"> and rl.replace_method = #{replaceMethod}</if>
         <if test="customerId != null"> and d.customer_id = #{customerId}</if>
         <if test="replaceUsername != null and replaceUsername != ''"> and rl.replace_username LIKE concat('%',#{replaceUsername},'%')</if>
-        <if test="isAccepted != null and isAccepted == 1"> and sil.is_accepted = #{isAccepted}</if>
-        <if test="isAccepted != null and isAccepted == 0"> and (sil.is_accepted = #{isAccepted} or sil.is_accepted is null)</if>
+        <if test="isAccepted != null and isAccepted == 1"> and (sil.is_accepted = #{isAccepted} or sil.is_accepted is null)</if>
+        <if test="isAccepted != null and isAccepted == 0"> and sil.is_accepted = #{isAccepted} </if>
         <if test="provinceId != null"> and sb.province = #{provinceId}</if>
         <if test="cityId != null"> and sb.city = #{cityId}</if>
         <if test="regionId != null"> and sb.region = #{regionId}</if>
@@ -415,8 +415,8 @@
             <if test="replaceMethod != null"> and rl.replace_method = #{replaceMethod}</if>
             <if test="customerId != null"> and sd.customer_id = #{customerId}</if>
             <if test="replaceUsername != null and replaceUsername != ''"> and rl.replace_username LIKE concat('%',#{replaceUsername},'%')</if>
-            <if test="isAccepted != null and isAccepted == 1"> and sil.is_accepted = #{isAccepted}</if>
-            <if test="isAccepted != null and isAccepted == 0"> and (sil.is_accepted = #{isAccepted} or sil.is_accepted is null)</if>
+            <if test="isAccepted != null and isAccepted == 1"> and (sil.is_accepted = #{isAccepted} or sil.is_accepted is null)</if>
+            <if test="isAccepted != null and isAccepted == 0"> and sil.is_accepted = #{isAccepted} </if>
             <if test="startDate != null"> and rl.date_create <![CDATA[ >= ]]> #{startDate}</if>
             <if test="endDate != null"> and rl.date_create <![CDATA[ <= ]]> #{endDate}</if>
             <if test="programItems != null and programItems.size() != 0"> and