id唯一性校验
This commit is contained in:
parent
9fb6f094ad
commit
54a3155461
|
@ -48,11 +48,18 @@ public class UserService {
|
|||
|
||||
public UserDTO insert(User user) {
|
||||
checkUserParam(user);
|
||||
//
|
||||
String id = user.getId();
|
||||
User user1 = userMapper.selectByPrimaryKey(id);
|
||||
if (user1 != null) {
|
||||
MSException.throwException("user_id_already_exists");
|
||||
}
|
||||
createUser(user);
|
||||
return getUserDTO(user.getId());
|
||||
}
|
||||
|
||||
private void checkUserParam(User user) {
|
||||
|
||||
if (StringUtils.isBlank(user.getName())) {
|
||||
MSException.throwException(Translator.get("user_name_is_null"));
|
||||
}
|
||||
|
@ -292,7 +299,7 @@ public class UserService {
|
|||
return user;
|
||||
}
|
||||
}
|
||||
MSException.throwException("密码修改失败");
|
||||
MSException.throwException("password_modification_failed");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -30,4 +30,6 @@ user_email_is_null=User email cannot be null
|
|||
password_is_null=Password cannot be null
|
||||
workspace_not_exists=Workspace is not exists
|
||||
#api
|
||||
api_load_script_error="Load script error"
|
||||
api_load_script_error="Load script error"
|
||||
user_id_already_exists="User ID already exists"
|
||||
password_modification_failed="Password modification failed"
|
|
@ -30,4 +30,6 @@ user_email_is_null=用户邮箱不能为空
|
|||
password_is_null=密码不能为空
|
||||
workspace_not_exists=工作空间不存在
|
||||
#api
|
||||
api_load_script_error="读取脚本失败"
|
||||
api_load_script_error="读取脚本失败"
|
||||
user_id_already_exists="用户id已存在"
|
||||
password_modification_failed="密码修改失败"
|
|
@ -93,8 +93,6 @@
|
|||
@confirm="updateUser('updateUserForm')"/>
|
||||
</template>
|
||||
</el-dialog>
|
||||
Changing user password in system settings
|
||||
|
||||
<!--Changing user password in system settings-->
|
||||
<el-dialog :title="$t('member.edit_password')" :visible.sync="editPasswordVisible" width="30%" left>
|
||||
<el-form :model="ruleForm" label-position="right" label-width="100px" size="small" :rules="rule" ref="editPasswordForm" class="demo-ruleForm">
|
||||
|
|
Loading…
Reference in New Issue