package com.hai.dao;

import com.hai.entity.HighCoupon;
import com.hai.entity.HighCouponExample;
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 HighCouponMapper extends HighCouponMapperExt {
    @SelectProvider(type=HighCouponSqlProvider.class, method="countByExample")
    long countByExample(HighCouponExample example);

    @DeleteProvider(type=HighCouponSqlProvider.class, method="deleteByExample")
    int deleteByExample(HighCouponExample example);

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

    @Insert({
        "insert into high_coupon (company_id, merchant_id, ",
        "coupon_key, coupon_name, ",
        "coupon_price, coupon_img, ",
        "coupon_carousel_img, coupon_desc, ",
        "coupon_type, sales_end_time, ",
        "recycle_day, limit_number, ",
        "sales_price, discount_price, ",
        "sales_count, is_present, ",
        "create_time, update_time, ",
        "operator_id, operator_name, ",
        "pay_type, ext_1, ext_2, ",
        "ext_3, `status`, display_area, ",
        "coupon_source, distributor, ",
        "goods_type_id, brand_id, ",
        "reserve_status, buy_points)",
        "values (#{companyId,jdbcType=BIGINT}, #{merchantId,jdbcType=BIGINT}, ",
        "#{couponKey,jdbcType=VARCHAR}, #{couponName,jdbcType=VARCHAR}, ",
        "#{couponPrice,jdbcType=DECIMAL}, #{couponImg,jdbcType=VARCHAR}, ",
        "#{couponCarouselImg,jdbcType=VARCHAR}, #{couponDesc,jdbcType=VARCHAR}, ",
        "#{couponType,jdbcType=INTEGER}, #{salesEndTime,jdbcType=TIMESTAMP}, ",
        "#{recycleDay,jdbcType=INTEGER}, #{limitNumber,jdbcType=INTEGER}, ",
        "#{salesPrice,jdbcType=DECIMAL}, #{discountPrice,jdbcType=DECIMAL}, ",
        "#{salesCount,jdbcType=INTEGER}, #{isPresent,jdbcType=BIT}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
        "#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ",
        "#{payType,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ",
        "#{ext3,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{displayArea,jdbcType=INTEGER}, ",
        "#{couponSource,jdbcType=INTEGER}, #{distributor,jdbcType=INTEGER}, ",
        "#{goodsTypeId,jdbcType=INTEGER}, #{brandId,jdbcType=INTEGER}, ",
        "#{reserveStatus,jdbcType=BIT}, #{buyPoints,jdbcType=BIT})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(HighCoupon record);

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

    @SelectProvider(type=HighCouponSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT),
        @Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_key", property="couponKey", jdbcType=JdbcType.VARCHAR),
        @Result(column="coupon_name", property="couponName", jdbcType=JdbcType.VARCHAR),
        @Result(column="coupon_price", property="couponPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="coupon_img", property="couponImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="coupon_carousel_img", property="couponCarouselImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="coupon_desc", property="couponDesc", jdbcType=JdbcType.VARCHAR),
        @Result(column="coupon_type", property="couponType", jdbcType=JdbcType.INTEGER),
        @Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="recycle_day", property="recycleDay", jdbcType=JdbcType.INTEGER),
        @Result(column="limit_number", property="limitNumber", jdbcType=JdbcType.INTEGER),
        @Result(column="sales_price", property="salesPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="sales_count", property="salesCount", jdbcType=JdbcType.INTEGER),
        @Result(column="is_present", property="isPresent", jdbcType=JdbcType.BIT),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT),
        @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR),
        @Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER),
        @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="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="display_area", property="displayArea", jdbcType=JdbcType.INTEGER),
        @Result(column="coupon_source", property="couponSource", jdbcType=JdbcType.INTEGER),
        @Result(column="distributor", property="distributor", jdbcType=JdbcType.INTEGER),
        @Result(column="goods_type_id", property="goodsTypeId", jdbcType=JdbcType.INTEGER),
        @Result(column="brand_id", property="brandId", jdbcType=JdbcType.INTEGER),
        @Result(column="reserve_status", property="reserveStatus", jdbcType=JdbcType.BIT),
        @Result(column="buy_points", property="buyPoints", jdbcType=JdbcType.BIT)
    })
    List<HighCoupon> selectByExample(HighCouponExample example);

    @Select({
        "select",
        "id, company_id, merchant_id, coupon_key, coupon_name, coupon_price, coupon_img, ",
        "coupon_carousel_img, coupon_desc, coupon_type, sales_end_time, recycle_day, ",
        "limit_number, sales_price, discount_price, sales_count, is_present, create_time, ",
        "update_time, operator_id, operator_name, pay_type, ext_1, ext_2, ext_3, `status`, ",
        "display_area, coupon_source, distributor, goods_type_id, brand_id, reserve_status, ",
        "buy_points",
        "from high_coupon",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT),
        @Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_key", property="couponKey", jdbcType=JdbcType.VARCHAR),
        @Result(column="coupon_name", property="couponName", jdbcType=JdbcType.VARCHAR),
        @Result(column="coupon_price", property="couponPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="coupon_img", property="couponImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="coupon_carousel_img", property="couponCarouselImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="coupon_desc", property="couponDesc", jdbcType=JdbcType.VARCHAR),
        @Result(column="coupon_type", property="couponType", jdbcType=JdbcType.INTEGER),
        @Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="recycle_day", property="recycleDay", jdbcType=JdbcType.INTEGER),
        @Result(column="limit_number", property="limitNumber", jdbcType=JdbcType.INTEGER),
        @Result(column="sales_price", property="salesPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="sales_count", property="salesCount", jdbcType=JdbcType.INTEGER),
        @Result(column="is_present", property="isPresent", jdbcType=JdbcType.BIT),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT),
        @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR),
        @Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER),
        @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="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="display_area", property="displayArea", jdbcType=JdbcType.INTEGER),
        @Result(column="coupon_source", property="couponSource", jdbcType=JdbcType.INTEGER),
        @Result(column="distributor", property="distributor", jdbcType=JdbcType.INTEGER),
        @Result(column="goods_type_id", property="goodsTypeId", jdbcType=JdbcType.INTEGER),
        @Result(column="brand_id", property="brandId", jdbcType=JdbcType.INTEGER),
        @Result(column="reserve_status", property="reserveStatus", jdbcType=JdbcType.BIT),
        @Result(column="buy_points", property="buyPoints", jdbcType=JdbcType.BIT)
    })
    HighCoupon selectByPrimaryKey(Long id);

    @UpdateProvider(type=HighCouponSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") HighCoupon record, @Param("example") HighCouponExample example);

    @UpdateProvider(type=HighCouponSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") HighCoupon record, @Param("example") HighCouponExample example);

    @UpdateProvider(type=HighCouponSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(HighCoupon record);

    @Update({
        "update high_coupon",
        "set company_id = #{companyId,jdbcType=BIGINT},",
          "merchant_id = #{merchantId,jdbcType=BIGINT},",
          "coupon_key = #{couponKey,jdbcType=VARCHAR},",
          "coupon_name = #{couponName,jdbcType=VARCHAR},",
          "coupon_price = #{couponPrice,jdbcType=DECIMAL},",
          "coupon_img = #{couponImg,jdbcType=VARCHAR},",
          "coupon_carousel_img = #{couponCarouselImg,jdbcType=VARCHAR},",
          "coupon_desc = #{couponDesc,jdbcType=VARCHAR},",
          "coupon_type = #{couponType,jdbcType=INTEGER},",
          "sales_end_time = #{salesEndTime,jdbcType=TIMESTAMP},",
          "recycle_day = #{recycleDay,jdbcType=INTEGER},",
          "limit_number = #{limitNumber,jdbcType=INTEGER},",
          "sales_price = #{salesPrice,jdbcType=DECIMAL},",
          "discount_price = #{discountPrice,jdbcType=DECIMAL},",
          "sales_count = #{salesCount,jdbcType=INTEGER},",
          "is_present = #{isPresent,jdbcType=BIT},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "operator_id = #{operatorId,jdbcType=BIGINT},",
          "operator_name = #{operatorName,jdbcType=VARCHAR},",
          "pay_type = #{payType,jdbcType=INTEGER},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR},",
          "`status` = #{status,jdbcType=INTEGER},",
          "display_area = #{displayArea,jdbcType=INTEGER},",
          "coupon_source = #{couponSource,jdbcType=INTEGER},",
          "distributor = #{distributor,jdbcType=INTEGER},",
          "goods_type_id = #{goodsTypeId,jdbcType=INTEGER},",
          "brand_id = #{brandId,jdbcType=INTEGER},",
          "reserve_status = #{reserveStatus,jdbcType=BIT},",
          "buy_points = #{buyPoints,jdbcType=BIT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(HighCoupon record);
}