123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <?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.ruoyi.system.mapper.CpsContentInfoMapper">
- <resultMap type="com.ruoyi.system.domain.CpsContentInfo" id="CpsContentInfoResult">
- <result property="id" column="id"/>
- <result property="title" column="title"/>
- <result property="content" column="content"/>
- <result property="thumbnail" column="thumbnail"/>
- <result property="likeCnt" column="like_cnt"/>
- <result property="collectedCnt" column="collected_cnt"/>
- <result property="contentType" column="content_type"/>
- <result property="deptId" column="dept_id"/>
- <result property="updateTime" column="update_time"/>
- <result property="createTime" column="create_time"/>
- <result property="createBy" column="create_by"/>
- <result property="updateBy" column="update_by"/>
- </resultMap>
- <sql id="selectCpsContentInfoVo">
- select id,
- title,
- content,
- thumbnail,
- content_type,
- like_cnt,
- collected_cnt,
- dept_id,
- update_time,
- create_time,
- create_by,
- update_by
- from cps_content_info
- </sql>
- <select id="selectCpsContentInfoList" parameterType="com.ruoyi.system.domain.CpsContentInfo"
- resultMap="CpsContentInfoResult">
- select id, title, thumbnail, content_type,like_cnt, collected_cnt,dept_id, update_time, create_time, create_by,
- update_by from cps_content_info
- <where>
- <if test="title != null and title != ''">and title like concat('%', #{title}, '%')</if>
- <if test="content != null and content != ''">and content like concat('%', #{content}, '%')</if>
- <if test="contentType != null ">and content_type = #{contentType}</if>
- </where>
- order by create_time desc
- </select>
- <select id="selectCpsContentInfoById" parameterType="Long" resultMap="CpsContentInfoResult">
- <include refid="selectCpsContentInfoVo"/>
- where id = #{id}
- </select>
- <insert id="insertCpsContentInfo" parameterType="com.ruoyi.system.domain.CpsContentInfo" useGeneratedKeys="true"
- keyProperty="id">
- insert into cps_content_info
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="title != null">title,</if>
- <if test="content != null">content,</if>
- <if test="thumbnail != null">thumbnail,</if>
- <if test="contentType != null">content_type,</if>
- <if test="deptId !=null">dept_id,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="createTime != null">create_time,</if>
- <if test="createBy != null">create_by,</if>
- <if test="updateBy != null">update_by,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="title != null">#{title},</if>
- <if test="content != null">#{content},</if>
- <if test="thumbnail != null">#{thumbnail},</if>
- <if test="contentType != null">#{contentType},</if>
- <if test="deptId !=null">#{deptId},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="updateBy != null">#{updateBy},</if>
- </trim>
- </insert>
- <update id="updateCpsContentInfo" parameterType="com.ruoyi.system.domain.CpsContentInfo">
- update cps_content_info
- <trim prefix="SET" suffixOverrides=",">
- <if test="title != null">title = #{title},</if>
- <if test="content != null">content = #{content},</if>
- <if test="thumbnail != null">thumbnail = #{thumbnail},</if>
- <if test="contentType != null">content_type = #{contentType},</if>
- <if test="deptId !=null">dept_id = #{deptId},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- </trim>
- where id = #{id}
- </update>
- <update id="updateCollectContent" parameterType="java.lang.Long">
- update cps_content_info
- set collected_cnt = collected_cnt + 1,
- update_time = now()
- where id = #{id}
- </update>
- <update id="updateDisCollectContent" parameterType="java.lang.Long">
- update cps_content_info
- set collected_cnt = collected_cnt - 1,
- update_time = now()
- where id = #{id}
- </update>
- <update id="updateLikeContent" parameterType="java.lang.Long">
- update cps_content_info
- set like_cnt = like_cnt + 1,
- update_time = now()
- where id = #{id}
- </update>
- <update id="updateDisLikeContent" parameterType="java.lang.Long">
- update cps_content_info
- set like_cnt = like_cnt - 1,
- update_time = now()
- where id = #{id}
- </update>
- <delete id="deleteCpsContentInfoById" parameterType="Long">
- delete
- from cps_content_info
- where id = #{id}
- </delete>
- <delete id="deleteCpsContentInfoByIds" parameterType="String">
- delete from cps_content_info where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="selectCpsContentInfoByIds" parameterType="String" resultMap="CpsContentInfoResult">
- <include refid="selectCpsContentInfoVo"/>
- where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </select>
- </mapper>
|