From 54d0ec10021475d56a1581a30a77949734a22180 Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期五, 30 五月 2025 09:57:47 +0800 Subject: [PATCH] 电源信息统计 --- src/main/java/com/whyc/dto/Statistic/StationStic.java | 1 + src/main/resources/mapper/PowerInfMapper.xml | 33 +++++++++++++++++++++++++++++++++ src/main/java/com/whyc/controller/StatisticController.java | 12 ++++++++++++ src/main/java/com/whyc/mapper/PowerInfMapper.java | 3 +++ src/main/java/com/whyc/service/PowerInfService.java | 8 ++++++++ 5 files changed, 57 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/whyc/controller/StatisticController.java b/src/main/java/com/whyc/controller/StatisticController.java index 0b5bc82..0c34b6e 100644 --- a/src/main/java/com/whyc/controller/StatisticController.java +++ b/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){ diff --git a/src/main/java/com/whyc/dto/Statistic/StationStic.java b/src/main/java/com/whyc/dto/Statistic/StationStic.java index 788374f..4b8c660 100644 --- a/src/main/java/com/whyc/dto/Statistic/StationStic.java +++ b/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; //鐢垫簮鍘傚鍝佺墝 } \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/PowerInfMapper.java b/src/main/java/com/whyc/mapper/PowerInfMapper.java index 16111b5..c478962 100644 --- a/src/main/java/com/whyc/mapper/PowerInfMapper.java +++ b/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); } \ No newline at end of file diff --git a/src/main/java/com/whyc/service/PowerInfService.java b/src/main/java/com/whyc/service/PowerInfService.java index 05cbad6..90e1e71 100644 --- a/src/main/java/com/whyc/service/PowerInfService.java +++ b/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,"鐢垫簮淇℃伅缁熻"); + } } \ No newline at end of file diff --git a/src/main/resources/mapper/PowerInfMapper.xml b/src/main/resources/mapper/PowerInfMapper.xml index c72433e..b811797 100644 --- a/src/main/resources/mapper/PowerInfMapper.xml +++ b/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> \ No newline at end of file -- Gitblit v1.9.1