package com.hai.dao;

import com.hai.entity.HighCouponAgentCode;
import com.hai.entity.HighCouponAgentCodeExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;

/**
 * 
 * 代码由工具生成,请勿修改!!!
 * 如果需要扩展请在其父类进行扩展
 * 
 **/
@Repository
public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt {
    @SelectProvider(type=HighCouponAgentCodeSqlProvider.class, method="countByExample")
    long countByExample(HighCouponAgentCodeExample example);

    @DeleteProvider(type=HighCouponAgentCodeSqlProvider.class, method="deleteByExample")
    int deleteByExample(HighCouponAgentCodeExample example);

    @Delete({
        "delete from high_coupon_agent_code",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into high_coupon_agent_code (`type`, coupon_agent_id, ",
        "coupon_id, agent_id, ",
        "coupon_agent_record_id, convert_user_phone, ",
        "convert_code, coupon_code_id, ",
        "coupon_code, qr_code, ",
        "`status`, assign_coupon_agent_id, ",
        "assign_agent_id, assign_agent_name, ",
        "remark, create_time, ",
        "sales_time, operator_id, ",
        "operator_name, ext_1, ",
        "ext_2, ext_3)",
        "values (#{type,jdbcType=INTEGER}, #{couponAgentId,jdbcType=BIGINT}, ",
        "#{couponId,jdbcType=BIGINT}, #{agentId,jdbcType=BIGINT}, ",
        "#{couponAgentRecordId,jdbcType=BIGINT}, #{convertUserPhone,jdbcType=VARCHAR}, ",
        "#{convertCode,jdbcType=VARCHAR}, #{couponCodeId,jdbcType=BIGINT}, ",
        "#{couponCode,jdbcType=VARCHAR}, #{qrCode,jdbcType=VARCHAR}, ",
        "#{status,jdbcType=INTEGER}, #{assignCouponAgentId,jdbcType=BIGINT}, ",
        "#{assignAgentId,jdbcType=BIGINT}, #{assignAgentName,jdbcType=VARCHAR}, ",
        "#{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{salesTime,jdbcType=TIMESTAMP}, #{operatorId,jdbcType=BIGINT}, ",
        "#{operatorName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
        "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(HighCouponAgentCode record);

    @InsertProvider(type=HighCouponAgentCodeSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insertSelective(HighCouponAgentCode record);

    @SelectProvider(type=HighCouponAgentCodeSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="coupon_agent_id", property="couponAgentId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
        @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_agent_record_id", property="couponAgentRecordId", jdbcType=JdbcType.BIGINT),
        @Result(column="convert_user_phone", property="convertUserPhone", jdbcType=JdbcType.VARCHAR),
        @Result(column="convert_code", property="convertCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_code", property="couponCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="assign_coupon_agent_id", property="assignCouponAgentId", jdbcType=JdbcType.BIGINT),
        @Result(column="assign_agent_id", property="assignAgentId", jdbcType=JdbcType.BIGINT),
        @Result(column="assign_agent_name", property="assignAgentName", jdbcType=JdbcType.VARCHAR),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="sales_time", property="salesTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT),
        @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
    })
    List<HighCouponAgentCode> selectByExample(HighCouponAgentCodeExample example);

    @Select({
        "select",
        "id, `type`, coupon_agent_id, coupon_id, agent_id, coupon_agent_record_id, convert_user_phone, ",
        "convert_code, coupon_code_id, coupon_code, qr_code, `status`, assign_coupon_agent_id, ",
        "assign_agent_id, assign_agent_name, remark, create_time, sales_time, operator_id, ",
        "operator_name, ext_1, ext_2, ext_3",
        "from high_coupon_agent_code",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="coupon_agent_id", property="couponAgentId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
        @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_agent_record_id", property="couponAgentRecordId", jdbcType=JdbcType.BIGINT),
        @Result(column="convert_user_phone", property="convertUserPhone", jdbcType=JdbcType.VARCHAR),
        @Result(column="convert_code", property="convertCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_code", property="couponCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="assign_coupon_agent_id", property="assignCouponAgentId", jdbcType=JdbcType.BIGINT),
        @Result(column="assign_agent_id", property="assignAgentId", jdbcType=JdbcType.BIGINT),
        @Result(column="assign_agent_name", property="assignAgentName", jdbcType=JdbcType.VARCHAR),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="sales_time", property="salesTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT),
        @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
    })
    HighCouponAgentCode selectByPrimaryKey(Long id);

    @UpdateProvider(type=HighCouponAgentCodeSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") HighCouponAgentCode record, @Param("example") HighCouponAgentCodeExample example);

    @UpdateProvider(type=HighCouponAgentCodeSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") HighCouponAgentCode record, @Param("example") HighCouponAgentCodeExample example);

    @UpdateProvider(type=HighCouponAgentCodeSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(HighCouponAgentCode record);

    @Update({
        "update high_coupon_agent_code",
        "set `type` = #{type,jdbcType=INTEGER},",
          "coupon_agent_id = #{couponAgentId,jdbcType=BIGINT},",
          "coupon_id = #{couponId,jdbcType=BIGINT},",
          "agent_id = #{agentId,jdbcType=BIGINT},",
          "coupon_agent_record_id = #{couponAgentRecordId,jdbcType=BIGINT},",
          "convert_user_phone = #{convertUserPhone,jdbcType=VARCHAR},",
          "convert_code = #{convertCode,jdbcType=VARCHAR},",
          "coupon_code_id = #{couponCodeId,jdbcType=BIGINT},",
          "coupon_code = #{couponCode,jdbcType=VARCHAR},",
          "qr_code = #{qrCode,jdbcType=VARCHAR},",
          "`status` = #{status,jdbcType=INTEGER},",
          "assign_coupon_agent_id = #{assignCouponAgentId,jdbcType=BIGINT},",
          "assign_agent_id = #{assignAgentId,jdbcType=BIGINT},",
          "assign_agent_name = #{assignAgentName,jdbcType=VARCHAR},",
          "remark = #{remark,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "sales_time = #{salesTime,jdbcType=TIMESTAMP},",
          "operator_id = #{operatorId,jdbcType=BIGINT},",
          "operator_name = #{operatorName,jdbcType=VARCHAR},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(HighCouponAgentCode record);
}