|
@@ -17,11 +17,14 @@ import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumCategoryWrapper;
|
|
import com.yonge.cooleshow.common.enums.ETenantAlbumCategoryType;
|
|
import com.yonge.cooleshow.common.enums.ETenantAlbumCategoryType;
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -70,10 +73,29 @@ public class TenantAlbumCategoryServiceImpl extends ServiceImpl<TenantAlbumCateg
|
|
* @return IPage<TenantAlbumCategory>
|
|
* @return IPage<TenantAlbumCategory>
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public IPage<TenantAlbumCategory> selectPage(IPage<TenantAlbumCategory> page,
|
|
|
|
- TenantAlbumCategoryWrapper.TenantAlbumCategoryQuery query) {
|
|
|
|
-
|
|
|
|
- return page.setRecords(baseMapper.selectPage(page, query));
|
|
|
|
|
|
+ public IPage<TenantAlbumCategoryWrapper.TenantAlbumCategory> selectPage(
|
|
|
|
+ IPage<TenantAlbumCategoryWrapper.TenantAlbumCategory> page,
|
|
|
|
+ TenantAlbumCategoryWrapper.TenantAlbumCategoryQuery query) {
|
|
|
|
+
|
|
|
|
+ List<TenantAlbumCategory> tenantAlbumCategories = baseMapper.selectPage(page, query);
|
|
|
|
+
|
|
|
|
+ List<TenantAlbumCategoryWrapper.TenantAlbumCategory> result = tenantAlbumCategories.stream().map(next -> {
|
|
|
|
+ TenantAlbumCategoryWrapper.TenantAlbumCategory tenantAlbumCategory =
|
|
|
|
+ new TenantAlbumCategoryWrapper.TenantAlbumCategory();
|
|
|
|
+ BeanUtils.copyProperties(next, tenantAlbumCategory);
|
|
|
|
+ return tenantAlbumCategory;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ List<Long> idList = tenantAlbumCategories.stream().map(TenantAlbumCategory::getId).collect(Collectors.toList());
|
|
|
|
+ if (!idList.isEmpty()) {
|
|
|
|
+ List<TenantAlbumCategoryDetail> detailList = tenantAlbumCategoryDetailService.lambdaQuery()
|
|
|
|
+ .in(TenantAlbumCategoryDetail::getTenantAlbumCategoryId, idList)
|
|
|
|
+ .list();
|
|
|
|
+ Map<Long, List<TenantAlbumCategoryDetail>> groupById = detailList.stream()
|
|
|
|
+ .collect(Collectors.groupingBy(TenantAlbumCategoryDetail::getTenantAlbumCategoryId));
|
|
|
|
+ result.forEach(next -> next.setValues(groupById.getOrDefault(next.getId(), new ArrayList<>())));
|
|
|
|
+ }
|
|
|
|
+ return page.setRecords(result);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|