package cn.iocoder.yudao.module.mes.dal.mysql.ticketresults;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketresults.TicketResultsDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mes.controller.admin.ticketresults.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 工单检验结果 Mapper
 *
 * @author 内蒙必硕
 */
@Mapper
public interface TicketResultsMapper extends BaseMapperX<TicketResultsDO> {

    default PageResult<TicketResultsDO> selectPage(TicketResultsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TicketResultsDO>()
                .likeIfPresent(TicketResultsDO::getInspectionItemName, reqVO.getInspectionItemName())
                .eqIfPresent(TicketResultsDO::getInspectionMethod, reqVO.getInspectionMethod())
                .eqIfPresent(TicketResultsDO::getJudgmentCriteria, reqVO.getJudgmentCriteria())
                .eqIfPresent(TicketResultsDO::getInspectionResult, reqVO.getInspectionResult())
                .eqIfPresent(TicketResultsDO::getImages, reqVO.getImages())
                .eqIfPresent(TicketResultsDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(TicketResultsDO::getInspectionTime, reqVO.getInspectionTime())
                .eqIfPresent(TicketResultsDO::getManagementId, reqVO.getManagementId())
                .betweenIfPresent(TicketResultsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TicketResultsDO::getId));
    }

    List<TicketResultsDO> findByDeviceIdAndPlanType(@Param("deviceId") Long deviceId,@Param("planType") Integer planType,
                                                    @Param("startTime") String startTime,@Param("endTime") String endTime,
                                                    @Param("ids") String ids);
}