whycxzp
2025-06-12 d0b438dc5925fc153842f6c83b74c118bd5ad473
src/main/java/com/whyc/service/AlarmInspectionResultService.java
@@ -1,11 +1,16 @@
package com.whyc.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.mapper.AlarmInspectionResultMapper;
import com.whyc.pojo.web_site.AlarmInspectionResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class AlarmInspectionResultService {
@@ -16,4 +21,15 @@
    public void add(AlarmInspectionResult result) {
        mapper.insert(result);
    }
    public Response<PageInfo<AlarmInspectionResult>> getPage(Integer pageNum, Integer pageSize, Integer stationId, Integer inspectionType) {
        PageHelper.startPage(pageNum, pageSize);
        QueryWrapper<AlarmInspectionResult> query = Wrappers.query();
        query.eq(stationId  != null,"station_id", stationId);
        query.eq(inspectionType  != null,"inspection_type", inspectionType);
        query.orderByDesc("id");
        List<AlarmInspectionResult> list = mapper.selectList(query);
        PageInfo<AlarmInspectionResult> pageInfo = new PageInfo<>(list);
        return new Response<PageInfo<AlarmInspectionResult>>().set(1, pageInfo);
    }
}