BUGFIX: workspace校验添加;

This commit is contained in:
shahaibo
2023-10-17 10:29:08 +08:00
parent c3e979e096
commit 8720fc5992
2 changed files with 15 additions and 0 deletions

View File

@@ -504,6 +504,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
}else {
throw new BusinessException("templateId or modelType can't be null");
}
if (StringUtils.isEmpty(designDTO.getModelSex())) {
throw new BusinessException("modelSex can't be null");
}
elementVO.setModelSex(designDTO.getModelSex());
return elementVO;
}

View File

@@ -86,6 +86,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
workspace.setIsLastIndex(null);
AuthPrincipalVo userInfo = UserContext.getUserHolder();
workspace.setUserName(userInfo.getUsername());
checkWorkspaceName(workspace.getId(), workspace.getWorkSpaceName(), userInfo.getUsername());
if (null == workspace.getId()) {
workspace.setIsLastIndex(0);
QueryWrapper<SysFile> systemFemaleQw = new QueryWrapper<>();
@@ -121,6 +122,17 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
}
}
private void checkWorkspaceName(Long id, String workSpaceName, String userName) {
QueryWrapper<Workspace> qw = new QueryWrapper<>();
qw.lambda().ne(null != id, Workspace::getId, id);
qw.lambda().eq(Workspace::getWorkSpaceName, workSpaceName);
qw.lambda().eq(Workspace::getUserName, userName);
List<Workspace> workspaces = baseMapper.selectList(qw);
if (!CollectionUtils.isEmpty(workspaces)) {
throw new BusinessException("The workspace name already exists!");
}
}
@Override
public WorkspaceVO getPage(WorkspaceDTO query) {
WorkspaceVO vo = new WorkspaceVO();