xiaoyong931011
2021-04-12 a13a93a493e7e94e28b2225c26e7e13b52d3288c
zq-erp/src/main/resources/mybatis/mapper/hive/ArticleDao.xml
@@ -16,7 +16,7 @@
         <result property="sort" column="sort" />
         <result property="createtiem" column="createtiem" />
         <result property="url" column="url" />
      <result property="shopId" column="shop_id"/>
      <result property="companyId" column="company_id"/>
         
         
         <result property="articleTypeName" column="article_type_name" />
@@ -43,7 +43,7 @@
         url,
         like_number,
         classify,
         shop_id
         company_id
      )
   VALUES (
         #{id},
@@ -59,7 +59,7 @@
         #{url},
         #{likeNumber},
         #{classify},
         #{shopId}
         #{companyId}
   )
   </insert>
   
@@ -143,7 +143,7 @@
         url,
         classify,
         like_number,
         shop_id,
         company_id,
         (select article_type_name from article_type c where type_id = c.id) articleTypeName,
         (select type from article_type c where type_id = c.id) type
      from article
@@ -188,8 +188,8 @@
         <if test="record.likeNumber != null and record.likeNumber !='' ">
            and like_number = #{record.likeNumber}
         </if>
         <if test="record.shopId != null and record.shopId !='' ">
            and shop_id = #{record.shopId}
         <if test="record.companyId != null and record.companyId !='' ">
            and company_id = #{record.companyId}
         </if>
         <if test="record.type != null and record.type !='' ">
            and (select type from article_type c where type_id = c.id) = #{record.type}
@@ -228,7 +228,7 @@
         url,
         classify,
         like_number,
         shop_id,
         company_id,
         (select article_type_name from article_type c where type_id = c.id) articleTypeName,
         (select type from article_type c where type_id = c.id) type
      from article
@@ -279,8 +279,8 @@
         <if test="record.articleTypeName != null and record.url !='' ">
            and (select article_type_name from article_type c where type_id = c.id) = #{record.articleTypeName}
         </if>
         <if test="record.shopId != null and record.shopId !='' ">
            and shop_id = #{record.shopId}
         <if test="record.companyId != null and record.companyId !='' ">
            and company_id = #{record.companyId}
         </if>
      </if>
      order by type_id,sort,createtiem desc
@@ -338,8 +338,8 @@
         <if test="record.articleTypeName != null and record.url !='' ">
            and (select article_type_name from article_type c where type_id = c.id) = #{record.articleTypeName}
         </if>
         <if test="record.shopId != null and record.shopId !='' ">
            and shop_id = #{record.shopId}
         <if test="record.companyId != null and record.companyId !='' ">
            and company_id = #{record.companyId}
         </if>
      </if>
   </select>
@@ -360,12 +360,14 @@
         url,
         like_number,
         classify,
         shop_id,
         company_id,
         (select article_type_name from article_type c where type_id = c.id) articleTypeName<!-- 所属门店名称 -->
      from article
      where  id=#{id} 
   </select>
   </select>
   
   <!-- 根据对象查询-->
   <select id="selectByModel" resultMap="ArticleMap">
@@ -383,7 +385,7 @@
         a.url,
         a.classify,
         a.like_number,
         a.shop_id,
         a.company_id,
         (select article_type_name from article_type c where a.type_id = c.id) articleTypeName,<!-- 所属门店名称 -->
         (select count(*) from article_comment ac where ac.article_id=a.id) commentNum
      from article a
@@ -431,10 +433,25 @@
         <if test="record.articleTypeName != null and record.url !='' ">
            and (select article_type_name from article_type c where a.type_id = c.id) = #{record.articleTypeName}
         </if>
         <if test="record.shopId != null and record.shopId !='' ">
            and a.shop_id = #{record.shopId}
         <if test="record.companyId != null and record.companyId !='' ">
            and a.company_id = #{record.companyId}
         </if>
      </if>
      order by type_id,sort,createtiem desc
   </select>
   <select id="selectApiArticleListInPage" resultMap="ArticleMap">
      select * from article a
      inner join article_type b on a.type_id=b.id
      where a.company_id=#{record.companyId} and  (a.type_id=#{record.typeId} or find_in_set(#{record.typeId}, b.parent_ids))
      order by a.createtiem desc
      <if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
         <if test="pageVo.offset >=0  and pageVo.limit >0">
            limit
            #{pageVo.offset},#{pageVo.limit}
         </if>
      </if>
   </select>
</mapper>