| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.InfoDto; |
| | | 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.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Autowired(required = false) |
| | | private StationInfMapper mapper; |
| | | |
| | | |
| | | @Autowired(required = false) |
| | | private InfoChangeService changeService; |
| | | //获取左侧列表 |
| | | public Response getLeftStation(int uid) { |
| | | List<Provice> list=mapper.getLeftStation(uid); |
| | |
| | | } |
| | | //获取省市区县下的站点 |
| | | public Response getStationByUid(int uid, String provice, String city, String country) { |
| | | List<String> list=mapper.getStationByUid(uid,provice,city,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<String> list=mapper.getPowerByUid(uid,provice,city,country,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 List<StationInf> getAllWithFields(Integer userId, String... fields) { |
| | | QueryWrapper<StationInf> query = Wrappers.query(); |
| | | StringBuilder fieldsStr = new StringBuilder(); |
| | | //对fields进行拼接,拼接为select |
| | | for(int i=0;i<fields.length;i++) { |
| | | if(i==fields.length-1) { |
| | | fieldsStr.append(fields[i]); |
| | | }else { |
| | | fieldsStr.append(fields[i]).append(","); |
| | | } |
| | | } |
| | | query.select(fieldsStr.toString()); |
| | | |
| | | return mapper.selectList(query); |
| | | |
| | | }*/ |
| | | //站点信息统计 |
| | | 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); |
| | | //获取机房,电源,电池组变更记录 |
| | | List<StationInfChange> sinfChangeList=changeService.getSinfChange(sinf.getStationId()); |
| | | sinf.setSinfChangeList(sinfChangeList); |
| | | return sinf; |
| | | } |
| | | |
| | | public List<StationInf> getListByUserId(Integer userId) { |
| | | return mapper.getListByUserId(userId); |
| | | } |
| | | } |