<?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.vote.system.mapper.VoteUserActionMapper">

    <resultMap id="BaseResultMap" type="com.vote.system.domain.VoteUserAction">
        <id property="id" column="id" jdbcType="BIGINT"/>
        <result property="userId" column="user_id" jdbcType="BIGINT"/>
        <result property="newsId" column="news_id" jdbcType="BIGINT"/>
        <result property="hasRead" column="has_read" jdbcType="TINYINT"/>
        <result property="hasLiked" column="has_liked" jdbcType="TINYINT"/>
    </resultMap>

    <sql id="Base_Column_List">
        id
        ,user_id,new_id,
        has_read,has_liked
    </sql>
    <select id="checkUserHasRead" resultType="java.lang.Boolean">
        SELECT has_read
        FROM vote_user_action
        WHERE user_id = #{userId}
          AND news_id = #{newsId};
    </select>
</mapper>
