package com.hai.dao;

import com.hai.entity.HighCouponCode;
import com.hai.entity.HighCouponCodeExample;
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 HighCouponCodeMapper extends HighCouponCodeMapperExt {
    @SelectProvider(type=HighCouponCodeSqlProvider.class, method="countByExample")
    long countByExample(HighCouponCodeExample example);

    @DeleteProvider(type=HighCouponCodeSqlProvider.class, method="deleteByExample")
    int deleteByExample(HighCouponCodeExample example);

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

    @Insert({
        "insert into high_coupon_code (coupon_id, merchant_id, ",
        "is_assign_agent, agent_id, ",
        "store_id, store_name, ",
        "child_order_id, code_key, ",
        "sales_code, sales_end_time, ",
        "use_end_time, create_time, ",
        "receive_time, consume_time, ",
        "`status`, operator_id, ",
        "operator_name, ext_1, ",
        "ext_2, ext_3)",
        "values (#{couponId,jdbcType=BIGINT}, #{merchantId,jdbcType=BIGINT}, ",
        "#{isAssignAgent,jdbcType=BIT}, #{agentId,jdbcType=BIGINT}, ",
        "#{storeId,jdbcType=BIGINT}, #{storeName,jdbcType=VARCHAR}, ",
        "#{childOrderId,jdbcType=BIGINT}, #{codeKey,jdbcType=VARCHAR}, ",
        "#{salesCode,jdbcType=VARCHAR}, #{salesEndTime,jdbcType=TIMESTAMP}, ",
        "#{useEndTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{receiveTime,jdbcType=TIMESTAMP}, #{consumeTime,jdbcType=TIMESTAMP}, ",
        "#{status,jdbcType=INTEGER}, #{operatorId,jdbcType=BIGINT}, ",
        "#{operatorName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
        "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(HighCouponCode record);

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

    @SelectProvider(type=HighCouponCodeSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
        @Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT),
        @Result(column="is_assign_agent", property="isAssignAgent", jdbcType=JdbcType.BIT),
        @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
        @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
        @Result(column="store_name", property="storeName", jdbcType=JdbcType.VARCHAR),
        @Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT),
        @Result(column="code_key", property="codeKey", jdbcType=JdbcType.VARCHAR),
        @Result(column="sales_code", property="salesCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="receive_time", property="receiveTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="consume_time", property="consumeTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @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<HighCouponCode> selectByExample(HighCouponCodeExample example);

    @Select({
        "select",
        "id, coupon_id, merchant_id, is_assign_agent, agent_id, store_id, store_name, ",
        "child_order_id, code_key, sales_code, sales_end_time, use_end_time, create_time, ",
        "receive_time, consume_time, `status`, operator_id, operator_name, ext_1, ext_2, ",
        "ext_3",
        "from high_coupon_code",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
        @Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT),
        @Result(column="is_assign_agent", property="isAssignAgent", jdbcType=JdbcType.BIT),
        @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
        @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
        @Result(column="store_name", property="storeName", jdbcType=JdbcType.VARCHAR),
        @Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT),
        @Result(column="code_key", property="codeKey", jdbcType=JdbcType.VARCHAR),
        @Result(column="sales_code", property="salesCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="receive_time", property="receiveTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="consume_time", property="consumeTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @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)
    })
    HighCouponCode selectByPrimaryKey(Long id);

    @UpdateProvider(type=HighCouponCodeSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") HighCouponCode record, @Param("example") HighCouponCodeExample example);

    @UpdateProvider(type=HighCouponCodeSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") HighCouponCode record, @Param("example") HighCouponCodeExample example);

    @UpdateProvider(type=HighCouponCodeSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(HighCouponCode record);

    @Update({
        "update high_coupon_code",
        "set coupon_id = #{couponId,jdbcType=BIGINT},",
          "merchant_id = #{merchantId,jdbcType=BIGINT},",
          "is_assign_agent = #{isAssignAgent,jdbcType=BIT},",
          "agent_id = #{agentId,jdbcType=BIGINT},",
          "store_id = #{storeId,jdbcType=BIGINT},",
          "store_name = #{storeName,jdbcType=VARCHAR},",
          "child_order_id = #{childOrderId,jdbcType=BIGINT},",
          "code_key = #{codeKey,jdbcType=VARCHAR},",
          "sales_code = #{salesCode,jdbcType=VARCHAR},",
          "sales_end_time = #{salesEndTime,jdbcType=TIMESTAMP},",
          "use_end_time = #{useEndTime,jdbcType=TIMESTAMP},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "receive_time = #{receiveTime,jdbcType=TIMESTAMP},",
          "consume_time = #{consumeTime,jdbcType=TIMESTAMP},",
          "`status` = #{status,jdbcType=INTEGER},",
          "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(HighCouponCode record);
}