package com.cool.store.mapper;

import com.cool.store.entity.SplitOrderDO;
import com.cool.store.request.SplitOrderPageRequest;
import com.cool.store.response.SplitOrderResponse;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * 分账主表 Mapper
 */
public interface SplitOrderMapper extends Mapper<SplitOrderDO> {

    /**
     * 根据分账单号查询
     */
    SplitOrderDO getBySplitNo(@Param("splitNo") String splitNo);

    /**
     * 根据状态查询
     */
    List<SplitOrderDO> listByStatus(@Param("status") String status);

    /**
     * 根据关联单据号查询
     */
    List<SplitOrderDO> listByRelatedDocNo(@Param("relatedDocNo") String relatedDocNo,
                                          @Param("statusList") List<Integer> statusList);

    /**
     * 根据门店ID查询
     */
    List<SplitOrderDO> listByStoreId(@Param("storeId") String storeId);

    /**
     * 批量更新状态
     */
    int batchUpdateStatus(@Param("ids") List<Long> ids, @Param("status") String status);

    /**
     * 分页查询
     */
    List<SplitOrderDO> pageQuery(@Param("request") SplitOrderPageRequest request);

    /**
     * 分页查询（关联门店信息）
     */
    List<SplitOrderResponse> pageQueryWithStore(@Param("request") SplitOrderPageRequest request);
}
