package com.hfkj.dao;

import com.hfkj.entity.BsTradeOrderRefund;
import com.hfkj.entity.BsTradeOrderRefundExample;
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 BsTradeOrderRefundMapper extends BsTradeOrderRefundMapperExt {
    @SelectProvider(type=BsTradeOrderRefundSqlProvider.class, method="countByExample")
    long countByExample(BsTradeOrderRefundExample example);

    @DeleteProvider(type=BsTradeOrderRefundSqlProvider.class, method="deleteByExample")
    int deleteByExample(BsTradeOrderRefundExample example);

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

    @Insert({
        "insert into bs_trade_order_refund (trade_order_id, out_trade_no, ",
        "agent_id, salesman_id, ",
        "mer_id, store_id, platform_type, ",
        "platform_order_no, platform_log_no, ",
        "refund_no, acc_trade_no, ",
        "total_amount, refund_amount, ",
        "payer_amount, shd_fee_amt, ",
        "settle_amount, settle_date, ",
        "refund_reason, `status`, ",
        "refund_time, create_time, ",
        "update_time, operator_id, ",
        "operator_name, ext_1, ",
        "ext_2, ext_3)",
        "values (#{tradeOrderId,jdbcType=BIGINT}, #{outTradeNo,jdbcType=VARCHAR}, ",
        "#{agentId,jdbcType=BIGINT}, #{salesmanId,jdbcType=BIGINT}, ",
        "#{merId,jdbcType=BIGINT}, #{storeId,jdbcType=BIGINT}, #{platformType,jdbcType=INTEGER}, ",
        "#{platformOrderNo,jdbcType=VARCHAR}, #{platformLogNo,jdbcType=VARCHAR}, ",
        "#{refundNo,jdbcType=VARCHAR}, #{accTradeNo,jdbcType=VARCHAR}, ",
        "#{totalAmount,jdbcType=DECIMAL}, #{refundAmount,jdbcType=DECIMAL}, ",
        "#{payerAmount,jdbcType=DECIMAL}, #{shdFeeAmt,jdbcType=DECIMAL}, ",
        "#{settleAmount,jdbcType=DECIMAL}, #{settleDate,jdbcType=DATE}, ",
        "#{refundReason,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
        "#{refundTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{updateTime,jdbcType=TIMESTAMP}, #{operatorId,jdbcType=BIGINT}, ",
        "#{operatorName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
        "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(BsTradeOrderRefund record);

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

    @SelectProvider(type=BsTradeOrderRefundSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="trade_order_id", property="tradeOrderId", jdbcType=JdbcType.BIGINT),
        @Result(column="out_trade_no", property="outTradeNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
        @Result(column="salesman_id", property="salesmanId", jdbcType=JdbcType.BIGINT),
        @Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
        @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
        @Result(column="platform_type", property="platformType", jdbcType=JdbcType.INTEGER),
        @Result(column="platform_order_no", property="platformOrderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="platform_log_no", property="platformLogNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="refund_no", property="refundNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="acc_trade_no", property="accTradeNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="total_amount", property="totalAmount", jdbcType=JdbcType.DECIMAL),
        @Result(column="refund_amount", property="refundAmount", jdbcType=JdbcType.DECIMAL),
        @Result(column="payer_amount", property="payerAmount", jdbcType=JdbcType.DECIMAL),
        @Result(column="shd_fee_amt", property="shdFeeAmt", jdbcType=JdbcType.DECIMAL),
        @Result(column="settle_amount", property="settleAmount", jdbcType=JdbcType.DECIMAL),
        @Result(column="settle_date", property="settleDate", jdbcType=JdbcType.DATE),
        @Result(column="refund_reason", property="refundReason", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT),
        @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR),
        @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<BsTradeOrderRefund> selectByExample(BsTradeOrderRefundExample example);

    @Select({
        "select",
        "id, trade_order_id, out_trade_no, agent_id, salesman_id, mer_id, store_id, platform_type, ",
        "platform_order_no, platform_log_no, refund_no, acc_trade_no, total_amount, refund_amount, ",
        "payer_amount, shd_fee_amt, settle_amount, settle_date, refund_reason, `status`, ",
        "refund_time, create_time, update_time, operator_id, operator_name, ext_1, ext_2, ",
        "ext_3",
        "from bs_trade_order_refund",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="trade_order_id", property="tradeOrderId", jdbcType=JdbcType.BIGINT),
        @Result(column="out_trade_no", property="outTradeNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
        @Result(column="salesman_id", property="salesmanId", jdbcType=JdbcType.BIGINT),
        @Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
        @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
        @Result(column="platform_type", property="platformType", jdbcType=JdbcType.INTEGER),
        @Result(column="platform_order_no", property="platformOrderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="platform_log_no", property="platformLogNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="refund_no", property="refundNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="acc_trade_no", property="accTradeNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="total_amount", property="totalAmount", jdbcType=JdbcType.DECIMAL),
        @Result(column="refund_amount", property="refundAmount", jdbcType=JdbcType.DECIMAL),
        @Result(column="payer_amount", property="payerAmount", jdbcType=JdbcType.DECIMAL),
        @Result(column="shd_fee_amt", property="shdFeeAmt", jdbcType=JdbcType.DECIMAL),
        @Result(column="settle_amount", property="settleAmount", jdbcType=JdbcType.DECIMAL),
        @Result(column="settle_date", property="settleDate", jdbcType=JdbcType.DATE),
        @Result(column="refund_reason", property="refundReason", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT),
        @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR),
        @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)
    })
    BsTradeOrderRefund selectByPrimaryKey(Long id);

    @UpdateProvider(type=BsTradeOrderRefundSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") BsTradeOrderRefund record, @Param("example") BsTradeOrderRefundExample example);

    @UpdateProvider(type=BsTradeOrderRefundSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") BsTradeOrderRefund record, @Param("example") BsTradeOrderRefundExample example);

    @UpdateProvider(type=BsTradeOrderRefundSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(BsTradeOrderRefund record);

    @Update({
        "update bs_trade_order_refund",
        "set trade_order_id = #{tradeOrderId,jdbcType=BIGINT},",
          "out_trade_no = #{outTradeNo,jdbcType=VARCHAR},",
          "agent_id = #{agentId,jdbcType=BIGINT},",
          "salesman_id = #{salesmanId,jdbcType=BIGINT},",
          "mer_id = #{merId,jdbcType=BIGINT},",
          "store_id = #{storeId,jdbcType=BIGINT},",
          "platform_type = #{platformType,jdbcType=INTEGER},",
          "platform_order_no = #{platformOrderNo,jdbcType=VARCHAR},",
          "platform_log_no = #{platformLogNo,jdbcType=VARCHAR},",
          "refund_no = #{refundNo,jdbcType=VARCHAR},",
          "acc_trade_no = #{accTradeNo,jdbcType=VARCHAR},",
          "total_amount = #{totalAmount,jdbcType=DECIMAL},",
          "refund_amount = #{refundAmount,jdbcType=DECIMAL},",
          "payer_amount = #{payerAmount,jdbcType=DECIMAL},",
          "shd_fee_amt = #{shdFeeAmt,jdbcType=DECIMAL},",
          "settle_amount = #{settleAmount,jdbcType=DECIMAL},",
          "settle_date = #{settleDate,jdbcType=DATE},",
          "refund_reason = #{refundReason,jdbcType=VARCHAR},",
          "`status` = #{status,jdbcType=INTEGER},",
          "refund_time = #{refundTime,jdbcType=TIMESTAMP},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "operator_id = #{operatorId,jdbcType=BIGINT},",
          "operator_name = #{operatorName,jdbcType=VARCHAR},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(BsTradeOrderRefund record);
}