zhaoyun 4 månader sedan
förälder
incheckning
3db75b7d27

+ 2 - 0
ruoyi-powerdistribution/src/main/java/com/ruoyi/powerdistribution/mapper/PdmConstructTeamMapper.java

@@ -58,4 +58,6 @@ public interface PdmConstructTeamMapper
      * @return 结果
      */
     public int deletePdmConstructTeamByIds(Long[] ids);
+
+    public void clean();
 }

+ 2 - 0
ruoyi-powerdistribution/src/main/java/com/ruoyi/powerdistribution/mapper/PdmConstructorMapper.java

@@ -70,4 +70,6 @@ public interface PdmConstructorMapper
     public  int deletePdmConstructorByTeamIds(Long[] ids);
 
     public List<PdmConstructor> selectPdmConstructorByTeamNo(@Param("teamNo")String teamNo);
+
+    public void clean();
 }

+ 3 - 0
ruoyi-powerdistribution/src/main/java/com/ruoyi/powerdistribution/service/impl/PdmConstructTeamServiceImpl.java

@@ -127,6 +127,7 @@ public class PdmConstructTeamServiceImpl implements IPdmConstructTeamService
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public void importExcel(List<ConstructTeam> constructTeamList) {
         Map<String,PdmConstructTeamVo> data=new HashMap<>();
         for (ConstructTeam constructTeam : constructTeamList) {
@@ -153,6 +154,8 @@ public class PdmConstructTeamServiceImpl implements IPdmConstructTeamService
             }
         }
         System.out.println("解析数据:"+ JSON.toJSON(data.values()));
+        pdmConstructTeamMapper.clean();
+        pdmConstructorMapper.clean();
         data.values().forEach(dmConstructTeamVo->{
             insertPdmConstructTeam(dmConstructTeamVo);
 

+ 5 - 2
ruoyi-powerdistribution/src/main/resources/mapper/powerdistribution/PdmConstructTeamMapper.xml

@@ -57,9 +57,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="teamSerialNo != null "> and team_serial_no = #{teamSerialNo}</if>
             <if test="teamLeader != null  and teamLeader != ''"> and team_leader = #{teamLeader}</if>
             <if test="teamLeaderPhone != null  and teamLeaderPhone != ''"> and team_leader_phone = #{teamLeaderPhone}</if>
-            <if test="construcCarNumber != null  and construcCarNumber != ''"> and construc_car_number = #{construcCarNumber}</if>
             <if test="arrestPoint != null  and arrestPoint != ''"> and arrest_point = #{arrestPoint}</if>
         </where>
+        order by team_serial_no
     </select>
     
     <select id="selectPdmConstructTeamById" parameterType="Long" resultMap="PdmConstructTeamResult">
@@ -118,7 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="teamSerialNo != null">team_serial_no = #{teamSerialNo},</if>
             <if test="teamLeader != null">team_leader = #{teamLeader},</if>
             <if test="teamLeaderPhone != null">team_leader_phone = #{teamLeaderPhone},</if>
-            <if test="construcCarNumber != null">construc_car_number = #{construcCarNumber,typeHandler=com.ruoyi.common.handler.ConvertCommaSeparatedStrToListTypeHandler},</if>
+            construc_car_number = #{construcCarNumber,typeHandler=com.ruoyi.common.handler.ConvertCommaSeparatedStrToListTypeHandler},
             <if test="arrestPoint != null">arrest_point = #{arrestPoint},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
@@ -139,4 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+    <delete id="clean">
+        TRUNCATE TABLE pdm_construct_team
+    </delete>
 </mapper>

+ 4 - 1
ruoyi-powerdistribution/src/main/resources/mapper/powerdistribution/PdmConstructorMapper.xml

@@ -102,6 +102,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         )
     </delete>
     <select id="selectPdmConstructorByTeamNo" resultMap="PdmConstructorResult">
-        select * from pdm_constructor where team_no=#{teamNo}
+        select * from pdm_constructor where team_no=#{teamNo} order by construct_person_type,construct_personnel_name
     </select>
+    <delete id="clean">
+        TRUNCATE TABLE pdm_constructor
+    </delete>
 </mapper>