whyclxw
2025-05-28 e787bc5515949320b1d3c6e521b9fee6b72c1d04
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.whyc.service;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.dto.Station.Provice;
import com.whyc.dto.Statistic.StationStic;
import com.whyc.mapper.StationInfMapper;
import com.whyc.pojo.db_station.PowerInf;
import com.whyc.pojo.db_station.StationInf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service
public class StationInfService {
    @Autowired(required = false)
    private StationInfMapper mapper;
 
 
    //获取左侧列表
    public Response getLeftStation(int uid) {
        List<Provice> list=mapper.getLeftStation(uid);
        return new Response().setII(1,list.size()>0,list,"获取左侧列表");
    }
    //获取所有的省份
    public Response getProviceByUid(int uid) {
        List<String> list=mapper.getProviceByUid(uid);
        return new Response().setII(1,list.size()>0,list,"获取所有的省份");
    }
    //获取省下的市
    public Response getCityByUid(int uid, String provice) {
        List<String> list=mapper.getCityByUid(uid,provice);
        return new Response().setII(1,list.size()>0,list,"获取省下的市");
    }
    //获取省市下的区县
    public Response getCountryByUid(int uid, String provice, String city) {
        List<String> list=mapper.getCountryByUid(uid,provice,city);
        return new Response().setII(1,list.size()>0,list,"获取省市下的区县");
    }
    //获取省市区县下的站点
    public Response getStationByUid(int uid, String provice, String city, String country) {
        List<StationInf> list=mapper.getStationByUid(uid,provice,city,country);
        return new Response().setII(1,list.size()>0,list,"获取省市区县下的站点");
    }
    //获取站点下的电源(下拉)
    public Response getPowerByUid(int uid, String provice, String city, String country, String stationName) {
        List<PowerInf> list=mapper.getPowerByUid(uid,provice,city,country,stationName);
        return new Response().setII(1,list.size()>0,list,"获取站点下的电源(下拉)");
    }
    //获取电压等级(下拉)
    public Response getStationTypeByUid(Integer uid) {
        List<String> list=mapper.getStationTypeByUid(uid);
        return new Response().setII(1,list.size()>0,list,"获取电压等级(下拉)");
    }
    //站点信息统计
    public Response getStationStatistic(StationStic stic) {
        PageHelper.startPage(stic.getPageNum(),stic.getPageSize());
        List<StationInf> list=mapper.getStationStatistic(stic);
        PageInfo<StationInf> pageInfo=new PageInfo<>(list);
        return new Response().setII(1,list.size()>0,pageInfo,"站点信息统计");
    }
    //获取机房信息
    public StationInf getStationInfById(Integer stationId) {
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("station_id",stationId);
        wrapper.last("limit 1");
        StationInf sinf=mapper.selectOne(wrapper);
        return sinf;
    }
}