123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?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.caimei.mapper.cmMapper.ArticleMapper">
- <insert id="insertArticle">
- insert into cm_brand_article(authUserId, title, image, content, auditStatus, status, createTime, auditBy, auditTime)
- values (#{authUserId}, #{title}, #{image}, #{content}, #{auditStatus}, #{status}, #{createTime}, #{auditBy}, #{auditTime})
- </insert>
- <update id="updateArticleByArticleId">
- update cm_brand_article
- set title = #{title},
- image = #{image},
- content = #{content},
- status = #{status},
- auditStatus = #{auditStatus}
- where id = #{id}
- </update>
- <update id="updateArticleStatusByArticleId">
- update cm_brand_article
- set status = #{status}
- where id = #{articleId}
- </update>
- <update id="updateArticleAuditStatus">
- update cm_brand_article
- set status = #{status},
- auditStatus = #{auditStatus},
- invalidReason = #{invalidReason},
- auditBy = #{auditBy},
- auditTime = #{auditTime}
- where id = #{articleId}
- </update>
- <delete id="deleteArticleByArticleId">
- delete from cm_brand_article where id = #{articleId}
- </delete>
- <select id="getArticleList" resultType="com.caimei.model.vo.ArticleListVo">
- select a.id as articleId,a.title as articleTitle,a.image as articleImage,
- a.auditStatus,a.invalidReason,a.status,a.createTime,
- au.name as auditBy,a.auditTime
- from cm_brand_article a
- left join cm_brand_auth_user au on a.auditBy = au.authUserId
- where a.authUserId = #{authUserId}
- <if test="articleTitle != null and articleTitle != ''">
- and a.title like concat('%',#{articleTitle},'%')
- </if>
- <if test="auditStatus != null">
- and a.auditStatus = #{auditStatus}
- </if>
- <if test="status != null">
- and a.status = #{status}
- </if>
- <choose>
- <when test="listType == 2">
- order by a.auditStatus desc, a.createTime desc
- </when>
- <otherwise>
- order by a.createTime desc
- </otherwise>
- </choose>
- </select>
- <select id="getArticleForm" resultType="com.caimei.model.vo.ArticleFormVo">
- select id as articleId, title as articleTitle, image as articleImage, content as articleContent, createTime
- from cm_brand_article
- where id = #{articleId}
- </select>
- <select id="getWxArticleList" resultType="com.caimei.model.vo.WxArticleListVo">
- select id as articleId, title as articleTitle, image as articleImage, date_format(createTime, '%Y-%m-%d') as
- createTime
- from cm_brand_article a
- where authUserId = #{authUserId}
- and status = 1
- <if test="articleTitle != null and articleTitle != ''">
- and title like concat('%',#{articleTitle},'%')
- </if>
- order by a.createTime desc
- </select>
- </mapper>
|