|
@@ -175,17 +175,31 @@ |
|
@@ -175,17 +175,31 @@ |
175
|
</update>
|
175
|
</update>
|
176
|
|
176
|
|
177
|
<select id="selectProductStorageCount" resultType="java.lang.Integer">
|
177
|
<select id="selectProductStorageCount" resultType="java.lang.Integer">
|
178
|
- select count(*) from product p where <include refid="skcPageCondition" />
|
178
|
+ select
|
|
|
179
|
+ <if test="product.storageNum != null"> count(DISTINCT p.id) </if>
|
|
|
180
|
+ <if test="product.storageNum == null"> count(p.id) </if>
|
|
|
181
|
+ from product p where
|
|
|
182
|
+ <include refid="skcPageCondition" />
|
179
|
</select>
|
183
|
</select>
|
180
|
|
184
|
|
181
|
<select id="selectProductStorageList" resultMap="BaseResultMap">
|
185
|
<select id="selectProductStorageList" resultMap="BaseResultMap">
|
182
|
- select id, brand_id, product_name, max_sort_id, mid_sort_id
|
186
|
+ select
|
|
|
187
|
+ <if test="product.storageNum != null"> DISTINCT p.id, p.brand_id, p.product_name, p.max_sort_id, p.mid_sort_id </if>
|
|
|
188
|
+ <if test="product.storageNum == null"> p.id, p.brand_id, p.product_name, p.max_sort_id, p.mid_sort_id </if>
|
183
|
from product p
|
189
|
from product p
|
184
|
where <include refid="skcPageCondition" /> limit #{start},#{rows}
|
190
|
where <include refid="skcPageCondition" /> limit #{start},#{rows}
|
185
|
</select>
|
191
|
</select>
|
186
|
|
192
|
|
187
|
<sql id="skcPageCondition">
|
193
|
<sql id="skcPageCondition">
|
188
|
1 = 1
|
194
|
1 = 1
|
|
|
195
|
+ <if test="product.storageNum != null">
|
|
|
196
|
+ <if test="product.storageNum == 0">
|
|
|
197
|
+ And exists(SELECT 1 FROM storage s WHERE s.storage_num = 0 AND s.product_id= p.id)
|
|
|
198
|
+ </if>
|
|
|
199
|
+ <if test="product.storageNum != 0">
|
|
|
200
|
+ And exists(SELECT 1 FROM storage s WHERE s.storage_num >= 1 AND s.product_id= p.id)
|
|
|
201
|
+ </if>
|
|
|
202
|
+ </if>
|
189
|
<if test="product.id != null and product.id > 0">
|
203
|
<if test="product.id != null and product.id > 0">
|
190
|
and p.id = #{product.id}
|
204
|
and p.id = #{product.id}
|
191
|
</if>
|
205
|
</if>
|