校验工作空间是否存在

parent 39ae1e3f
...@@ -28,4 +28,10 @@ public class ApiWorkspaceController { ...@@ -28,4 +28,10 @@ public class ApiWorkspaceController {
workspaceService.add(workspaceName); workspaceService.add(workspaceName);
return "SUCCESS"; return "SUCCESS";
} }
@PostMapping("exist")
@ApiOperation("是否存在")
public Boolean exist(String workspaceName){
return workspaceService.exist(workspaceName);
}
} }
...@@ -7,4 +7,11 @@ package com.byit.service; ...@@ -7,4 +7,11 @@ package com.byit.service;
*/ */
public interface ApiWorkspaceService { public interface ApiWorkspaceService {
void add(String workspaceName); void add(String workspaceName);
/**
* 判断工作空间是否存在
* @param workspaceName
* @return
*/
Boolean exist(String workspaceName);
} }
...@@ -32,4 +32,14 @@ public class ApiWorkspaceServiceImpl implements ApiWorkspaceService { ...@@ -32,4 +32,14 @@ public class ApiWorkspaceServiceImpl implements ApiWorkspaceService {
workspace.setAddTime(new Date()); workspace.setAddTime(new Date());
workspaceMapper.insertSelective(workspace); workspaceMapper.insertSelective(workspace);
} }
@Override
public Boolean exist(String workspaceName) {
ValidationUtil.dataNotBank(workspaceName, "工作空间名称不允许为空!");
Workspace workspace = workspaceMapper.getByName(workspaceName);
if (null == workspace){
return true;
}
return false;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment