|
@@ -115,21 +115,21 @@
|
|
|
from product p
|
|
|
join product_category pc on p.product_category_id = pc.id
|
|
|
<where>
|
|
|
- <if test="productName != null">
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
and product_name like '%${productName}%'
|
|
|
</if>
|
|
|
- <if test="companyName != null">
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
and company_name like '%${companyName}%'
|
|
|
</if>
|
|
|
- <if test="patentNo != null">
|
|
|
- and id in
|
|
|
+ <if test="patentNo != null and patentNo != ''">
|
|
|
+ and p.id in
|
|
|
(select product_id from asso_product_patent where patent_no = #{patentNo}
|
|
|
union select product_id from asso_structure_patent where patent_no = #{patentNo})
|
|
|
</if>
|
|
|
- <if test="productCategoryId != null">
|
|
|
+ <if test="productCategoryId != null and productCategoryId != ''">
|
|
|
and product_category_id = #{productCategoryId}
|
|
|
</if>
|
|
|
- <if test="productCategoryName != null">
|
|
|
+ <if test="productCategoryName != null and productCategoryName != ''">
|
|
|
and product_category_id in (select id from product_category where product_category_name like
|
|
|
'%${productCategoryName}%')
|
|
|
</if>
|
|
@@ -230,26 +230,31 @@
|
|
|
<select id="queryByGroupProductCategoryId" resultMap="queryByGroupProductCategoryIdMap">
|
|
|
select product_category_id pci,
|
|
|
product_category_name,
|
|
|
- #{orderBy} orderBy,
|
|
|
- #{orderType} orderType
|
|
|
+ ifnull(#{orderBy}, '') orderBy,
|
|
|
+ ifnull(#{orderType}, '') orderType,
|
|
|
+ ifnull(#{productName}, '') productName,
|
|
|
+ ifnull(#{companyName}, '') companyName,
|
|
|
+ ifnull(#{patentNo}, '') patentNo,
|
|
|
+ ifnull(#{productCategoryId}, '') productCategoryId,
|
|
|
+ ifnull(#{productCategoryName}, '') productCategoryName
|
|
|
from product p
|
|
|
join product_category pc on p.product_category_id = pc.id
|
|
|
<where>
|
|
|
- <if test="productName != null">
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
and product_name like '%${productName}%'
|
|
|
</if>
|
|
|
- <if test="companyName != null">
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
and company_name like '%${companyName}%'
|
|
|
</if>
|
|
|
- <if test="patentNo != null">
|
|
|
- and id in
|
|
|
+ <if test="patentNo != null and patentNo != ''">
|
|
|
+ and p.id in
|
|
|
(select product_id from asso_product_patent where patent_no = #{patentNo}
|
|
|
union select product_id from asso_structure_patent where patent_no = #{patentNo})
|
|
|
</if>
|
|
|
- <if test="productCategoryId != null">
|
|
|
+ <if test="productCategoryId != null and productCategoryId != ''">
|
|
|
and product_category_id = #{productCategoryId}
|
|
|
</if>
|
|
|
- <if test="productCategoryName != null">
|
|
|
+ <if test="productCategoryName != null and productCategoryName != ''">
|
|
|
and product_category_id in (select id from product_category where product_category_name like
|
|
|
'%${productCategoryName}%')
|
|
|
</if>
|
|
@@ -262,7 +267,9 @@
|
|
|
<result column="product_category_id" property="productCategoryId"/>
|
|
|
<result column="product_category_name" property="productCategoryName"/>
|
|
|
<collection property="products" ofType="cn.cslg.pas.common.model.vo.ProductVO"
|
|
|
- select="queryByGroupProductCategoryId2" column="{pci=pci, orderBy=orderBy, orderType=orderType}">
|
|
|
+ select="queryByGroupProductCategoryId2"
|
|
|
+ column="{pci=pci, orderBy=orderBy, orderType=orderType, productName=productName, companyName=companyName,
|
|
|
+ patentNo=patentNo, productCategoryId=productCategoryId, productCategoryName=productCategoryName}">
|
|
|
</collection>
|
|
|
</resultMap>
|
|
|
|
|
@@ -279,7 +286,29 @@
|
|
|
product_category_name
|
|
|
from product p
|
|
|
join product_category pc on p.product_category_id = pc.id
|
|
|
- where product_category_id = #{pci}
|
|
|
+ <where>
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
+ and product_name like '%${productName}%'
|
|
|
+ </if>
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
+ and company_name like '%${companyName}%'
|
|
|
+ </if>
|
|
|
+ <if test="patentNo != null and patentNo != ''">
|
|
|
+ and p.id in
|
|
|
+ (select product_id from asso_product_patent where patent_no = #{patentNo}
|
|
|
+ union select product_id from asso_structure_patent where patent_no = #{patentNo})
|
|
|
+ </if>
|
|
|
+ <if test="productCategoryId != null and productCategoryId != ''">
|
|
|
+ and product_category_id = #{productCategoryId}
|
|
|
+ </if>
|
|
|
+ <if test="productCategoryName != null and productCategoryName != ''">
|
|
|
+ and product_category_id in (select id from product_category where product_category_name like
|
|
|
+ '%${productCategoryName}%')
|
|
|
+ </if>
|
|
|
+ <if test="true">
|
|
|
+ and product_category_id = #{pci}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
order by
|
|
|
<choose>
|
|
|
<when test="orderBy != null and orderBy != ''">
|
|
@@ -295,24 +324,30 @@
|
|
|
<!--List<ProductGroupVO> queryByGroupCompanyName(ProductQueryPageDTO productQueryPageDTO);-->
|
|
|
<select id="queryByGroupCompanyName" resultMap="queryByGroupCompanyNameMap">
|
|
|
select company_name cn,
|
|
|
- #{orderBy} orderBy, #{orderType} orderType
|
|
|
+ ifnull(#{orderBy}, '') orderBy,
|
|
|
+ ifnull(#{orderType}, '') orderType,
|
|
|
+ ifnull(#{productName}, '') productName,
|
|
|
+ ifnull(#{companyName}, '') companyName,
|
|
|
+ ifnull(#{patentNo}, '') patentNo,
|
|
|
+ ifnull(#{productCategoryId}, '') productCategoryId,
|
|
|
+ ifnull(#{productCategoryName}, '') productCategoryName
|
|
|
from product
|
|
|
<where>
|
|
|
- <if test="productName != null">
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
and product_name like '%${productName}%'
|
|
|
</if>
|
|
|
- <if test="companyName != null">
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
and company_name like '%${companyName}%'
|
|
|
</if>
|
|
|
- <if test="patentNo != null">
|
|
|
+ <if test="patentNo != null and patentNo != ''">
|
|
|
and id in
|
|
|
(select product_id from asso_product_patent where patent_no = #{patentNo}
|
|
|
union select product_id from asso_structure_patent where patent_no = #{patentNo})
|
|
|
</if>
|
|
|
- <if test="productCategoryId != null">
|
|
|
+ <if test="productCategoryId != null and productCategoryId != ''">
|
|
|
and product_category_id = #{productCategoryId}
|
|
|
</if>
|
|
|
- <if test="productCategoryName != null">
|
|
|
+ <if test="productCategoryName != null and productCategoryName != ''">
|
|
|
and product_category_id in (select id from product_category where product_category_name like
|
|
|
'%${productCategoryName}%')
|
|
|
</if>
|
|
@@ -327,7 +362,9 @@
|
|
|
<resultMap id="queryByGroupCompanyNameMap" type="cn.cslg.pas.common.model.vo.ProductGroupVO">
|
|
|
<result column="cn" property="companyName"/>
|
|
|
<collection property="products" ofType="cn.cslg.pas.common.model.vo.ProductVO"
|
|
|
- select="queryByGroupCompanyNameMap2" column="{cn=cn, orderBy=orderBy, orderType=orderType}">
|
|
|
+ select="queryByGroupCompanyNameMap2"
|
|
|
+ column="{cn=cn, orderBy=orderBy, orderType=orderType, productName=productName, companyName=companyName,
|
|
|
+ patentNo=patentNo, productCategoryId=productCategoryId, productCategoryName=productCategoryName}">
|
|
|
</collection>
|
|
|
</resultMap>
|
|
|
|
|
@@ -344,7 +381,29 @@
|
|
|
product_category_name
|
|
|
from product p
|
|
|
join product_category pc on p.product_category_id = pc.id
|
|
|
- where company_name = #{cn}
|
|
|
+ <where>
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
+ and product_name like '%${productName}%'
|
|
|
+ </if>
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
+ and company_name like '%${companyName}%'
|
|
|
+ </if>
|
|
|
+ <if test="patentNo != null and patentNo != ''">
|
|
|
+ and p.id in
|
|
|
+ (select product_id from asso_product_patent where patent_no = #{patentNo}
|
|
|
+ union select product_id from asso_structure_patent where patent_no = #{patentNo})
|
|
|
+ </if>
|
|
|
+ <if test="productCategoryId != null and productCategoryId != ''">
|
|
|
+ and product_category_id = #{productCategoryId}
|
|
|
+ </if>
|
|
|
+ <if test="productCategoryName != null and productCategoryName != ''">
|
|
|
+ and product_category_id in (select id from product_category where product_category_name like
|
|
|
+ '%${productCategoryName}%')
|
|
|
+ </if>
|
|
|
+ <if test="true">
|
|
|
+ and company_name = #{cn}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
order by
|
|
|
<choose>
|
|
|
<when test="orderBy != null and orderBy != ''">
|