Merge remote-tracking branch 'ruoyi-vue/master' into dev
# Conflicts: # pom.xml # ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java # ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java # ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java # ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java # ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java # ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java # ruoyi-ui/src/assets/styles/ruoyi.scss # ry.bat
This commit is contained in:
commit
0b852faf00
@ -116,12 +116,14 @@ public class SysDeptController extends BaseController {
|
|||||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult<Void> edit(@Validated @RequestBody SysDept dept) {
|
public AjaxResult<Void> edit(@Validated @RequestBody SysDept dept) {
|
||||||
|
Long deptId = dept.getDeptId();
|
||||||
|
deptService.checkDeptDataScope(deptId);
|
||||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
|
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
|
||||||
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
} else if (dept.getParentId().equals(dept.getDeptId())) {
|
} else if (dept.getParentId().equals(deptId)) {
|
||||||
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||||
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
||||||
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0) {
|
&& deptService.selectNormalChildrenDeptById(deptId) > 0) {
|
||||||
return AjaxResult.error("该部门包含未停用的子部门!");
|
return AjaxResult.error("该部门包含未停用的子部门!");
|
||||||
}
|
}
|
||||||
return toAjax(deptService.updateDept(dept));
|
return toAjax(deptService.updateDept(dept));
|
||||||
@ -141,6 +143,7 @@ public class SysDeptController extends BaseController {
|
|||||||
if (deptService.checkDeptExistUser(deptId)) {
|
if (deptService.checkDeptExistUser(deptId)) {
|
||||||
return AjaxResult.error("部门存在用户,不允许删除");
|
return AjaxResult.error("部门存在用户,不允许删除");
|
||||||
}
|
}
|
||||||
|
deptService.checkDeptDataScope(deptId);
|
||||||
return toAjax(deptService.deleteDeptById(deptId));
|
return toAjax(deptService.deleteDeptById(deptId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,7 @@ public class SysRoleController extends BaseController {
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult<Void> edit(@Validated @RequestBody SysRole role) {
|
public AjaxResult<Void> edit(@Validated @RequestBody SysRole role) {
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
|
roleService.checkRoleDataScope(role.getRoleId());
|
||||||
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
|
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
|
||||||
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
} else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
|
} else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
|
||||||
@ -123,6 +124,7 @@ public class SysRoleController extends BaseController {
|
|||||||
@PutMapping("/dataScope")
|
@PutMapping("/dataScope")
|
||||||
public AjaxResult<Void> dataScope(@RequestBody SysRole role) {
|
public AjaxResult<Void> dataScope(@RequestBody SysRole role) {
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
|
roleService.checkRoleDataScope(role.getRoleId());
|
||||||
return toAjax(roleService.authDataScope(role));
|
return toAjax(roleService.authDataScope(role));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,6 +137,7 @@ public class SysRoleController extends BaseController {
|
|||||||
@PutMapping("/changeStatus")
|
@PutMapping("/changeStatus")
|
||||||
public AjaxResult<Void> changeStatus(@RequestBody SysRole role) {
|
public AjaxResult<Void> changeStatus(@RequestBody SysRole role) {
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
|
roleService.checkRoleDataScope(role.getRoleId());
|
||||||
return toAjax(roleService.updateRoleStatus(role));
|
return toAjax(roleService.updateRoleStatus(role));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,6 +220,7 @@ public class SysRoleController extends BaseController {
|
|||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@PutMapping("/authUser/selectAll")
|
@PutMapping("/authUser/selectAll")
|
||||||
public AjaxResult<Void> selectAuthUserAll(Long roleId, Long[] userIds) {
|
public AjaxResult<Void> selectAuthUserAll(Long roleId, Long[] userIds) {
|
||||||
|
roleService.checkRoleDataScope(roleId);
|
||||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,6 +150,7 @@ public class SysUserController extends BaseController {
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult<Void> edit(@Validated @RequestBody SysUser user) {
|
public AjaxResult<Void> edit(@Validated @RequestBody SysUser user) {
|
||||||
userService.checkUserAllowed(user);
|
userService.checkUserAllowed(user);
|
||||||
|
userService.checkUserDataScope(user.getUserId());
|
||||||
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
@ -183,6 +184,7 @@ public class SysUserController extends BaseController {
|
|||||||
@PutMapping("/resetPwd")
|
@PutMapping("/resetPwd")
|
||||||
public AjaxResult<Void> resetPwd(@RequestBody SysUser user) {
|
public AjaxResult<Void> resetPwd(@RequestBody SysUser user) {
|
||||||
userService.checkUserAllowed(user);
|
userService.checkUserAllowed(user);
|
||||||
|
userService.checkUserDataScope(user.getUserId());
|
||||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||||
return toAjax(userService.resetPwd(user));
|
return toAjax(userService.resetPwd(user));
|
||||||
}
|
}
|
||||||
@ -196,6 +198,7 @@ public class SysUserController extends BaseController {
|
|||||||
@PutMapping("/changeStatus")
|
@PutMapping("/changeStatus")
|
||||||
public AjaxResult<Void> changeStatus(@RequestBody SysUser user) {
|
public AjaxResult<Void> changeStatus(@RequestBody SysUser user) {
|
||||||
userService.checkUserAllowed(user);
|
userService.checkUserAllowed(user);
|
||||||
|
userService.checkUserDataScope(user.getUserId());
|
||||||
return toAjax(userService.updateUserStatus(user));
|
return toAjax(userService.updateUserStatus(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,6 +229,7 @@ public class SysUserController extends BaseController {
|
|||||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||||
@PutMapping("/authRole")
|
@PutMapping("/authRole")
|
||||||
public AjaxResult<Void> insertAuthRole(Long userId, Long[] roleIds) {
|
public AjaxResult<Void> insertAuthRole(Long userId, Long[] roleIds) {
|
||||||
|
userService.checkUserDataScope(userId);
|
||||||
userService.insertUserAuth(userId, roleIds);
|
userService.insertUserAuth(userId, roleIds);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
@ -329,6 +329,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
|||||||
public int deleteRoleByIds(Long[] roleIds) {
|
public int deleteRoleByIds(Long[] roleIds) {
|
||||||
for (Long roleId : roleIds) {
|
for (Long roleId : roleIds) {
|
||||||
checkRoleAllowed(new SysRole(roleId));
|
checkRoleAllowed(new SysRole(roleId));
|
||||||
|
checkRoleDataScope(roleId);
|
||||||
SysRole role = selectRoleById(roleId);
|
SysRole role = selectRoleById(roleId);
|
||||||
if (countUserRoleByRoleId(roleId) > 0) {
|
if (countUserRoleByRoleId(roleId) > 0) {
|
||||||
throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName()));
|
throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName()));
|
||||||
|
@ -438,6 +438,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|||||||
public int deleteUserByIds(Long[] userIds) {
|
public int deleteUserByIds(Long[] userIds) {
|
||||||
for (Long userId : userIds) {
|
for (Long userId : userIds) {
|
||||||
checkUserAllowed(new SysUser(userId));
|
checkUserAllowed(new SysUser(userId));
|
||||||
|
checkUserDataScope(userId);
|
||||||
}
|
}
|
||||||
List<Long> ids = Arrays.asList(userIds);
|
List<Long> ids = Arrays.asList(userIds);
|
||||||
// 删除用户与角色关联
|
// 删除用户与角色关联
|
||||||
|
@ -47,9 +47,8 @@
|
|||||||
.mb10 {
|
.mb10 {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
.ml10 {
|
||||||
.ml0 {
|
margin-left: 10px;
|
||||||
margin-left: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mt20 {
|
.mt20 {
|
||||||
@ -63,9 +62,8 @@
|
|||||||
.mb20 {
|
.mb20 {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
.ml20 {
|
||||||
.m20 {
|
margin-left: 20px;
|
||||||
margin-left: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
|
.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user