package com.hai.dao;

import com.hai.entity.HighCouponRecycle;
import com.hai.entity.HighCouponRecycleExample;
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 HighCouponRecycleMapper extends HighCouponRecycleMapperExt {
    @SelectProvider(type=HighCouponRecycleSqlProvider.class, method="countByExample")
    long countByExample(HighCouponRecycleExample example);

    @DeleteProvider(type=HighCouponRecycleSqlProvider.class, method="deleteByExample")
    int deleteByExample(HighCouponRecycleExample example);

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

    @Insert({
        "insert into high_coupon_recycle (coupon_id, coupon_name, ",
        "merchant_id, coupon_sales_code, ",
        "coupon_code_id, user_id, ",
        "user_phone, order_no, ",
        "order_id, child_order_id, ",
        "`type`, receive_time, ",
        "create_time, ext_1, ",
        "ext_3, ext_2)",
        "values (#{couponId,jdbcType=BIGINT}, #{couponName,jdbcType=VARCHAR}, ",
        "#{merchantId,jdbcType=BIGINT}, #{couponSalesCode,jdbcType=VARCHAR}, ",
        "#{couponCodeId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, ",
        "#{userPhone,jdbcType=VARCHAR}, #{orderNo,jdbcType=VARCHAR}, ",
        "#{orderId,jdbcType=BIGINT}, #{childOrderId,jdbcType=BIGINT}, ",
        "#{type,jdbcType=INTEGER}, #{receiveTime,jdbcType=TIMESTAMP}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
        "#{ext3,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(HighCouponRecycle record);

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

    @SelectProvider(type=HighCouponRecycleSqlProvider.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="coupon_name", property="couponName", jdbcType=JdbcType.VARCHAR),
        @Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_sales_code", property="couponSalesCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
        @Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
        @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.BIGINT),
        @Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="receive_time", property="receiveTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR)
    })
    List<HighCouponRecycle> selectByExample(HighCouponRecycleExample example);

    @Select({
        "select",
        "id, coupon_id, coupon_name, merchant_id, coupon_sales_code, coupon_code_id, ",
        "user_id, user_phone, order_no, order_id, child_order_id, `type`, receive_time, ",
        "create_time, ext_1, ext_3, ext_2",
        "from high_coupon_recycle",
        "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="coupon_name", property="couponName", jdbcType=JdbcType.VARCHAR),
        @Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_sales_code", property="couponSalesCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
        @Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
        @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.BIGINT),
        @Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="receive_time", property="receiveTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR)
    })
    HighCouponRecycle selectByPrimaryKey(Long id);

    @UpdateProvider(type=HighCouponRecycleSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") HighCouponRecycle record, @Param("example") HighCouponRecycleExample example);

    @UpdateProvider(type=HighCouponRecycleSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") HighCouponRecycle record, @Param("example") HighCouponRecycleExample example);

    @UpdateProvider(type=HighCouponRecycleSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(HighCouponRecycle record);

    @Update({
        "update high_coupon_recycle",
        "set coupon_id = #{couponId,jdbcType=BIGINT},",
          "coupon_name = #{couponName,jdbcType=VARCHAR},",
          "merchant_id = #{merchantId,jdbcType=BIGINT},",
          "coupon_sales_code = #{couponSalesCode,jdbcType=VARCHAR},",
          "coupon_code_id = #{couponCodeId,jdbcType=BIGINT},",
          "user_id = #{userId,jdbcType=BIGINT},",
          "user_phone = #{userPhone,jdbcType=VARCHAR},",
          "order_no = #{orderNo,jdbcType=VARCHAR},",
          "order_id = #{orderId,jdbcType=BIGINT},",
          "child_order_id = #{childOrderId,jdbcType=BIGINT},",
          "`type` = #{type,jdbcType=INTEGER},",
          "receive_time = #{receiveTime,jdbcType=TIMESTAMP},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(HighCouponRecycle record);
}