From ee8a9ad78bfa39164582615f2b139c1df74c2bb4 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sat, 17 Oct 2020 09:58:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E7=94=A8=E6=88=B7=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E9=82=AE=E7=AE=B1=E9=83=A8=E9=97=A8=E5=BF=85=E5=A1=AB?= =?UTF-8?q?=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/system/SysUserController.java | 13 +++++++++---- .../main/resources/templates/system/user/add.html | 12 ++++++------ .../main/resources/templates/system/user/edit.html | 12 ++++++------ 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index f5109d291..7d6846ba9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -19,6 +19,7 @@ import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.shiro.service.SysPasswordService; import com.ruoyi.framework.util.ShiroUtils; @@ -125,11 +126,13 @@ public class SysUserController extends BaseController { return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在"); } - else if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + else if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在"); } - else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在"); } @@ -162,11 +165,13 @@ public class SysUserController extends BaseController public AjaxResult editSave(@Validated SysUser user) { userService.checkUserAllowed(user); - if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在"); } - else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在"); } diff --git a/ruoyi-admin/src/main/resources/templates/system/user/add.html b/ruoyi-admin/src/main/resources/templates/system/user/add.html index 1d6c93a35..c7f25c5ad 100644 --- a/ruoyi-admin/src/main/resources/templates/system/user/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/user/add.html @@ -20,10 +20,10 @@
- +
- +
@@ -33,10 +33,10 @@
- +
- +
@@ -44,10 +44,10 @@
- +
- +
diff --git a/ruoyi-admin/src/main/resources/templates/system/user/edit.html b/ruoyi-admin/src/main/resources/templates/system/user/edit.html index 8e2464e40..3d598dbd4 100644 --- a/ruoyi-admin/src/main/resources/templates/system/user/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/user/edit.html @@ -21,10 +21,10 @@
- +
- +
@@ -34,10 +34,10 @@
- +
- +
@@ -45,10 +45,10 @@
- +
- +