|
|
@@ -971,34 +971,35 @@
|
|
|
</foreach>
|
|
|
</update>
|
|
|
<select id="getProdStorage" resultType="com.usoftchina.saas.document.dto.ProdStorageDTO">
|
|
|
+ SELECT * FROM (
|
|
|
SELECT pr_id prodId, pr_detail prodName, pr_code prodCode, pr_spec prodSpec, pr_unid prodUnit, pr_brand prodBrand,
|
|
|
- pr_orispeccode prodSpeccode,pr_leadtime prodLeadtime, 1 status
|
|
|
+ pr_orispeccode prodSpeccode,pr_leadtime prodLeadtime, 1 status
|
|
|
FROM product
|
|
|
<where>
|
|
|
- <if test="condition != null">
|
|
|
- ${condition}
|
|
|
- </if>
|
|
|
- <if test="userId != null">
|
|
|
- and pr_id in (select ps_prid from productsaler where ps_acid = #{userId})
|
|
|
- </if>
|
|
|
- <if test="companyId != null">
|
|
|
- and product.companyId = #{companyId}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- union all
|
|
|
- SELECT pr_id prodId, pr_detail prodName, pr_code prodCode, pr_spec prodSpec, pr_unid prodUnit, pr_brand prodBrand,
|
|
|
- pr_orispeccode prodSpeccode,pr_leadtime prodLeadtime, 0 status
|
|
|
- FROM product
|
|
|
+ <if test="userId != null">
|
|
|
+ and pr_id in (select ps_prid from productsaler where ps_acid = #{userId})
|
|
|
+ </if>
|
|
|
+ <if test="companyId != null">
|
|
|
+ and product.companyId = #{companyId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ union all
|
|
|
+ SELECT pr_id prodId, pr_detail prodName, pr_code prodCode, pr_spec prodSpec, pr_unid prodUnit, pr_brand prodBrand,
|
|
|
+ pr_orispeccode prodSpeccode,pr_leadtime prodLeadtime, 0 status
|
|
|
+ FROM product
|
|
|
+ <where>
|
|
|
+ <if test="userId != null">
|
|
|
+ and pr_id not in (select ps_prid from productsaler where ps_acid = #{userId})
|
|
|
+ </if>
|
|
|
+ <if test="companyId != null">
|
|
|
+ and product.companyId = #{companyId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) result
|
|
|
<where>
|
|
|
<if test="condition != null">
|
|
|
${condition}
|
|
|
</if>
|
|
|
- <if test="userId != null">
|
|
|
- and pr_id not in (select ps_prid from productsaler where ps_acid = #{userId})
|
|
|
- </if>
|
|
|
- <if test="companyId != null">
|
|
|
- and product.companyId = #{companyId}
|
|
|
- </if>
|
|
|
</where>
|
|
|
</select>
|
|
|
</mapper>
|