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


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

import java.util.List;

/**
 * @Author Gwl·Q
 * @ClassName OrderPayDetailsDao
 * @Date 2020/12/1 11:36 AM
 */
@Repository
public interface OrderPayDetailsDao {

    /**
     * 删除
     * @param id
     * @param userId
     * @return:
     * @Date: 2020/12/1 11:49 AM
     */
    int delete(@Param("id") Long id, @Param("userId") Long userId);



    /**
     * 删除
     * @param orderNo
     * @param userId
     * @return:
     * @Date: 2020/12/1 11:49 AM
     */
    int deleteByOrderNo(@Param("orderNo") String orderNo, @Param("userId") Long userId);
    int deleteByOrderNos(@Param("orderNoList") List<String> orderNoList, @Param("userIdList") List<Long> userIdList);


    int updateBizTypeByList(@Param("bizType") Integer bizType,
                            @Param("orderNoList") List<String> orderNoList,
                            @Param("userIdList") List<Long> userIdList);

    /**
     * 新增
     * @param record
     * @return:
     * @Date: 2020/12/1 11:49 AM
     */
    int insert(OrderPayDetails record);
    int replace(OrderPayDetails record);

    /**
     * 批量新增
     * @param list
     * @return:
     * @Date: 2020/12/1 11:49 AM
     */
    void insertList(List<OrderPayDetails> list);

    void inserts(List<OrderPayDetails> list);

    /**
     * 查询
     * @param orderNo
     * @param userId
     * @return:
     * @Date: 2020/12/1 11:49 AM
     */
    List<OrderPayDetails> selectByOrderNo(@Param("orderNo") String orderNo,
                                          @Param("userId") Long userId);

    OrderPayDetails selectById(@Param("orderNo") String orderNo,
                                          @Param("userId") Long userId,
                               @Param("id") Long id);

    OrderPayDetails selectOne(@Param("id") Long id, @Param("userId") Long userId);

    /**
     * 查询列表
     * @param query
     * @return:
     * @Date: 2020/12/1 11:51 AM
     */
    List<OrderPayDetails> selectList(OrderPayDetailsQuery query);
    /**
     * 修改bizType
     *
     * @param bizType
     * @param userId
     * @param orderNo
     * @return
     */
    int updateBizType(@Param("bizType") Integer bizType, @Param("userId") Long userId, @Param("orderNo") String orderNo);

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

    int updatePayType(@Param("payType") Integer payType, @Param("userId") Long userId, @Param("id") Long id);

    /**
     * 修改
     * @param record
     * @return:
     * @Date: 2020/12/1 11:49 AM
     */
    int update(OrderPayDetails record);
    int updateExtra(OrderPayDetails record);
    int updateAmount(OrderPayDetails record);

    int updateUpdatedAt(@Param("id") Long id, @Param("userId") Long userId);

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

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

}
