package com.hfkj.dao;

import com.hfkj.entity.BsDiscount;
import com.hfkj.entity.BsDiscountExample;
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 BsDiscountMapper extends BsDiscountMapperExt {
    @SelectProvider(type=BsDiscountSqlProvider.class, method="countByExample")
    long countByExample(BsDiscountExample example);

    @DeleteProvider(type=BsDiscountSqlProvider.class, method="deleteByExample")
    int deleteByExample(BsDiscountExample example);

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

    @Insert({
        "insert into bs_discount (discount_no, discount_name, ",
        "discount_type, discount_condition, ",
        "discount_price, overlay_discount, ",
        "use_scope, receive_expiration_date, ",
        "start_time, end_time, ",
        "reality_end_time, `status`, ",
        "create_time, create_user_type, ",
        "create_user_id, create_user_name, ",
        "create_user_mer_no, update_time, ",
        "ext_1, ext_2, ext_3)",
        "values (#{discountNo,jdbcType=VARCHAR}, #{discountName,jdbcType=VARCHAR}, ",
        "#{discountType,jdbcType=INTEGER}, #{discountCondition,jdbcType=DECIMAL}, ",
        "#{discountPrice,jdbcType=DECIMAL}, #{overlayDiscount,jdbcType=BIT}, ",
        "#{useScope,jdbcType=VARCHAR}, #{receiveExpirationDate,jdbcType=INTEGER}, ",
        "#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, ",
        "#{realityEndTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{createUserType,jdbcType=INTEGER}, ",
        "#{createUserId,jdbcType=BIGINT}, #{createUserName,jdbcType=VARCHAR}, ",
        "#{createUserMerNo,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, ",
        "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(BsDiscount record);

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

    @SelectProvider(type=BsDiscountSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="discount_no", property="discountNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="discount_name", property="discountName", 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="overlay_discount", property="overlayDiscount", jdbcType=JdbcType.BIT),
        @Result(column="use_scope", property="useScope", jdbcType=JdbcType.VARCHAR),
        @Result(column="receive_expiration_date", property="receiveExpirationDate", jdbcType=JdbcType.INTEGER),
        @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="reality_end_time", property="realityEndTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_user_type", property="createUserType", jdbcType=JdbcType.INTEGER),
        @Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.BIGINT),
        @Result(column="create_user_name", property="createUserName", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_user_mer_no", property="createUserMerNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @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<BsDiscount> selectByExample(BsDiscountExample example);

    @Select({
        "select",
        "id, discount_no, discount_name, discount_type, discount_condition, discount_price, ",
        "overlay_discount, use_scope, receive_expiration_date, start_time, end_time, ",
        "reality_end_time, `status`, create_time, create_user_type, create_user_id, create_user_name, ",
        "create_user_mer_no, update_time, ext_1, ext_2, ext_3",
        "from bs_discount",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="discount_no", property="discountNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="discount_name", property="discountName", 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="overlay_discount", property="overlayDiscount", jdbcType=JdbcType.BIT),
        @Result(column="use_scope", property="useScope", jdbcType=JdbcType.VARCHAR),
        @Result(column="receive_expiration_date", property="receiveExpirationDate", jdbcType=JdbcType.INTEGER),
        @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="reality_end_time", property="realityEndTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_user_type", property="createUserType", jdbcType=JdbcType.INTEGER),
        @Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.BIGINT),
        @Result(column="create_user_name", property="createUserName", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_user_mer_no", property="createUserMerNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @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)
    })
    BsDiscount selectByPrimaryKey(Long id);

    @UpdateProvider(type=BsDiscountSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") BsDiscount record, @Param("example") BsDiscountExample example);

    @UpdateProvider(type=BsDiscountSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") BsDiscount record, @Param("example") BsDiscountExample example);

    @UpdateProvider(type=BsDiscountSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(BsDiscount record);

    @Update({
        "update bs_discount",
        "set discount_no = #{discountNo,jdbcType=VARCHAR},",
          "discount_name = #{discountName,jdbcType=VARCHAR},",
          "discount_type = #{discountType,jdbcType=INTEGER},",
          "discount_condition = #{discountCondition,jdbcType=DECIMAL},",
          "discount_price = #{discountPrice,jdbcType=DECIMAL},",
          "overlay_discount = #{overlayDiscount,jdbcType=BIT},",
          "use_scope = #{useScope,jdbcType=VARCHAR},",
          "receive_expiration_date = #{receiveExpirationDate,jdbcType=INTEGER},",
          "start_time = #{startTime,jdbcType=TIMESTAMP},",
          "end_time = #{endTime,jdbcType=TIMESTAMP},",
          "reality_end_time = #{realityEndTime,jdbcType=TIMESTAMP},",
          "`status` = #{status,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "create_user_type = #{createUserType,jdbcType=INTEGER},",
          "create_user_id = #{createUserId,jdbcType=BIGINT},",
          "create_user_name = #{createUserName,jdbcType=VARCHAR},",
          "create_user_mer_no = #{createUserMerNo,jdbcType=VARCHAR},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(BsDiscount record);
}