Commit 70b6ff1f authored by 耿迪迪's avatar 耿迪迪

基础信息统计

parent 348ddbea
......@@ -6,6 +6,7 @@ import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.BaseInfoStatistics;
import com.zehong.system.domain.TGasStorageStationInfo;
import com.zehong.system.service.ITGasStorageStationInfoService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -125,4 +126,23 @@ public class TGasStorageStationInfoController extends BaseController
ExcelUtil<TGasStorageStationInfo> util = new ExcelUtil<>(TGasStorageStationInfo.class);
return util.importTemplateExcel("储配站数据");
}
/**
* 基础信息统计
* @param stationId 储配站id
* @return
*/
@GetMapping("/baseInfoStatistics")
public TableDataInfo baseInfoStatistics(@RequestParam(value = "stationId",required = false) Long stationId){
startPage();
return getDataTable(tGasStorageStationInfoService.baseInfoStatistics(stationId));
}
@GetMapping("/baseInfoStatisticsExport")
public AjaxResult baseInfoStatisticsExport(@RequestParam(value = "stationId",required = false) Long stationId)
{
List<BaseInfoStatistics> statistics = tGasStorageStationInfoService.baseInfoStatistics(stationId);
ExcelUtil<BaseInfoStatistics> util = new ExcelUtil<>(BaseInfoStatistics.class);
return util.exportExcel(statistics, "基础信息数据");
}
}
package com.zehong.system.domain;
import com.zehong.common.annotation.Excel;
public class BaseInfoStatistics {
/**储配站*/
@Excel(name = "储配站")
private String stationName;
/**气瓶数量*/
@Excel(name = "气瓶数量")
private int totalBottle;
/**车辆数量*/
@Excel(name = "车辆数量")
private int totalVehicle;
/**从业人员数量*/
@Excel(name = "从业人员数量")
private int totalPractitioner;
public String getStationName() {
return stationName;
}
public void setStationName(String stationName) {
this.stationName = stationName;
}
public int getTotalBottle() {
return totalBottle;
}
public void setTotalBottle(int totalBottle) {
this.totalBottle = totalBottle;
}
public int getTotalVehicle() {
return totalVehicle;
}
public void setTotalVehicle(int totalVehicle) {
this.totalVehicle = totalVehicle;
}
public int getTotalPractitioner() {
return totalPractitioner;
}
public void setTotalPractitioner(int totalPractitioner) {
this.totalPractitioner = totalPractitioner;
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.BaseInfoStatistics;
import com.zehong.system.domain.TGasStorageStationInfo;
/**
......@@ -58,4 +60,11 @@ public interface TGasStorageStationInfoMapper
* @return 结果
*/
public int deleteTGasStorageStationInfoByIds(Long[] stationIds);
/**
* 基础信息统计
* @param stationId 储配站id
* @return
*/
List<BaseInfoStatistics> baseInfoStatistics(Long stationId);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.BaseInfoStatistics;
import com.zehong.system.domain.TGasStorageStationInfo;
/**
......@@ -67,4 +69,11 @@ public interface ITGasStorageStationInfoService
* @return 结果
*/
String importTGasStorageStationInfo(List<TGasStorageStationInfo> tGasStorageStationInfoList, Boolean isUpdateSupport);
/**
* 基础信息统计
* @param stationId 储配站id
* @return
*/
List<BaseInfoStatistics> baseInfoStatistics(Long stationId);
}
......@@ -3,6 +3,7 @@ package com.zehong.system.service.impl;
import com.zehong.common.exception.CustomException;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.BaseInfoStatistics;
import com.zehong.system.domain.TGasStorageStationInfo;
import com.zehong.system.mapper.TGasStorageStationInfoMapper;
import com.zehong.system.service.ITGasStorageStationInfoService;
......@@ -159,4 +160,14 @@ public class TGasStorageStationInfoServiceImpl implements ITGasStorageStationInf
}
return successMsg.toString();
}
/**
* 基础信息统计
* @param stationId 储配站id
* @return
*/
@Override
public List<BaseInfoStatistics> baseInfoStatistics(Long stationId){
return tGasStorageStationInfoMapper.baseInfoStatistics(stationId);
}
}
......@@ -118,4 +118,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{stationId}
</foreach>
</delete>
<select id="baseInfoStatistics" parameterType="java.lang.String" resultType="com.zehong.system.domain.BaseInfoStatistics">
SELECT
station.station_name as stationName,
(SELECT COUNT(1) FROM t_gas_bottle_info bottle WHERE bottle.station_id = station.station_id)as totalBottle,
(SELECT COUNT(1) FROM t_vehicle_info vehicle WHERE vehicle.station_id = station.station_id) AS totalVehicle,
(SELECT COUNT(1) FROM t_practitioner_info pr WHERE pr.station_id = station.station_id) AS totalPractitioner
FROM
t_gas_storage_station_info station
<where>
<if test="stationId != null" >
station.station_id = #{stationId}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment