Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cocktail-party-server
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
cocktail-party
cocktail-party-server
Commits
a3116cd2
提交
a3116cd2
authored
6月 10, 2021
作者:
RuoYi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化部门父级启用状态
上级
2ace3257
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
14 行增加
和
17 行删除
+14
-17
SysDeptMapper.java
.../src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java
+3
-3
SysDeptServiceImpl.java
...ava/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
+6
-6
SysDeptMapper.xml
...system/src/main/resources/mapper/system/SysDeptMapper.xml
+5
-8
没有找到文件。
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java
浏览文件 @
a3116cd2
...
@@ -94,11 +94,11 @@ public interface SysDeptMapper
...
@@ -94,11 +94,11 @@ public interface SysDeptMapper
public
int
updateDept
(
SysDept
dept
);
public
int
updateDept
(
SysDept
dept
);
/**
/**
* 修改所在部门
的父级部门
状态
* 修改所在部门
正常
状态
*
*
* @param dept
部门
* @param dept
Ids 部门ID组
*/
*/
public
void
updateDeptStatus
(
SysDept
dept
);
public
void
updateDeptStatus
Normal
(
Long
[]
deptIds
);
/**
/**
* 修改子元素关系
* 修改子元素关系
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
浏览文件 @
a3116cd2
...
@@ -11,6 +11,7 @@ import com.ruoyi.common.constant.UserConstants;
...
@@ -11,6 +11,7 @@ import com.ruoyi.common.constant.UserConstants;
import
com.ruoyi.common.core.domain.TreeSelect
;
import
com.ruoyi.common.core.domain.TreeSelect
;
import
com.ruoyi.common.core.domain.entity.SysDept
;
import
com.ruoyi.common.core.domain.entity.SysDept
;
import
com.ruoyi.common.core.domain.entity.SysRole
;
import
com.ruoyi.common.core.domain.entity.SysRole
;
import
com.ruoyi.common.core.text.Convert
;
import
com.ruoyi.common.exception.CustomException
;
import
com.ruoyi.common.exception.CustomException
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.system.mapper.SysDeptMapper
;
import
com.ruoyi.system.mapper.SysDeptMapper
;
...
@@ -211,7 +212,7 @@ public class SysDeptServiceImpl implements ISysDeptService
...
@@ -211,7 +212,7 @@ public class SysDeptServiceImpl implements ISysDeptService
if
(
UserConstants
.
DEPT_NORMAL
.
equals
(
dept
.
getStatus
()))
if
(
UserConstants
.
DEPT_NORMAL
.
equals
(
dept
.
getStatus
()))
{
{
// 如果该部门是启用状态,则启用该部门的所有上级部门
// 如果该部门是启用状态,则启用该部门的所有上级部门
updateParentDeptStatus
(
dept
);
updateParentDeptStatus
Normal
(
dept
);
}
}
return
result
;
return
result
;
}
}
...
@@ -221,12 +222,11 @@ public class SysDeptServiceImpl implements ISysDeptService
...
@@ -221,12 +222,11 @@ public class SysDeptServiceImpl implements ISysDeptService
*
*
* @param dept 当前部门
* @param dept 当前部门
*/
*/
private
void
updateParentDeptStatus
(
SysDept
dept
)
private
void
updateParentDeptStatus
Normal
(
SysDept
dept
)
{
{
String
updateBy
=
dept
.
getUpdateBy
();
String
ancestors
=
dept
.
getAncestors
();
dept
=
deptMapper
.
selectDeptById
(
dept
.
getDeptId
());
Long
[]
deptIds
=
Convert
.
toLongArray
(
ancestors
);
dept
.
setUpdateBy
(
updateBy
);
deptMapper
.
updateDeptStatusNormal
(
deptIds
);
deptMapper
.
updateDeptStatus
(
dept
);
}
}
/**
/**
...
...
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
浏览文件 @
a3116cd2
...
@@ -140,14 +140,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -140,14 +140,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</foreach>
</update>
</update>
<update
id=
"updateDeptStatus"
parameterType=
"SysDept"
>
<update
id=
"updateDeptStatusNormal"
parameterType=
"Long"
>
update sys_dept
update sys_dept set status = '0' where dept_id in
<set>
<foreach
collection=
"array"
item=
"deptId"
open=
"("
separator=
","
close=
")"
>
<if
test=
"status != null and status != ''"
>
status = #{status},
</if>
#{deptId}
<if
test=
"updateBy != null and updateBy != ''"
>
update_by = #{updateBy},
</if>
</foreach>
update_time = sysdate()
</set>
where find_in_set(#{deptId}, ancestors)
</update>
</update>
<delete
id=
"deleteDeptById"
parameterType=
"Long"
>
<delete
id=
"deleteDeptById"
parameterType=
"Long"
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论