diff --git a/src/main/java/com/whu/edu/LyStatistic/MapLyStatistic/Controller/StatisticsController.java b/src/main/java/com/whu/edu/LyStatistic/MapLyStatistic/Controller/StatisticsController.java index da289ec..07c2437 100644 --- a/src/main/java/com/whu/edu/LyStatistic/MapLyStatistic/Controller/StatisticsController.java +++ b/src/main/java/com/whu/edu/LyStatistic/MapLyStatistic/Controller/StatisticsController.java @@ -1,11 +1,6 @@ package com.whu.edu.LyStatistic.MapLyStatistic.Controller; -import com.whu.edu.LyStatistic.MapLyStatistic.Dto.DistrictStatsDTO; -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.Dto.*; import com.whu.edu.LyStatistic.MapLyStatistic.Service.StatisticsService; import com.whu.edu.LyStatistic.MapLyStatistic.Service.PlotService; import com.whu.edu.LyStatistic.MapLyStatistic.Service.DateService; @@ -64,13 +59,30 @@ public class StatisticsController { /** - * 小班属性 - * 入参:内业小班号NYXBH+乡XIANG + * 区级计数 + * 入参:区名称 + * 出参:内业数量 + * 外业完成 + * 样地数量 */ @GetMapping("/district/count") - public ApiResponse> getDistrictCount(@RequestParam String district) { + public ApiResponse getDistrictCount(@RequestParam String district) { try { - List data = statisticsService.getDistrictCount(district); + DistrictCountDTO data = statisticsService.getDistrictCount(district); + return ApiResponse.success(data); + } catch (Exception e) { + return ApiResponse.error("查询区计数失败:" + e.getMessage()); + } + } + + /** + * 小班计数 + * 入参:rootid,databasename + */ + @GetMapping("/plot/count") + public ApiResponse getPlotCount(@RequestParam String rootId, @RequestParam String databaseName) { + try { + PlotCountDTO data = statisticsService.getPlotCount(rootId,databaseName); return ApiResponse.success(data); } catch (Exception e) { return ApiResponse.error("查询小班计数失败:" + e.getMessage()); @@ -78,8 +90,6 @@ public class StatisticsController { } - - /** * 区级统计 */ diff --git a/src/main/java/com/whu/edu/LyStatistic/MapLyStatistic/Dto/PlotCountDTO.java b/src/main/java/com/whu/edu/LyStatistic/MapLyStatistic/Dto/PlotCountDTO.java new file mode 100644 index 0000000..9d05cce --- /dev/null +++ b/src/main/java/com/whu/edu/LyStatistic/MapLyStatistic/Dto/PlotCountDTO.java @@ -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; +} diff --git a/src/main/java/com/whu/edu/LyStatistic/MapLyStatistic/Mapper/TaskCommonMapper.java b/src/main/java/com/whu/edu/LyStatistic/MapLyStatistic/Mapper/TaskCommonMapper.java index ab5ab98..8e7ac5b 100644 --- a/src/main/java/com/whu/edu/LyStatistic/MapLyStatistic/Mapper/TaskCommonMapper.java +++ b/src/main/java/com/whu/edu/LyStatistic/MapLyStatistic/Mapper/TaskCommonMapper.java @@ -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.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.Param; @@ -30,12 +30,16 @@ public interface TaskCommonMapper { /** - * 按照区统计信息(内业外业样地数量) + * 按照区统计数量(内业外业样地数量) * @return 统计结果 DTO */ - List loadDistrictCount(String district); - + DistrictCountDTO loadDistrictCount(String district); + /** + * 按照小班统计信息(内业外业样地数量) + * @return 统计结果 DTO + */ + PlotCountDTO loadPlotCount(String rootId, String databaseName); /** * 获取所有小班的ID和边界信息 diff --git a/src/main/java/com/whu/edu/LyStatistic/MapLyStatistic/Service/StatisticsService.java b/src/main/java/com/whu/edu/LyStatistic/MapLyStatistic/Service/StatisticsService.java index 59b1745..6285686 100644 --- a/src/main/java/com/whu/edu/LyStatistic/MapLyStatistic/Service/StatisticsService.java +++ b/src/main/java/com/whu/edu/LyStatistic/MapLyStatistic/Service/StatisticsService.java @@ -1,7 +1,7 @@ package com.whu.edu.LyStatistic.MapLyStatistic.Service; import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO; 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.Mapper.InfoMapper; import com.whu.edu.LyStatistic.MapLyStatistic.Mapper.TaskCommonMapper; @@ -54,15 +54,21 @@ public class StatisticsService { } /** - * 查询所有区的计数信息 + * 查询区的计数信息 */ - public List getDistrictCount(String district) { - // 直接从数据库一次性查出“按区聚合后的统计数据” - List list = taskCommonMapper.loadDistrictCount(district); + public DistrictCountDTO getDistrictCount(String district) { + DistrictCountDTO data = taskCommonMapper.loadDistrictCount(district); - return list; + return data; } + /** + * 查询小班的计数信息 + */ + public PlotCountDTO getPlotCount(String rootId, String databaseName) { + PlotCountDTO data = taskCommonMapper.loadPlotCount(rootId,databaseName); + return data; + } /** * 按街道统计(传入区名称) diff --git a/src/main/resources/mapper/MapLyStatistic/TaskCommonMapper.xml b/src/main/resources/mapper/MapLyStatistic/TaskCommonMapper.xml index 6a3264e..2240496 100644 --- a/src/main/resources/mapper/MapLyStatistic/TaskCommonMapper.xml +++ b/src/main/resources/mapper/MapLyStatistic/TaskCommonMapper.xml @@ -105,7 +105,7 @@ FROM "${schema}".roottable1 - + + + +