mirror of
https://gitee.com/log4j/pig.git
synced 2024-12-23 13:03:42 +08:00
解决在 mysql.version=5.6.46-log 时,权限管理-部门管理,修改部门时报错问题
This commit is contained in:
parent
cb1a6c6948
commit
f433df97a1
@ -42,5 +42,16 @@ public interface SysDeptRelationMapper extends BaseMapper<SysDeptRelation> {
|
||||
* @param deptRelation
|
||||
*/
|
||||
void updateDeptRelations(SysDeptRelation deptRelation);
|
||||
/**
|
||||
* 删除部门关系
|
||||
* @param deptRelation
|
||||
*/
|
||||
void deleteDeptRelations(SysDeptRelation deptRelation);
|
||||
|
||||
/**
|
||||
* 新增部门关系
|
||||
* @param deptRelation
|
||||
*/
|
||||
void insertDeptRelations(SysDeptRelation deptRelation);
|
||||
|
||||
}
|
||||
|
@ -84,8 +84,10 @@ public class SysDeptRelationServiceImpl extends ServiceImpl<SysDeptRelationMappe
|
||||
* @param relation
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateDeptRelation(SysDeptRelation relation) {
|
||||
baseMapper.updateDeptRelations(relation);
|
||||
baseMapper.deleteDeptRelations(relation);
|
||||
baseMapper.insertDeptRelations(relation);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,24 @@
|
||||
<sql id="Base_Column_List">
|
||||
ancestor, descendant
|
||||
</sql>
|
||||
|
||||
<!-- 删除机构关系 -->
|
||||
<delete id="deleteDeptRelations" >
|
||||
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>
|
||||
<!-- 新增机构关系 -->
|
||||
<insert id="insertDeptRelations">
|
||||
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}
|
||||
</insert>
|
||||
<!-- 更新部门关系 -->
|
||||
<update id="updateDeptRelations">
|
||||
DELETE FROM sys_dept_relation
|
||||
|
Loading…
Reference in New Issue
Block a user