Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fgqyxxlr
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yaru
fgqyxxlr
Commits
8a9d298f
Commit
8a9d298f
authored
May 07, 2020
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加校验部门包含未停用的子部门
parent
2c8365b6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
2 deletions
+42
-2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
+5
-0
ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java
+5
-2
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java
+9
-0
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
+8
-0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
+11
-0
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
+4
-0
No files found.
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
View file @
8a9d298f
...
...
@@ -112,6 +112,11 @@ public class SysDeptController extends BaseController
{
return
error
(
"修改部门'"
+
dept
.
getDeptName
()
+
"'失败,上级部门不能是自己"
);
}
else
if
(
StringUtils
.
equals
(
UserConstants
.
DEPT_DISABLE
,
dept
.
getStatus
())
&&
deptService
.
selectNormalChildrenDeptById
(
dept
.
getDeptId
())
>
0
)
{
return
AjaxResult
.
error
(
"该部门包含未停用的子部门!"
);
}
dept
.
setUpdateBy
(
ShiroUtils
.
getLoginName
());
return
toAjax
(
deptService
.
updateDept
(
dept
));
}
...
...
ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java
View file @
8a9d298f
...
...
@@ -19,14 +19,17 @@ public class UserConstants
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_DISABLE
=
"1"
;
/** 字典正常状态 */
public
static
final
String
DICT_NORMAL
=
"0"
;
...
...
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java
View file @
8a9d298f
...
...
@@ -101,8 +101,17 @@ public interface SysDeptMapper
/**
* 根据ID查询所有子部门
*
* @param deptId 部门ID
* @return 部门列表
*/
public
List
<
SysDept
>
selectChildrenDeptById
(
Long
deptId
);
/**
* 根据ID查询所有子部门(正常状态)
*
* @param deptId 部门ID
* @return 子部门数
*/
public
int
selectNormalChildrenDeptById
(
Long
deptId
);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
View file @
8a9d298f
...
...
@@ -85,6 +85,14 @@ public interface ISysDeptService
public
SysDept
selectDeptById
(
Long
deptId
);
/**
* 根据ID查询所有子部门(正常状态)
*
* @param deptId 部门ID
* @return 子部门数
*/
public
int
selectNormalChildrenDeptById
(
Long
deptId
);
/**
* 校验部门名称是否唯一
*
* @param dept 部门信息
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
View file @
8a9d298f
...
...
@@ -252,6 +252,17 @@ public class SysDeptServiceImpl implements ISysDeptService
}
/**
* 根据ID查询所有子部门(正常状态)
*
* @param deptId 部门ID
* @return 子部门数
*/
public
int
selectNormalChildrenDeptById
(
Long
deptId
)
{
return
deptMapper
.
selectNormalChildrenDeptById
(
deptId
);
}
/**
* 校验部门名称是否唯一
*
* @param dept 部门信息
...
...
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
View file @
8a9d298f
...
...
@@ -79,6 +79,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select * from sys_dept where find_in_set(#{deptId}, ancestors)
</select>
<select
id=
"selectNormalChildrenDeptById"
parameterType=
"Long"
resultType=
"int"
>
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
</select>
<insert
id=
"insertDept"
parameterType=
"SysDept"
>
insert into sys_dept(
<if
test=
"deptId != null and deptId != 0"
>
dept_id,
</if>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment