package com.fjhx.stock.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.entity.stock.StockBack;
import com.fjhx.params.stock.StatisticsResult;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.tenant.annotation.TenantIgnore;

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

/**
 * <p>
 * 退仓面料 Mapper 接口
 * </p>
 *
 * @author ${author}
 * @since 2022-08-31
 */
public interface StockBackMapper extends BaseMapper<StockBack> {

    @TenantIgnore
    List<Map<String, Object>> getPickingToday(@Param("ew") QueryWrapper<Object> wrapper);

    @TenantIgnore
    List<Map<String, Object>> getPickingTodayByUserId(@Param("ew") QueryWrapper<Object> wrapper);

    @TenantIgnore
    List<Map<String, Object>> checkList();

    @InterceptorIgnore(tenantLine = "1")
    @TenantIgnore
    List<Map<String, Object>> userStatistics(@Param("ew") QueryWrapper<Object> wrapper);

    @InterceptorIgnore(tenantLine = "1")
    @TenantIgnore
    Double selectSchedule(@Param("materialCode") String materialCode,
                          @Param("technologyType") String technologyType,
                          @Param("jobNo") String jobNo,
                          @Param("beginTime") Date beginTime,
                          @Param("endTime") Date endTime);

    @InterceptorIgnore(tenantLine = "1")
    @TenantIgnore
    StatisticsResult selectPicking(@Param("technologyType") String technologyType,
                                   @Param("userId") String userId,
                                   @Param("beginTime") Date beginTime,
                                   @Param("endTime") Date endTime);

    @InterceptorIgnore(tenantLine = "1")
    @TenantIgnore
    StatisticsResult selectBack(@Param("materialCode") String materialCode,
                                @Param("technologyType") String technologyType,
                                @Param("userId") String userId,
                                @Param("beginTime") Date beginTime,
                                @Param("endTime") Date endTime);

    @InterceptorIgnore(tenantLine = "1")
    @TenantIgnore
    Double selectCorrect(@Param("materialId") String materialId,
                         @Param("technologyType") String technologyType,
                         @Param("userId") String userId,
                         @Param("beginTime") Date beginTime,
                         @Param("endTime") Date endTime);

    @InterceptorIgnore(tenantLine = "1")
    @TenantIgnore
    Page<StatisticsResult> selectPickingPage(@Param("page") Page<StockBack> page,
                                             @Param("jobNo") String jobNo,
                                             @Param("beginTime") Date beginTime,
                                             @Param("endTime") Date endTime,
                                             @Param("tech") String tech);

    @TenantIgnore
    Map<String, Object> getBackStatistics(@Param("ew") QueryWrapper<Object> wrapper);

    @TenantIgnore
    Page<Map<String, Object>> getBackPage(@Param("page") Page<StockBack> page, @Param("ew") QueryWrapper<Object> backWrapper);


}
