Merge branch 'dev' of https://gitee.ltd/pig/pigx into dev
This commit is contained in:
commit
b860c20ca4
6 files changed
+56
-32
No files matched your search
-7
@@ -41,11 +41,4 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
|
||||
* @return 数据列表
|
||||
*/
|
||||
List<SysDept> selectDeptDtoList(String delFlag);
|
||||
|
||||
/**
|
||||
* 删除部门关系表数据
|
||||
*
|
||||
* @param id 部门ID
|
||||
*/
|
||||
void deleteDeptRealtion(Integer id);
|
||||
}
|
||||
+12
@@ -31,5 +31,17 @@ import com.pig4cloud.pigx.admin.api.entity.SysDeptRelation;
|
||||
* @since 2018-02-12
|
||||
*/
|
||||
public interface SysDeptRelationMapper extends BaseMapper<SysDeptRelation> {
|
||||
/**
|
||||
* 删除部门关系表数据
|
||||
*
|
||||
* @param id 部门ID
|
||||
*/
|
||||
void deleteAllDeptRealtion(Integer id);
|
||||
|
||||
/**
|
||||
* 更改部分关系表数据
|
||||
*
|
||||
* @param deptRelation
|
||||
*/
|
||||
void updateDeptRealtion(SysDeptRelation deptRelation);
|
||||
}
|
||||
+6
-5
@@ -100,7 +100,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
sysDept.setUpdateTime(LocalDateTime.now());
|
||||
sysDept.setDelFlag(CommonConstant.STATUS_DEL);
|
||||
this.deleteById(sysDept);
|
||||
sysDeptMapper.deleteDeptRealtion(id);
|
||||
sysDeptRelationMapper.deleteAllDeptRealtion(id);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -114,10 +114,11 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
public Boolean updateDeptById(SysDept sysDept) {
|
||||
//更新部门状态
|
||||
this.updateById(sysDept);
|
||||
//删除部门关系
|
||||
sysDeptMapper.deleteDeptRealtion(sysDept.getDeptId());
|
||||
//新建部门关系
|
||||
this.insertDeptRelation(sysDept);
|
||||
//更新部门关系
|
||||
SysDeptRelation relation = new SysDeptRelation();
|
||||
relation.setAncestor(sysDept.getParentId());
|
||||
relation.setDescendant(sysDept.getDeptId());
|
||||
sysDeptRelationMapper.updateDeptRealtion(relation);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,25 +35,6 @@
|
||||
<sql id="Base_Column_List">
|
||||
dept_id AS deptId, parent_id AS parentId, name, order_num AS orderNum, create_time AS createTime, update_time AS updateTime, del_flag AS delFlag
|
||||
</sql>
|
||||
<delete id="deleteDeptRealtion">
|
||||
DELETE
|
||||
FROM
|
||||
sys_dept_relation
|
||||
WHERE
|
||||
descendant IN (
|
||||
SELECT
|
||||
temp.descendant
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
descendant
|
||||
FROM
|
||||
sys_dept_relation
|
||||
WHERE
|
||||
ancestor = #{id}
|
||||
) temp
|
||||
)
|
||||
</delete>
|
||||
|
||||
<!--关联查询部门列表-->
|
||||
<select id="selectDeptDtoList" resultType="com.pig4cloud.pigx.admin.api.entity.SysDept">
|
||||
|
||||
@@ -32,4 +32,41 @@
|
||||
ancestor, descendant
|
||||
</sql>
|
||||
|
||||
<!-- 更新部门关系 -->
|
||||
<update id="updateDeptRealtion">
|
||||
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
|
||||
WHERE a.descendant = #{ancestor}
|
||||
AND b.ancestor = #{descendant};
|
||||
</update>
|
||||
|
||||
<!--删除部门-->
|
||||
<delete id="deleteAllDeptRealtion">
|
||||
DELETE
|
||||
FROM
|
||||
sys_dept_relation
|
||||
WHERE
|
||||
descendant IN (
|
||||
SELECT
|
||||
temp.descendant
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
descendant
|
||||
FROM
|
||||
sys_dept_relation
|
||||
WHERE
|
||||
ancestor = #{id}
|
||||
) temp
|
||||
)
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -37,7 +37,7 @@
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<pigx.version>1.6.1</pigx.version>
|
||||
<pigx.version>1.6.2</pigx.version>
|
||||
<spring-boot.version>2.0.4.RELEASE</spring-boot.version>
|
||||
<spring-cloud.version>Finchley.SR1</spring-cloud.version>
|
||||
<spring-platform.version>Cairo-SR2</spring-platform.version>
|
||||
|
||||
Reference in new issue
Block a user