workspace name duplicate check
This commit is contained in:
parent
64c46ea715
commit
43506a265e
|
@ -230,6 +230,19 @@ public class WorkspaceService {
|
|||
}
|
||||
|
||||
public void addWorkspaceByAdmin(Workspace workspace) {
|
||||
if (StringUtils.isBlank(workspace.getName())) {
|
||||
MSException.throwException(Translator.get("workspace_name_is_null"));
|
||||
}
|
||||
if (StringUtils.isBlank(workspace.getOrganizationId())) {
|
||||
MSException.throwException(Translator.get("organization_id_is_null"));
|
||||
}
|
||||
WorkspaceExample example = new WorkspaceExample();
|
||||
example.createCriteria()
|
||||
.andOrganizationIdEqualTo(workspace.getOrganizationId())
|
||||
.andNameEqualTo(workspace.getName());
|
||||
if (workspaceMapper.countByExample(example) > 0) {
|
||||
MSException.throwException(Translator.get("workspace_name_already_exists"));
|
||||
}
|
||||
workspace.setId(UUID.randomUUID().toString());
|
||||
workspace.setCreateTime(System.currentTimeMillis());
|
||||
workspace.setUpdateTime(System.currentTimeMillis());
|
||||
|
|
|
@ -17,5 +17,6 @@
|
|||
"node_deep_limit": "The node depth does not exceed 5 layers!",
|
||||
"no_nodes_message": "No node message",
|
||||
"duplicate_node_ip": "Duplicate IPs",
|
||||
"only_one_k8s": "Only one K8s can be added"
|
||||
"only_one_k8s": "Only one K8s can be added",
|
||||
"organization_id_is_null": "Organization ID cannot be null"
|
||||
}
|
|
@ -17,5 +17,6 @@
|
|||
"node_deep_limit": "节点深度不超过5层!",
|
||||
"no_nodes_message": "没有节点信息",
|
||||
"duplicate_node_ip": "节点 IP 重复",
|
||||
"only_one_k8s": "只能添加一个 K8s"
|
||||
"only_one_k8s": "只能添加一个 K8s",
|
||||
"organization_id_is_null": "组织 ID 不能为空"
|
||||
}
|
Loading…
Reference in New Issue