Authored by Lixiaodi

香港价格

... ... @@ -36,6 +36,7 @@ public interface StoragePriceMapper {
StoragePrice selectLeastPrice(Integer storageId);
StoragePrice selectPreSaleLeastPrice(Integer storageId);
StoragePrice selectHKLeastPrice(Integer storageId);
List<StoragePrice> selectByStorageIds(List<Integer> storageIds);
... ... @@ -65,6 +66,7 @@ public interface StoragePriceMapper {
*/
List<StoragePrice> selectBatchLeastPrice(@Param("skuList") Collection<Integer> skuList);
List<StoragePrice> selectBatchPreSaleLeastPrice(@Param("skuList") Collection<Integer> skuList);
List<StoragePrice> selectBatchHKLeastPrice(@Param("skuList") Collection<Integer> skuList);
List<StoragePrice> selectByStorageIdsPlus(@Param("list") List<Integer> integers, @Param("storageId") Integer storageId, @Param("sellerUid") Integer sellerUid);
... ...
... ... @@ -84,10 +84,13 @@
where skup = #{skup,jdbcType=INTEGER} and status = 2
</update>
<select id="selectLeastPrice" resultMap="BaseResultMap">
select price, skup, product_id from storage_price where storage_id = #{storageId,jdbcType=INTEGER} and status = 1 and is_hide = 0 and pre_sale_flag=0 order by price limit 1
select price, skup, product_id from storage_price where storage_id = #{storageId,jdbcType=INTEGER} and status = 1 and is_hide = 0 and pre_sale_flag=0 and region=0 order by price limit 1
</select>
<select id="selectPreSaleLeastPrice" resultMap="BaseResultMap">
select price, skup from storage_price where storage_id = #{storageId,jdbcType=INTEGER} and status = 1 and is_hide = 0 and pre_sale_flag=1 order by price limit 1
select price, skup from storage_price where storage_id = #{storageId,jdbcType=INTEGER} and status = 1 and is_hide = 0 and pre_sale_flag=1 and region=0 order by price limit 1
</select>
<select id="selectHKLeastPrice" resultMap="BaseResultMap">
select price, skup from storage_price where storage_id = #{storageId,jdbcType=INTEGER} and status = 1 and is_hide = 0 and pre_sale_flag=1 and region=1 order by price limit 1
</select>
<select id="selectByStorageIds" resultMap="BaseResultMap">
select id, skup, storage_id, price, status
... ... @@ -112,7 +115,7 @@
<select id="selectInStockLeastPriceByProductId" resultType="java.math.BigDecimal">
select min(price) as price
from storage_price
where status = 1 and storage_id = #{storageId} and is_hide = 0 and pre_sale_flag=0
where status = 1 and storage_id = #{storageId} and is_hide = 0 and pre_sale_flag=0 and region=0
</select>
<select id="selectBySkupList" resultMap="BaseResultMap">
... ... @@ -176,7 +179,7 @@
storage_id in
<foreach item="storageId" index="index" collection="skuList" open="(" separator="," close=")">
#{storageId, jdbcType=INTEGER}
</foreach> and status = 1 and is_hide = 0 and pre_sale_flag=0
</foreach> and status = 1 and is_hide = 0 and pre_sale_flag=0 and region=0
group by storage_id
</select>
... ... @@ -185,7 +188,16 @@
storage_id in
<foreach item="storageId" index="index" collection="skuList" open="(" separator="," close=")">
#{storageId, jdbcType=INTEGER}
</foreach> and status = 1 and is_hide = 0 and pre_sale_flag=1
</foreach> and status = 1 and is_hide = 0 and pre_sale_flag=1 and region=0
group by storage_id
</select>
<select id="selectBatchHKLeastPrice" resultMap="BaseResultMap">
select storage_id , min(price) as price from storage_price where
storage_id in
<foreach item="storageId" index="index" collection="skuList" open="(" separator="," close=")">
#{storageId, jdbcType=INTEGER}
</foreach> and status = 1 and is_hide = 0 and pre_sale_flag=0 and region=1
group by storage_id
</select>
... ... @@ -208,7 +220,7 @@
from storage_price
where storage_id =#{storageId} and status in(1,100) and is_hide = 0
<if test="secondType != null and secondType !=''">
and pre_sale_flag in (${secondType})
and pre_sale_flag in (${secondType}) and region=0
</if>
order by ${orderBy}
limit #{start},#{limit}
... ... @@ -219,18 +231,18 @@
from storage_price
where storage_id =#{storageId} and status in(1,100) and is_hide = 0
<if test="secondType != null and secondType !=''">
and pre_sale_flag in (${secondType})
and pre_sale_flag in (${secondType}) and region=0
</if>
</select>
<select id="selectSecondHandType" resultType="java.lang.Integer">
select distinct pre_sale_flag from storage_price
where storage_id =#{storageId} and status in(1,100) and is_hide = 0 and pre_sale_flag in (5,6) order by pre_sale_flag
where storage_id =#{storageId} and status in(1,100) and is_hide = 0 and pre_sale_flag in (5,6) and region=0 order by pre_sale_flag
</select>
<select id="selectSecondHandCount" resultType="java.lang.Integer">
select count(*) from storage_price
where storage_id =#{storageId} and status in(1,100) and is_hide = 0 and pre_sale_flag in (5,6)
where storage_id =#{storageId} and status in(1,100) and is_hide = 0 and pre_sale_flag in (5,6) and region=0
</select>
... ...
... ... @@ -471,6 +471,10 @@ public class ProductServiceImpl implements ProductService {
resp.setPreSaleLeastPrice(preSaleStoragePrice.getPrice());
}
StoragePrice hkStoragePrice = storagePriceMapper.selectHKLeastPrice(storageId);
if (null != hkStoragePrice) {
resp.setHkLeastPrice(hkStoragePrice.getPrice());
}
return resp;
}
... ... @@ -490,9 +494,11 @@ public class ProductServiceImpl implements ProductService {
List<StoragePrice> preSaleStoragePrices = storagePriceMapper.selectBatchPreSaleLeastPrice(skuList);
List<StoragePrice> hkStoragePrices = storagePriceMapper.selectBatchHKLeastPrice(skuList);
Map<Integer, BigDecimal> priceMap = storagePrices.stream().collect(Collectors.toMap(StoragePrice::getStorageId, StoragePrice::getPrice));
Map<Integer, BigDecimal> preSalePriceMap = preSaleStoragePrices.stream().collect(Collectors.toMap(StoragePrice::getStorageId, StoragePrice::getPrice));
Map<Integer, BigDecimal> hkPriceMap = hkStoragePrices.stream().collect(Collectors.toMap(StoragePrice::getStorageId, StoragePrice::getPrice));
List<StorageInfoResp> resp = Lists.newArrayList();
storageList.stream().forEach(item -> {
StorageInfoResp storageInfoResp = new StorageInfoResp();
... ... @@ -502,6 +508,7 @@ public class ProductServiceImpl implements ProductService {
storageInfoResp.setStorageId(item.getId());
storageInfoResp.setLeastPrice(priceMap.get(item.getId()));
storageInfoResp.setPreSaleLeastPrice(preSalePriceMap.get(item.getId()));
storageInfoResp.setHkLeastPrice(hkPriceMap.get(item.getId()));
resp.add(storageInfoResp);
});
... ...