恢复修改设置会多一个模特fix判断模特是否存在的方式
This commit is contained in:
@@ -722,12 +722,8 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
// deleteMannequinByProjectId(projectId);
|
// deleteMannequinByProjectId(projectId);
|
||||||
if (!workspaceNew.getSex().equals(workspace.getSex())) {
|
if (!workspaceNew.getSex().equals(workspace.getSex())) {
|
||||||
// deleteSketchByProjectId(projectId);
|
// deleteSketchByProjectId(projectId);
|
||||||
|
|
||||||
LambdaQueryWrapper<CollectionElement> queryWrapper = new LambdaQueryWrapper<CollectionElement>().eq(CollectionElement::getProjectId, projectId)
|
|
||||||
.eq(CollectionElement::getLevel1Type, CollectionLevel1TypeEnum.MODEL.getRealName())
|
|
||||||
.eq(CollectionElement::getLevel3Type, workspaceNew.getSex());
|
|
||||||
if (collectionElementMapper.selectCount(queryWrapper) == 0){
|
|
||||||
SysFile sysFile = sysFileService.getOneBySex(projectDTO.getStyleId(), projectDTO.getWorkspace().getSex(), projectDTO.getWorkspace().getAgeGroup());
|
SysFile sysFile = sysFileService.getOneBySex(projectDTO.getStyleId(), projectDTO.getWorkspace().getSex(), projectDTO.getWorkspace().getAgeGroup());
|
||||||
|
if (!checkIfModelExistsInProject(sysFile.getMd5(), projectId)) {
|
||||||
CollectionElement collectionElement = new CollectionElement();
|
CollectionElement collectionElement = new CollectionElement();
|
||||||
collectionElement.setAccountId(userInfo.getId());
|
collectionElement.setAccountId(userInfo.getId());
|
||||||
collectionElement.setProjectId(projectId);
|
collectionElement.setProjectId(projectId);
|
||||||
@@ -879,6 +875,17 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 由于在数据库中表设计问题,目前只能通过路径来判断项目中是否存在某一个模特
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
public static List<File> getPNGFiles(String directoryPath) {
|
public static List<File> getPNGFiles(String directoryPath) {
|
||||||
List<File> pngFiles = new ArrayList<>();
|
List<File> pngFiles = new ArrayList<>();
|
||||||
File directory = new File(directoryPath);
|
File directory = new File(directoryPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user