|
@@ -12,7 +12,9 @@ import com.chelvc.cloud.vehicle.api.param.GoodsPagingParam;
|
|
|
import com.chelvc.cloud.vehicle.api.param.GoodsQueryParam;
|
|
|
import com.chelvc.cloud.vehicle.server.copier.GoodsCopier;
|
|
|
import com.chelvc.cloud.vehicle.server.dao.GoodsMapper;
|
|
|
+import com.chelvc.cloud.vehicle.server.entity.Category;
|
|
|
import com.chelvc.cloud.vehicle.server.entity.Goods;
|
|
|
+import com.chelvc.cloud.vehicle.server.service.CategoryService;
|
|
|
import com.chelvc.cloud.vehicle.server.service.CommentService;
|
|
|
import com.chelvc.cloud.vehicle.server.service.CouponService;
|
|
|
import com.chelvc.cloud.vehicle.server.service.GoodsService;
|
|
@@ -43,6 +45,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
com.chelvc.cloud.vehicle.api.service.GoodsService {
|
|
|
private final CouponService couponService;
|
|
|
private final CommentService commentService;
|
|
|
+ private final CategoryService categoryService;
|
|
|
|
|
|
@Override
|
|
|
public List<CategoryType> listMerchantGoodsCategoryTypes(@NonNull Long merchantId) {
|
|
@@ -114,7 +117,14 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
.eq(Objects.nonNull(param.getStatus()), Goods::getStatus, param.getStatus())
|
|
|
.like(StringUtils.nonEmpty(param.getName()), Goods::getName, param.getName())
|
|
|
.orderByDesc(Goods::getCreateTime).page(PagingUtils.convert(param.getPaging()));
|
|
|
- return PagingUtils.convert(page, GoodsCopier.INSTANCE::copying);
|
|
|
+ Pagination<GoodsDTO> pagination = PagingUtils.convert(page, GoodsCopier.INSTANCE::copying);
|
|
|
+ pagination.getRecords().forEach(item ->{
|
|
|
+ Category category = this.categoryService.getById(item.getCategoryId());
|
|
|
+ if (category != null){
|
|
|
+ item.setCategoryName(category.getName());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return pagination;
|
|
|
}
|
|
|
|
|
|
@Override
|