package com.hfkj.dao;

import com.hfkj.entity.BsOrderDeduction;
import com.hfkj.entity.BsOrderDeductionExample;
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 BsOrderDeductionMapper extends BsOrderDeductionMapperExt {
    @SelectProvider(type=BsOrderDeductionSqlProvider.class, method="countByExample")
    long countByExample(BsOrderDeductionExample example);

    @DeleteProvider(type=BsOrderDeductionSqlProvider.class, method="deleteByExample")
    int deleteByExample(BsOrderDeductionExample example);

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

    @Insert({
        "insert into bs_order_deduction (order_id, order_no, ",
        "total_deduction_price, user_coupon_discount_id, ",
        "coupon_discount_id, coupon_discount_type, ",
        "coupon_discount_price, coupon_discount_actual_price, ",
        "integral_discount_price, ext_1, ",
        "ext_2, ext_3)",
        "values (#{orderId,jdbcType=BIGINT}, #{orderNo,jdbcType=VARCHAR}, ",
        "#{totalDeductionPrice,jdbcType=DECIMAL}, #{userCouponDiscountId,jdbcType=BIGINT}, ",
        "#{couponDiscountId,jdbcType=BIGINT}, #{couponDiscountType,jdbcType=INTEGER}, ",
        "#{couponDiscountPrice,jdbcType=DECIMAL}, #{couponDiscountActualPrice,jdbcType=DECIMAL}, ",
        "#{integralDiscountPrice,jdbcType=BIGINT}, #{ext1,jdbcType=VARCHAR}, ",
        "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(BsOrderDeduction record);

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

    @SelectProvider(type=BsOrderDeductionSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.BIGINT),
        @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="total_deduction_price", property="totalDeductionPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="user_coupon_discount_id", property="userCouponDiscountId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_discount_id", property="couponDiscountId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_discount_type", property="couponDiscountType", jdbcType=JdbcType.INTEGER),
        @Result(column="coupon_discount_price", property="couponDiscountPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="coupon_discount_actual_price", property="couponDiscountActualPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="integral_discount_price", property="integralDiscountPrice", jdbcType=JdbcType.BIGINT),
        @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<BsOrderDeduction> selectByExample(BsOrderDeductionExample example);

    @Select({
        "select",
        "id, order_id, order_no, total_deduction_price, user_coupon_discount_id, coupon_discount_id, ",
        "coupon_discount_type, coupon_discount_price, coupon_discount_actual_price, integral_discount_price, ",
        "ext_1, ext_2, ext_3",
        "from bs_order_deduction",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.BIGINT),
        @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="total_deduction_price", property="totalDeductionPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="user_coupon_discount_id", property="userCouponDiscountId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_discount_id", property="couponDiscountId", jdbcType=JdbcType.BIGINT),
        @Result(column="coupon_discount_type", property="couponDiscountType", jdbcType=JdbcType.INTEGER),
        @Result(column="coupon_discount_price", property="couponDiscountPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="coupon_discount_actual_price", property="couponDiscountActualPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="integral_discount_price", property="integralDiscountPrice", jdbcType=JdbcType.BIGINT),
        @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)
    })
    BsOrderDeduction selectByPrimaryKey(Long id);

    @UpdateProvider(type=BsOrderDeductionSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") BsOrderDeduction record, @Param("example") BsOrderDeductionExample example);

    @UpdateProvider(type=BsOrderDeductionSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") BsOrderDeduction record, @Param("example") BsOrderDeductionExample example);

    @UpdateProvider(type=BsOrderDeductionSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(BsOrderDeduction record);

    @Update({
        "update bs_order_deduction",
        "set order_id = #{orderId,jdbcType=BIGINT},",
          "order_no = #{orderNo,jdbcType=VARCHAR},",
          "total_deduction_price = #{totalDeductionPrice,jdbcType=DECIMAL},",
          "user_coupon_discount_id = #{userCouponDiscountId,jdbcType=BIGINT},",
          "coupon_discount_id = #{couponDiscountId,jdbcType=BIGINT},",
          "coupon_discount_type = #{couponDiscountType,jdbcType=INTEGER},",
          "coupon_discount_price = #{couponDiscountPrice,jdbcType=DECIMAL},",
          "coupon_discount_actual_price = #{couponDiscountActualPrice,jdbcType=DECIMAL},",
          "integral_discount_price = #{integralDiscountPrice,jdbcType=BIGINT},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(BsOrderDeduction record);
}