package com.zm.order.tool.server.dao;

import com.zm.order.tool.server.model.OrderRefundDetails;
import com.zm.order.tool.server.query.OrderRefundDetailsQuery;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 订单退款明细
 *
 * @author Gwl·Q
 */
@Repository
public interface OrderRefundDetailsDao {

    /**
     * 新增一条记录
     *
     * @param record OrderRefundDetails
     * @return 影响行数
     */
    int insert(OrderRefundDetails record);
    int replace(OrderRefundDetails record);

    /**
     * 新增列表
     *
     * @param list
     * @return 影响行数
     */
    int insertList(List<OrderRefundDetails> list);

    /**
     * 删除
     * @param id
     * @return: 影响行数
     */
    int delete(Long id);

    int updatePayType(OrderRefundDetails refund);

    /**
     * 修改
     *
     * @param record OrderRefundDetails
     * @return 影响行数
     */
    int update(OrderRefundDetails record);

    OrderRefundDetails selectById(@Param("id") Long id);

    int updateBiz(@Param("bizType") Integer bizType, @Param("orderNoList") List<String> orderNoList);
    int updateStoreId(@Param("storeId") Long storeId, @Param("userId") Long userId, @Param("orderNo") String orderNo);

    /**
     * 查询列表
     *
     * @param query
     * @return list
     */
    List<OrderRefundDetails> selectList(OrderRefundDetailsQuery query);

    List<OrderRefundDetails> selectByRefundNo(String refundNo);

    List<OrderRefundDetails> selectByRefundNoList(@Param("refundNoList") List<String> refundNoList);
    List<OrderRefundDetails> selectByOrderNoNoList(@Param("orderNoList") List<String> orderNoList);


    int deleteTemp(@Param("orderNo") String orderNo,
                   @Param("userId") Long userId);

    int deleteByOrderNos(@Param("orderNoList") List<String> orderNoList);

    int updateBatchToBaking(List<OrderRefundDetails> list);


    int updateSellerUser(
            @Param("sellerId") Long sellerId,
            @Param("storeId") Long storeId,
            @Param("oldUserId") Long oldUserId,
            @Param("newUserId") Long newUserId,
            @Param("orderNo") String orderNo);
}
