<?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.reading.dao.impl.ReadingGroupCreateDaoImpl" >
  <resultMap id="BaseResultMap" type="com.pcloud.book.reading.entity.ReadingGroupCreate" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="wx_group_id" property="wxGroupId" jdbcType="VARCHAR" />
    <result column="master_id" property="masterId" jdbcType="VARCHAR" />
    <result column="use_state" property="useState" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
  </resultMap>

  <sql id="Base_Column_List" >
    id, wx_group_id, master_id, use_state, create_time, update_time
  </sql>

  <insert id="insert" parameterType="com.pcloud.book.reading.entity.ReadingGroupCreate" useGeneratedKeys="true" keyProperty="id">
    insert into reading_group_create (wx_group_id, master_id,
      use_state, create_time
      )
    values (#{wxGroupId,jdbcType=VARCHAR}, #{masterId,jdbcType=VARCHAR},
      #{useState}, NOW()
      )
  </insert>

  <update id="updateStateByWxGroupId" parameterType="map">
    UPDATE reading_group_create
    SET use_state = #{useState},
    update_time = NOW()
    WHERE wx_group_id = #{wxGroupId}
  </update>

</mapper>