package com.ruoyi.jarvis.mapper;

import com.ruoyi.jarvis.domain.ErpGoofishOrder;
import com.ruoyi.jarvis.dto.GoofishRrsLogisticsStatsVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ErpGoofishOrderMapper {

    ErpGoofishOrder selectById(Long id);

    ErpGoofishOrder selectByAppKeyAndOrderNo(@Param("appKey") String appKey, @Param("orderNo") String orderNo);

    List<ErpGoofishOrder> selectList(ErpGoofishOrder query);

    int insert(ErpGoofishOrder row);

    int update(ErpGoofishOrder row);

    List<ErpGoofishOrder> selectPendingShip(@Param("statuses") List<Integer> statuses, @Param("limit") int limit);

    /**
     * 按闲鱼买家订单号（与 jd_order.third_party_order_no 对齐时）检索，用于京东运单就绪后补绑发货。
     */
    List<ErpGoofishOrder> selectByGoofishOrderNo(@Param("orderNo") String orderNo);

    int resetShipForRetry(@Param("id") Long id);

    /**
     * 已关联 jd_order_id、承运为日日顺（rrs 或名称含日日顺）；排除已退款/已关闭。
     */
    GoofishRrsLogisticsStatsVo selectRrsJdLinkedLogisticsStats();
}
