package com.whyc.service;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageInfo;
|
import com.whyc.dto.A059StationInfDTO;
|
import com.whyc.dto.Response;
|
import com.whyc.mapper.A059StationInfMapper;
|
import com.whyc.mapper.BattInfMapper;
|
import com.whyc.pojo.A059StationInf;
|
import com.whyc.pojo.Battinf;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
@Service
|
public class A059StationInfService {
|
@Resource
|
private A059StationInfMapper mapper;
|
@Resource
|
private BattInfMapper battInfMapper;
|
|
|
public Response getA059StationInfListAndBattInf(int pageNum, int pageSize, String province, String city, String county, int stationType) {
|
PageHelper.startPage(pageNum, pageSize);
|
List<A059StationInfDTO> list = new ArrayList<>();
|
QueryWrapper<A059StationInf> queryWrapper = new QueryWrapper<>();
|
if (province!=null) {
|
queryWrapper.eq("station_province", province);
|
}
|
if (city!=null) {
|
queryWrapper.eq("station_city", city);
|
}
|
if (county!=null) {
|
queryWrapper.eq("station_county", county);
|
}
|
if (stationType != -1) {
|
queryWrapper.eq("station_type", stationType);
|
}
|
queryWrapper.orderByDesc("last_update_time");
|
List<A059StationInf> stationInfs = mapper.selectList(queryWrapper);
|
QueryWrapper<Battinf> battinfQueryWrapper = new QueryWrapper<>();
|
for (A059StationInf stationInf : stationInfs) {
|
A059StationInfDTO dto = new A059StationInfDTO();
|
dto.setStationInf(stationInf);
|
//battinfQueryWrapper.eq("StationName1",stationInf.getStationProvince())
|
//.eq("StationName2",stationInf.getStationCity())
|
//.eq("StationName5",stationInf.getStationCounty())
|
//.eq("StationName3",stationInf.getStationNameEx());
|
//
|
//List<Battinf> battinf = battInfMapper.selectList(battinfQueryWrapper);
|
List<Battinf> battinf = battInfMapper.getA059StationOfBattinf(stationInf.getStationProvince(), stationInf.getStationCity(), stationInf.getStationCounty(), stationInf.getStationNameEx());
|
dto.setBattinf(battinf);
|
list.add(dto);
|
}
|
PageInfo<A059StationInfDTO> pageInfo = new PageInfo<>(list);
|
return new Response<>().set(1,pageInfo,"查询成功");
|
}
|
|
|
}
|