...
|
...
|
@@ -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>
|
...
|
...
|
|