<?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.tzld.piaoquan.api.dao.mapper.AutoReplyMsgSendRecordMapper">
  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.api.model.po.AutoReplyMsgSendRecord">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="msg_id" jdbcType="BIGINT" property="msgId" />
    <result column="msg_type" jdbcType="INTEGER" property="msgType" />
    <result column="corp_id" jdbcType="VARCHAR" property="corpId" />
    <result column="user_id" jdbcType="VARCHAR" property="userId" />
    <result column="group_id" jdbcType="VARCHAR" property="groupId" />
    <result column="external_user_id" jdbcType="VARCHAR" property="externalUserId" />
    <result column="mini_video_id" jdbcType="BIGINT" property="miniVideoId" />
    <result column="news_publish_content_id" jdbcType="VARCHAR" property="newsPublishContentId" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="error_msg" jdbcType="VARCHAR" property="errorMsg" />
    <result column="send_timestamp" jdbcType="BIGINT" property="sendTimestamp" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, msg_id, msg_type, corp_id, user_id, group_id, external_user_id, mini_video_id, 
    news_publish_content_id, `status`, error_msg, send_timestamp
  </sql>
  <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.AutoReplyMsgSendRecordExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from workwx_auto_reply_msg_send_record
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    <if test="page != null">
      limit #{page.offset} , #{page.pageSize}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from workwx_auto_reply_msg_send_record
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from workwx_auto_reply_msg_send_record
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.api.model.po.AutoReplyMsgSendRecordExample">
    delete from workwx_auto_reply_msg_send_record
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.AutoReplyMsgSendRecord">
    insert into workwx_auto_reply_msg_send_record (id, msg_id, msg_type, 
      corp_id, user_id, group_id, 
      external_user_id, mini_video_id, news_publish_content_id, 
      `status`, error_msg, send_timestamp
      )
    values (#{id,jdbcType=BIGINT}, #{msgId,jdbcType=BIGINT}, #{msgType,jdbcType=INTEGER}, 
      #{corpId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{groupId,jdbcType=VARCHAR}, 
      #{externalUserId,jdbcType=VARCHAR}, #{miniVideoId,jdbcType=BIGINT}, #{newsPublishContentId,jdbcType=VARCHAR}, 
      #{status,jdbcType=INTEGER}, #{errorMsg,jdbcType=VARCHAR}, #{sendTimestamp,jdbcType=BIGINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.AutoReplyMsgSendRecord">
    insert into workwx_auto_reply_msg_send_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="msgId != null">
        msg_id,
      </if>
      <if test="msgType != null">
        msg_type,
      </if>
      <if test="corpId != null">
        corp_id,
      </if>
      <if test="userId != null">
        user_id,
      </if>
      <if test="groupId != null">
        group_id,
      </if>
      <if test="externalUserId != null">
        external_user_id,
      </if>
      <if test="miniVideoId != null">
        mini_video_id,
      </if>
      <if test="newsPublishContentId != null">
        news_publish_content_id,
      </if>
      <if test="status != null">
        `status`,
      </if>
      <if test="errorMsg != null">
        error_msg,
      </if>
      <if test="sendTimestamp != null">
        send_timestamp,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="msgId != null">
        #{msgId,jdbcType=BIGINT},
      </if>
      <if test="msgType != null">
        #{msgType,jdbcType=INTEGER},
      </if>
      <if test="corpId != null">
        #{corpId,jdbcType=VARCHAR},
      </if>
      <if test="userId != null">
        #{userId,jdbcType=VARCHAR},
      </if>
      <if test="groupId != null">
        #{groupId,jdbcType=VARCHAR},
      </if>
      <if test="externalUserId != null">
        #{externalUserId,jdbcType=VARCHAR},
      </if>
      <if test="miniVideoId != null">
        #{miniVideoId,jdbcType=BIGINT},
      </if>
      <if test="newsPublishContentId != null">
        #{newsPublishContentId,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="errorMsg != null">
        #{errorMsg,jdbcType=VARCHAR},
      </if>
      <if test="sendTimestamp != null">
        #{sendTimestamp,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.tzld.piaoquan.api.model.po.AutoReplyMsgSendRecordExample" resultType="java.lang.Long">
    select count(*) from workwx_auto_reply_msg_send_record
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update workwx_auto_reply_msg_send_record
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.msgId != null">
        msg_id = #{record.msgId,jdbcType=BIGINT},
      </if>
      <if test="record.msgType != null">
        msg_type = #{record.msgType,jdbcType=INTEGER},
      </if>
      <if test="record.corpId != null">
        corp_id = #{record.corpId,jdbcType=VARCHAR},
      </if>
      <if test="record.userId != null">
        user_id = #{record.userId,jdbcType=VARCHAR},
      </if>
      <if test="record.groupId != null">
        group_id = #{record.groupId,jdbcType=VARCHAR},
      </if>
      <if test="record.externalUserId != null">
        external_user_id = #{record.externalUserId,jdbcType=VARCHAR},
      </if>
      <if test="record.miniVideoId != null">
        mini_video_id = #{record.miniVideoId,jdbcType=BIGINT},
      </if>
      <if test="record.newsPublishContentId != null">
        news_publish_content_id = #{record.newsPublishContentId,jdbcType=VARCHAR},
      </if>
      <if test="record.status != null">
        `status` = #{record.status,jdbcType=INTEGER},
      </if>
      <if test="record.errorMsg != null">
        error_msg = #{record.errorMsg,jdbcType=VARCHAR},
      </if>
      <if test="record.sendTimestamp != null">
        send_timestamp = #{record.sendTimestamp,jdbcType=BIGINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update workwx_auto_reply_msg_send_record
    set id = #{record.id,jdbcType=BIGINT},
      msg_id = #{record.msgId,jdbcType=BIGINT},
      msg_type = #{record.msgType,jdbcType=INTEGER},
      corp_id = #{record.corpId,jdbcType=VARCHAR},
      user_id = #{record.userId,jdbcType=VARCHAR},
      group_id = #{record.groupId,jdbcType=VARCHAR},
      external_user_id = #{record.externalUserId,jdbcType=VARCHAR},
      mini_video_id = #{record.miniVideoId,jdbcType=BIGINT},
      news_publish_content_id = #{record.newsPublishContentId,jdbcType=VARCHAR},
      `status` = #{record.status,jdbcType=INTEGER},
      error_msg = #{record.errorMsg,jdbcType=VARCHAR},
      send_timestamp = #{record.sendTimestamp,jdbcType=BIGINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.api.model.po.AutoReplyMsgSendRecord">
    update workwx_auto_reply_msg_send_record
    <set>
      <if test="msgId != null">
        msg_id = #{msgId,jdbcType=BIGINT},
      </if>
      <if test="msgType != null">
        msg_type = #{msgType,jdbcType=INTEGER},
      </if>
      <if test="corpId != null">
        corp_id = #{corpId,jdbcType=VARCHAR},
      </if>
      <if test="userId != null">
        user_id = #{userId,jdbcType=VARCHAR},
      </if>
      <if test="groupId != null">
        group_id = #{groupId,jdbcType=VARCHAR},
      </if>
      <if test="externalUserId != null">
        external_user_id = #{externalUserId,jdbcType=VARCHAR},
      </if>
      <if test="miniVideoId != null">
        mini_video_id = #{miniVideoId,jdbcType=BIGINT},
      </if>
      <if test="newsPublishContentId != null">
        news_publish_content_id = #{newsPublishContentId,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        `status` = #{status,jdbcType=INTEGER},
      </if>
      <if test="errorMsg != null">
        error_msg = #{errorMsg,jdbcType=VARCHAR},
      </if>
      <if test="sendTimestamp != null">
        send_timestamp = #{sendTimestamp,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.api.model.po.AutoReplyMsgSendRecord">
    update workwx_auto_reply_msg_send_record
    set msg_id = #{msgId,jdbcType=BIGINT},
      msg_type = #{msgType,jdbcType=INTEGER},
      corp_id = #{corpId,jdbcType=VARCHAR},
      user_id = #{userId,jdbcType=VARCHAR},
      group_id = #{groupId,jdbcType=VARCHAR},
      external_user_id = #{externalUserId,jdbcType=VARCHAR},
      mini_video_id = #{miniVideoId,jdbcType=BIGINT},
      news_publish_content_id = #{newsPublishContentId,jdbcType=VARCHAR},
      `status` = #{status,jdbcType=INTEGER},
      error_msg = #{errorMsg,jdbcType=VARCHAR},
      send_timestamp = #{sendTimestamp,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>