|  |  |  | 
|---|
|  |  |  | <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" /> | 
|---|
|  |  |  | 
|---|
|  |  |  | url, | 
|---|
|  |  |  | like_number, | 
|---|
|  |  |  | classify, | 
|---|
|  |  |  | shop_id | 
|---|
|  |  |  | company_id | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | VALUES ( | 
|---|
|  |  |  | #{id}, | 
|---|
|  |  |  | 
|---|
|  |  |  | #{url}, | 
|---|
|  |  |  | #{likeNumber}, | 
|---|
|  |  |  | #{classify}, | 
|---|
|  |  |  | #{shopId} | 
|---|
|  |  |  | #{companyId} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | 
|---|
|  |  |  | <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} | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | 
|---|
|  |  |  | <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 | 
|---|
|  |  |  | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | 
|---|
|  |  |  | 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"> | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | 
|---|
|  |  |  | <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 id="selectApiArticleListInPage" resultMap="ArticleMap"> | 
|---|
|  |  |  | select * from article a | 
|---|
|  |  |  | inner join article_type b on a.type_id=b.id | 
|---|
|  |  |  | where  a.type_id=#{record.typeId} or find_in_set(#{record.typeId}, b.parent_ids) | 
|---|
|  |  |  | 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"> | 
|---|
|  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </mapper> | 
|---|