diff --git a/pigx-gateway/src/main/resources/bootstrap.yml b/pigx-gateway/src/main/resources/bootstrap.yml index 83045b213..afd6b6fa2 100644 --- a/pigx-gateway/src/main/resources/bootstrap.yml +++ b/pigx-gateway/src/main/resources/bootstrap.yml @@ -14,4 +14,4 @@ spring: shared-configs: - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} profiles: - active: @profiles.active@ \ No newline at end of file + active: @profiles.active@ diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/mapper/SysDeptRelationMapper.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/mapper/SysDeptRelationMapper.java index 85637841f..9250bb62e 100644 --- a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/mapper/SysDeptRelationMapper.java +++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/mapper/SysDeptRelationMapper.java @@ -35,15 +35,21 @@ import org.apache.ibatis.annotations.Mapper; public interface SysDeptRelationMapper extends PigxBaseMapper { /** - * 删除部门关系表数据 + * 删除部门 > 删除所有关联此部门子节点的闭包关系 * @param id 部门ID */ - void deleteDeptRelationsById(Long id); + void deleteDeptRelationsByDeptId(Long id); /** - * 更改部分关系表数据 - * @param deptRelation + * 删除节点数据 + * @param deptRelation 关系节点 */ - void updateDeptRelations(SysDeptRelation deptRelation); + void deleteDeptRelations(SysDeptRelation deptRelation); + + /** + * 新增节点数据 + * @param deptRelation 关系节点 + */ + void insertDeptRelations(SysDeptRelation deptRelation); } diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDeptRelationServiceImpl.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDeptRelationServiceImpl.java index 70209d9a8..4e7dd22b2 100644 --- a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDeptRelationServiceImpl.java +++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDeptRelationServiceImpl.java @@ -79,7 +79,7 @@ public class SysDeptRelationServiceImpl extends ServiceImpl - - - - - - - - - ancestor, descendant - - - - - DELETE FROM sys_dept_relation - WHERE - descendant IN ( SELECT temp.descendant FROM - ( SELECT descendant FROM sys_dept_relation WHERE ancestor = #{descendant} ) temp ) - AND ancestor IN ( SELECT temp.ancestor FROM ( SELECT ancestor FROM - sys_dept_relation WHERE descendant = #{descendant} AND ancestor != descendant ) temp ); + + + DELETE FROM sys_dept_relation + WHERE + descendant IN ( SELECT temp.descendant FROM + ( SELECT descendant FROM sys_dept_relation WHERE ancestor = #{descendant} ) temp ) + AND ancestor IN ( SELECT temp.ancestor FROM ( SELECT ancestor FROM + sys_dept_relation WHERE descendant = #{descendant} AND ancestor != descendant ) temp ) + + + INSERT INTO sys_dept_relation (ancestor, descendant) SELECT a.ancestor, b.descendant FROM sys_dept_relation a - CROSS JOIN sys_dept_relation b + CROSS JOIN sys_dept_relation b WHERE a.descendant = #{ancestor} - AND b.ancestor = #{descendant}; - + AND b.ancestor = #{descendant} + - - - DELETE - FROM - sys_dept_relation - WHERE - descendant IN ( - SELECT - temp.descendant - FROM - ( - SELECT - descendant - FROM - sys_dept_relation - WHERE - ancestor = #{id} - ) temp - ) - + + + DELETE + FROM + sys_dept_relation + WHERE + descendant IN ( + SELECT + temp.descendant + FROM + ( + SELECT + descendant + FROM + sys_dept_relation + WHERE + ancestor = #{id} + ) temp + ) +