<?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.pcloud.book.adnews.dao.impl.AdNewsClickRecordDaoImpl">
    <resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsClickRecord">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="message_statistic_id" property="messageStatisticId" jdbcType="BIGINT"/>
        <result column="group_record_id" property="groupRecordId" jdbcType="BIGINT"/>
        <result column="wechat_user_id" property="wechatUserId" jdbcType="BIGINT"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
    </resultMap>

    <sql id="Base_Column_List">
        id, message_statistic_id, group_record_id, wechat_user_id, create_time
    </sql>

    <select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List"/>
        from ad_news_click_record
        where id = #{id,jdbcType=BIGINT}
    </select>

    <insert id="insert" parameterType="com.pcloud.book.adnews.entity.AdNewsClickRecord" useGeneratedKeys="true" keyProperty="id">
        insert into ad_news_click_record
        (message_statistic_id,
        group_record_id,
        wechat_user_id,
        create_time)
        values(
        #{messageStatisticId,jdbcType=BIGINT},
        #{groupRecordId,jdbcType=BIGINT},
        #{wechatUserId,jdbcType=BIGINT},
        NOW())
    </insert>

</mapper>
