123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- <?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.manager.dao.productArchive.CmProductArchiveContentMapper">
- <resultMap type="CmProductArchiveContent" id="CmProductArchiveContentResult">
- <result property="id" column="id" />
- <result property="productArchiveId" column="productArchiveId" />
- <result property="title" column="title" />
- <result property="type" column="type" />
- <result property="content" column="content" />
- <result property="stageStatus" column="stageStatus" />
- <result property="allStatus" column="allStatus" />
- <result property="labelIds" column="labelIds" />
- <result property="addTime" column="addTime" />
- </resultMap>
- <sql id="selectCmProductArchiveContentVo">
- select
- cm_product_archive_content.id,
- cm_product_archive_content.productArchiveId,
- cm_product_archive_content.title,
- cm_product_archive_content.type,
- cm_product_archive_content.content,
- cm_product_archive_content.stageStatus,
- cm_product_archive_content.allStatus,
- cm_product_archive_content.labelIds,
- cm_product_archive_content.createBy,
- cm_product_archive_content.addTime
- </sql>
- <select id="getByCmProductArchiveContent" parameterType="CmProductArchiveContent" resultMap="CmProductArchiveContentResult">
- <include refid="selectCmProductArchiveContentVo"/>
- ,(SELECT GROUP_CONCAT(cusf.keyword) FROM cm_user_search_frequency cusf WHERE FIND_IN_SET(cusf.id ,cm_product_archive_content.labelIds)) as keywords
- from cm_product_archive_content AS cm_product_archive_content
- <where>
- <if test="id != null and id != ''"> and cm_product_archive_content.id = #{id}</if>
- <if test="productArchiveId != null "> and cm_product_archive_content.productArchiveId = #{productArchiveId}</if>
- <if test="title != null and title != ''"> and cm_product_archive_content.title = #{title}</if>
- <if test="type != null and type != ''"> and cm_product_archive_content.type = #{type}</if>
- <if test="content != null and content != ''"> and cm_product_archive_content.content = #{content}</if>
- <if test="stageStatus != null "> and cm_product_archive_content.stageStatus = #{stageStatus}</if>
- <if test="allStatus != null "> and cm_product_archive_content.allStatus = #{allStatus}</if>
- <if test="labelIds != null and labelIds != ''"> and cm_product_archive_content.labelIds = #{labelIds}</if>
- <if test="createBy != null and createBy != ''"> and cm_product_archive_content.createBy = #{createBy}</if>
- <if test="addTime != null "> and cm_product_archive_content.addTime = #{addTime}</if>
- </where>
- group by cm_product_archive_content.id
- limit 0,1
- </select>
- <select id="getCmProductArchiveContentList" parameterType="CmProductArchiveContent" resultMap="CmProductArchiveContentResult">
- <include refid="selectCmProductArchiveContentVo"/>
- ,IFNULL((select sum(c.pv) from cm_praise_statistics c where c.delFlag = 0 and c.type = 1 and cm_product_archive_content.id = c.authorId <if test="startPvCreateTime != null ">AND c.createTime >= #{startPvCreateTime} </if><if test="endPvCreateTime != null ">AND c.createTime <![CDATA[ <= ]]> #{endPvCreateTime} </if>), 0) as pv
- ,(SELECT GROUP_CONCAT(cusf.keyword) FROM cm_user_search_frequency cusf WHERE FIND_IN_SET(cusf.id ,cm_product_archive_content.labelIds)) as keywords
- from cm_product_archive_content AS cm_product_archive_content
- <where>
- <if test="id != null and id != ''"> and cm_product_archive_content.id = #{id}</if>
- <if test="productArchiveId != null "> and cm_product_archive_content.productArchiveId = #{productArchiveId}</if>
- <if test="title != null and title != ''"> and cm_product_archive_content.title like concat('%', #{title}, '%')</if>
- <if test="type != null and type != ''">
- and cm_product_archive_content.type
- <if test="type.toUpperCase().indexOf('=')==-1">
- = #{type}
- </if>
- <if test="type.toUpperCase().indexOf('=')!=-1">
- <if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
- #{typeIn}
- </foreach>
- </if>
- </if>
- <if test="content != null and content != ''"> and cm_product_archive_content.content = #{content}</if>
- <if test="stageStatus != null "> and cm_product_archive_content.stageStatus = #{stageStatus}</if>
- <if test="allStatus != null "> and cm_product_archive_content.allStatus = #{allStatus}</if>
- <if test="labelIds != null and labelIds != ''">
- AND
- <foreach item="labelIdIn" collection="labelIds.split(',')" open="(" separator="or" close=")">
- cm_product_archive_content.labelIds like concat('%', #{labelIdIn}, '%')
- </foreach>
- </if>
- <if test="createBy != null and createBy != ''"> and cm_product_archive_content.createBy = #{createBy}</if>
- <if test="addTime != null "> and cm_product_archive_content.addTime = #{addTime}</if>
- </where>
- group by cm_product_archive_content.id
- order by cm_product_archive_content.addTime desc
- </select>
- <select id="getCount" parameterType="CmProductArchiveContent" resultType="int">
- select count(1)
- from cm_product_archive_content AS cm_product_archive_content
- <where>
- <if test="id != null and id != ''"> and cm_product_archive_content.id = #{id}</if>
- <if test="productArchiveId != null "> and cm_product_archive_content.productArchiveId = #{productArchiveId}</if>
- <if test="title != null and title != ''"> and cm_product_archive_content.title = #{title}</if>
- <if test="type != null and type != ''"> and cm_product_archive_content.type = #{type}</if>
- <if test="content != null and content != ''"> and cm_product_archive_content.content = #{content}</if>
- <if test="stageStatus != null "> and cm_product_archive_content.stageStatus = #{stageStatus}</if>
- <if test="allStatus != null "> and cm_product_archive_content.allStatus = #{allStatus}</if>
- <if test="labelIds != null and labelIds != ''"> and cm_product_archive_content.labelIds = #{labelIds}</if>
- <if test="createBy != null and createBy != ''"> and cm_product_archive_content.createBy = #{createBy}</if>
- <if test="addTime != null "> and cm_product_archive_content.addTime = #{addTime}</if>
- </where>
- </select>
- <select id="getCmProductArchiveContentById" parameterType="String" resultMap="CmProductArchiveContentResult">
- <include refid="selectCmProductArchiveContentVo"/>
- from cm_product_archive_content AS cm_product_archive_content
- where cm_product_archive_content.id = #{id}
- </select>
- <select id="getById" parameterType="CmProductArchiveContent" resultType="String">
- select id
- from cm_product_archive_content AS cm_product_archive_content
- <where>
- <if test="id != null and id != ''"> and cm_product_archive_content.id = #{id}</if>
- <if test="productArchiveId != null "> and cm_product_archive_content.productArchiveId = #{productArchiveId}</if>
- <if test="title != null and title != ''"> and cm_product_archive_content.title = #{title}</if>
- <if test="type != null and type != ''"> and cm_product_archive_content.type = #{type}</if>
- <if test="content != null and content != ''"> and cm_product_archive_content.content = #{content}</if>
- <if test="stageStatus != null "> and cm_product_archive_content.stageStatus = #{stageStatus}</if>
- <if test="allStatus != null "> and cm_product_archive_content.allStatus = #{allStatus}</if>
- <if test="labelIds != null and labelIds != ''"> and cm_product_archive_content.labelIds = #{labelIds}</if>
- <if test="createBy != null and createBy != ''"> and cm_product_archive_content.createBy = #{createBy}</if>
- <if test="addTime != null "> and cm_product_archive_content.addTime = #{addTime}</if>
- </where>
- group by cm_product_archive_content.id
- limit 0,1
- </select>
- <insert id="addCmProductArchiveContent" parameterType="CmProductArchiveContent" useGeneratedKeys="true" keyProperty="id">
- insert into cm_product_archive_content
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null and id != ''">id,</if>
- <if test="productArchiveId != null">productArchiveId,</if>
- <if test="title != null and title != ''">title,</if>
- <if test="type != null and type != ''">type,</if>
- <if test="content != null and content != ''">content,</if>
- <if test="stageStatus != null">stageStatus,</if>
- <if test="allStatus != null">allStatus,</if>
- <if test="labelIds != null and labelIds != ''">labelIds,</if>
- <if test="createBy != null and createBy != ''">createBy,</if>
- <if test="addTime != null">addTime,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null and id != ''">#{id},</if>
- <if test="productArchiveId != null">#{productArchiveId},</if>
- <if test="title != null and title != ''">#{title},</if>
- <if test="type != null and type != ''">#{type},</if>
- <if test="content != null and content != ''">#{content},</if>
- <if test="stageStatus != null">#{stageStatus},</if>
- <if test="allStatus != null">#{allStatus},</if>
- <if test="labelIds != null and labelIds != ''">#{labelIds},</if>
- <if test="createBy != null and createBy != ''">#{createBy},</if>
- <if test="addTime != null">#{addTime},</if>
- </trim>
- </insert>
- <update id="updateCmProductArchiveContent" parameterType="CmProductArchiveContent">
- update cm_product_archive_content
- <trim prefix="SET" suffixOverrides=",">
- <if test="productArchiveId != null">productArchiveId = #{productArchiveId},</if>
- <if test="title != null and title != ''">title = #{title},</if>
- <if test="type != null and type != ''">type = #{type},</if>
- <if test="content != null and content != ''">content = #{content},</if>
- <if test="stageStatus != null">stageStatus = #{stageStatus},</if>
- <if test="allStatus != null">allStatus = #{allStatus},</if>
- <if test="labelIds != null and labelIds != ''">labelIds = #{labelIds},</if>
- <if test="createBy != null and createBy != ''">createBy = #{createBy},</if>
- <if test="addTime != null">addTime = #{addTime},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="delCmProductArchiveContentById" parameterType="String">
- delete
- from cm_product_archive_content where id = #{id}
- </delete>
- <delete id="delCmProductArchiveContent" parameterType="CmProductArchiveContent">
- delete
- from cm_product_archive_content AS cm_product_archive_content
- <where>
- <if test="id != null and id != ''"> and cm_product_archive_content.id = #{id}</if>
- <if test="productArchiveId != null "> and cm_product_archive_content.productArchiveId = #{productArchiveId}</if>
- <if test="title != null and title != ''"> and cm_product_archive_content.title = #{title}</if>
- <if test="type != null and type != ''"> and cm_product_archive_content.type = #{type}</if>
- <if test="content != null and content != ''"> and cm_product_archive_content.content = #{content}</if>
- <if test="stageStatus != null "> and cm_product_archive_content.stageStatus = #{stageStatus}</if>
- <if test="allStatus != null "> and cm_product_archive_content.allStatus = #{allStatus}</if>
- <if test="labelIds != null and labelIds != ''"> and cm_product_archive_content.labelIds = #{labelIds}</if>
- <if test="createBy != null and createBy != ''"> and cm_product_archive_content.createBy = #{createBy}</if>
- <if test="addTime != null "> and cm_product_archive_content.addTime = #{addTime}</if>
- </where>
- </delete>
- </mapper>
|