组织同名检查
This commit is contained in:
parent
f415a121a5
commit
e4d1046152
|
@ -48,6 +48,16 @@ public class OrganizationService {
|
|||
private UserService userService;
|
||||
|
||||
public Organization addOrganization(Organization organization) {
|
||||
if (StringUtils.isBlank(organization.getName())) {
|
||||
MSException.throwException(Translator.get("organization_name_is_null"));
|
||||
}
|
||||
|
||||
OrganizationExample organizationExample = new OrganizationExample();
|
||||
organizationExample.createCriteria().andNameEqualTo(organization.getName());
|
||||
if (organizationMapper.countByExample(organizationExample) > 0) {
|
||||
MSException.throwException(Translator.get("organization_name_already_exists"));
|
||||
}
|
||||
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
organization.setId(UUID.randomUUID().toString());
|
||||
organization.setCreateTime(currentTimeMillis);
|
||||
|
|
|
@ -33,6 +33,8 @@ workspace_not_exists=Workspace is not exists
|
|||
project_name_is_null=Project name cannot be null
|
||||
project_name_already_exists=The project name already exists
|
||||
#organization
|
||||
organization_name_is_null=organization name cannot be null
|
||||
organization_name_already_exists=The organization name already exists
|
||||
organization_does_not_belong_to_user=The current organization does not belong to the current user
|
||||
organization_id_is_null=Organization ID cannot be null
|
||||
#api
|
||||
|
|
|
@ -33,6 +33,8 @@ workspace_not_exists=工作空间不存在
|
|||
project_name_is_null=项目名称不能为空
|
||||
project_name_already_exists=项目名称已存在
|
||||
#organization
|
||||
organization_name_is_null=组织名不能为空
|
||||
organization_name_already_exists=组织名已存在
|
||||
organization_does_not_belong_to_user=当前组织不属于当前用户
|
||||
organization_id_is_null=组织 ID 不能为空
|
||||
#api
|
||||
|
|
|
@ -33,6 +33,8 @@ workspace_not_exists=工作空間不存在
|
|||
project_name_is_null=項目名稱不能為空
|
||||
project_name_already_exists=項目名稱已存在
|
||||
#organization
|
||||
organization_name_is_null=組織名不能為空
|
||||
organization_name_already_exists=組織名已存在
|
||||
organization_does_not_belong_to_user=當前組織不屬於當前用戶
|
||||
organization_id_is_null=組織 ID 不能為空
|
||||
#api
|
||||
|
|
Loading…
Reference in New Issue