cr пре 1 месец
родитељ
комит
604947a453

+ 3 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.java

@@ -182,5 +182,7 @@ public interface WbsTreeContractMapper extends EasyBaseMapper<WbsTreeContract> {
 
     List<WbsTreeContract> getChildWbsTreeContracts(@Param("pKeyId") Long pKeyId);
 
-    void updateAncestorsPid(@Param("ancestorsPid") String ancestorsPid, @Param("ancestors") String ancestors,@Param("pKeyId")Long pKeyId);
+    void updateAncestorsPid(@Param("ancestorsPId") String ancestorsPId, @Param("ancestors") String ancestors,@Param("pKeyId")Long pKeyId);
+
+    void updateWbsTreeAncestors(@Param("contract")WbsTreeContract contract);
 }

+ 7 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml

@@ -845,9 +845,12 @@
     </update>
     <update id="updateAncestorsPid">
         UPDATE m_wbs_tree_contract
-        SET ancestors_p_id = #{ancestorsPid},ancestors = #{ancestors}
+        SET ancestors_p_id = #{ancestorsPId},ancestors = #{ancestors}
         WHERE p_key_id = #{pKeyId}
     </update>
+    <update id="updateWbsTreeAncestors">
+        update m_wbs_tree_contract set p_id = #{contract.pId},parent_id=#{contract.parentId},ancestors_p_id = #{contract.ancestorsPId},ancestors = #{contract.ancestors} where p_key_id = #{contract.pKeyId}
+    </update>
 
     <select id="selectQueryValueLikeNodeName" resultMap="ResultMap">
         select *
@@ -1057,14 +1060,14 @@
         select * from m_wbs_tree_contract where p_id= (select p_id from m_wbs_tree_contract where p_key_id=#{pKeyId}) and is_deleted=0;
     </select>
     <select id="getWbsTreeContractsByPKeyIds" resultType="org.springblade.manager.entity.WbsTreeContract">
-        select * from m_wbs_tree_contract where p_key_id in (
-        <foreach collection="list" item="pkeyId" separator=",">
+        select p_key_id,parent_id,p_id,ancestors,ancestors_p_id from m_wbs_tree_contract where p_key_id in (
+        <foreach collection="pKeyIds" item="pkeyId" separator=",">
             #{pkeyId}
         </foreach>
         ) and is_deleted=0
     </select>
     <select id="getChildWbsTreeContracts" resultType="org.springblade.manager.entity.WbsTreeContract">
-        select * from m_wbs_tree_contract where ancestors_p_id like #{pId}  and is_deleted=0
+        select p_key_id,ancestors,ancestors_p_id from m_wbs_tree_contract where ancestors_p_id like #{pKeyId}  and is_deleted=0
     </select>
 
 </mapper>

+ 4 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -4701,15 +4701,15 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
             List<WbsTreeContract> childContracts = wbsTreeContractMapper.getChildWbsTreeContracts(contract.getPKeyId());
             if(!childContracts.isEmpty()){
                 for (WbsTreeContract childContract : childContracts) {
-                    String ancestorsPid =  childContract.getAncestorsPId();
-                    ancestorsPid=ancestorsPid.replace(oldancestorsPId,contract.getAncestorsPId());
+                    String ancestorsPId =  childContract.getAncestorsPId();
+                    ancestorsPId=ancestorsPId.replace(oldancestorsPId,contract.getAncestorsPId());
                     String ancestors = childContract.getAncestors();
                     ancestors=ancestors.replace(oldancestors,contract.getAncestors());
-                    wbsTreeContractMapper.updateAncestorsPid(ancestorsPid,ancestors,childContract.getPKeyId());
+                    wbsTreeContractMapper.updateAncestorsPid(ancestorsPId,ancestors,childContract.getPKeyId());
                 }
             }
+            this.wbsTreeContractMapper.updateWbsTreeAncestors(contract);
         }
-        this.updateBatchById(list);
         return R.success("操作成功");
     }