diff --git a/src/main/java/com/ai/da/model/dto/QueryLibraryPageDTO.java b/src/main/java/com/ai/da/model/dto/QueryLibraryPageDTO.java index ff668e18..3a1bc632 100644 --- a/src/main/java/com/ai/da/model/dto/QueryLibraryPageDTO.java +++ b/src/main/java/com/ai/da/model/dto/QueryLibraryPageDTO.java @@ -22,4 +22,7 @@ public class QueryLibraryPageDTO extends PageQueryBaseVo { @ApiModelProperty("pictureName") private String pictureName; + + @ApiModelProperty("分类ID") + private Long classificationId; } diff --git a/src/main/java/com/ai/da/model/dto/QueryLibraryPageServiceDTO.java b/src/main/java/com/ai/da/model/dto/QueryLibraryPageServiceDTO.java index c566e364..7f1d9f5c 100644 --- a/src/main/java/com/ai/da/model/dto/QueryLibraryPageServiceDTO.java +++ b/src/main/java/com/ai/da/model/dto/QueryLibraryPageServiceDTO.java @@ -25,4 +25,6 @@ public class QueryLibraryPageServiceDTO extends PageQueryBaseVo { @ApiModelProperty("pictureName") private String pictureName; + private Long classificationId; + } diff --git a/src/main/java/com/ai/da/service/ClassificationService.java b/src/main/java/com/ai/da/service/ClassificationService.java index f25f10ef..7dd31dbb 100644 --- a/src/main/java/com/ai/da/service/ClassificationService.java +++ b/src/main/java/com/ai/da/service/ClassificationService.java @@ -29,4 +29,6 @@ public interface ClassificationService { List getClassificationVOList(List classificationList); Boolean relationLibrary(ClassificationDTO classificationDTO); + + List getLibraryIdListByClassificationId(Long classificationId); } diff --git a/src/main/java/com/ai/da/service/impl/ClassificationServiceImpl.java b/src/main/java/com/ai/da/service/impl/ClassificationServiceImpl.java index f2cb2f83..8ba9b878 100644 --- a/src/main/java/com/ai/da/service/impl/ClassificationServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/ClassificationServiceImpl.java @@ -24,6 +24,7 @@ import javax.annotation.Resource; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; /** @@ -157,6 +158,36 @@ public class ClassificationServiceImpl implements ClassificationService { return Boolean.TRUE; } + @Override + public List getLibraryIdListByClassificationId(Long classificationId) { + List treeClassificationIdList = getTreeClassificationIdListByClassificationId(classificationId); + QueryWrapper qw = new QueryWrapper<>(); + qw.lambda().in(ClassificationRelLibrary::getClassificationId, treeClassificationIdList); + List classificationRelLibraryList = classificationRelLibraryMapper.selectList(qw); + Set collect = classificationRelLibraryList.stream() + .map(ClassificationRelLibrary::getLibraryId) + .collect(Collectors.toSet()); + List libraryIdList = new ArrayList<>(collect); + return libraryIdList; + } + + private List getTreeClassificationIdListByClassificationId(Long classificationId) { + List classificationIdList = new ArrayList<>(); + classificationIdList.add(classificationId); + QueryWrapper qw = new QueryWrapper<>(); + qw.lambda().eq(Classification::getParentId, classificationId); + List childList = classificationMapper.selectList(qw); + if (CollectionUtil.isNotEmpty(childList)) { + for (Classification child : childList) { + List childTree = getTreeClassificationIdListByClassificationId(child.getId()); + if (CollectionUtil.isNotEmpty(childTree)) { + classificationIdList.addAll(childTree); + } + } + } + return classificationIdList; + } + private List recursionClassificationVO(ClassificationVO classificationVO) { QueryWrapper qw = new QueryWrapper<>(); qw.lambda().eq(Classification::getParentId, classificationVO.getId()); diff --git a/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java b/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java index 7e018227..59cc4373 100644 --- a/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java @@ -199,13 +199,13 @@ public class CollectionElementServiceImpl extends ServiceImpl impl @Resource private WorkspaceService workspaceService; @Resource + private ClassificationService classificationService; + @Resource private MinioUtil minioUtil; @Value("${minio.bucketName.users}") @@ -129,6 +132,11 @@ public class LibraryServiceImpl extends ServiceImpl impl if (!StringUtils.isEmpty(query.getPictureName())) { queryWrapper.like("name", query.getPictureName()); } + // 新增分类过滤 + if (null != query.getClassificationId()) { + List libraryIdList = classificationService.getLibraryIdListByClassificationId(query.getClassificationId()); + queryWrapper.lambda().in(Library::getId, libraryIdList); + } queryWrapper.orderByDesc("id"); IPage page = getBaseMapper().selectPage( new Page<>(query.getPage(), query.getSize()), queryWrapper); @@ -309,7 +317,7 @@ public class LibraryServiceImpl extends ServiceImpl impl public void batchDeleteLibrary(LibraryDeleteDTO deleteDTO) { List librarys = libraryMapper.selectBatchIds(deleteDTO.getLibraryIds()); if (CollectionUtils.isEmpty(librarys)) { - throw new BusinessException("librarys.not.found"); + throw new BusinessException("libraryList.not.found"); } List femaleModelIds = librarys.stream() .filter(o -> o.getLevel1Type().equals(LibraryLevel1TypeEnum.MODELS.getRealName()) && o.getLevel2Type().equals(Sex.FEMALE.getValue())) @@ -412,7 +420,7 @@ public class LibraryServiceImpl extends ServiceImpl impl library.setUrl(sysFile.getUrl()); return library; } else { - throw new BusinessException("system.error"); + throw new BusinessException("unknown.modelType"); } } @@ -428,7 +436,7 @@ public class LibraryServiceImpl extends ServiceImpl impl public void updateLibraryName(LibraryUpdateDTO libraryUpdateDTO) { List librarys = getByIds(libraryUpdateDTO.getLibraryIds()); if (CollectionUtils.isEmpty(librarys)) { - throw new BusinessException("librarys.not.found"); + throw new BusinessException("libraryList.not.found"); } QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.in("id", libraryUpdateDTO.getLibraryIds()); diff --git a/src/main/resources/messages_en.properties b/src/main/resources/messages_en.properties index 98784052..4f41e910 100644 --- a/src/main/resources/messages_en.properties +++ b/src/main/resources/messages_en.properties @@ -1,28 +1,13 @@ -# 业务逻辑 +# 不易报异常 system.error=System error! -system.busy=System busy! -userName.does.not.exist=UserName does not exist! -user.expired=User expired! -password.error=Password error! -email.error=Email error! unknown.authentication.operation.type=Unknown authentication operation type! failed.to.send.mail=Failed to send mail! -email.does.not.exist=Email does not exist! unknown.login.type=Unknown login type! error.login.type=Error login type! -the.verification.code.has.expired=The verification code has expired! -verification.code.error=Verification code error! -user.has.bound.mailbox=User has bound mailbox! get.moodBoards.data.is.mismatch=Get moodBoards data is mismatch! get.printBoards.data.is.mismatch=Get printBoards data is mismatch! get.sketchBoards.data.is.mismatch=Get sketchBoards data is mismatch! -the.number.of.PIN.top.or.bottom.or.outerwear.sketchBoard.cannot.be.more.than.8=The number of PIN top or bottom or outerwear sketchBoard cannot be more than 8! modelPoint.not.found=ModelPoint not found! -attributeRetrieval.interface.exception=AttributeRetrieval interface exception, please try again later! If still failed after trying again please contact administrator! -design.interface.exception=Design interface exception, please try again later! If still failed after trying again please contact administrator! -processMannequins.interface.exception=ProcessMannequins interface exception, please try again later! If still failed after trying again please contact administrator! -designProcess.interface.exception=DesignProcess interface exception, please try again later! If still failed after trying again please contact administrator! -generate.interface.exception=Generate interface exception, please try again later! If still failed after trying again please contact administrator! collection.not.found=Collection not found! design.not.found=Design not found! designItem.not.found=DesignItem not found! @@ -32,9 +17,6 @@ new.designItemDetails.not.found=New designItemDetails not found! save.workspace.failed=Save workspace failed! save.design.failed=Save design failed! update.workspace.failed=Update workspace failed! -the.workspace.lastIndex.not.found=The workspace lastIndex not found! -the.workspaceName.already.exists=The workspaceName already exists! -unable.to.delete.the.workspace.you.are.currently.using=Unable to delete the workspace you are currently using! enumeration.class.not.found=Enumeration class not found! history.detail.not.found=History detail not found! designItemDetails.not.found=DesignItemDetails not found! @@ -43,12 +25,10 @@ unknown.parameter.level1Type=Unknown parameter level1Type! collectionElement.not.found=collectionElement not found! select1.file.does.not.exist=Select1 file does not exist! select2.file.does.not.exist=Select2 file does not exist! -generate.print.exception=Generate print exception! -generate.print.failed=Generate print failed! +save.collectionElement.failed=Save collectionElement failed! collectionElements.not.found=CollectionElements not found! batch.save.libraryList.failed=Batch save libraryList failed! panTones.not.found=PanTones not found! -hsv.value.cannot.exceed.the.maximum.of.8=Hsv value cannot exceed the maximum of 8! save.designItem.failed=Save designItem failed! unknown.type=Unknown type! unknown.operateType=Unknown operateType! @@ -57,7 +37,7 @@ the.id.value.is.out.of.range=The id value is out of range! library.not.found=Library not found! wrong.clothes.type=Wrong clothes type! sysFile.not.found=SysFile not found! -librarys.not.found=Librarys not found! +libraryList.not.found=LibraryList not found! groupDetails.not.found=GroupDetails not found! history.not.found=History not found! unknown.parameter.level2Type=Unknown parameter level2Type! @@ -72,7 +52,6 @@ save.sysFile.failed=Save sysFile failed! save.pythonTAllInfo.failed=Save pythonTAllInfo failed! save.collection.failed=Save collection failed! save.designItemDetail.failed=Save designItemDetail failed! - save.classification.failed=Save classification failed! update.classification.failed=Update classification failed! please.input.the.caption=Please input the caption! @@ -80,7 +59,6 @@ please.choose.an.image=Please choose an image! please.input.the.caption.and.choose.an.image=Please input the caption and choose an image! duplicate.likes.are.not.allowed=Duplicate likes are not allowed! layer.information.not.found=Layer information not found! -# 前端传参校验 singleOverall.cannot.be.empty=singleOverall cannot be empty! colorBoards.cannot.be.empty=colorBoards cannot be empty! systemScale.cannot.be.empty=systemScale cannot be empty! @@ -140,15 +118,34 @@ regionNum.cannot.be.empty=regionNum cannot be empty! phone.cannot.be.empty=phone cannot be empty! printId.cannot.be.empty=printId cannot be empty! path.cannot.be.empty=path cannot be empty! - classificationName.cannot.be.empty=classificationName cannot be empty! -classificationName.already.exists=ClassificationName already exists, please change it! -the.classification.you.deleted.has.associated.library=The classification you deleted has associated data, are you sure you want to delete it! -the.model.has.been.referenced.by.the.workspace=The model has been referenced by the workspace, are you sure you want to delete it! level2Type.cannot.be.empty=level2Type cannot be empty! generateItem.does.not.exist=generateItem does not exist! level1Type.does.not.match=level1Type does not match! the.image.does.not.exist.please.reselect=the image does not exist, please reselect! design.item.does.not.exist=design item does not exist! layers.does.not.exists=layers does not exists! -unknown.generate.type=unknown generate type! \ No newline at end of file +unknown.generate.type=unknown generate type! +# 可能会报异常 +system.busy=System busy! +user.expired=User expired! +user.has.bound.mailbox=User has bound mailbox! +userName.does.not.exist=UserName does not exist! +password.error=Password error! +email.error=Email error! +email.does.not.exist=Email does not exist! +the.verification.code.has.expired=The verification code has expired! +verification.code.error=Verification code error! +the.number.of.PIN.top.or.bottom.or.outerwear.sketchBoard.cannot.be.more.than.8=The number of PIN top or bottom or outerwear sketchBoard cannot be more than 8! +attributeRetrieval.interface.exception=AttributeRetrieval interface exception, please try again later! If still failed after trying again please contact administrator! +design.interface.exception=Design interface exception, please try again later! If still failed after trying again please contact administrator! +processMannequins.interface.exception=ProcessMannequins interface exception, please try again later! If still failed after trying again please contact administrator! +designProcess.interface.exception=DesignProcess interface exception, please try again later! If still failed after trying again please contact administrator! +generate.interface.exception=Generate interface exception, please try again later! If still failed after trying again please contact administrator! +the.workspace.lastIndex.not.found=The workspace lastIndex not found! +the.workspaceName.already.exists=The workspaceName already exists! +unable.to.delete.the.workspace.you.are.currently.using=Unable to delete the workspace you are currently using! +hsv.value.cannot.exceed.the.maximum.of.8=Hsv value cannot exceed the maximum of 8! +classificationName.already.exists=ClassificationName already exists, please change it! +the.classification.you.deleted.has.associated.library=The classification you deleted has associated data, are you sure you want to delete it! +the.model.has.been.referenced.by.the.workspace=The model has been referenced by the workspace, are you sure you want to delete it!