123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.caimei365.user.mapper.ArticleMapper">
- <delete id="deleteArticle">
- delete from info where id = #{articleId}
- </delete>
- <select id="getShopArticleById" resultType="com.caimei365.user.model.vo.ShopArticleVo">
- select id as articleId,
- title,
- label,
- keyword,
- publisher,
- source,
- recommendContent,
- infoContent as articleContent,
- typeId,
- guidanceImage,
- enabledStatus as status
- from info
- where id = #{articleId}
- </select>
- <select id="getArticleTypeList" resultType="com.caimei365.user.model.vo.ArticleTypeVo">
- select id as typeId, name as typeName from info_type where enabledStatus = '1' order by sort desc,createDate desc
- </select>
- <select id="getArticleLabelId" resultType="java.lang.Integer">
- select id from info_label where name = #{label}
- </select>
- <select id="getShopArticleList" resultType="com.caimei365.user.model.vo.ShopArticleVo">
- select i.id as articleId,
- title,
- ip.num as praiseNum,
- ip.pv as pvNum,
- publisher,
- source,
- it.name as typeName,
- guidanceImage,
- i.pubdate as publishDate,
- i.createDate,
- i.auditStatus,
- i.failReason,
- i.enabledStatus as status
- from info i
- left join info_type it on i.typeId = it.id
- left join info_praise ip on i.id = ip.infoId
- where shopId = #{shopId} and publishSource = 2
- <if test="articleId != null">
- and i.id = #{articleId}
- </if>
- <if test="title != null and title != ''">
- and title like concat('%',#{title},'%')
- </if>
- <if test="publisher != null and publisher != ''">
- and publisher like concat('%',#{publisher},'%')
- </if>
- <if test="typeId != null">
- and typeId = #{typeId}
- </if>
- <if test="auditStatus != null">
- and auditStatus = #{auditStatus}
- </if>
- order by i.createDate desc
- </select>
- <select id="getArticleLabelList" resultType="java.lang.String">
- select value from sys_dict where type = 'sys_config' limit 1
- </select>
- <insert id="insertShopArticle" parameterType="com.caimei365.user.model.po.ArticlePo" keyProperty="articleId" useGeneratedKeys="true">
- insert into info (typeId, title, label, publisher, source, publishSource, shopId, keyword,
- recommendContent, infoContent, guidanceImage,
- recommendStatus, enabledStatus, basePraise, basePv, priorityIndex,
- auditStatus, createDate)
- values (#{typeId}, #{title}, #{label}, #{publisher}, #{source}, #{publishSource}, #{shopId},
- #{keyword}, #{recommendContent}, #{articleContent}, #{guidanceImage}, #{recommendStatus},
- #{status}, #{basePraise}, #{basePv}, #{priorityIndex}, #{auditStatus}, NOW())
- </insert>
- <insert id="insertArticleLabel">
- insert into info_label (name, createDate)
- values (#{label}, NOW())
- </insert>
- <insert id="insertArticlePraise">
- insert into info_praise (infoId, num, pv)
- values (#{articleId}, 0, 0)
- </insert>
- <update id="updateShopArticle">
- update info
- set typeId = #{typeId},
- title = #{title},
- label = #{label},
- publisher = #{publisher},
- source = #{source},
- keyword = #{keyword},
- recommendContent = #{recommendContent},
- infoContent = #{articleContent},
- guidanceImage = #{guidanceImage},
- enabledStatus = #{status},
- auditStatus = #{auditStatus}
- where id = #{articleId}
- </update>
- <update id="updateArticleStatus">
- update info set enabledStatus = #{status} where id = #{articleId}
- </update>
- </mapper>
|