Authored by Lixiaodi

香港价格

@@ -36,6 +36,7 @@ public interface StoragePriceMapper { @@ -36,6 +36,7 @@ public interface StoragePriceMapper {
36 36
37 StoragePrice selectLeastPrice(Integer storageId); 37 StoragePrice selectLeastPrice(Integer storageId);
38 StoragePrice selectPreSaleLeastPrice(Integer storageId); 38 StoragePrice selectPreSaleLeastPrice(Integer storageId);
  39 + StoragePrice selectHKLeastPrice(Integer storageId);
39 40
40 41
41 List<StoragePrice> selectByStorageIds(List<Integer> storageIds); 42 List<StoragePrice> selectByStorageIds(List<Integer> storageIds);
@@ -65,6 +66,7 @@ public interface StoragePriceMapper { @@ -65,6 +66,7 @@ public interface StoragePriceMapper {
65 */ 66 */
66 List<StoragePrice> selectBatchLeastPrice(@Param("skuList") Collection<Integer> skuList); 67 List<StoragePrice> selectBatchLeastPrice(@Param("skuList") Collection<Integer> skuList);
67 List<StoragePrice> selectBatchPreSaleLeastPrice(@Param("skuList") Collection<Integer> skuList); 68 List<StoragePrice> selectBatchPreSaleLeastPrice(@Param("skuList") Collection<Integer> skuList);
  69 + List<StoragePrice> selectBatchHKLeastPrice(@Param("skuList") Collection<Integer> skuList);
68 70
69 71
70 List<StoragePrice> selectByStorageIdsPlus(@Param("list") List<Integer> integers, @Param("storageId") Integer storageId, @Param("sellerUid") Integer sellerUid); 72 List<StoragePrice> selectByStorageIdsPlus(@Param("list") List<Integer> integers, @Param("storageId") Integer storageId, @Param("sellerUid") Integer sellerUid);
@@ -84,10 +84,13 @@ @@ -84,10 +84,13 @@
84 where skup = #{skup,jdbcType=INTEGER} and status = 2 84 where skup = #{skup,jdbcType=INTEGER} and status = 2
85 </update> 85 </update>
86 <select id="selectLeastPrice" resultMap="BaseResultMap"> 86 <select id="selectLeastPrice" resultMap="BaseResultMap">
87 - 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 87 + 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
88 </select> 88 </select>
89 <select id="selectPreSaleLeastPrice" resultMap="BaseResultMap"> 89 <select id="selectPreSaleLeastPrice" resultMap="BaseResultMap">
90 - 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 90 + 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
  91 + </select>
  92 + <select id="selectHKLeastPrice" resultMap="BaseResultMap">
  93 + 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
91 </select> 94 </select>
92 <select id="selectByStorageIds" resultMap="BaseResultMap"> 95 <select id="selectByStorageIds" resultMap="BaseResultMap">
93 select id, skup, storage_id, price, status 96 select id, skup, storage_id, price, status
@@ -112,7 +115,7 @@ @@ -112,7 +115,7 @@
112 <select id="selectInStockLeastPriceByProductId" resultType="java.math.BigDecimal"> 115 <select id="selectInStockLeastPriceByProductId" resultType="java.math.BigDecimal">
113 select min(price) as price 116 select min(price) as price
114 from storage_price 117 from storage_price
115 - where status = 1 and storage_id = #{storageId} and is_hide = 0 and pre_sale_flag=0 118 + where status = 1 and storage_id = #{storageId} and is_hide = 0 and pre_sale_flag=0 and region=0
116 </select> 119 </select>
117 120
118 <select id="selectBySkupList" resultMap="BaseResultMap"> 121 <select id="selectBySkupList" resultMap="BaseResultMap">
@@ -176,7 +179,7 @@ @@ -176,7 +179,7 @@
176 storage_id in 179 storage_id in
177 <foreach item="storageId" index="index" collection="skuList" open="(" separator="," close=")"> 180 <foreach item="storageId" index="index" collection="skuList" open="(" separator="," close=")">
178 #{storageId, jdbcType=INTEGER} 181 #{storageId, jdbcType=INTEGER}
179 - </foreach> and status = 1 and is_hide = 0 and pre_sale_flag=0 182 + </foreach> and status = 1 and is_hide = 0 and pre_sale_flag=0 and region=0
180 group by storage_id 183 group by storage_id
181 </select> 184 </select>
182 185
@@ -185,7 +188,16 @@ @@ -185,7 +188,16 @@
185 storage_id in 188 storage_id in
186 <foreach item="storageId" index="index" collection="skuList" open="(" separator="," close=")"> 189 <foreach item="storageId" index="index" collection="skuList" open="(" separator="," close=")">
187 #{storageId, jdbcType=INTEGER} 190 #{storageId, jdbcType=INTEGER}
188 - </foreach> and status = 1 and is_hide = 0 and pre_sale_flag=1 191 + </foreach> and status = 1 and is_hide = 0 and pre_sale_flag=1 and region=0
  192 + group by storage_id
  193 + </select>
  194 +
  195 + <select id="selectBatchHKLeastPrice" resultMap="BaseResultMap">
  196 + select storage_id , min(price) as price from storage_price where
  197 + storage_id in
  198 + <foreach item="storageId" index="index" collection="skuList" open="(" separator="," close=")">
  199 + #{storageId, jdbcType=INTEGER}
  200 + </foreach> and status = 1 and is_hide = 0 and pre_sale_flag=0 and region=1
189 group by storage_id 201 group by storage_id
190 </select> 202 </select>
191 203
@@ -208,7 +220,7 @@ @@ -208,7 +220,7 @@
208 from storage_price 220 from storage_price
209 where storage_id =#{storageId} and status in(1,100) and is_hide = 0 221 where storage_id =#{storageId} and status in(1,100) and is_hide = 0
210 <if test="secondType != null and secondType !=''"> 222 <if test="secondType != null and secondType !=''">
211 - and pre_sale_flag in (${secondType}) 223 + and pre_sale_flag in (${secondType}) and region=0
212 </if> 224 </if>
213 order by ${orderBy} 225 order by ${orderBy}
214 limit #{start},#{limit} 226 limit #{start},#{limit}
@@ -219,18 +231,18 @@ @@ -219,18 +231,18 @@
219 from storage_price 231 from storage_price
220 where storage_id =#{storageId} and status in(1,100) and is_hide = 0 232 where storage_id =#{storageId} and status in(1,100) and is_hide = 0
221 <if test="secondType != null and secondType !=''"> 233 <if test="secondType != null and secondType !=''">
222 - and pre_sale_flag in (${secondType}) 234 + and pre_sale_flag in (${secondType}) and region=0
223 </if> 235 </if>
224 </select> 236 </select>
225 237
226 <select id="selectSecondHandType" resultType="java.lang.Integer"> 238 <select id="selectSecondHandType" resultType="java.lang.Integer">
227 select distinct pre_sale_flag from storage_price 239 select distinct pre_sale_flag from storage_price
228 - 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 240 + 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
229 </select> 241 </select>
230 242
231 <select id="selectSecondHandCount" resultType="java.lang.Integer"> 243 <select id="selectSecondHandCount" resultType="java.lang.Integer">
232 select count(*) from storage_price 244 select count(*) from storage_price
233 - where storage_id =#{storageId} and status in(1,100) and is_hide = 0 and pre_sale_flag in (5,6) 245 + where storage_id =#{storageId} and status in(1,100) and is_hide = 0 and pre_sale_flag in (5,6) and region=0
234 </select> 246 </select>
235 247
236 248
@@ -471,6 +471,10 @@ public class ProductServiceImpl implements ProductService { @@ -471,6 +471,10 @@ public class ProductServiceImpl implements ProductService {
471 resp.setPreSaleLeastPrice(preSaleStoragePrice.getPrice()); 471 resp.setPreSaleLeastPrice(preSaleStoragePrice.getPrice());
472 } 472 }
473 473
  474 + StoragePrice hkStoragePrice = storagePriceMapper.selectHKLeastPrice(storageId);
  475 + if (null != hkStoragePrice) {
  476 + resp.setHkLeastPrice(hkStoragePrice.getPrice());
  477 + }
474 478
475 return resp; 479 return resp;
476 } 480 }
@@ -490,9 +494,11 @@ public class ProductServiceImpl implements ProductService { @@ -490,9 +494,11 @@ public class ProductServiceImpl implements ProductService {
490 494
491 List<StoragePrice> preSaleStoragePrices = storagePriceMapper.selectBatchPreSaleLeastPrice(skuList); 495 List<StoragePrice> preSaleStoragePrices = storagePriceMapper.selectBatchPreSaleLeastPrice(skuList);
492 496
  497 + List<StoragePrice> hkStoragePrices = storagePriceMapper.selectBatchHKLeastPrice(skuList);
493 498
494 Map<Integer, BigDecimal> priceMap = storagePrices.stream().collect(Collectors.toMap(StoragePrice::getStorageId, StoragePrice::getPrice)); 499 Map<Integer, BigDecimal> priceMap = storagePrices.stream().collect(Collectors.toMap(StoragePrice::getStorageId, StoragePrice::getPrice));
495 Map<Integer, BigDecimal> preSalePriceMap = preSaleStoragePrices.stream().collect(Collectors.toMap(StoragePrice::getStorageId, StoragePrice::getPrice)); 500 Map<Integer, BigDecimal> preSalePriceMap = preSaleStoragePrices.stream().collect(Collectors.toMap(StoragePrice::getStorageId, StoragePrice::getPrice));
  501 + Map<Integer, BigDecimal> hkPriceMap = hkStoragePrices.stream().collect(Collectors.toMap(StoragePrice::getStorageId, StoragePrice::getPrice));
496 List<StorageInfoResp> resp = Lists.newArrayList(); 502 List<StorageInfoResp> resp = Lists.newArrayList();
497 storageList.stream().forEach(item -> { 503 storageList.stream().forEach(item -> {
498 StorageInfoResp storageInfoResp = new StorageInfoResp(); 504 StorageInfoResp storageInfoResp = new StorageInfoResp();
@@ -502,6 +508,7 @@ public class ProductServiceImpl implements ProductService { @@ -502,6 +508,7 @@ public class ProductServiceImpl implements ProductService {
502 storageInfoResp.setStorageId(item.getId()); 508 storageInfoResp.setStorageId(item.getId());
503 storageInfoResp.setLeastPrice(priceMap.get(item.getId())); 509 storageInfoResp.setLeastPrice(priceMap.get(item.getId()));
504 storageInfoResp.setPreSaleLeastPrice(preSalePriceMap.get(item.getId())); 510 storageInfoResp.setPreSaleLeastPrice(preSalePriceMap.get(item.getId()));
  511 + storageInfoResp.setHkLeastPrice(hkPriceMap.get(item.getId()));
505 resp.add(storageInfoResp); 512 resp.add(storageInfoResp);
506 }); 513 });
507 514