|
|
@ -151,6 +151,7 @@ public class SysUserController extends BaseController {
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
|
|
|
@PostMapping
|
|
|
|
@PostMapping
|
|
|
|
public R<Void> add(@Validated @RequestBody SysUserBo user) {
|
|
|
|
public R<Void> add(@Validated @RequestBody SysUserBo user) {
|
|
|
|
|
|
|
|
deptService.checkDeptDataScope(user.getDeptId());
|
|
|
|
if (!userService.checkUserNameUnique(user)) {
|
|
|
|
if (!userService.checkUserNameUnique(user)) {
|
|
|
|
return R.fail("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
|
|
|
return R.fail("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
|
|
|
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
|
|
|
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
|
|
@ -176,6 +177,7 @@ public class SysUserController extends BaseController {
|
|
|
|
public R<Void> edit(@Validated @RequestBody SysUserBo user) {
|
|
|
|
public R<Void> edit(@Validated @RequestBody SysUserBo user) {
|
|
|
|
userService.checkUserAllowed(user.getUserId());
|
|
|
|
userService.checkUserAllowed(user.getUserId());
|
|
|
|
userService.checkUserDataScope(user.getUserId());
|
|
|
|
userService.checkUserDataScope(user.getUserId());
|
|
|
|
|
|
|
|
deptService.checkDeptDataScope(user.getDeptId());
|
|
|
|
if (!userService.checkUserNameUnique(user)) {
|
|
|
|
if (!userService.checkUserNameUnique(user)) {
|
|
|
|
return R.fail("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
|
|
|
return R.fail("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
|
|
|
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
|
|
|
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
|
|
|