From d4a4d749269fb18f86626800859af397144277ba Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 27 May 2020 21:09:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E9=82=AE=E7=AE=B1=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/metersphere/service/UserService.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/src/main/java/io/metersphere/service/UserService.java b/backend/src/main/java/io/metersphere/service/UserService.java index 71434fcd33..aa0b12d74d 100644 --- a/backend/src/main/java/io/metersphere/service/UserService.java +++ b/backend/src/main/java/io/metersphere/service/UserService.java @@ -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); }