去除用户手机邮箱部门必填验证

master
RuoYi 4 years ago
parent 231bbf6928
commit 9e387dc447
  1. 12
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  2. 2
      ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
  3. 3
      ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
  4. 5
      ruoyi-ui/src/views/system/user/index.vue

@ -127,11 +127,13 @@ public class SysUserController extends BaseController
{ {
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
} }
else if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) else if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{ {
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
} }
else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
{ {
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
} }
@ -149,11 +151,13 @@ public class SysUserController extends BaseController
public AjaxResult edit(@Validated @RequestBody SysUser user) public AjaxResult edit(@Validated @RequestBody SysUser user)
{ {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{ {
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
} }
else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
{ {
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
} }

@ -877,7 +877,7 @@ public class ExcelUtil<T>
*/ */
private Object getValue(Object o, String name) throws Exception private Object getValue(Object o, String name) throws Exception
{ {
if (StringUtils.isNotEmpty(name)) if (StringUtils.isNotNull(o) && StringUtils.isNotEmpty(name))
{ {
Class<?> clazz = o.getClass(); Class<?> clazz = o.getClass();
Field field = clazz.getDeclaredField(name); Field field = clazz.getDeclaredField(name);

@ -212,6 +212,7 @@ public class LogAspect
* @param o 对象信息 * @param o 对象信息
* @return 如果是需要过滤的对象则返回true否则返回false * @return 如果是需要过滤的对象则返回true否则返回false
*/ */
@SuppressWarnings("rawtypes")
public boolean isFilterObject(final Object o) public boolean isFilterObject(final Object o)
{ {
Class<?> clazz = o.getClass(); Class<?> clazz = o.getClass();
@ -230,7 +231,7 @@ public class LogAspect
else if (Map.class.isAssignableFrom(clazz)) else if (Map.class.isAssignableFrom(clazz))
{ {
Map map = (Map) o; Map map = (Map) o;
for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) for (Iterator iter = map.entrySet().iterator(); iter.hasNext();)
{ {
Map.Entry entry = (Map.Entry) iter.next(); Map.Entry entry = (Map.Entry) iter.next();
return entry.getValue() instanceof MultipartFile; return entry.getValue() instanceof MultipartFile;

@ -421,14 +421,10 @@ export default {
nickName: [ nickName: [
{ required: true, message: "用户昵称不能为空", trigger: "blur" } { required: true, message: "用户昵称不能为空", trigger: "blur" }
], ],
deptId: [
{ required: true, message: "归属部门不能为空", trigger: "change" }
],
password: [ password: [
{ required: true, message: "用户密码不能为空", trigger: "blur" } { required: true, message: "用户密码不能为空", trigger: "blur" }
], ],
email: [ email: [
{ required: true, message: "邮箱地址不能为空", trigger: "blur" },
{ {
type: "email", type: "email",
message: "'请输入正确的邮箱地址", message: "'请输入正确的邮箱地址",
@ -436,7 +432,6 @@ export default {
} }
], ],
phonenumber: [ phonenumber: [
{ required: true, message: "手机号码不能为空", trigger: "blur" },
{ {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码", message: "请输入正确的手机号码",

Loading…
Cancel
Save