src/main/java/com/whyc/controller/StatisticController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/dto/Statistic/DeviceStateStic.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/mapper/DeviceStateMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataInf.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/pojo/db_ram_db/DeviceState.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/DeviceStateService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/BatttestdataInfMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/DeviceStateMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/StationInfMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/controller/StatisticController.java
@@ -2,9 +2,11 @@ import com.whyc.dto.Response; import com.whyc.dto.Statistic.BattTinfStic; import com.whyc.dto.Statistic.DeviceStateStic; import com.whyc.dto.Statistic.StationStic; import com.whyc.pojo.db_user.User; import com.whyc.service.BatttestdataInfService; import com.whyc.service.DeviceStateService; import com.whyc.service.StationInfService; import com.whyc.util.ActionUtil; import io.swagger.annotations.Api; @@ -25,6 +27,9 @@ @Autowired private BatttestdataInfService battTinfService; @Autowired private DeviceStateService deviceStateService; @ApiOperation(value = "站点信息统计") @PostMapping("getStationStatistic") public Response getStationStatistic(@RequestBody StationStic stic){ @@ -40,4 +45,12 @@ stic.setUid(uinf.getId()); return battTinfService.getBattTinfStatistic(stic); } @ApiOperation(value = "设备工作状态统计") @PostMapping("getDeviceStateStatistic") public Response getDeviceStateStatistic(@RequestBody DeviceStateStic stic){ User uinf= ActionUtil.getUser(); stic.setUid(uinf.getId()); return deviceStateService.getDeviceStateStatistic(stic); } } src/main/java/com/whyc/dto/Statistic/DeviceStateStic.java
New file @@ -0,0 +1,15 @@ package com.whyc.dto.Statistic; import lombok.Data; @Data public class DeviceStateStic { private String provice; private String city; private String country; private String stationName; private Integer uid; private Integer pageNum; private Integer pageSize; private Integer devWorkstate; } src/main/java/com/whyc/mapper/DeviceStateMapper.java
@@ -1,6 +1,12 @@ package com.whyc.mapper; import com.whyc.dto.Statistic.DeviceStateStic; import com.whyc.pojo.db_ram_db.DeviceState; import org.apache.ibatis.annotations.Param; import java.util.List; public interface DeviceStateMapper extends CustomMapper<DeviceState>{ //设备工作状态统计 List<DeviceState> getDeviceStateStatistic(@Param("stic") DeviceStateStic stic); } src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataInf.java
@@ -110,5 +110,14 @@ @TableField(exist = false) private String battgroupName; @TableField(exist = false) private String provice; @TableField(exist = false) private String city; @TableField(exist = false) private String country; @TableField(exist = false) private String fullName; } src/main/java/com/whyc/pojo/db_ram_db/DeviceState.java
@@ -1,6 +1,7 @@ package com.whyc.pojo.db_ram_db; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -127,5 +128,18 @@ @ApiModelProperty(value = "充放电一体机组2组端电流") private Float groupCurr2; @TableField(exist = false) private String stationName; @TableField(exist = false) private String devName; @TableField(exist = false) private String provice; @TableField(exist = false) private String city; @TableField(exist = false) private String country; @TableField(exist = false) private String fullName; } src/main/java/com/whyc/service/DeviceStateService.java
@@ -1,11 +1,18 @@ package com.whyc.service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.whyc.dto.Response; import com.whyc.dto.Statistic.DeviceStateStic; import com.whyc.mapper.DeviceStateMapper; import com.whyc.pojo.db_batt_testdata.BatttestdataInf; import com.whyc.pojo.db_ram_db.BattRtstate; import com.whyc.pojo.db_ram_db.DeviceState; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class DeviceStateService { @@ -19,4 +26,11 @@ DeviceState dev=mapper.selectOne(wrapper); return dev; } //设备工作状态统计 public Response getDeviceStateStatistic(DeviceStateStic stic) { PageHelper.startPage(stic.getPageNum(),stic.getPageSize()); List<DeviceState> list=mapper.getDeviceStateStatistic(stic); PageInfo pageInfo=new PageInfo(list); return new Response().setII(1,list.size()>0,pageInfo,"设备工作状态统计"); } } src/main/resources/mapper/BatttestdataInfMapper.xml
@@ -3,7 +3,8 @@ <mapper namespace="com.whyc.mapper.BatttestdataInfMapper"> <select id="getBattTinfStatistic" resultType="com.whyc.pojo.db_batt_testdata.BatttestdataInf"> select tb_batttestdata_inf.*,tb_station_inf.station_name,tb_batt_inf.battgroup_name select tb_batttestdata_inf.* ,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name,tb_batt_inf.battgroup_name from db_batt_testdata.tb_batttestdata_inf,db_station.tb_station_inf,db_station.tb_batt_inf <where> tb_batttestdata_inf.battgroup_id=tb_batt_inf.battgroup_id @@ -37,5 +38,6 @@ ) </if> </where> order by tb_batttestdata_inf.battgroup_id asc, tb_batttestdata_inf.test_record_count asc </select> </mapper> src/main/resources/mapper/DeviceStateMapper.xml
New file @@ -0,0 +1,37 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.whyc.mapper.DeviceStateMapper"> <select id="getDeviceStateStatistic" resultType="com.whyc.pojo.db_ram_db.DeviceState"> select tb_device_state.* ,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name,tb_batt_inf.dev_name from db_ram_db.tb_device_state,db_station.tb_station_inf,db_station.tb_batt_inf <where> tb_device_state.dev_id=tb_batt_inf.dev_id and tb_batt_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.devWorkstate!=null"> and tb_device_state.dev_workstate= #{stic.devWorkstate} </if> <if test="stic.uid>100"> and tb_station_inf.station_id in( select distinct station_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_device_state.dev_id asc </where> </select> </mapper> src/main/resources/mapper/StationInfMapper.xml
@@ -204,6 +204,7 @@ and tb_baojigroup_usr.uid=#{stic.uid} ) </if> order by station_id asc </where> </select>