Authored by caoyan

Merge branch 'master' of http://git.yoho.cn/ufo/ufo-platform

... ... @@ -175,17 +175,31 @@
</update>
<select id="selectProductStorageCount" resultType="java.lang.Integer">
select count(*) from product p where <include refid="skcPageCondition" />
select
<if test="product.storageNum != null"> count(DISTINCT p.id) </if>
<if test="product.storageNum == null"> count(p.id) </if>
from product p where
<include refid="skcPageCondition" />
</select>
<select id="selectProductStorageList" resultMap="BaseResultMap">
select id, brand_id, product_name, max_sort_id, mid_sort_id
select
<if test="product.storageNum != null"> DISTINCT p.id, p.brand_id, p.product_name, p.max_sort_id, p.mid_sort_id </if>
<if test="product.storageNum == null"> p.id, p.brand_id, p.product_name, p.max_sort_id, p.mid_sort_id </if>
from product p
where <include refid="skcPageCondition" /> limit #{start},#{rows}
</select>
<sql id="skcPageCondition">
1 = 1
<if test="product.storageNum != null">
<if test="product.storageNum == 0">
And exists(SELECT 1 FROM storage s WHERE s.storage_num = 0 AND s.product_id= p.id)
</if>
<if test="product.storageNum != 0">
And exists(SELECT 1 FROM storage s WHERE s.storage_num >= 1 AND s.product_id= p.id)
</if>
</if>
<if test="product.id != null and product.id > 0">
and p.id = #{product.id}
</if>
... ...
... ... @@ -52,7 +52,7 @@ public class StorageService {
// 如果查询条件含storage_price,先根据条件查询出productId列表 ,再到product表中联合查询
List<Integer> integerList = storagePriceService.selectProductIdBySkupInfo(product);
if (null != integerList && integerList.isEmpty()) {
if (null != integerList && integerList.isEmpty()) { // 返回空列表,代表查询了storage_price表,但是查询的接口是空,再联合查询肯定也是空,所有直接返回空
LOGGER.warn("storagePriceService.selectProductIdBySkupInfo count is 0.param = {}", bo);
return new PageResponseBO<>();
}
... ...