shiyue 5 месяцев назад
Родитель
Сommit
bdfb5b58a2

+ 4 - 2
energy-manage-service/src/main/java/com/energy/manage/service/service/units/impl/UnitServiceImpl.java

@@ -112,10 +112,11 @@ public class UnitServiceImpl implements UnitService {
             //更新
             if (unitBearingsPO.getId() != null && unitBearingsPO.getId() > 0) {
                 unitBearingsPO.setUpdateBy(userId);
+                unitBearingsPO.setMillTypeCode(unitDto.getMillTypeCode());
                 Example queryExample = new Example(UnitBearingsPO.class);
                 Example.Criteria criteria = queryExample.createCriteria();
                 criteria.andEqualTo("id", unitBearingsPO.getId());
-                flg = unitBearingsMapper.updateByExampleSelective(unitBearingsPO, queryExample) > 0;
+                flg = unitBearingsMapper.updateByExample(unitBearingsPO, queryExample) > 0;
                 break outBearings;
             }
             // 创建
@@ -139,10 +140,11 @@ public class UnitServiceImpl implements UnitService {
             //更新
             if (unitDynamoPO.getId() != null && unitDynamoPO.getId() > 0) {
                 unitDynamoPO.setUpdateBy(userId);
+                unitDynamoPO.setMillTypeCode(unitDto.getMillTypeCode());
                 Example queryExample = new Example(UnitDynamoPO.class);
                 Example.Criteria criteria = queryExample.createCriteria();
                 criteria.andEqualTo("id", unitDynamoPO.getId());
-                flg = unitDynamoMapper.updateByExampleSelective(unitDynamoPO, queryExample) > 0;
+                flg = unitDynamoMapper.updateByExample(unitDynamoPO, queryExample) > 0;
                 break outDynamo;
             }
             // 创建

+ 13 - 13
energy-manage-service/src/main/resources/mybatis/units/UnitGearBoxBearingsMapper.xml

@@ -8,19 +8,19 @@
         <foreach collection="list" item="item" index="index" separator=";">
             UPDATE unit_gearbox_bearings
             <set>
-                <if test="item.gearboxCode != null">gearbox_code = #{item.gearboxCode},</if>
-                <if test="item.parallelWheelGrade != null">parallel_wheel_grade = #{item.parallelWheelGrade},</if>
-                <if test="item.gearboxBearingNumber != null">gearbox_bearing_number = #{item.gearboxBearingNumber},</if>
-                <if test="item.gearboxBearingLevel != null">gearbox_bearing_level = #{item.gearboxBearingLevel},</if>
-                <if test="item.bearingBrand != null">bearing_brand = #{item.bearingBrand},</if>
-                <if test="item.bearingModel != null">bearing_model = #{item.bearingModel},</if>
-                <if test="item.gearRingTeethCount != null">gear_ring_teeth_count = #{item.gearRingTeethCount},</if>
-                <if test="item.bearingRsBrand != null">bearing_rs_brand = #{item.bearingRsBrand},</if>
-                <if test="item.bearingRsModel != null">bearing_rs_model = #{item.bearingRsModel},</if>
-                <if test="item.bearingGsBrand != null">bearing_gs_brand = #{item.bearingGsBrand},</if>
-                <if test="item.bearingGsModel != null">bearing_gs_model = #{item.bearingGsModel},</if>
-                <if test="item.updateBy != null">update_by = #{item.updateBy},</if>
-                <if test="item.updateTime != null">update_time = #{item.updateTime}</if>
+                <if test="item.gearboxCode != null">gearbox_code = #{item.gearboxCode},</if><if test="item.gearboxCode == null">gearbox_code = null,</if>
+                <if test="item.parallelWheelGrade != null">parallel_wheel_grade = #{item.parallelWheelGrade},</if><if test="item.parallelWheelGrade == null">parallel_wheel_grade = null,</if>
+                <if test="item.gearboxBearingNumber != null">gearbox_bearing_number = #{item.gearboxBearingNumber},</if><if test="item.gearboxBearingNumber == null">gearbox_bearing_number = null,</if>
+                <if test="item.gearboxBearingLevel != null">gearbox_bearing_level = #{item.gearboxBearingLevel},</if><if test="item.gearboxBearingLevel == null">gearbox_bearing_level = null,</if>
+                <if test="item.bearingBrand != null">bearing_brand = #{item.bearingBrand},</if><if test="item.bearingBrand == null">bearing_brand = null,</if>
+                <if test="item.bearingModel != null">bearing_model = #{item.bearingModel},</if><if test="item.bearingModel == null">bearing_model = null,</if>
+                <if test="item.gearRingTeethCount != null">gear_ring_teeth_count = #{item.gearRingTeethCount},</if><if test="item.gearRingTeethCount == null">gear_ring_teeth_count = null,</if>
+                <if test="item.bearingRsBrand != null">bearing_rs_brand = #{item.bearingRsBrand},</if><if test="item.bearingRsBrand == null">bearing_rs_brand = null,</if>
+                <if test="item.bearingRsModel != null">bearing_rs_model = #{item.bearingRsModel},</if><if test="item.bearingRsModel == null">bearing_rs_model = null,</if>
+                <if test="item.bearingGsBrand != null">bearing_gs_brand = #{item.bearingGsBrand},</if><if test="item.bearingGsBrand == null">bearing_gs_brand = null,</if>
+                <if test="item.bearingGsModel != null">bearing_gs_model = #{item.bearingGsModel},</if><if test="item.bearingGsModel == null">bearing_gs_model = null,</if>
+                <if test="item.updateBy != null">update_by = #{item.updateBy},</if><if test="item.updateBy == null">update_by = null,</if>
+                <if test="item.updateTime != null">update_time = #{item.updateTime}</if><if test="item.updateTime == null">update_time = null}</if>
             </set>
             WHERE id = #{item.id}
         </foreach>

+ 22 - 19
energy-manage-service/src/main/resources/mybatis/units/UnitGearBoxStructureMapper.xml

@@ -9,32 +9,35 @@
             UPDATE unit_gearbox_structure
             <set>
                 <if test="item.gearboxCode != null">gearbox_code = #{item.gearboxCode},</if>
+                <if test="item.gearboxCode == null">gearbox_code = null,</if>
                 <if test="item.gearboxStructure != null">gearbox_structure = #{item.gearboxStructure},</if>
+                <if test="item.gearboxStructure == null">gearbox_structure  = null,</if>
                 <if test="item.planetaryGearGrade != null">planetary_gear_grade = #{item.planetaryGearGrade},</if>
-                <if test="item.largeGearTeethCount != null">large_gear_teeth_count =
-                    #{item.largeGearTeethCount},
-                </if>
-                <if test="item.smallGearTeethCount != null">small_gear_teeth_count =
-                    #{item.smallGearTeethCount},
-                </if>
+                <if test="item.planetaryGearGrade == null">planetary_gear_grade  = null,</if>
+                <if test="item.largeGearTeethCount != null">large_gear_teeth_count = #{item.largeGearTeethCount},</if>
+                <if test="item.largeGearTeethCount == null">large_gear_teeth_count  = null,</if>
+                <if test="item.smallGearTeethCount != null">small_gear_teeth_count = #{item.smallGearTeethCount}, </if>
+                <if test="item.smallGearTeethCount== null">small_gear_teeth_count = null,</if>
                 <if test="item.bearingBrand != null">bearing_brand = #{item.bearingBrand},</if>
+                <if test="item.bearingBrand == null">bearing_brand  = null,</if>
                 <if test="item.bearingModel != null">bearing_model = #{item.bearingModel},</if>
-                <if test="item.gearRingTeethCount != null">gear_ring_teeth_count = #{item.gearRingTeethCount},
-                </if>
-                <if test="item.sunWheelTeethCount != null">sun_wheel_teeth_count = #{item.sunWheelTeethCount},
-                </if>
+                <if test="item.bearingModel == null">bearing_model  = null,</if>
+                <if test="item.gearRingTeethCount != null">gear_ring_teeth_count = #{item.gearRingTeethCount},</if>
+                <if test="item.gearRingTeethCount == null">gear_ring_teeth_count  = null,</if>
+                <if test="item.sunWheelTeethCount != null">sun_wheel_teeth_count = #{item.sunWheelTeethCount},</if>
+                <if test="item.sunWheelTeethCount == null">sun_wheel_teeth_count  = null,</if>
                 <if test="item.planetWheelCount != null">planet_wheel_count = #{item.planetWheelCount},</if>
-                <if test="item.planetWheelTeethCount != null">planet_wheel_teeth_count =
-                    #{item.planetWheelTeethCount},
-                </if>
-                <if test="item.sunWheelBearingBrand != null">sun_wheel_bearing_brand =
-                    #{item.sunWheelBearingBrand},
-                </if>
-                <if test="item.sunWheelBearingModel != null">sun_wheel_bearing_model =
-                    #{item.sunWheelBearingModel},
-                </if>
+                <if test="item.planetWheelCount == null">planet_wheel_count  = null,</if>
+                <if test="item.planetWheelTeethCount != null">planet_wheel_teeth_count = #{item.planetWheelTeethCount}, </if>
+                <if test="item.planetWheelTeethCount == null">planet_wheel_teeth_count  = null, </if>
+                <if test="item.sunWheelBearingBrand != null">sun_wheel_bearing_brand =#{item.sunWheelBearingBrand},</if>
+                <if test="item.sunWheelBearingBrand == null">sun_wheel_bearing_brand  = null,</if>
+                <if test="item.sunWheelBearingModel != null">sun_wheel_bearing_model =#{item.sunWheelBearingModel},</if>
+                <if test="item.sunWheelBearingModel == null">sun_wheel_bearing_model  = null,</if>
                 <if test="item.updateBy != null">update_by = #{item.updateBy},</if>
+                <if test="item.updateBy == null">update_by =  = null,</if>
                 <if test="item.updateTime != null">update_time = #{item.updateTime}</if>
+                <if test="item.updateTime == null">update_time  = null</if>
             </set>
             WHERE id = #{item.id}
         </foreach>