123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420 |
- <?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.modules.miniprogram.dao.CmWxArticleDao">
- <sql id="cmWxArticleColumns">
- a.id AS "id",
- a.source AS "source",
- a.type AS "type",
- a.mediaId AS "mediaId",
- a.title AS "title",
- a.author AS "author",
- a.digest AS "digest",
- a.content AS "content",
- a.contentSourceUrl AS "contentSourceUrlfindAllList",
- a.thumbMediaId AS "thumbMediaId",
- a.showCoverPic AS "showCoverPic",
- a.url AS "url",
- a.thumbUrl AS "thumbUrl",
- a.needOpenComment AS "needOpenComment",
- a.onlyFansCanComment AS "onlyFansCanComment",
- a.actType AS "actType",
- a.actName AS "actName",
- a.actTime AS "actTime",
- a.actEndTime AS "actEndTime",
- a.actStatus AS "actStatus",
- a.deployTime AS "deployTime",
- a.deployStatus AS "deployStatus",
- a.points AS "points",
- a.readings AS "readings",
- a.pv AS "pv",
- a.basePoints AS "basePoints",
- a.baseReadings AS "baseReadings",
- a.createTime AS "createTime",
- a.updateTime AS "updateTime",
- a.tagId as "tagId",
- a.tagName as "tagName",
- a.keyWord as "keyWord",
- a.subtitle as "subtitle"
- </sql>
- <sql id="cmWxArticleJoins">
- </sql>
- <select id="get" resultType="CmWxArticle">
- SELECT
- <include refid="cmWxArticleColumns"/>
- FROM cm_wx_article a
- <include refid="cmWxArticleJoins"/>
- WHERE a.id = #{id}
- </select>
- <select id="getUnionArticle" resultType="CmWxArticlePo">
- SELECT
- *
- FROM cm_wx_article b
- INNER JOIN cm_wx_article_article a
- ON a.relatedArticleId = b.id
- WHERE a.articleId = #{articleId}
- ORDER BY a.sort;
- </select>
- <select id="getUnionProduct" resultType="ProductPo">
- SELECT
- *
- FROM product b
- INNER JOIN cm_wx_article_product a
- ON a.relatedProductId = b.productId
- WHERE b.articleId = #{articleId}
- and a.productCategory = 1
- ORDER BY a.sort;
- </select>
- <select id="findList" resultType="CmWxArticle">
- SELECT
- <include refid="cmWxArticleColumns"/>
- FROM cm_wx_article a
- <include refid="cmWxArticleJoins"/>
- <where>
- <if test="type != null and type != ''">
- AND a.type = #{type}
- </if>
- <choose>
- <when test="source !=null and source != ''">
- AND a.source = #{source}
- </when>
- <otherwise>
- AND a.source != 2
- </otherwise>
- </choose>
- <if test="deployStatus != null and deployStatus != ''">
- AND a.deployStatus = #{deployStatus}
- </if>
- <if test="deployTime != null and deployTime != ''">
- AND STR_TO_DATE(deployTime,'%Y-%m-%d %H:%i') <![CDATA[ > ]]> STR_TO_DATE(#{deployTime},'%Y-%m-%d %H:%i')
- AND STR_TO_DATE(deployTime,'%Y-%m-%d %H:%i') <![CDATA[ < ]]> DATE_SUB(STR_TO_DATE(#{deployTime},'%Y-%m-%d %H:%i'),INTERVAL -1 DAY)
- </if>
- <if test="title != null and title != ''">
- AND a.title LIKE
- <if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{title}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{title},'%')</if>
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy} DESC
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultType="CmWxArticle">
- SELECT
- <include refid="cmWxArticleColumns"/>
- FROM cm_wx_article a
- <include refid="cmWxArticleJoins"/>
- <where>
- <if test="source != null and source != ''">
- AND a.source = #{source}
- </if>
- <if test="type != null and type != ''">
- AND a.type = #{type}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy} DESC
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <insert id="insert" parameterType="CmWxArticle" keyProperty="id" keyColumn="id" useGeneratedKeys="true">
- INSERT INTO cm_wx_article
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="source != null" >
- source,
- </if>
- <if test="type != null" >
- type,
- </if>
- <if test="mediaId != null" >
- mediaId,
- </if>
- <if test="title != null" >
- title,
- </if>
- <if test="author != null" >
- author,
- </if>
- <if test="digest != null" >
- digest,
- </if>
- <if test="content != null" >
- content,
- </if>
- <if test="contentSourceUrl != null" >
- contentSourceUrl,
- </if>
- <if test="thumbMediaId != null" >
- thumbMediaId,
- </if>
- <if test="showCoverPic != null" >
- showCoverPic,
- </if>
- <if test="url != null" >
- url,
- </if>
- <if test="thumbUrl != null" >
- thumbUrl,
- </if>
- <if test="needOpenComment != null" >
- needOpenComment,
- </if>
- <if test="onlyFansCanComment != null" >
- onlyFansCanComment,
- </if>
- <if test="actType != null" >
- actType,
- </if>
- <if test="actName != null" >
- actName,
- </if>
- <if test="actTime != null" >
- actTime,
- </if>
- <if test="actEndTime != null" >
- actEndTime,
- </if>
- <if test="actStatus != null" >
- actStatus,
- </if>
- <if test="deployTime != null" >
- deployTime,
- </if>
- <if test="deployStatus != null" >
- deployStatus,
- </if>
- <if test="points != null" >
- points,
- </if>
- <if test="readings != null" >
- readings,
- </if>
- <if test="pv != null" >
- pv,
- </if>
- <if test="basePoints != null" >
- basePoints,
- </if>
- <if test="baseReadings != null" >
- baseReadings,
- </if>
- <if test="createTime != null" >
- createTime,
- </if>
- <if test="updateTime != null" >
- updateTime,
- </if>
- <if test="tagId != null" >
- tagId,
- </if>
- <if test="keyWord != null" >
- keyWord,
- </if>
- <if test="subtitle != null" >
- subtitle
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="source != null" >
- #{source},
- </if>
- <if test="type != null" >
- #{type},
- </if>
- <if test="mediaId != null" >
- #{mediaId},
- </if>
- <if test="title != null" >
- #{title},
- </if>
- <if test="author != null" >
- #{author},
- </if>
- <if test="digest != null" >
- #{digest},
- </if>
- <if test="content != null" >
- #{content},
- </if>
- <if test="contentSourceUrl != null" >
- #{contentSourceUrl},
- </if>
- <if test="thumbMediaId != null" >
- #{thumbMediaId},
- </if>
- <if test="showCoverPic != null" >
- #{showCoverPic},
- </if>
- <if test="url != null" >
- #{url},
- </if>
- <if test="thumbUrl != null" >
- #{thumbUrl},
- </if>
- <if test="needOpenComment != null" >
- #{needOpenComment},
- </if>
- <if test="onlyFansCanComment != null" >
- #{onlyFansCanComment},
- </if>
- <if test="actType != null" >
- #{actType},
- </if>
- <if test="actName != null" >
- #{actName},
- </if>
- <if test="actTime != null" >
- #{actTime},
- </if>
- <if test="actEndTime != null" >
- #{actEndTime},
- </if>
- <if test="actStatus != null" >
- #{actStatus},
- </if>
- <if test="deployTime != null" >
- #{deployTime},
- </if>
- <if test="deployStatus != null" >
- #{deployStatus},
- </if>
- <if test="points != null" >
- #{points},
- </if>
- <if test="readings != null" >
- #{readings},
- </if>
- <if test="pv != null" >
- #{pv},
- </if>
- <if test="basePoints != null" >
- #{basePoints},
- </if>
- <if test="baseReadings != null" >
- #{baseReadings},
- </if>
- <if test="createTime != null" >
- #{createTime},
- </if>
- <if test="updateTime != null" >
- #{updateTime},
- </if>
- <if test="tagId != null" >
- #{tagId},
- </if>
- <if test="keyWord != null" >
- #{keyWord},
- </if>
- <if test="subtitle != null" >
- #{subtitle}
- </if>
- </trim>
- </insert>
- <update id="update">
- UPDATE cm_wx_article SET
- source = #{source},
- type = #{type},
- mediaId = #{mediaId},
- title = #{title},
- author = #{author},
- digest = #{digest},
- content = #{content},
- contentSourceUrl = #{contentSourceUrl},
- thumbMediaId = #{thumbMediaId},
- showCoverPic = #{showCoverPic},
- url = #{url},
- thumbUrl = #{thumbUrl},
- needOpenComment = #{needOpenComment},
- onlyFansCanComment = #{onlyFansCanComment},
- actType = #{actType},
- actName = #{actName},
- actTime = #{actTime},
- actEndTime = #{actEndTime},
- actStatus = #{actStatus},
- deployTime = #{deployTime},
- deployStatus = #{deployStatus},
- points = #{points},
- readings = #{readings},
- pv = #{pv},
- basePoints = #{basePoints},
- baseReadings = #{baseReadings},
- createTime = #{createTime},
- updateTime = #{updateTime},
- tagId = #{tagId},
- keyWord = #{keyWord},
- subtitle = #{subtitle}
- WHERE id = #{id}
- </update>
- <update id="deploy">
- UPDATE cm_wx_article SET
- deployTime = #{deployTime},
- deployStatus = #{deployStatus}
- WHERE id = #{id}
- </update>
- <update id="persist">
- UPDATE cm_wx_article SET
- content = #{content},
- thumbUrl = #{thumbUrl},
- type = #{type}
- WHERE id = #{id}
- </update>
- <delete id="delete">
- DELETE FROM cm_wx_article
- WHERE id = #{id}
- </delete>
- <delete id="deleteAllUnionArticle">
- DELETE FROM cm_wx_article_article
- WHERE articleId = #{articleId}
- </delete>
- <delete id="deleteAllUnionProduct">
- DELETE FROM cm_wx_article_product
- WHERE articleId = #{articleId}
- </delete>
- <insert id="insertArtile" parameterType="CmWxArticlePo" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO cm_wx_article_article(
- articleId,
- relatedArticleId,
- sort
- ) VALUES (
- #{articleId},
- #{id},
- #{sort}
- )
- </insert>
- <insert id="insertProduct" parameterType="ProductPo" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO cm_wx_article_product(
- articleId,
- relatedProductId,
- sort
- ) VALUES (
- #{articleId},
- #{productID},
- #{sort}
- )
- </insert>
- </mapper>
|