package com.hfkj.dao;

import com.hfkj.entity.CouponDiscountPackageDetails;
import com.hfkj.entity.CouponDiscountPackageDetailsExample;
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 CouponDiscountPackageDetailsMapper extends CouponDiscountPackageDetailsMapperExt {
    @SelectProvider(type=CouponDiscountPackageDetailsSqlProvider.class, method="countByExample")
    long countByExample(CouponDiscountPackageDetailsExample example);

    @DeleteProvider(type=CouponDiscountPackageDetailsSqlProvider.class, method="deleteByExample")
    int deleteByExample(CouponDiscountPackageDetailsExample example);

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

    @Insert({
        "insert into coupon_discount_package_details (discount_package_id, discount_id, ",
        "discount_name, discount_img, ",
        "num, created_time, ",
        "updated_time, `status`, ",
        "ext_1, ext_2, ext_3)",
        "values (#{discountPackageId,jdbcType=INTEGER}, #{discountId,jdbcType=INTEGER}, ",
        "#{discountName,jdbcType=VARCHAR}, #{discountImg,jdbcType=VARCHAR}, ",
        "#{num,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, ",
        "#{updatedTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
        "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(CouponDiscountPackageDetails record);

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

    @SelectProvider(type=CouponDiscountPackageDetailsSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER),
        @Result(column="discount_id", property="discountId", jdbcType=JdbcType.INTEGER),
        @Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR),
        @Result(column="discount_img", property="discountImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="num", property="num", jdbcType=JdbcType.INTEGER),
        @Result(column="created_time", property="createdTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="updated_time", property="updatedTime", jdbcType=JdbcType.TIMESTAMP),
        @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<CouponDiscountPackageDetails> selectByExample(CouponDiscountPackageDetailsExample example);

    @Select({
        "select",
        "id, discount_package_id, discount_id, discount_name, discount_img, num, created_time, ",
        "updated_time, `status`, ext_1, ext_2, ext_3",
        "from coupon_discount_package_details",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER),
        @Result(column="discount_id", property="discountId", jdbcType=JdbcType.INTEGER),
        @Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR),
        @Result(column="discount_img", property="discountImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="num", property="num", jdbcType=JdbcType.INTEGER),
        @Result(column="created_time", property="createdTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="updated_time", property="updatedTime", jdbcType=JdbcType.TIMESTAMP),
        @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)
    })
    CouponDiscountPackageDetails selectByPrimaryKey(Integer id);

    @UpdateProvider(type=CouponDiscountPackageDetailsSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") CouponDiscountPackageDetails record, @Param("example") CouponDiscountPackageDetailsExample example);

    @UpdateProvider(type=CouponDiscountPackageDetailsSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") CouponDiscountPackageDetails record, @Param("example") CouponDiscountPackageDetailsExample example);

    @UpdateProvider(type=CouponDiscountPackageDetailsSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(CouponDiscountPackageDetails record);

    @Update({
        "update coupon_discount_package_details",
        "set discount_package_id = #{discountPackageId,jdbcType=INTEGER},",
          "discount_id = #{discountId,jdbcType=INTEGER},",
          "discount_name = #{discountName,jdbcType=VARCHAR},",
          "discount_img = #{discountImg,jdbcType=VARCHAR},",
          "num = #{num,jdbcType=INTEGER},",
          "created_time = #{createdTime,jdbcType=TIMESTAMP},",
          "updated_time = #{updatedTime,jdbcType=TIMESTAMP},",
          "`status` = #{status,jdbcType=INTEGER},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(CouponDiscountPackageDetails record);
}