提交 5b4f1a1e 作者: zhenjie

商品查询修改

上级 04b2773d
...@@ -83,7 +83,7 @@ public class MallGoodsDO implements Serializable { ...@@ -83,7 +83,7 @@ public class MallGoodsDO implements Serializable {
private Integer imgId; private Integer imgId;
private List<MallGoodsDO> mallGoodsDOList; private List<MallGoodsDO> mallGoodsDOList;
private PriceStockDO priceStockDO; private List<PriceStockDO> priceStockDOS;
public MallGoodsDO(MallGoodsVO mallGoodsVO) { public MallGoodsDO(MallGoodsVO mallGoodsVO) {
this.id = mallGoodsVO.getId(); this.id = mallGoodsVO.getId();
...@@ -118,9 +118,7 @@ public class MallGoodsDO implements Serializable { ...@@ -118,9 +118,7 @@ public class MallGoodsDO implements Serializable {
public UavCartDTO buildUavCartDTO() { public UavCartDTO buildUavCartDTO() {
return UavCartDTO.builder().mallGoodsId(id).thirdBackUserAccountId(userAccountId).tradeName(tradeName) return UavCartDTO.builder().mallGoodsId(id).thirdBackUserAccountId(userAccountId).tradeName(tradeName)
.productSpec(priceStockDO.getProductSpec()).salePrice(priceStockDO.getSalePrice()) .priceShow(priceShow).deleted(deleted).shelfStatus(shelfStatus).build();
.skuImage(priceStockDO.getSkuImage() == null ? url : priceStockDO.getSkuImage())
.skuNo(priceStockDO.getSkuNo()).priceShow(priceShow).deleted(deleted).shelfStatus(shelfStatus).build();
} }
} }
...@@ -3,12 +3,14 @@ package com.mmc.pms.service.mall.impl; ...@@ -3,12 +3,14 @@ package com.mmc.pms.service.mall.impl;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.dao.mall.AppMallGoodsDao; import com.mmc.pms.dao.mall.AppMallGoodsDao;
import com.mmc.pms.entity.mall.MallGoodsDO; import com.mmc.pms.entity.mall.MallGoodsDO;
import com.mmc.pms.entity.mall.PriceStockDO;
import com.mmc.pms.model.mall.GoodsListVO; import com.mmc.pms.model.mall.GoodsListVO;
import com.mmc.pms.model.mall.MallGoodsVO; import com.mmc.pms.model.mall.MallGoodsVO;
import com.mmc.pms.model.mall.UavCartDTO; import com.mmc.pms.model.mall.UavCartDTO;
import com.mmc.pms.model.qo.mall.PriceStockQO; import com.mmc.pms.model.qo.mall.PriceStockQO;
import com.mmc.pms.service.mall.AppMallGoodsService; import com.mmc.pms.service.mall.AppMallGoodsService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -69,6 +71,19 @@ public class AppMallGoodsServiceImpl implements AppMallGoodsService { ...@@ -69,6 +71,19 @@ public class AppMallGoodsServiceImpl implements AppMallGoodsService {
public List<UavCartDTO> listPriceStock(List<PriceStockQO> param) { public List<UavCartDTO> listPriceStock(List<PriceStockQO> param) {
// 根据商品id和规格套装查询 // 根据商品id和规格套装查询
List<MallGoodsDO> mallGoodsList = appMallGoodsDao.listPriceStock(param); List<MallGoodsDO> mallGoodsList = appMallGoodsDao.listPriceStock(param);
return mallGoodsList.stream().map(MallGoodsDO::buildUavCartDTO).collect(Collectors.toList()); List<UavCartDTO> uavCartDTOS = new ArrayList<UavCartDTO>();
for (MallGoodsDO mallGoodsDO : mallGoodsList) {
if (CollectionUtils.isNotEmpty(mallGoodsDO.getPriceStockDOS())) {
for (PriceStockDO priceStockDO : mallGoodsDO.getPriceStockDOS()) {
UavCartDTO uavCartDTO = mallGoodsDO.buildUavCartDTO();
uavCartDTO.setSkuImage(StringUtils.isBlank(priceStockDO.getSkuImage()) ? mallGoodsDO.getUrl() : priceStockDO.getSkuImage());
uavCartDTO.setProductSpec(priceStockDO.getProductSpec());
uavCartDTO.setSalePrice(priceStockDO.getSalePrice());
uavCartDTO.setSkuNo(priceStockDO.getSkuNo());
uavCartDTOS.add(uavCartDTO);
}
}
}
return uavCartDTOS;
} }
} }
...@@ -74,12 +74,13 @@ ...@@ -74,12 +74,13 @@
<result column="url" property="url"/> <result column="url" property="url"/>
<result column="is_deleted" property="deleted"/> <result column="is_deleted" property="deleted"/>
<result column="shelf_status" property="shelfStatus"/> <result column="shelf_status" property="shelfStatus"/>
<association property="priceStockDO" javaType="com.mmc.pms.entity.mall.PriceStockDO"> <collection property="priceStockDOS" ofType="com.mmc.pms.entity.mall.PriceStockDO" >
<id column="productSpecId" property="id"/>
<result column="product_spec" property="productSpec"/> <result column="product_spec" property="productSpec"/>
<result column="sku_image" property="skuImage"/> <result column="sku_image" property="skuImage"/>
<result column="sale_price" property="salePrice"/> <result column="sale_price" property="salePrice"/>
<result column="sku_no" property="skuNo"/> <result column="sku_no" property="skuNo"/>
</association> </collection>
</resultMap> </resultMap>
<select id="listPriceStock" resultMap="resultMallGoodsMap"> <select id="listPriceStock" resultMap="resultMallGoodsMap">
SELECT SELECT
...@@ -90,6 +91,7 @@ ...@@ -90,6 +91,7 @@
mg.is_deleted, mg.is_deleted,
mg.shelf_status, mg.shelf_status,
mgr.url url, mgr.url url,
ps.id as productSpecId,
ps.product_spec, ps.product_spec,
ps.sale_price, ps.sale_price,
ps.sku_image, ps.sku_image,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论