BUGFIX:1、删除模特后保存失败

2、获取个人库中的模特不准确
This commit is contained in:
2025-08-18 16:18:51 +08:00
parent 45d6af92e8
commit 552ec828ab
4 changed files with 21 additions and 10 deletions

View File

@@ -20,6 +20,7 @@ import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -168,7 +169,7 @@ public class LibraryController {
@ApiOperation(value = "更新sketchboard level2type")
@PostMapping("/updateLibraryLevel2Type")
public Response<Boolean> updateLibraryLevel2Type(@RequestBody LibraryLevel2TypeUpdateDTO libraryLevel2TypeUpdateDTO) {
public Response<Boolean> updateLibraryLevel2Type(@Validated @RequestBody LibraryLevel2TypeUpdateDTO libraryLevel2TypeUpdateDTO) {
return Response.success(libraryService.updateLibraryLevel2Type(libraryLevel2TypeUpdateDTO));
}

View File

@@ -171,7 +171,12 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
if (!StringUtils.isEmpty(query.getAgeGroup())) {
// queryWrapper.eq("level3_type", query.getAgeGroup());
queryWrapper.eq("age_group", query.getAgeGroup());
// queryWrapper.eq("age_group", query.getAgeGroup());
queryWrapper.lambda().and(wrapper -> wrapper
.eq(Library::getLevel3Type, query.getAgeGroup())
.or()
.eq(Library::getAgeGroup, query.getAgeGroup())
);
}
if (query.getBrandId() != null) {
@@ -892,7 +897,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
Library library = CopyUtil.copyObject(sysFile, Library.class);
library.setId(null);
library.setAccountId(accountId);
library.setLevel3Type(sysFileExtra.getAgeGroup());
library.setAgeGroup(sysFileExtra.getAgeGroup());
library.setName(DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD));
List<Integer> imagesWidthAndHeight = minioUtil.getImagesWidthAndHeight(sysFile.getUrl());
library.setWidth(imagesWidthAndHeight.get(0));

View File

@@ -2557,12 +2557,12 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
if (CollectionUtil.isNotEmpty(moduleSaveDTO.getMannequin())) {
List<CollectionElementRelModel> collectionElementRelModels = collectionElementMapper.selectByProject(projectId);
List<MannequinDTO> mannequin = moduleSaveDTO.getMannequin();
List<Long> inputMannequinId = mannequin.stream().map(MannequinDTO::getId).collect(Collectors.toList());
List<Long> inputMannequinId = mannequin.stream().map(MannequinDTO::getCollectionElementId).collect(Collectors.toList());
// 创建relationId到Model的映射
Map<Long, CollectionElementRelModel> relationIdToModelMap = collectionElementRelModels.stream()
.collect(Collectors.toMap(
CollectionElementRelModel::getRelationId,
CollectionElementRelModel::getCollectionElementId,
java.util.function.Function.identity(),
(existing, replacement) -> existing
));

View File

@@ -416,11 +416,16 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
AuthPrincipalVo userInfo = UserContext.getUserHolder();
List<ModelsVO> result = new ArrayList<>();
QueryWrapper<Library> libraryQueryWrapper = new QueryWrapper<>();
libraryQueryWrapper.lambda().eq(Library::getAccountId, userInfo.getId());
libraryQueryWrapper.lambda().eq(Library::getLevel1Type, LibraryLevel1TypeEnum.MODELS.getRealName());
libraryQueryWrapper.lambda().eq(Library::getLevel2Type, sex);
libraryQueryWrapper.lambda().eq(Library::getLevel3Type, ageGroup);
libraryQueryWrapper.lambda().orderByDesc(Library::getCreateDate);
libraryQueryWrapper.lambda()
.eq(Library::getAccountId, userInfo.getId())
.eq(Library::getLevel1Type, LibraryLevel1TypeEnum.MODELS.getRealName())
.eq(Library::getLevel2Type, sex)
.and(wrapper -> wrapper
.eq(Library::getLevel3Type, ageGroup)
.or()
.eq(Library::getAgeGroup, ageGroup)
)
.orderByDesc(Library::getCreateDate);
List<Library> libraries = libraryMapper.selectList(libraryQueryWrapper);
if (!CollectionUtils.isEmpty(libraries)) {
List<ModelVO> modelVOList = new ArrayList<>();