小班计数接口

This commit is contained in:
2025-11-28 12:05:21 +08:00
parent 1ba1152339
commit 984c1c5ef3
5 changed files with 73 additions and 23 deletions

View File

@@ -1,11 +1,6 @@
package com.whu.edu.LyStatistic.MapLyStatistic.Controller; package com.whu.edu.LyStatistic.MapLyStatistic.Controller;
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.DistrictStatsDTO; import com.whu.edu.LyStatistic.MapLyStatistic.Dto.*;
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.StreetStatsDTO;
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotAttrDTO;
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.DatePlotDTO;
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO;
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.DistrictCountDTO;
import com.whu.edu.LyStatistic.MapLyStatistic.Service.StatisticsService; import com.whu.edu.LyStatistic.MapLyStatistic.Service.StatisticsService;
import com.whu.edu.LyStatistic.MapLyStatistic.Service.PlotService; import com.whu.edu.LyStatistic.MapLyStatistic.Service.PlotService;
import com.whu.edu.LyStatistic.MapLyStatistic.Service.DateService; import com.whu.edu.LyStatistic.MapLyStatistic.Service.DateService;
@@ -64,13 +59,30 @@ public class StatisticsController {
/** /**
* 小班属性 * 区级计数
* 入参:内业小班号NYXBH+乡XIANG * 入参:区名称
* 出参:内业数量
* 外业完成
* 样地数量
*/ */
@GetMapping("/district/count") @GetMapping("/district/count")
public ApiResponse<List<DistrictCountDTO>> getDistrictCount(@RequestParam String district) { public ApiResponse<DistrictCountDTO> getDistrictCount(@RequestParam String district) {
try { try {
List<DistrictCountDTO> data = statisticsService.getDistrictCount(district); DistrictCountDTO data = statisticsService.getDistrictCount(district);
return ApiResponse.success(data);
} catch (Exception e) {
return ApiResponse.error("查询区计数失败:" + e.getMessage());
}
}
/**
* 小班计数
* 入参rootiddatabasename
*/
@GetMapping("/plot/count")
public ApiResponse<PlotCountDTO> getPlotCount(@RequestParam String rootId, @RequestParam String databaseName) {
try {
PlotCountDTO data = statisticsService.getPlotCount(rootId,databaseName);
return ApiResponse.success(data); return ApiResponse.success(data);
} catch (Exception e) { } catch (Exception e) {
return ApiResponse.error("查询小班计数失败:" + e.getMessage()); return ApiResponse.error("查询小班计数失败:" + e.getMessage());
@@ -78,8 +90,6 @@ public class StatisticsController {
} }
/** /**
* 区级统计 * 区级统计
*/ */

View File

@@ -0,0 +1,23 @@
package com.whu.edu.LyStatistic.MapLyStatistic.Dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PlotCountDTO {
private Integer yds;
private Integer ysyfs;
private Integer xmyfs;
private Integer wclyfs;
private Integer jjlyfs;
private Integer gmyfs;
private Integer tbyfs;
private Integer cbyfs;
private Integer dbyfs;
private Integer mcxms;
private Integer ssms;
private Integer spss;
}

View File

@@ -2,7 +2,7 @@ package com.whu.edu.LyStatistic.MapLyStatistic.Mapper;
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO; import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO;
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.DistrictCountDTO; import com.whu.edu.LyStatistic.MapLyStatistic.Dto.DistrictCountDTO;
//import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotDetailDTO; import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotCountDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -30,12 +30,16 @@ public interface TaskCommonMapper {
/** /**
* 按照区统计信息(内业外业样地数量) * 按照区统计数量(内业外业样地数量)
* @return 统计结果 DTO * @return 统计结果 DTO
*/ */
List<DistrictCountDTO> loadDistrictCount(String district); DistrictCountDTO loadDistrictCount(String district);
/**
* 按照小班统计信息(内业外业样地数量)
* @return 统计结果 DTO
*/
PlotCountDTO loadPlotCount(String rootId, String databaseName);
/** /**
* 获取所有小班的ID和边界信息 * 获取所有小班的ID和边界信息

View File

@@ -1,7 +1,7 @@
package com.whu.edu.LyStatistic.MapLyStatistic.Service; package com.whu.edu.LyStatistic.MapLyStatistic.Service;
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO; import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO;
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.DistrictCountDTO; import com.whu.edu.LyStatistic.MapLyStatistic.Dto.DistrictCountDTO;
//import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotBoundaryDTO; import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotCountDTO;
//import com.whu.edu.LyStatistic.MapLyStatistic.Dto.UnitInfo; //import com.whu.edu.LyStatistic.MapLyStatistic.Dto.UnitInfo;
//import com.whu.edu.LyStatistic.MapLyStatistic.Mapper.InfoMapper; //import com.whu.edu.LyStatistic.MapLyStatistic.Mapper.InfoMapper;
import com.whu.edu.LyStatistic.MapLyStatistic.Mapper.TaskCommonMapper; import com.whu.edu.LyStatistic.MapLyStatistic.Mapper.TaskCommonMapper;
@@ -54,15 +54,21 @@ public class StatisticsService {
} }
/** /**
* 查询所有区的计数信息 * 查询区的计数信息
*/ */
public List<DistrictCountDTO> getDistrictCount(String district) { public DistrictCountDTO getDistrictCount(String district) {
// 直接从数据库一次性查出“按区聚合后的统计数据” DistrictCountDTO data = taskCommonMapper.loadDistrictCount(district);
List<DistrictCountDTO> list = taskCommonMapper.loadDistrictCount(district);
return list; return data;
} }
/**
* 查询小班的计数信息
*/
public PlotCountDTO getPlotCount(String rootId, String databaseName) {
PlotCountDTO data = taskCommonMapper.loadPlotCount(rootId,databaseName);
return data;
}
/** /**
* 按街道统计(传入区名称) * 按街道统计(传入区名称)

View File

@@ -105,7 +105,7 @@
FROM "${schema}".roottable1 FROM "${schema}".roottable1
</select> </select>
<!-- 按区返回计数 -->
<select id="loadDistrictCount" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.DistrictCountDTO"> <select id="loadDistrictCount" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.DistrictCountDTO">
SELECT SELECT
"NY", "NY",
@@ -114,4 +114,11 @@
FROM xian_stats FROM xian_stats
WHERE "NAME" = #{district} WHERE "NAME" = #{district}
</select> </select>
<!-- 按小班返回计数 -->
<select id="loadPlotCount" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotCountDTO">
SELECT *
FROM root_summary
WHERE root_id = #{rootId} AND database_name = #{databaseName}
</select>
</mapper> </mapper>