package com.hfkj.dao;

import com.hfkj.entity.CouponDiscountPackageRecord;
import com.hfkj.entity.CouponDiscountPackageRecordExample;
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 CouponDiscountPackageRecordMapper extends CouponDiscountPackageRecordMapperExt {
    @SelectProvider(type=CouponDiscountPackageRecordSqlProvider.class, method="countByExample")
    long countByExample(CouponDiscountPackageRecordExample example);

    @DeleteProvider(type=CouponDiscountPackageRecordSqlProvider.class, method="deleteByExample")
    int deleteByExample(CouponDiscountPackageRecordExample example);

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

    @Insert({
        "insert into coupon_discount_package_record (discount_package_title, discount_package_id, ",
        "order_id, order_no, ",
        "child_order_id, serial_no, ",
        "`type`, user_id, user_phone, ",
        "created_time, `status`, ",
        "ext_1, ext_2, ext_3)",
        "values (#{discountPackageTitle,jdbcType=VARCHAR}, #{discountPackageId,jdbcType=INTEGER}, ",
        "#{orderId,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, ",
        "#{childOrderId,jdbcType=INTEGER}, #{serialNo,jdbcType=VARCHAR}, ",
        "#{type,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{userPhone,jdbcType=VARCHAR}, ",
        "#{createdTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
        "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(CouponDiscountPackageRecord record);

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

    @SelectProvider(type=CouponDiscountPackageRecordSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR),
        @Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER),
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.INTEGER),
        @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.INTEGER),
        @Result(column="serial_no", property="serialNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.INTEGER),
        @Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
        @Result(column="created_time", property="createdTime", 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<CouponDiscountPackageRecord> selectByExample(CouponDiscountPackageRecordExample example);

    @Select({
        "select",
        "id, discount_package_title, discount_package_id, order_id, order_no, child_order_id, ",
        "serial_no, `type`, user_id, user_phone, created_time, `status`, ext_1, ext_2, ",
        "ext_3",
        "from coupon_discount_package_record",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR),
        @Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER),
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.INTEGER),
        @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.INTEGER),
        @Result(column="serial_no", property="serialNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.INTEGER),
        @Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
        @Result(column="created_time", property="createdTime", 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)
    })
    CouponDiscountPackageRecord selectByPrimaryKey(Long id);

    @UpdateProvider(type=CouponDiscountPackageRecordSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") CouponDiscountPackageRecord record, @Param("example") CouponDiscountPackageRecordExample example);

    @UpdateProvider(type=CouponDiscountPackageRecordSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") CouponDiscountPackageRecord record, @Param("example") CouponDiscountPackageRecordExample example);

    @UpdateProvider(type=CouponDiscountPackageRecordSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(CouponDiscountPackageRecord record);

    @Update({
        "update coupon_discount_package_record",
        "set discount_package_title = #{discountPackageTitle,jdbcType=VARCHAR},",
          "discount_package_id = #{discountPackageId,jdbcType=INTEGER},",
          "order_id = #{orderId,jdbcType=INTEGER},",
          "order_no = #{orderNo,jdbcType=VARCHAR},",
          "child_order_id = #{childOrderId,jdbcType=INTEGER},",
          "serial_no = #{serialNo,jdbcType=VARCHAR},",
          "`type` = #{type,jdbcType=INTEGER},",
          "user_id = #{userId,jdbcType=INTEGER},",
          "user_phone = #{userPhone,jdbcType=VARCHAR},",
          "created_time = #{createdTime,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=BIGINT}"
    })
    int updateByPrimaryKey(CouponDiscountPackageRecord record);
}