whyclxw
5 天以前 58dac809d5d3a78ca9578edbf2e9ff80ff4b6e57
src/main/java/com/whyc/service/StationInfService.java
@@ -1,16 +1,15 @@
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.PowerInf;
import com.whyc.pojo.db_station.StationInf;
import com.whyc.pojo.db_station.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -21,7 +20,8 @@
    @Autowired(required = false)
    private StationInfMapper mapper;
    @Autowired(required = false)
    private InfoChangeService changeService;
    //获取左侧列表
    public Response getLeftStation(int uid) {
        List<Provice> list=mapper.getLeftStation(uid);
@@ -58,7 +58,7 @@
        return new Response().setII(1,list.size()>0,list,"获取电压等级(下拉)");
    }
    public List<StationInf> getAllWithFields(String... fields) {
    /*public List<StationInf> getAllWithFields(Integer userId, String... fields) {
        QueryWrapper<StationInf> query = Wrappers.query();
        StringBuilder fieldsStr = new StringBuilder();
        //对fields进行拼接,拼接为select
@@ -73,7 +73,7 @@
        return mapper.selectList(query);
    }
    }*/
    //站点信息统计
    public Response getStationStatistic(StationStic stic) {
        PageHelper.startPage(stic.getPageNum(),stic.getPageSize());
@@ -87,6 +87,13 @@
        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);
    }
}