|
@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.github.pagehelper.Page;
|
|
@@ -176,18 +177,23 @@ public class ActivityRecommendServiceImpl extends ServiceImpl<ActivityRecommendM
|
|
|
return result;
|
|
|
}
|
|
|
List<ActivityRecommendGoods> list = page.getRecords();
|
|
|
- List<ActivityRecommendGoodsVo> listVos = list.stream().map(item -> {
|
|
|
- ActivityRecommendGoodsVo vo = new ActivityRecommendGoodsVo();
|
|
|
- BeanUtil.copyProperties(item, vo);
|
|
|
- Goods goods = iGoodsService.getById(item.getGoodsId());
|
|
|
- vo.setGoodsName(goods.getGoodsName());
|
|
|
- vo.setGoodsType(goods.getGoodsType());
|
|
|
- vo.setCoverUrl(goods.getCoverUrl());
|
|
|
- vo.setYear(goods.getYear());
|
|
|
- vo.setStandPrice(goods.getStandPrice());
|
|
|
- vo.setLinePrice(goods.getLinePrice());
|
|
|
- return vo;
|
|
|
- }).collect(Collectors.toList());
|
|
|
+ List<ActivityRecommendGoodsVo> listVos = new ArrayList<>();
|
|
|
+ for (ActivityRecommendGoods item : list) {
|
|
|
+ Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>()
|
|
|
+ .eq(Goods::getGoodsId, item.getGoodsId())
|
|
|
+ .eq(Goods::getGoodsStatus, 1));
|
|
|
+ if (ObjectUtils.isNotNull(goods)){
|
|
|
+ ActivityRecommendGoodsVo vo = new ActivityRecommendGoodsVo();
|
|
|
+ BeanUtil.copyProperties(item, vo);
|
|
|
+ vo.setGoodsName(goods.getGoodsName());
|
|
|
+ vo.setGoodsType(goods.getGoodsType());
|
|
|
+ vo.setCoverUrl(goods.getCoverUrl());
|
|
|
+ vo.setYear(goods.getYear());
|
|
|
+ vo.setStandPrice(goods.getStandPrice());
|
|
|
+ vo.setLinePrice(goods.getLinePrice());
|
|
|
+ listVos.add(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
result.setTotal(page.getTotal());
|
|
|
result.setRows(listVos);
|
|
|
result.setCode(200);
|