package com.hfkj.dao;

import com.hfkj.entity.CouponDiscountPackage;
import com.hfkj.entity.CouponDiscountPackageExample;
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 CouponDiscountPackageMapper extends CouponDiscountPackageMapperExt {
    @SelectProvider(type=CouponDiscountPackageSqlProvider.class, method="countByExample")
    long countByExample(CouponDiscountPackageExample example);

    @DeleteProvider(type=CouponDiscountPackageSqlProvider.class, method="deleteByExample")
    int deleteByExample(CouponDiscountPackageExample example);

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

    @Insert({
        "insert into coupon_discount_package (`key`, title, ",
        "effective_time, created_user_id, ",
        "created_time, updated_user_id, ",
        "updated_time, `status`, ",
        "total_stock, surplus_stock, ",
        "ext_1, ext_2, ext_3)",
        "values (#{key,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, ",
        "#{effectiveTime,jdbcType=TIMESTAMP}, #{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(CouponDiscountPackage record);

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

    @SelectProvider(type=CouponDiscountPackageSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="key", property="key", jdbcType=JdbcType.VARCHAR),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="effective_time", property="effectiveTime", jdbcType=JdbcType.TIMESTAMP),
        @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<CouponDiscountPackage> selectByExample(CouponDiscountPackageExample example);

    @Select({
        "select",
        "id, `key`, title, effective_time, created_user_id, created_time, updated_user_id, ",
        "updated_time, `status`, total_stock, surplus_stock, ext_1, ext_2, ext_3",
        "from coupon_discount_package",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="key", property="key", jdbcType=JdbcType.VARCHAR),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="effective_time", property="effectiveTime", jdbcType=JdbcType.TIMESTAMP),
        @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)
    })
    CouponDiscountPackage selectByPrimaryKey(Long id);

    @UpdateProvider(type=CouponDiscountPackageSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") CouponDiscountPackage record, @Param("example") CouponDiscountPackageExample example);

    @UpdateProvider(type=CouponDiscountPackageSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") CouponDiscountPackage record, @Param("example") CouponDiscountPackageExample example);

    @UpdateProvider(type=CouponDiscountPackageSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(CouponDiscountPackage record);

    @Update({
        "update coupon_discount_package",
        "set `key` = #{key,jdbcType=VARCHAR},",
          "title = #{title,jdbcType=VARCHAR},",
          "effective_time = #{effectiveTime,jdbcType=TIMESTAMP},",
          "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=BIGINT}"
    })
    int updateByPrimaryKey(CouponDiscountPackage record);
}