hsy
2026-08-28 36fa58c0de255ad56f50a565cbe7a5d93604dd88
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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<InspectionReportMapper, InspectionReport> implements IInspectionReportService {
 
    @Override
    public IPage<InspectionReport> listPage(Page<InspectionReport> page, InspectionReport report) {
        LambdaQueryWrapper<InspectionReport> 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);
    }
}