package com.foreverwin.mesnac.meapi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.foreverwin.mesnac.meapi.dto.NcCodeDto;
import com.foreverwin.mesnac.meapi.model.NcCode;
import com.foreverwin.mesnac.meapi.model.NcGroup;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author robert
 * @since 2021-06-23
 */
@Repository
public interface NcCodeMapper extends BaseMapper<NcCode> {
    /**
     * 查询设备的不合格代码
     * @param site
     * @param locale
     * @param messageType 无用
     * @param code 无用
     * @return
     */
    List<NcCode> findNcByCategory(@Param("site")String site,
                            @Param("locale")String locale,
                            @Param("messageType")String messageType,
                            @Param("code")String code);

    /*暂时不用*/
    List<NcCode> findSecondaryNcByNc(@Param("site")String site,@Param("locale")String locale,@Param("ncCode")String ncCode);

    List<NcCode> selectPageByNcGroup(@Param("ncGroupBO") String ncGroupBO,@Param("locale") String locale);

    /**
     * 判断不良代码是否正确
     * @return
     */
    Integer checkNcCode(@Param("NcCodeList")List<String> ncCodes,@Param("site")String site);

    List<NcCode> findNcCodeByNcGroup(@Param("ncGroup")NcGroup ncGroup);


    List<NcCodeDto> findNcCodeDescriptionByNcCode(@Param("site")String site, @Param("locale")String locale, @Param("ncCode")String[] ncCode);

    List<NcCodeDto> findNcCodeByNcGroupList(@Param("site")String site, @Param("locale")String locale, @Param("ncGroup")String[] ncGroup);

    /*根据不良代码，查询描述，以逗号为分隔符*/
    String findNcCodeDescriptionByNcCodeList(@Param("site")String site, @Param("ncCode")String[] ncCode);

}