package com.hai.dao;

import com.hai.entity.HighUserCoupon;
import com.hai.entity.HighUserCouponExample;
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 HighUserCouponMapper extends HighUserCouponMapperExt {
    @SelectProvider(type=HighUserCouponSqlProvider.class, method="countByExample")
    long countByExample(HighUserCouponExample example);

    @DeleteProvider(type=HighUserCouponSqlProvider.class, method="deleteByExample")
    int deleteByExample(HighUserCouponExample example);

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

    @Insert({
        "insert into high_user_coupon (merchant_id, coupon_id, ",
        "user_id, coupon_code_id, ",
        "store_id, create_time, ",
        "consume_time, use_end_time, ",
        "qr_code_img, `status`, ",
        "`source`, source_id, ",
        "ext_1, ext_2, ext_3, ",
        "ext_4)",
        "values (#{merchantId,jdbcType=BIGINT}, #{couponId,jdbcType=BIGINT}, ",
        "#{userId,jdbcType=BIGINT}, #{couponCodeId,jdbcType=BIGINT}, ",
        "#{storeId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{consumeTime,jdbcType=TIMESTAMP}, #{useEndTime,jdbcType=TIMESTAMP}, ",
        "#{qrCodeImg,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
        "#{source,jdbcType=INTEGER}, #{sourceId,jdbcType=BIGINT}, ",
        "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ",
        "#{ext4,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(HighUserCoupon record);

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

    @SelectProvider(type=HighUserCouponSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT),
        @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="consume_time", property="consumeTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="qr_code_img", property="qrCodeImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="source", property="source", jdbcType=JdbcType.INTEGER),
        @Result(column="source_id", property="sourceId", jdbcType=JdbcType.BIGINT),
        @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),
        @Result(column="ext_4", property="ext4", jdbcType=JdbcType.VARCHAR)
    })
    List<HighUserCoupon> selectByExample(HighUserCouponExample example);

    @Select({
        "select",
        "id, merchant_id, coupon_id, user_id, coupon_code_id, store_id, create_time, ",
        "consume_time, use_end_time, qr_code_img, `status`, `source`, source_id, ext_1, ",
        "ext_2, ext_3, ext_4",
        "from high_user_coupon",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT),
        @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="consume_time", property="consumeTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="qr_code_img", property="qrCodeImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="source", property="source", jdbcType=JdbcType.INTEGER),
        @Result(column="source_id", property="sourceId", jdbcType=JdbcType.BIGINT),
        @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),
        @Result(column="ext_4", property="ext4", jdbcType=JdbcType.VARCHAR)
    })
    HighUserCoupon selectByPrimaryKey(Long id);

    @UpdateProvider(type=HighUserCouponSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") HighUserCoupon record, @Param("example") HighUserCouponExample example);

    @UpdateProvider(type=HighUserCouponSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") HighUserCoupon record, @Param("example") HighUserCouponExample example);

    @UpdateProvider(type=HighUserCouponSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(HighUserCoupon record);

    @Update({
        "update high_user_coupon",
        "set merchant_id = #{merchantId,jdbcType=BIGINT},",
          "coupon_id = #{couponId,jdbcType=BIGINT},",
          "user_id = #{userId,jdbcType=BIGINT},",
          "coupon_code_id = #{couponCodeId,jdbcType=BIGINT},",
          "store_id = #{storeId,jdbcType=BIGINT},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "consume_time = #{consumeTime,jdbcType=TIMESTAMP},",
          "use_end_time = #{useEndTime,jdbcType=TIMESTAMP},",
          "qr_code_img = #{qrCodeImg,jdbcType=VARCHAR},",
          "`status` = #{status,jdbcType=INTEGER},",
          "`source` = #{source,jdbcType=INTEGER},",
          "source_id = #{sourceId,jdbcType=BIGINT},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR},",
          "ext_4 = #{ext4,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(HighUserCoupon record);
}