Authored by Lixiaodi

闪购

... ... @@ -8,5 +8,6 @@ public class StorageDepositCount {
private Integer productId;
private Integer storageIdCount;
private Integer storageCount;
private Integer skup;
private Integer unShelfStorageCount;
}
\ No newline at end of file
... ...
... ... @@ -25,6 +25,7 @@
<resultMap id="CountResultMap" type="com.yohoufo.dal.order.model.StorageDepositCount" >
<result column="product_id" property="productId" jdbcType="INTEGER" />
<result column="storage_id_count" property="storageIdCount" jdbcType="INTEGER" />
<result column="skup" property="skup" jdbcType="BIGINT" />
<result column="storage_count" property="storageCount" jdbcType="INTEGER" />
<result column="un_shelf_storage_count" property="unShelfStorageCount" jdbcType="INTEGER" />
</resultMap>
... ... @@ -263,7 +264,7 @@
</select>
<select id="queryUserDepositProduct" resultMap="CountResultMap">
select product_id , count(distinct storage_id) as storage_id_count,count(*) as storage_count,sum( if( order_status = 0, 1, 0)) as un_shelf_storage_count from storage_deposit
select product_id , count(distinct storage_id) as storage_id_count,count(*) as storage_count,sum( if( order_status = 0, 1, 0)) as un_shelf_storage_count,max(skup) as skup from storage_deposit
where owner_uid = #{uid} and status=1 and del_status=0 limit #{start}, #{count}
and product_id in
<foreach item="item" index="index" collection="productIdList" open="(" separator="," close=")">
... ...
... ... @@ -49,32 +49,20 @@ public class DepositServiceImpl implements DepositService {
}
List<Integer> productIdList = storageDepositMapper.queryUserDepositProductId(uid, (page - 1) * limit, limit);
List<StorageDepositCount> countInfoList = storageDepositMapper.queryUserDepositProduct(uid, productIdList);
/*// 商品名称
List<Product> productList = productMapper.selectByIds(productIdList);
// 颜色
List<Goods> goodsList = goodsMapper.selectByProductIds(productIdList);
// 图片
List<GoodsImages> goodsImagesList = goodsImagesMapper.selectByGoodsIdList(goodsList.stream().map(Goods::getId).collect(Collectors.toList()));
List<Integer> skupList = countInfoList.stream().map(StorageDepositCount::getSkup).collect(Collectors.toList());
List<SellerOrderGoods> goodsList = sellerOrderGoodsMapper.selectBySkups(skupList);
Map<Integer, StorageDepositCount> countInfoMap = countInfoList.stream().map(Function.identity()).collect(Collectors.toMap(StorageDepositCount::getProductId, Function.identity()));
Map<Integer, Product> productMap = productList.stream().map(Function.identity()).collect(Collectors.toMap(Product::getId, Function.identity()));
Map<Integer, Goods> goodsMap = goodsList.stream().map(Function.identity()).collect(Collectors.toMap(Goods::getProductId, Function.identity()));
Map<Integer, GoodsImages> goodsImagesMap = goodsImagesList.stream().map(Function.identity()).collect(Collectors.toMap(GoodsImages::getProductId, Function.identity()));
Map<Integer, SellerOrderGoods> goodsMap = goodsList.stream().map(Function.identity()).collect(Collectors.toMap(SellerOrderGoods::getProductId, Function.identity()));
List<DepositProductBo> result = new ArrayList<>();
for (Integer productId : productIdList) {
DepositProductBo bo = new DepositProductBo();
bo.setProductId(productId);
Product p = productMap.get(productId);
if (p != null) {
bo.setProductName(p.getProductName());
}
Goods g = goodsMap.get(productId);
if (g != null) {
bo.setColorName(StringUtils.isBlank(g.getGoodsName()) ? g.getColorName() : g.getGoodsName());
}
GoodsImages gi = goodsImagesMap.get(productId);
if (gi != null) {
bo.setPic(ImageUrlAssist.getAllProductPicUrl(gi.getImageUrl(), "goodsimg", "center", "d2hpdGU="));
SellerOrderGoods goods = goodsMap.get(productId);
if (goods != null) {
bo.setProductName(goods.getProductName());
bo.setColorName(goods.getColorName());
bo.setPic(goods.getImageUrl());
}
StorageDepositCount countInfo = countInfoMap.get(productId);
if (countInfo != null) {
... ... @@ -83,7 +71,7 @@ public class DepositServiceImpl implements DepositService {
bo.setShelfStatus(countInfo.getStorageIdCount() == 0 ? "全部已上架" : ("有" + countInfo.getStorageIdCount() + "件未上架"));
}
result.add(bo);
}*/
}
return null;
}
... ...