package cn.iocoder.yudao.module.common.dal.mysql.moldticketresults;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.common.controller.admin.moldticketresults.vo.MoldTicketResultsPageReqVO;
import cn.iocoder.yudao.module.common.dal.dataobject.moldticketresults.MoldTicketResultsDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

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

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

    List<MoldTicketResultsDO> findByMoldIdAndPlanType(@Param("moldId") Long moldId, @Param("planType") Integer planType,
                                                    @Param("startTime") String startTime, @Param("endTime") String endTime,
                                                    @Param("ids") String ids);
}