src/main/java/com/whyc/controller/StatisticController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/dto/Statistic/StationStic.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/mapper/PowerInfMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/PowerInfService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/PowerInfMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/controller/StatisticController.java
@@ -7,6 +7,7 @@ import com.whyc.pojo.db_user.User; import com.whyc.service.BatttestdataInfService; import com.whyc.service.DeviceStateService; import com.whyc.service.PowerInfService; import com.whyc.service.StationInfService; import com.whyc.util.ActionUtil; import io.swagger.annotations.Api; @@ -28,8 +29,19 @@ private BatttestdataInfService battTinfService; @Autowired private PowerInfService powerInfService; @Autowired private DeviceStateService deviceStateService; @ApiOperation(value = "电源信息统计") @PostMapping("getPowerStatistic") public Response getPowerStatistic(@RequestBody StationStic stic){ User uinf= ActionUtil.getUser(); stic.setUid(uinf.getId()); return powerInfService.getPowerStatistic(stic); } @ApiOperation(value = "站点信息统计") @PostMapping("getStationStatistic") public Response getStationStatistic(@RequestBody StationStic stic){ src/main/java/com/whyc/dto/Statistic/StationStic.java
@@ -12,4 +12,5 @@ private String stationType; private Integer pageNum; private Integer pageSize; private String company; //电源厂家品牌 } src/main/java/com/whyc/mapper/PowerInfMapper.java
@@ -1,6 +1,7 @@ package com.whyc.mapper; import com.whyc.dto.PowerDto; import com.whyc.dto.Statistic.StationStic; import com.whyc.pojo.db_station.PowerInf; import com.whyc.pojo.db_station.StationInf; import org.apache.ibatis.annotations.Param; @@ -21,4 +22,6 @@ List<String> getPowerModelByUid(Integer uid); //获取电源协议(下拉) List<String> getProtocolByUid(Integer uid); //电源信息统计 List<PowerInf> getPowerStatistic(@Param("stic") StationStic stic); } src/main/java/com/whyc/service/PowerInfService.java
@@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo; import com.whyc.dto.PowerDto; import com.whyc.dto.Response; import com.whyc.dto.Statistic.StationStic; import com.whyc.mapper.BaojigroupPowerMapper; import com.whyc.mapper.BaojigroupUsrMapper; import com.whyc.mapper.PowerInfMapper; @@ -140,4 +141,11 @@ PowerInf pinf=mapper.selectOne(wrapper); return pinf; } //电源信息统计 public Response getPowerStatistic(StationStic stic) { PageHelper.startPage(stic.getPageNum(),stic.getPageSize()); List<PowerInf> list=mapper.getPowerStatistic(stic); PageInfo<PowerInf> pageInfo=new PageInfo<>(list); return new Response().setII(1,list.size()>0,pageInfo,"电源信息统计"); } } src/main/resources/mapper/PowerInfMapper.xml
@@ -77,5 +77,38 @@ </if> </where> </select> <select id="getPowerStatistic" resultType="com.whyc.pojo.db_station.PowerInf"> select distinct tb_power_inf.*,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name from db_station.tb_power_inf,db_station.tb_station_inf <where> tb_power_inf.station_id=tb_station_inf.station_id <if test="stic.provice!=null"> and tb_station_inf.provice=#{stic.provice} </if> <if test="stic.city!=null"> and tb_station_inf.city=#{stic.city} </if> <if test="stic.country!=null"> and tb_station_inf.country=#{stic.country} </if> <if test="stic.stationName!=null"> and tb_station_inf.station_name=#{stic.stationName} </if> <if test="stic.stationType!=null"> and tb_station_inf.station_type=#{stic.stationType} </if> <if test="stic.stationType!=null"> and tb_power_inf.company=#{stic.company} </if> <if test="stic.uid>100"> and tb_power_inf.power_id in( select distinct power_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id and tb_baojigroup_usr.uid=#{stic.uid} ) </if> order by tb_power_inf.power_id asc </where> </select> </mapper>