| | |
| | | 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 { |
| | |
| | | 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); |
| | | } |
| | | } |