package com.hai.dao;

import com.hai.entity.HighDiscountPackage;
import com.hai.entity.HighDiscountPackageExample;
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 HighDiscountPackageMapper extends HighDiscountPackageMapperExt {
    @SelectProvider(type=HighDiscountPackageSqlProvider.class, method="countByExample")
    long countByExample(HighDiscountPackageExample example);

    @DeleteProvider(type=HighDiscountPackageSqlProvider.class, method="deleteByExample")
    int deleteByExample(HighDiscountPackageExample example);

    @Delete({
        "delete from high_discount_package",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into high_discount_package (company_id, using_attribution, ",
        "title, sales_type, ",
        "effective_tiem, price, ",
        "purchase_num, list_img, ",
        "banner_img, details_img, ",
        "created_user_id, created_time, ",
        "updated_user_id, updated_time, ",
        "`status`, total_stock, ",
        "surplus_stock, ext_1, ",
        "ext_2, ext_3)",
        "values (#{companyId,jdbcType=INTEGER}, #{usingAttribution,jdbcType=INTEGER}, ",
        "#{title,jdbcType=VARCHAR}, #{salesType,jdbcType=INTEGER}, ",
        "#{effectiveTiem,jdbcType=TIMESTAMP}, #{price,jdbcType=DECIMAL}, ",
        "#{purchaseNum,jdbcType=INTEGER}, #{listImg,jdbcType=VARCHAR}, ",
        "#{bannerImg,jdbcType=VARCHAR}, #{detailsImg,jdbcType=VARCHAR}, ",
        "#{createdUserId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, ",
        "#{updatedUserId,jdbcType=INTEGER}, #{updatedTime,jdbcType=TIMESTAMP}, ",
        "#{status,jdbcType=INTEGER}, #{totalStock,jdbcType=INTEGER}, ",
        "#{surplusStock,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, ",
        "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(HighDiscountPackage record);

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

    @SelectProvider(type=HighDiscountPackageSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="company_id", property="companyId", jdbcType=JdbcType.INTEGER),
        @Result(column="using_attribution", property="usingAttribution", jdbcType=JdbcType.INTEGER),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="sales_type", property="salesType", jdbcType=JdbcType.INTEGER),
        @Result(column="effective_tiem", property="effectiveTiem", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="price", property="price", jdbcType=JdbcType.DECIMAL),
        @Result(column="purchase_num", property="purchaseNum", jdbcType=JdbcType.INTEGER),
        @Result(column="list_img", property="listImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="banner_img", property="bannerImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="details_img", property="detailsImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="created_user_id", property="createdUserId", jdbcType=JdbcType.INTEGER),
        @Result(column="created_time", property="createdTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="updated_user_id", property="updatedUserId", jdbcType=JdbcType.INTEGER),
        @Result(column="updated_time", property="updatedTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="total_stock", property="totalStock", jdbcType=JdbcType.INTEGER),
        @Result(column="surplus_stock", property="surplusStock", 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<HighDiscountPackage> selectByExample(HighDiscountPackageExample example);

    @Select({
        "select",
        "id, company_id, using_attribution, title, sales_type, effective_tiem, price, ",
        "purchase_num, list_img, banner_img, details_img, created_user_id, created_time, ",
        "updated_user_id, updated_time, `status`, total_stock, surplus_stock, ext_1, ",
        "ext_2, ext_3",
        "from high_discount_package",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="company_id", property="companyId", jdbcType=JdbcType.INTEGER),
        @Result(column="using_attribution", property="usingAttribution", jdbcType=JdbcType.INTEGER),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="sales_type", property="salesType", jdbcType=JdbcType.INTEGER),
        @Result(column="effective_tiem", property="effectiveTiem", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="price", property="price", jdbcType=JdbcType.DECIMAL),
        @Result(column="purchase_num", property="purchaseNum", jdbcType=JdbcType.INTEGER),
        @Result(column="list_img", property="listImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="banner_img", property="bannerImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="details_img", property="detailsImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="created_user_id", property="createdUserId", jdbcType=JdbcType.INTEGER),
        @Result(column="created_time", property="createdTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="updated_user_id", property="updatedUserId", jdbcType=JdbcType.INTEGER),
        @Result(column="updated_time", property="updatedTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="total_stock", property="totalStock", jdbcType=JdbcType.INTEGER),
        @Result(column="surplus_stock", property="surplusStock", 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)
    })
    HighDiscountPackage selectByPrimaryKey(Integer id);

    @UpdateProvider(type=HighDiscountPackageSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") HighDiscountPackage record, @Param("example") HighDiscountPackageExample example);

    @UpdateProvider(type=HighDiscountPackageSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") HighDiscountPackage record, @Param("example") HighDiscountPackageExample example);

    @UpdateProvider(type=HighDiscountPackageSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(HighDiscountPackage record);

    @Update({
        "update high_discount_package",
        "set company_id = #{companyId,jdbcType=INTEGER},",
          "using_attribution = #{usingAttribution,jdbcType=INTEGER},",
          "title = #{title,jdbcType=VARCHAR},",
          "sales_type = #{salesType,jdbcType=INTEGER},",
          "effective_tiem = #{effectiveTiem,jdbcType=TIMESTAMP},",
          "price = #{price,jdbcType=DECIMAL},",
          "purchase_num = #{purchaseNum,jdbcType=INTEGER},",
          "list_img = #{listImg,jdbcType=VARCHAR},",
          "banner_img = #{bannerImg,jdbcType=VARCHAR},",
          "details_img = #{detailsImg,jdbcType=VARCHAR},",
          "created_user_id = #{createdUserId,jdbcType=INTEGER},",
          "created_time = #{createdTime,jdbcType=TIMESTAMP},",
          "updated_user_id = #{updatedUserId,jdbcType=INTEGER},",
          "updated_time = #{updatedTime,jdbcType=TIMESTAMP},",
          "`status` = #{status,jdbcType=INTEGER},",
          "total_stock = #{totalStock,jdbcType=INTEGER},",
          "surplus_stock = #{surplusStock,jdbcType=INTEGER},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(HighDiscountPackage record);
}