98 lines
4.7 KiB
XML
98 lines
4.7 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.xdadan.erp.emis.mapper.EmisArticleLikeRecordMapper">
|
|
|
|
<resultMap type="EmisArticleLikeRecord" id="EmisArticleLikeRecordResult">
|
|
<result property="id" column="id" />
|
|
<result property="articleId" column="article_id" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="sessionId" column="session_id" />
|
|
<result property="isGiveLike" column="is_give_like" />
|
|
</resultMap>
|
|
|
|
<sql id="selectEmisArticleLikeRecordVo">
|
|
select id, article_id, user_id, session_id, is_give_like, create_time, update_time from emis_article_like_record
|
|
</sql>
|
|
|
|
<select id="selectEmisArticleLikeRecordList" parameterType="EmisArticleLikeRecord" resultMap="EmisArticleLikeRecordResult">
|
|
<include refid="selectEmisArticleLikeRecordVo"/>
|
|
<where>
|
|
del_flag='0'
|
|
<if test="id != null "> and id = #{id}</if>
|
|
<if test="articleId != null "> and article_id = #{articleId}</if>
|
|
<if test="userId != null "> and user_id = #{userId}</if>
|
|
<if test="sessionId != null and sessionId != ''"> and session_id like concat('%', #{sessionId}, '%')</if>
|
|
<if test="isGiveLike != null and isGiveLike != ''"> and is_give_like like concat('%', #{isGiveLike}, '%')</if>
|
|
<if test="createTime != null "> and create_time = #{createTime}</if>
|
|
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
|
</where>
|
|
order by create_time desc
|
|
</select>
|
|
|
|
<select id="checkUnique" parameterType="EmisArticleLikeRecord" resultType="int">
|
|
select count(1) from emis_article_like_record
|
|
where del_flag='0'
|
|
and id = #{id}
|
|
and article_id = #{articleId}
|
|
and user_id = #{userId}
|
|
and session_id = #{sessionId}
|
|
and is_give_like = #{isGiveLike}
|
|
and create_time = #{createTime}
|
|
and update_time = #{updateTime}
|
|
limit 1
|
|
</select>
|
|
|
|
<select id="selectEmisArticleLikeRecordById" parameterType="Long" resultMap="EmisArticleLikeRecordResult">
|
|
select id, article_id, user_id, session_id, is_give_like, create_time, update_time
|
|
from emis_article_like_record a
|
|
where a.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertEmisArticleLikeRecord" parameterType="EmisArticleLikeRecord" useGeneratedKeys="true" keyProperty="id">
|
|
insert into emis_article_like_record
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">id,</if>
|
|
<if test="articleId != null">article_id,</if>
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="sessionId != null and sessionId != ''">session_id,</if>
|
|
<if test="isGiveLike != null and isGiveLike != ''">is_give_like,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">#{id},</if>
|
|
<if test="articleId != null">#{articleId},</if>
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="sessionId != null and sessionId != ''">#{sessionId},</if>
|
|
<if test="isGiveLike != null and isGiveLike != ''">#{isGiveLike},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEmisArticleLikeRecord" parameterType="EmisArticleLikeRecord">
|
|
update emis_article_like_record
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="articleId != null">article_id = #{articleId},</if>
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="sessionId != null and sessionId != ''">session_id = #{sessionId},</if>
|
|
<if test="isGiveLike != null and isGiveLike != ''">is_give_like = #{isGiveLike},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteEmisArticleLikeRecordById" parameterType="Long">
|
|
delete from emis_article_like_record where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteEmisArticleLikeRecordByIds" parameterType="String">
|
|
delete from emis_article_like_record where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |