package com.ruoyi.project.quality.report.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.project.quality.report.domain.InspectionReport; import com.ruoyi.project.quality.report.mapper.InspectionReportMapper; import com.ruoyi.project.quality.report.service.IInspectionReportService; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; /** * 检测报告Service业务层处理 */ @Service public class InspectionReportServiceImpl extends ServiceImpl implements IInspectionReportService { @Override public IPage listPage(Page page, InspectionReport report) { LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); if (report != null) { if (StringUtils.isNotBlank(report.getProductName())) { lqw.like(InspectionReport::getProductName, report.getProductName()); } if (StringUtils.isNotBlank(report.getProductModel())) { lqw.like(InspectionReport::getProductModel, report.getProductModel()); } if (StringUtils.isNotBlank(report.getReportNo())) { lqw.like(InspectionReport::getReportNo, report.getReportNo()); } if (StringUtils.isNotBlank(report.getReportType())) { lqw.eq(InspectionReport::getReportType, report.getReportType()); } if (StringUtils.isNotBlank(report.getStatus())) { lqw.eq(InspectionReport::getStatus, report.getStatus()); } else { // 默认查询正常的 lqw.ne(InspectionReport::getStatus, "CANCELLED"); } } else { lqw.ne(InspectionReport::getStatus, "CANCELLED"); } // 按照到期时间正序,越近到期排在越前 lqw.orderByAsc(InspectionReport::getExpirationTime); return baseMapper.selectPage(page, lqw); } }