package com.cool.store.mapper;

import com.cool.store.entity.AdjustmentOrderDO;
import com.cool.store.request.AdjustmentOrderPageRequest;
import com.cool.store.response.AdjustmentOrderResponse;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * 费用调整单 Mapper
 */
public interface AdjustmentOrderMapper extends Mapper<AdjustmentOrderDO> {

    /**
     * 根据调整单号查询
     */
    AdjustmentOrderDO getByAdjustmentNo(@Param("adjustmentNo") String adjustmentNo);

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

    /**
     * 根据关联分账单号查询
     */
    List<AdjustmentOrderDO> listByRelatedSplitNo(@Param("relatedSplitNo") String relatedSplitNo);

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

    /**
     * 批量更新状态
     */

    int batchUpdateStatus(@Param("ids") List<Long> ids, @Param("status") Integer status);

    /**
     * 根据ID更新关联分账单号
     */
    int updateRelatedSplitNo(@Param("id") Long id, @Param("relatedSplitNo") String relatedSplitNo);

    /**
     * 分页查询
     */
    List<AdjustmentOrderResponse> pageQuery(@Param("request") AdjustmentOrderPageRequest request);
}
