校验邮箱是否存在
This commit is contained in:
parent
fd4854d4ab
commit
d4a4d74926
|
@ -196,6 +196,15 @@ public class UserService {
|
|||
if (!roles.isEmpty()) {
|
||||
insertUserRole(roles, user.getId());
|
||||
}
|
||||
String email = user.getEmail();
|
||||
User u = userMapper.selectByPrimaryKey(userId);
|
||||
if (!StringUtils.equals(email, u.getEmail())) {
|
||||
UserExample userExample = new UserExample();
|
||||
userExample.createCriteria().andEmailEqualTo(email);
|
||||
if (userMapper.countByExample(userExample) > 0) {
|
||||
MSException.throwException(Translator.get("user_email_already_exists"));
|
||||
}
|
||||
}
|
||||
user.setUpdateTime(System.currentTimeMillis());
|
||||
userMapper.updateByPrimaryKeySelective(user);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue