TASK:workspace、design模块代码;

This commit is contained in:
shahaibo
2023-09-13 10:19:23 +08:00
parent 03f8f9a6cf
commit 7a6d70c2cf
4 changed files with 20 additions and 9 deletions

View File

@@ -218,7 +218,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
//保存collection
Long collectionId = (null == collectionIdParam) ?
collectionService.saveCollection(userInfo.getId(),designDTO.getTimeZone(),designDTO.getMoodTemplateId()) : collectionIdParam;
List<Long> elementIds =getElementId(elementVO);
List<Long> elementIds = getElementId(elementVO);
//批量关联element 到 collection
collectionElementService.relationCollection(elementIds,collectionId);
//library转化为collection(生成)

View File

@@ -53,9 +53,17 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
workspace.setUserName(userInfo.getUsername());
workspace.setIsLastIndex(0);
if (null == workspace.getId()) {
return workspaceMapper.insert(workspace) == 1;
int insert = workspaceMapper.insert(workspace);
if (insert <= 0) {
throw new BusinessException("insert workspace failed");
}
return true;
}else {
return workspaceMapper.updateById(workspace) == 1;
int update = workspaceMapper.updateById(workspace);
if (update <= 0) {
throw new BusinessException("update workspace failed");
}
return true;
}
}
@@ -78,7 +86,10 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
workspace.setPosition(Position.OVERALL.getValue());
workspace.setUserName(userName);
workspace.setIsLastIndex(1);
workspaceMapper.insert(workspace);
int insert = workspaceMapper.insert(workspace);
if (insert <= 0) {
throw new BusinessException("save workspace failed");
}
page = workspaceMapper.selectPage(new Page<>(query.getPage(), query.getSize()), qw);
vo.setPage(PageBaseResponse.success(page));
vo.setId(workspace.getId());