Jelajahi Sumber

4/24 修改查询产品时缺少根据产品所属类别id查

chendayu 2 tahun lalu
induk
melakukan
e9eb6896e3
1 mengubah file dengan 7 tambahan dan 4 penghapusan
  1. 7 4
      PAS/src/main/resources/mapper/ProductMapper.xml

+ 7 - 4
PAS/src/main/resources/mapper/ProductMapper.xml

@@ -78,7 +78,7 @@
     <!--根据id查询数据-->
     <!--ProductVO getStandardById(Integer id);-->
     <select id="getStandardById" resultMap="queryMap">
-        select id,
+        select id as p_id,
                product_name,
                market_time,
                company_name,
@@ -118,6 +118,9 @@
                 and p.id in
                 (select product_id from asso_product_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}%')
@@ -148,10 +151,10 @@
         <result column="license_rate" property="licenseRate"/>
         <result column="create_person_name" property="createPersonName"/>
         <collection property="pictures" ofType="cn.cslg.pas.common.model.vo.ProductPictureVO"
-                    select="query2" column="p_id">
+                    select="query2" column="{p_id=p_id}">
         </collection>
         <collection property="relativePatents" ofType="string"
-                    select="query3" column="p_id">
+                    select="query3" column="{p_id=p_id}">
         </collection>
         <collection property="productCategory" ofType="cn.cslg.pas.common.model.vo.ProductCategoryVO"
                     select="query4" column="{pc_id=product_category_id}">
@@ -173,7 +176,7 @@
     </resultMap>
 
     <select id="query3" resultType="string">
-        select patent_no
+        select distinct patent_no
         from asso_product_patent
         where product_id = #{p_id}
     </select>