161 lines
6.0 KiB
XML
161 lines
6.0 KiB
XML
<?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.zhwl.cms.mapper.ZdyUserCollectMapper">
|
|
|
|
<resultMap type="ZdyUserCollect" id="ZdyUserCollectResult">
|
|
<result property="userId" column="user_id"/>
|
|
<result property="archivesId" column="archives_id"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="type" column="type"/>
|
|
</resultMap>
|
|
|
|
<resultMap type="ZdyCmsArchives" id="ZdyCmsArchivesResult">
|
|
<result property="id" column="id"/>
|
|
<result property="userId" column="user_id"/>
|
|
<result property="channelId" column="channel_id"/>
|
|
<result property="modelId" column="model_id"/>
|
|
<result property="title" column="title"/>
|
|
<result property="flag" column="flag"/>
|
|
<result property="style" column="style"/>
|
|
<result property="image" column="image"/>
|
|
<result property="keywords" column="keywords"/>
|
|
<result property="description" column="description"/>
|
|
<result property="tags" column="tags"/>
|
|
<result property="weigh" column="weigh"/>
|
|
<result property="views" column="views"/>
|
|
<result property="collects" column="collects"/>
|
|
<result property="comments" column="comments"/>
|
|
<result property="likes" column="likes"/>
|
|
<result property="dislikes" column="dislikes"/>
|
|
<result property="diyname" column="diyname"/>
|
|
<result property="createtime" column="createtime"/>
|
|
<result property="updatetime" column="updatetime"/>
|
|
<result property="publishtime" column="publishtime"/>
|
|
<result property="deletetime" column="deletetime"/>
|
|
<result property="memo" column="memo"/>
|
|
<result property="status" column="status"/>
|
|
<result property="adminId" column="admin_id"/>
|
|
<result property="dataOrg" column="data_org"/>
|
|
<result property="subtitle" column="subtitle"/>
|
|
<result property="origin" column="origin"/>
|
|
<result property="imageList" column="image_list"/>
|
|
<result property="userName" column="user_name"/>
|
|
<result property="avatar" column="avatar"/>
|
|
<result property="channelKey" column="channelKey"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectZdyUserCollectVo">
|
|
select user_id, archives_id, create_time, update_time, type
|
|
from zdy_user_collect
|
|
</sql>
|
|
|
|
<select id="selectZdyUserCollectList" parameterType="ZdyUserCollect" resultMap="ZdyUserCollectResult">
|
|
<include refid="selectZdyUserCollectVo"/>
|
|
<where>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectZdyUserCollectByUserId" parameterType="Long"
|
|
resultMap="ZdyUserCollectResult">
|
|
<include refid="selectZdyUserCollectVo"/>
|
|
where user_id = #{userId}
|
|
</select>
|
|
|
|
<insert id="insertZdyUserCollect" parameterType="ZdyUserCollect">
|
|
insert into zdy_user_collect
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">user_id,
|
|
</if>
|
|
<if test="archivesId != null">archives_id,
|
|
</if>
|
|
<if test="createTime != null">create_time,
|
|
</if>
|
|
<if test="updateTime != null">update_time,
|
|
</if>
|
|
<if test="type != null">type,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">#{userId},
|
|
</if>
|
|
<if test="archivesId != null">#{archivesId},
|
|
</if>
|
|
<if test="createTime != null">#{createTime},
|
|
</if>
|
|
<if test="updateTime != null">#{updateTime},
|
|
</if>
|
|
<if test="type != null">#{type},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateZdyUserCollect" parameterType="ZdyUserCollect">
|
|
update zdy_user_collect
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="archivesId != null">archives_id =
|
|
#{archivesId},
|
|
</if>
|
|
<if test="createTime != null">create_time =
|
|
#{createTime},
|
|
</if>
|
|
<if test="updateTime != null">update_time =
|
|
#{updateTime},
|
|
</if>
|
|
<if test="type != null">type =
|
|
#{type},
|
|
</if>
|
|
</trim>
|
|
where user_id = #{userId}
|
|
</update>
|
|
|
|
<delete id="deleteZdyUserCollectByUserId" parameterType="Long">
|
|
delete
|
|
from zdy_user_collect
|
|
where user_id = #{userId}
|
|
</delete>
|
|
|
|
<delete id="deleteZdyUserCollectByUserIds" parameterType="String">
|
|
delete from zdy_user_collect where user_id in
|
|
<foreach item="userId" collection="array" open="(" separator="," close=")">
|
|
#{userId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteZdyUserCollect">
|
|
delete
|
|
from zdy_user_collect
|
|
where user_id = #{userId}
|
|
and archives_id = #{archivesId}
|
|
</delete>
|
|
<select id="selectZdyUserCollect" resultType="java.lang.Integer">
|
|
select count(1)
|
|
from zdy_user_collect
|
|
where user_id = #{userId}
|
|
and archives_id = #{archivesId}
|
|
</select>
|
|
|
|
<select id="selectArchivesIdsByUserIdAndArchivesIds" resultType="java.lang.Integer">
|
|
select archives_id
|
|
from zdy_user_collect
|
|
where user_id = #{userId}
|
|
and archives_id in
|
|
<foreach item="archivesId" collection="archivesIds" open="(" separator="," close=")">
|
|
#{archivesId}
|
|
</foreach>
|
|
</select>
|
|
|
|
<select id="countCollectsByArchiveIds" resultMap="ZdyCmsArchivesResult">
|
|
select archives_id as id, count(*) as collects
|
|
from zdy_user_collect
|
|
where
|
|
archives_id in
|
|
<foreach item="archivesId" collection="list" open="(" separator="," close=")">
|
|
#{archivesId}
|
|
</foreach>
|
|
group by archives_id
|
|
</select>
|
|
</mapper>
|