<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.keywords.dao.impl.SelfRobotBookRecordDaoImpl">
    <resultMap id="BaseResultMap" type="com.pcloud.book.keywords.entity.SelfRobotBookRecord">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
        <result column="wx_user_id" property="wxUserId" jdbcType="VARCHAR"/>
        <result column="alt_id" property="altId" jdbcType="VARCHAR"/>
        <result column="book_name" property="bookName" jdbcType="VARCHAR"/>
        <result column="agent_name" property="agentName" jdbcType="VARCHAR"/>
        <result column="status" property="status" jdbcType="INTEGER"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
    </resultMap>

    <sql id="Base_Column_List">
        id, book_group_id, wx_user_id, alt_id, book_name, agent_name, status, create_time
    </sql>

    <insert id="insert" parameterType="com.pcloud.book.keywords.entity.SelfRobotBookRecord" useGeneratedKeys="true"
            keyProperty="id">
        insert into self_robot_book_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            book_group_id,
            wx_user_id,
            alt_id,
            book_name,
            agent_name,
            status,
            create_time
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{bookGroupId,jdbcType=BIGINT},
            #{wxUserId,jdbcType=VARCHAR},
            #{altId,jdbcType=VARCHAR},
            #{bookName,jdbcType=VARCHAR},
            #{agentName,jdbcType=VARCHAR},
            #{status,jdbcType=INTEGER},
            NOW()
        </trim>
    </insert>

    <select id="getSelfRobotBookRecordList" resultType="com.pcloud.book.keywords.dto.SelfRobotBookRecordDTO">
        SELECT id,book_group_id bookGroupId,wx_user_id wxUserId,alt_id altId,book_name bookName,agent_name agentName, status, create_time createTime
        FROM self_robot_book_record
        ORDER BY id DESC
    </select>

    <select id="getAllSelfRobotBookRecordList" resultType="com.pcloud.book.keywords.dto.SelfRobotBookRecordDTO">
        SELECT id,book_group_id bookGroupId,wx_user_id wxUserId,alt_id altId,book_name bookName,agent_name agentName, status, create_time createTime
        FROM self_robot_book_record
        ORDER BY id DESC
    </select>

</mapper>