TASK: 默认不like的元素,如有parentId,需要添加到CollectionSort表中
This commit is contained in:
@@ -63,6 +63,8 @@ public interface DesignService extends IService<Design> {
|
|||||||
|
|
||||||
CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId, Long parentId);
|
CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId, Long parentId);
|
||||||
|
|
||||||
|
CollectionSort queryCollectionSortByRelation(Long relationId, String relationType, Long projectId);
|
||||||
|
|
||||||
int getNextSort(Long projectId, Long parentId);
|
int getNextSort(Long projectId, Long parentId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1262,6 +1262,10 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId, Long collectionSortParentId) {
|
public CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId, Long collectionSortParentId) {
|
||||||
|
CollectionSort collectionSort = queryCollectionSortByRelation(relationId, relationType, projectId);
|
||||||
|
if (Objects.nonNull(collectionSort)){
|
||||||
|
return collectionSort;
|
||||||
|
}
|
||||||
int sort = getNextSort(projectId, collectionSortParentId);
|
int sort = getNextSort(projectId, collectionSortParentId);
|
||||||
CollectionSort userLikeSort = new CollectionSort();
|
CollectionSort userLikeSort = new CollectionSort();
|
||||||
// userLikeSort.setUserLikeGroupId(userGroupId);
|
// userLikeSort.setUserLikeGroupId(userGroupId);
|
||||||
@@ -1278,6 +1282,14 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
return userLikeSort;
|
return userLikeSort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CollectionSort queryCollectionSortByRelation(Long relationId, String relationType, Long projectId){
|
||||||
|
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(CollectionSort::getProjectId, projectId).
|
||||||
|
eq(CollectionSort::getRelationId, relationId).
|
||||||
|
eq(CollectionSort::getRelationType, relationType);
|
||||||
|
return collectionSortMapper.selectOne(qw);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNextSort(Long projectId, Long parentId) {
|
public int getNextSort(Long projectId, Long parentId) {
|
||||||
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
||||||
|
|||||||
@@ -500,6 +500,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
||||||
}else if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && Objects.nonNull(toProductImageVO.getParentId())){
|
}else if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && Objects.nonNull(toProductImageVO.getParentId())){
|
||||||
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
||||||
|
// 默认不添加到like,但是需要有parentId,所以这里添加到collectionSort表中
|
||||||
|
designService.addCollectionSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), toProductImageDTO.getProjectId(), toProductImageVO.getParentId());
|
||||||
}
|
}
|
||||||
result.add(toProductImageResult);
|
result.add(toProductImageResult);
|
||||||
}else {
|
}else {
|
||||||
@@ -552,6 +554,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
||||||
}else if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && Objects.nonNull(toProductImageVO.getParentId())){
|
}else if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && Objects.nonNull(toProductImageVO.getParentId())){
|
||||||
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
||||||
|
// 默认不添加到like,但是需要有parentId,所以这里添加到collectionSort表中
|
||||||
|
designService.addCollectionSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), toProductImageDTO.getProjectId(), toProductImageVO.getParentId());
|
||||||
}
|
}
|
||||||
result.add(toProductImageResult);
|
result.add(toProductImageResult);
|
||||||
}
|
}
|
||||||
@@ -1151,6 +1155,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
||||||
}else if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && Objects.nonNull(toProductImageVO.getParentId())){
|
}else if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && Objects.nonNull(toProductImageVO.getParentId())){
|
||||||
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
||||||
|
// 默认不添加到like,但是需要有parentId,所以这里添加到collectionSort表中
|
||||||
|
designService.addCollectionSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(), toProductImageDTO.getProjectId(), toProductImageVO.getParentId());
|
||||||
}
|
}
|
||||||
result.add(toProductImageResult);
|
result.add(toProductImageResult);
|
||||||
}else {
|
}else {
|
||||||
@@ -1193,6 +1199,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
||||||
}else if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && Objects.nonNull(toProductImageVO.getParentId())){
|
}else if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && Objects.nonNull(toProductImageVO.getParentId())){
|
||||||
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
||||||
|
// 默认不添加到like,但是需要有parentId,所以这里添加到collectionSort表中
|
||||||
|
designService.addCollectionSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(), toProductImageDTO.getProjectId(), toProductImageVO.getParentId());
|
||||||
}
|
}
|
||||||
result.add(toProductImageResult);
|
result.add(toProductImageResult);
|
||||||
}
|
}
|
||||||
@@ -1594,7 +1602,9 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
queryWrapper.eq("account_id", authPrincipalVo.getId());
|
queryWrapper.eq("account_id", authPrincipalVo.getId());
|
||||||
|
if (Objects.nonNull(query.getId())){
|
||||||
queryWrapper.eq("id", query.getId());
|
queryWrapper.eq("id", query.getId());
|
||||||
|
}
|
||||||
// queryWrapper.isNull("parent_id");
|
// queryWrapper.isNull("parent_id");
|
||||||
if (!StringUtils.isEmpty(query.getProjectName())) {
|
if (!StringUtils.isEmpty(query.getProjectName())) {
|
||||||
queryWrapper.like("name", query.getProjectName());
|
queryWrapper.like("name", query.getProjectName());
|
||||||
|
|||||||
Reference in New Issue
Block a user