BUGFIX:1. 单品设计返回的优先级不对 2. 修改项目参数会导致多一个模特

This commit is contained in:
2025-09-26 16:47:03 +08:00
parent 2e4b1516cc
commit b1b465a05a
2 changed files with 32 additions and 16 deletions

View File

@@ -1425,7 +1425,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
} }
// 为没有优先级的衣服添加优先级 // 为没有优先级的衣服添加优先级
designItemDetailService.setDesignItemDetailPriority(designItemDetails); if (!StringUtil.isNullOrEmpty(design.getSingleOverall()) && design.getSingleOverall().equals("overall")){
designItemDetailService.setDesignItemDetailPriority(designItemDetails);
}
// 2、组装返回参数 // 2、组装返回参数
DesignItemDetailVO response = new DesignItemDetailVO(); DesignItemDetailVO response = new DesignItemDetailVO();

View File

@@ -727,22 +727,25 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
deleteSketchByProjectId(projectId); deleteSketchByProjectId(projectId);
} }
} }
// 判断当前使用的模特风格与新的模特风格是否一致
SysFile sysFile = sysFileService.getOneBySex(projectDTO.getStyleId(), projectDTO.getWorkspace().getSex(), projectDTO.getWorkspace().getAgeGroup()); SysFile sysFile = sysFileService.getOneBySex(projectDTO.getStyleId(), projectDTO.getWorkspace().getSex(), projectDTO.getWorkspace().getAgeGroup());
CollectionElement collectionElement = new CollectionElement(); if (!checkIfModelExistsInProject(sysFile.getMd5(), projectId)){
collectionElement.setAccountId(userInfo.getId()); CollectionElement collectionElement = new CollectionElement();
collectionElement.setProjectId(projectId); collectionElement.setAccountId(userInfo.getId());
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.MODEL.getRealName()); collectionElement.setProjectId(projectId);
collectionElement.setName(sysFile.getName()); collectionElement.setLevel1Type(CollectionLevel1TypeEnum.MODEL.getRealName());
collectionElement.setUrl(sysFile.getUrl()); collectionElement.setName(sysFile.getName());
collectionElement.setMd5(sysFile.getMd5()); collectionElement.setUrl(sysFile.getUrl());
collectionElement.setCreateDate(new Date()); collectionElement.setMd5(sysFile.getMd5());
collectionElement.setHasPin((byte) 0); collectionElement.setCreateDate(new Date());
collectionElementMapper.insert(collectionElement); collectionElement.setHasPin((byte) 0);
CollectionElementRelModel collectionElementRelModel = new CollectionElementRelModel(); collectionElementMapper.insert(collectionElement);
collectionElementRelModel.setCollectionElementId(collectionElement.getId()); CollectionElementRelModel collectionElementRelModel = new CollectionElementRelModel();
collectionElementRelModel.setRelationId(sysFile.getId()); collectionElementRelModel.setCollectionElementId(collectionElement.getId());
collectionElementRelModel.setRelationType("System"); collectionElementRelModel.setRelationId(sysFile.getId());
collectionElementRelModelMapper.insert(collectionElementRelModel); collectionElementRelModel.setRelationType("System");
collectionElementRelModelMapper.insert(collectionElementRelModel);
}
} }
workspaceNew.setId(workspace.getId()); workspaceNew.setId(workspace.getId());
workspace.setUpdateTime(LocalDateTime.now()); workspace.setUpdateTime(LocalDateTime.now());
@@ -855,6 +858,17 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
collectionElementMapper.delete(qw); collectionElementMapper.delete(qw);
} }
// 由于在数据库中表设计问题,目前只能通过路径来判断项目中是否存在某一个模特
public Boolean checkIfModelExistsInProject(String md5, Long projectId){
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
qw.lambda().eq(CollectionElement::getProjectId, projectId)
.eq(CollectionElement::getLevel1Type, CollectionLevel1TypeEnum.MODEL.getRealName())
.eq(CollectionElement::getMd5, md5);
List<CollectionElement> collectionElements = collectionElementMapper.selectList(qw);
return collectionElements != null && !collectionElements.isEmpty();
}
@Override @Override
public Long getByProjectId(Long projectId) { public Long getByProjectId(Long projectId) {
QueryWrapper<Workspace> qw = new QueryWrapper<>(); QueryWrapper<Workspace> qw = new QueryWrapper<>();