shiyue 6 місяців тому
батько
коміт
e4345a3cbf

+ 12 - 0
energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitGearboxBearingsMapper.java

@@ -3,8 +3,20 @@ package com.energy.manage.service.mappers.units;
 import com.energy.manage.common.mapper.MyMapper;
 import com.energy.manage.common.po.units.UnitGearboxBearingsPO;
 import com.energy.manage.common.po.units.UnitGearboxPO;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 @Repository
 public interface UnitGearboxBearingsMapper extends MyMapper<UnitGearboxBearingsPO> {
+
+    /**
+     * 批量更新
+     * @param list
+     */
+    void batchUpdate(@Param("list") List<UnitGearboxBearingsPO> list);
+
+
+
 }

+ 13 - 0
energy-manage-service/src/main/java/com/energy/manage/service/mappers/units/UnitGearboxStructureMapper.java

@@ -1,10 +1,23 @@
 package com.energy.manage.service.mappers.units;
 
 import com.energy.manage.common.mapper.MyMapper;
+import com.energy.manage.common.po.units.UnitGearboxBearingsPO;
 import com.energy.manage.common.po.units.UnitGearboxPO;
 import com.energy.manage.common.po.units.UnitGearboxStructurePO;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 @Repository
 public interface UnitGearboxStructureMapper extends MyMapper<UnitGearboxStructurePO> {
+
+    /**
+     * 批量更新
+     * @param list
+     */
+    void batchUpdate(@Param("list") List<UnitGearboxStructurePO> list);
+
+
+
 }

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

@@ -201,11 +201,11 @@ public class UnitServiceImpl implements UnitService {
                     unitGearboxBearingsPO.setUpdateTime(new Date());
                     unitGearboxBearingsPOList.add(unitGearboxBearingsPO);
                 }
-                UnitGearboxBearingsPO po = new UnitGearboxBearingsPO();
-                po.setGearboxCode(unitGearboxPO.getCode());
-                unitGearboxBearingsMapper.delete(po);
+//                UnitGearboxBearingsPO po = new UnitGearboxBearingsPO();
+//                po.setGearboxCode(unitGearboxPO.getCode());
+//                unitGearboxBearingsMapper.delete(po);
 
-                flg = unitGearboxBearingsMapper.insertList(unitGearboxBearingsPOList) > 0;
+                unitGearboxBearingsMapper.batchUpdate(unitGearboxBearingsPOList);
             }
 
             // 处理齿轮箱结构
@@ -222,11 +222,11 @@ public class UnitServiceImpl implements UnitService {
                     unitGearboxStructurePO.setUpdateBy(userId);
                     unitGearboxStructurePOList.add(unitGearboxStructurePO);
                 }
-                UnitGearboxStructurePO po = new UnitGearboxStructurePO();
-                po.setGearboxCode(unitGearboxPO.getCode());
-                unitGearboxStructureMapper.delete(po);
+//                UnitGearboxStructurePO po = new UnitGearboxStructurePO();
+//                po.setGearboxCode(unitGearboxPO.getCode());
+//                unitGearboxStructureMapper.delete(po);
 
-                flg = unitGearboxStructureMapper.insertList(unitGearboxStructurePOList) > 0;
+                  unitGearboxStructureMapper.batchUpdate(unitGearboxStructurePOList);
             }
         }
         return flg;

+ 1 - 0
energy-manage-service/src/main/resources/mybatis/units/UnitBrandModelMapper.xml

@@ -25,4 +25,5 @@
 
 
 
+
 </mapper>

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

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.energy.manage.service.mappers.units.UnitGearboxBearingsMapper">
+
+
+    <!-- 批量更新语句 -->
+    <update id="batchUpdate" parameterType="java.util.List">
+        <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>
+            </set>
+            WHERE id = #{item.id}
+        </foreach>
+    </update>
+
+
+</mapper>

+ 44 - 0
energy-manage-service/src/main/resources/mybatis/units/UnitGearBoxStructureMapper.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.energy.manage.service.mappers.units.UnitGearboxStructureMapper">
+
+
+    <!-- 批量更新语句 -->
+    <update id="batchUpdate" parameterType="java.util.List">
+        <foreach collection="list" item="item" index="index" separator=";">
+            UPDATE unit_gearbox_structure
+            <set>
+                <if test="item.gearboxCode != null">gearbox_code = #{item.gearboxCode},</if>
+                <if test="item.gearboxStructure != null">gearbox_structure = #{item.gearboxStructure},</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.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.sunWheelTeethCount != null">sun_wheel_teeth_count = #{item.sunWheelTeethCount},
+                </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.updateBy != null">update_by = #{item.updateBy},</if>
+                <if test="item.updateTime != null">update_time = #{item.updateTime}</if>
+            </set>
+            WHERE id = #{item.id}
+        </foreach>
+    </update>
+
+
+</mapper>