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
4b773784
提交
4b773784
authored
5月 07, 2020
作者:
RuoYi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加校验部门包含未停用的子部门
上级
066d3f3f
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
42 行增加
和
2 行删除
+42
-2
UserConstants.java
...rc/main/java/com/ruoyi/common/constant/UserConstants.java
+5
-2
SysDeptController.java
...om/ruoyi/project/system/controller/SysDeptController.java
+6
-0
SysDeptMapper.java
...n/java/com/ruoyi/project/system/mapper/SysDeptMapper.java
+8
-0
ISysDeptService.java
...ava/com/ruoyi/project/system/service/ISysDeptService.java
+8
-0
SysDeptServiceImpl.java
...ruoyi/project/system/service/impl/SysDeptServiceImpl.java
+11
-0
SysDeptMapper.xml
ruoyi/src/main/resources/mybatis/system/SysDeptMapper.xml
+4
-0
没有找到文件。
ruoyi/src/main/java/com/ruoyi/common/constant/UserConstants.java
浏览文件 @
4b773784
...
@@ -19,13 +19,16 @@ public class UserConstants
...
@@ -19,13 +19,16 @@ public class UserConstants
public
static
final
String
EXCEPTION
=
"1"
;
public
static
final
String
EXCEPTION
=
"1"
;
/** 用户封禁状态 */
/** 用户封禁状态 */
public
static
final
String
USER_
BLOCKED
=
"1"
;
public
static
final
String
USER_
DISABLE
=
"1"
;
/** 角色封禁状态 */
/** 角色封禁状态 */
public
static
final
String
ROLE_
BLOCKED
=
"1"
;
public
static
final
String
ROLE_
DISABLE
=
"1"
;
/** 部门正常状态 */
/** 部门正常状态 */
public
static
final
String
DEPT_NORMAL
=
"0"
;
public
static
final
String
DEPT_NORMAL
=
"0"
;
/** 部门停用状态 */
public
static
final
String
DEPT_DISABLE
=
"1"
;
/** 字典正常状态 */
/** 字典正常状态 */
public
static
final
String
DICT_NORMAL
=
"0"
;
public
static
final
String
DICT_NORMAL
=
"0"
;
...
...
ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java
浏览文件 @
4b773784
...
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.constant.UserConstants
;
import
com.ruoyi.common.constant.UserConstants
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.framework.aspectj.lang.annotation.Log
;
import
com.ruoyi.framework.aspectj.lang.annotation.Log
;
import
com.ruoyi.framework.aspectj.lang.enums.BusinessType
;
import
com.ruoyi.framework.aspectj.lang.enums.BusinessType
;
import
com.ruoyi.framework.web.controller.BaseController
;
import
com.ruoyi.framework.web.controller.BaseController
;
...
@@ -109,6 +110,11 @@ public class SysDeptController extends BaseController
...
@@ -109,6 +110,11 @@ public class SysDeptController extends BaseController
{
{
return
AjaxResult
.
error
(
"修改部门'"
+
dept
.
getDeptName
()
+
"'失败,上级部门不能是自己"
);
return
AjaxResult
.
error
(
"修改部门'"
+
dept
.
getDeptName
()
+
"'失败,上级部门不能是自己"
);
}
}
else
if
(
StringUtils
.
equals
(
UserConstants
.
DEPT_DISABLE
,
dept
.
getStatus
())
&&
deptService
.
selectNormalChildrenDeptById
(
dept
.
getDeptId
())
>
0
)
{
return
AjaxResult
.
error
(
"该部门包含未停用的子部门!"
);
}
dept
.
setUpdateBy
(
SecurityUtils
.
getUsername
());
dept
.
setUpdateBy
(
SecurityUtils
.
getUsername
());
return
toAjax
(
deptService
.
updateDept
(
dept
));
return
toAjax
(
deptService
.
updateDept
(
dept
));
}
}
...
...
ruoyi/src/main/java/com/ruoyi/project/system/mapper/SysDeptMapper.java
浏览文件 @
4b773784
...
@@ -43,6 +43,14 @@ public interface SysDeptMapper
...
@@ -43,6 +43,14 @@ public interface SysDeptMapper
*/
*/
public
List
<
SysDept
>
selectChildrenDeptById
(
Long
deptId
);
public
List
<
SysDept
>
selectChildrenDeptById
(
Long
deptId
);
/**
* 根据ID查询所有子部门(正常状态)
*
* @param deptId 部门ID
* @return 子部门数
*/
public
int
selectNormalChildrenDeptById
(
Long
deptId
);
/**
/**
* 是否存在子节点
* 是否存在子节点
*
*
...
...
ruoyi/src/main/java/com/ruoyi/project/system/service/ISysDeptService.java
浏览文件 @
4b773784
...
@@ -51,6 +51,14 @@ public interface ISysDeptService
...
@@ -51,6 +51,14 @@ public interface ISysDeptService
*/
*/
public
SysDept
selectDeptById
(
Long
deptId
);
public
SysDept
selectDeptById
(
Long
deptId
);
/**
* 根据ID查询所有子部门(正常状态)
*
* @param deptId 部门ID
* @return 子部门数
*/
public
int
selectNormalChildrenDeptById
(
Long
deptId
);
/**
/**
* 是否存在部门子节点
* 是否存在部门子节点
*
*
...
...
ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysDeptServiceImpl.java
浏览文件 @
4b773784
...
@@ -108,6 +108,17 @@ public class SysDeptServiceImpl implements ISysDeptService
...
@@ -108,6 +108,17 @@ public class SysDeptServiceImpl implements ISysDeptService
return
deptMapper
.
selectDeptById
(
deptId
);
return
deptMapper
.
selectDeptById
(
deptId
);
}
}
/**
* 根据ID查询所有子部门(正常状态)
*
* @param deptId 部门ID
* @return 子部门数
*/
public
int
selectNormalChildrenDeptById
(
Long
deptId
)
{
return
deptMapper
.
selectNormalChildrenDeptById
(
deptId
);
}
/**
/**
* 是否存在子节点
* 是否存在子节点
*
*
...
...
ruoyi/src/main/resources/mybatis/system/SysDeptMapper.xml
浏览文件 @
4b773784
...
@@ -71,6 +71,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -71,6 +71,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select * from sys_dept where find_in_set(#{deptId}, ancestors)
select * from sys_dept where find_in_set(#{deptId}, ancestors)
</select>
</select>
<select
id=
"selectNormalChildrenDeptById"
parameterType=
"Long"
resultType=
"java.lang.Integer"
>
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
</select>
<select
id=
"checkDeptNameUnique"
resultMap=
"SysDeptResult"
>
<select
id=
"checkDeptNameUnique"
resultMap=
"SysDeptResult"
>
<include
refid=
"selectDeptVo"
/>
<include
refid=
"selectDeptVo"
/>
where dept_name=#{deptName} and parent_id = #{parentId}
where dept_name=#{deptName} and parent_id = #{parentId}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论