lxw
2023-02-14 7c75759d56d996bebf3ae89ee522bc09a42bdaf3
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
53
54
55
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<>();
        queryWrapper.eq("station_province", province);
        queryWrapper.eq("station_city", city);
        queryWrapper.eq("station_county", county);
        queryWrapper.eq("station_type", stationType);
        queryWrapper.orderByDesc("last_update_time");
        List<A059StationInf> stationInfs = mapper.selectList(null);
        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,"查询成功");
    }
 
 
}