|
@@ -47,11 +47,12 @@
|
|
|
</select>
|
|
|
|
|
|
<!--根据id和名称统计数量-->
|
|
|
- <!--int countByIdAndName(Integer id, String productCategoryName);-->
|
|
|
+ <!--int countByIdAndName(Integer id, String productCategoryName, Integer tenantId);-->
|
|
|
<select id="countByIdAndName" resultType="int">
|
|
|
select count(*)
|
|
|
from product_category
|
|
|
where product_category_name = #{productCategoryName}
|
|
|
+ and tenant_id = #{tenantId}
|
|
|
and id != #{id}
|
|
|
</select>
|
|
|
|
|
@@ -245,31 +246,31 @@
|
|
|
|
|
|
<select id="getAreaList" resultMap="getAreaListMap">
|
|
|
SELECT DISTINCT sale_area
|
|
|
- FROM product_market_data a left join product b on a.product_id =b.id
|
|
|
+ FROM product_market_data a left join product b on a.product_id =b.id
|
|
|
<where>
|
|
|
- <if test="productId != null and productId != ''">
|
|
|
- a.product_id = #{productId} and b.tenant_id=#{tenantId}
|
|
|
- </if>
|
|
|
- <if test="categoryId !=null and categoryId != ''">
|
|
|
- product_id
|
|
|
- IN(
|
|
|
- SELECT id
|
|
|
- FROM product
|
|
|
- WHERE
|
|
|
- product_category_id = #{categoryId})
|
|
|
- and tenant_id=#{tenantId}
|
|
|
- </if>
|
|
|
- <if test="patentNoList != null and patentNoList.size() > 0 ">
|
|
|
- product_id IN(
|
|
|
- SELECT product_id
|
|
|
- FROM asso_product_patent c left join product d on c.product_id =d.id
|
|
|
- WHERE c.patent_no IN
|
|
|
- <foreach collection="patentNoList" item="patentNo" index="index" open="(" close=")" separator=",">
|
|
|
- #{patentNo}
|
|
|
- </foreach>
|
|
|
- and d.tenant_id=#{tenantId}
|
|
|
- )
|
|
|
- </if>
|
|
|
+ <if test="productId != null and productId != ''">
|
|
|
+ a.product_id = #{productId} and b.tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="categoryId !=null and categoryId != ''">
|
|
|
+ product_id
|
|
|
+ IN(
|
|
|
+ SELECT id
|
|
|
+ FROM product
|
|
|
+ WHERE
|
|
|
+ product_category_id = #{categoryId})
|
|
|
+ and tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="patentNoList != null and patentNoList.size() > 0 ">
|
|
|
+ product_id IN(
|
|
|
+ SELECT product_id
|
|
|
+ FROM asso_product_patent c left join product d on c.product_id =d.id
|
|
|
+ WHERE c.patent_no IN
|
|
|
+ <foreach collection="patentNoList" item="patentNo" index="index" open="(" close=")" separator=",">
|
|
|
+ #{patentNo}
|
|
|
+ </foreach>
|
|
|
+ and d.tenant_id=#{tenantId}
|
|
|
+ )
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</select>
|
|
|
</mapper>
|