package com.hai.dao;

import com.hai.entity.HighDiscount;
import com.hai.entity.HighDiscountExample;
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 HighDiscountMapper extends HighDiscountMapperExt {
    @SelectProvider(type=HighDiscountSqlProvider.class, method="countByExample")
    long countByExample(HighDiscountExample example);

    @DeleteProvider(type=HighDiscountSqlProvider.class, method="deleteByExample")
    int deleteByExample(HighDiscountExample example);

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

    @Insert({
        "insert into high_discount (company_id, discount_key, ",
        "using_range, use_scope, ",
        "discount_name, discount_img, ",
        "discount_carousel_img, discount_type, ",
        "discount_condition, discount_price, ",
        "receive_number, effective_day, ",
        "sales_end_time, create_time, ",
        "update_time, operator_id, ",
        "operator_name, `status`, ",
        "ext_1, ext_2, ext_3)",
        "values (#{companyId,jdbcType=BIGINT}, #{discountKey,jdbcType=VARCHAR}, ",
        "#{usingRange,jdbcType=INTEGER}, #{useScope,jdbcType=INTEGER}, ",
        "#{discountName,jdbcType=VARCHAR}, #{discountImg,jdbcType=VARCHAR}, ",
        "#{discountCarouselImg,jdbcType=VARCHAR}, #{discountType,jdbcType=INTEGER}, ",
        "#{discountCondition,jdbcType=DECIMAL}, #{discountPrice,jdbcType=DECIMAL}, ",
        "#{receiveNumber,jdbcType=INTEGER}, #{effectiveDay,jdbcType=INTEGER}, ",
        "#{salesEndTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{updateTime,jdbcType=TIMESTAMP}, #{operatorId,jdbcType=BIGINT}, ",
        "#{operatorName,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
        "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(HighDiscount record);

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

    @SelectProvider(type=HighDiscountSqlProvider.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="discount_key", property="discountKey", jdbcType=JdbcType.VARCHAR),
        @Result(column="using_range", property="usingRange", jdbcType=JdbcType.INTEGER),
        @Result(column="use_scope", property="useScope", jdbcType=JdbcType.INTEGER),
        @Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR),
        @Result(column="discount_img", property="discountImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="discount_carousel_img", property="discountCarouselImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER),
        @Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL),
        @Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="receive_number", property="receiveNumber", jdbcType=JdbcType.INTEGER),
        @Result(column="effective_day", property="effectiveDay", jdbcType=JdbcType.INTEGER),
        @Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP),
        @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="status", property="status", 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)
    })
    List<HighDiscount> selectByExample(HighDiscountExample example);

    @Select({
        "select",
        "id, company_id, discount_key, using_range, use_scope, discount_name, discount_img, ",
        "discount_carousel_img, discount_type, discount_condition, discount_price, receive_number, ",
        "effective_day, sales_end_time, create_time, update_time, operator_id, operator_name, ",
        "`status`, ext_1, ext_2, ext_3",
        "from high_discount",
        "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="discount_key", property="discountKey", jdbcType=JdbcType.VARCHAR),
        @Result(column="using_range", property="usingRange", jdbcType=JdbcType.INTEGER),
        @Result(column="use_scope", property="useScope", jdbcType=JdbcType.INTEGER),
        @Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR),
        @Result(column="discount_img", property="discountImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="discount_carousel_img", property="discountCarouselImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER),
        @Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL),
        @Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="receive_number", property="receiveNumber", jdbcType=JdbcType.INTEGER),
        @Result(column="effective_day", property="effectiveDay", jdbcType=JdbcType.INTEGER),
        @Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP),
        @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="status", property="status", 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)
    })
    HighDiscount selectByPrimaryKey(Long id);

    @UpdateProvider(type=HighDiscountSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") HighDiscount record, @Param("example") HighDiscountExample example);

    @UpdateProvider(type=HighDiscountSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") HighDiscount record, @Param("example") HighDiscountExample example);

    @UpdateProvider(type=HighDiscountSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(HighDiscount record);

    @Update({
        "update high_discount",
        "set company_id = #{companyId,jdbcType=BIGINT},",
          "discount_key = #{discountKey,jdbcType=VARCHAR},",
          "using_range = #{usingRange,jdbcType=INTEGER},",
          "use_scope = #{useScope,jdbcType=INTEGER},",
          "discount_name = #{discountName,jdbcType=VARCHAR},",
          "discount_img = #{discountImg,jdbcType=VARCHAR},",
          "discount_carousel_img = #{discountCarouselImg,jdbcType=VARCHAR},",
          "discount_type = #{discountType,jdbcType=INTEGER},",
          "discount_condition = #{discountCondition,jdbcType=DECIMAL},",
          "discount_price = #{discountPrice,jdbcType=DECIMAL},",
          "receive_number = #{receiveNumber,jdbcType=INTEGER},",
          "effective_day = #{effectiveDay,jdbcType=INTEGER},",
          "sales_end_time = #{salesEndTime,jdbcType=TIMESTAMP},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "operator_id = #{operatorId,jdbcType=BIGINT},",
          "operator_name = #{operatorName,jdbcType=VARCHAR},",
          "`status` = #{status,jdbcType=INTEGER},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(HighDiscount record);
}