package com.yiqi.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yiqi.core.domain.SettlementManageBill;
import com.yiqi.core.domain.dto.SettlementBillAddDTO;
import com.yiqi.order.domain.dto.*;
import com.yiqi.order.domain.OrderClothItem;
import com.yiqi.order.domain.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * 洗衣订单衣服明细Mapper接口
 *
 * @author ruoyi
 * @date 2023-10-06
 */
@Mapper
public interface OrderClothItemMapper extends BaseMapper<OrderClothItem> {

    /**
     * 获取工厂未完成衣服数量
     * @return
     */
    public OrderClothItemCountStatisticVO getUnFinishedOrderClothCountGroupByStatus(@Param("factoryId") Long factoryId, @Param("storeId") Long storeId);

    public OrderClothItemTimeoutCountStatisticVO getTimeoutOrderClothCountGroupByStatus(@Param("factoryId") Long factoryId, @Param("storeId") Long storeId, @Param("threeTimeoutDay")Date threeTimeoutDay, @Param("fiveTimeoutDay")Date fiveTimeoutDay);

    /**
     * 查询洗衣订单衣服明细
     *
     * @param id 洗衣订单衣服明细主键
     * @return 洗衣订单衣服明细
     */
    public OrderClothItem selectOrderClothItemById(Long id);

    /**
     * 查询洗衣订单衣服明细列表
     *
     * @param orderClothItem 洗衣订单衣服明细
     * @return 洗衣订单衣服明细集合
     */
    public List<OrderClothItem> selectOrderClothItemList(OrderClothItem orderClothItem);

    /**
     * 新增洗衣订单衣服明细
     *
     * @param orderClothItem 洗衣订单衣服明细
     * @return 结果
     */
    public int insertOrderClothItem(OrderClothItem orderClothItem);

    /**
     * 修改洗衣订单衣服明细
     *
     * @param orderClothItem 洗衣订单衣服明细
     * @return 结果
     */
    public int updateOrderClothItem(OrderClothItem orderClothItem);

    /**
     * 删除洗衣订单衣服明细
     *
     * @param id 洗衣订单衣服明细主键
     * @return 结果
     */
    public int deleteOrderClothItemById(Long id);

    /**
     * 批量删除洗衣订单衣服明细
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteOrderClothItemByIds(Long[] ids);

    /**
     * 重洗衣服
     *
     * @param orderClothItemId 洗衣订单衣服id
     * @return 洗衣订单衣服明细集合
     */
    public void reFlowCloth(Long orderClothItemId);

    List<FactoryFinancialClothDayVO> listFinancialStatisticsByFactoryWithToday(@Param("factoryOrderFinancialDayQueryDTO") FactoryOrderFinancialDayQueryDTO factoryOrderFinancialDayQueryDTO,
                                                                               @Param("factoryId") Long factoryId);

    List<FactoryStatisticsListQueryVO> listFinancialStatisticsByFactoryOperate(@Param("factoryStatisticsQueryDTO") FactoryStatisticsQueryDTO factoryStatisticsQueryDTO,
                                                                               @Param("factoryId") Long orgId);

    List<FactoryStatisticsDetailQueryVO> listFinancialStatisticsByFactoryOperateDetail(@Param("factoryStatisticsDetailQueryDTO") FactoryStatisticsDetailQueryDTO factoryStatisticsDetailQueryDTO,
                                                                                       @Param("factoryId") Long orgId);

    int countFinancialStatisticsByFactoryOperateDetail(@Param("factoryStatisticsDetailQueryDTO") FactoryStatisticsDetailQueryDTO factoryStatisticsDetailQueryDTO,
                                                       @Param("factoryId") Long orgId);

    /**
     * 查询订单 clothes item
     *
     * @param orderClothItemQueryDTO
     * @return
     */
    List<OrderClothItemVO> queryClothItem(OrderClothItemQueryDTO orderClothItemQueryDTO);

    /**
     * 修改订单 clothes item
     *
     * @param orderClothItem
     * @return
     */
    int updateAllClothItemStatusByOrderId(@Param("clothOrderId") Long clothOrderId, @Param("flawStatus") String flawStatus);

    /**
     * 检查订单 clothes item
     *
     * @param clothOrderId
     * @param flawStatus
     * @return
     */
    List<OrderClothItem> checkClothItemStatus(@Param("clothOrderId") Long clothOrderId, @Param("flawStatus") String flawStatus);

    /**
     * 查询订单 clothes item 包含附件和衣服
     *
     * @param orderClothItemQueryDTO
     * @return
     */
    List<OrderClothItemVO> findAllFactoryClothPage(OrderClothItemFactoryQueryDTO orderClothItemFactoryQueryDTO);
}
