package com.foreverwin.mesnac.anomaly.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDto;
import com.foreverwin.mesnac.anomaly.model.AbnormalBill;
import com.foreverwin.mesnac.common.dto.ScrapDto;
import com.foreverwin.mesnac.meapi.model.UserGroup;
import com.foreverwin.mesnac.production.model.SplitSfc;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

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

/**
 * <p>
 * 异常单 Mapper 接口
 * </p>
 *
 * @author zjw
 * @since 2021-08-16
 */
@Repository
public interface AbnormalBillMapper extends BaseMapper<AbnormalBill> {


    List<AbnormalBillDto> backLog(@Param("abnormalBill")AbnormalBillDto abnormalBillDto, @Param("language")String language,
                                  @Param("userGroupList")List<UserGroup> userGroupList);

    /**
     * 设备异常响应检索用
     * @param abnormalBill
     * @param language
     * @return
     */
    AbnormalBillDto findAllByAbnormalNoDevice(@Param("abnormalBill")AbnormalBill abnormalBill, @Param("language")String language);

    List<AbnormalBill> findCountBySfc(@Param("site")String site, @Param("type")String type, @Param("sfc")String sfc, @Param("status")List<String> status);

    Map<String,String> findAbnormalMethodBySFC(@Param("site")String site, @Param("abnormalBo")String abnormalBo, @Param("sfc")String sfc);

    List<ScrapDto> findScrapDtoBySfc(@Param("site")String site, @Param("mainSfc")String mainSfc,@Param("splitSfc")List<SplitSfc> splitSfc);

    List<AbnormalBill> getQCAbnormalList(@Param("site") String site);

    IPage getAbnormalByConditional(IPage page, @Param("paramMap")Map<String,String> paramMap,@Param("keyword")String keyword);

    IPage getAbnormalSFCPage(IPage page, @Param("paramMap")Map<String,String> paramMap,@Param("keyword")String keyword);
    Map<String,String> findReplaceMessageByAbnormal(@Param("abnormalBill")AbnormalBill abnormalBill);
}