diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/yada/PmDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/yada/PmDataController.java index 754dd93f2..b382c2956 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/yada/PmDataController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/yada/PmDataController.java @@ -65,7 +65,7 @@ public class PmDataController { @ApiOperation(value = "PM2.5月平均浓度", httpMethod = "GET") public AjaxResult monthAverage(@RequestParam(value = "year") String year, @RequestParam(value = "region") String region) { - PmKeyValueVo pmKeyValueVo = pmDataService.monthAverage(year, region); - return AjaxResult.success(pmKeyValueVo); + PmKeyValueEnVo pmKeyValueEnVo = pmDataService.monthAverage(year, region); + return AjaxResult.success(pmKeyValueEnVo); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain_yada/entity/PmMonthConcentrationEntity.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain_yada/entity/PmMonthConcentrationEntity.java index 7bdd57a36..bf69bf72b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain_yada/entity/PmMonthConcentrationEntity.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain_yada/entity/PmMonthConcentrationEntity.java @@ -11,6 +11,8 @@ public class PmMonthConcentrationEntity { private String month; + private String monthEn; + private String region; private String regionEn; @@ -21,10 +23,11 @@ public class PmMonthConcentrationEntity { public PmMonthConcentrationEntity() { } - public PmMonthConcentrationEntity(Integer id, String year, String month, String region, String regionEn, Double value) { + public PmMonthConcentrationEntity(Integer id, String year, String month, String monthEn, String region, String regionEn, Double value) { this.id = id; this.year = year; this.month = month; + this.monthEn = monthEn; this.region = region; this.regionEn = regionEn; this.value = value; @@ -78,6 +81,22 @@ public class PmMonthConcentrationEntity { this.month = month; } + /** + * 获取 + * @return monthEn + */ + public String getMonthEn() { + return monthEn; + } + + /** + * 设置 + * @param monthEn + */ + public void setMonthEn(String monthEn) { + this.monthEn = monthEn; + } + /** * 获取 * @return region @@ -126,8 +145,7 @@ public class PmMonthConcentrationEntity { this.value = value; } - @Override public String toString() { - return "PmMonthConcentrationEntity{id = " + id + ", year = " + year + ", month = " + month + ", region = " + region + ", regionEn = " + regionEn + ", value = " + value + "}"; + return "PmMonthConcentrationEntity{id = " + id + ", year = " + year + ", month = " + month + ", monthEn = " + monthEn + ", region = " + region + ", regionEn = " + regionEn + ", value = " + value + "}"; } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/PmDataService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/PmDataService.java index c7e3611df..4a33b28ab 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/PmDataService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/PmDataService.java @@ -52,5 +52,5 @@ public interface PmDataService { * @param region 地区 * @return */ - PmKeyValueVo monthAverage(String year,String region); + PmKeyValueEnVo monthAverage(String year,String region); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/PmDataImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/PmDataImpl.java index 60c764efc..962d7441b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/PmDataImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/PmDataImpl.java @@ -87,15 +87,17 @@ public class PmDataImpl implements PmDataService { } @Override - public PmKeyValueVo monthAverage(String year, String region) { + public PmKeyValueEnVo monthAverage(String year, String region) { List list = pmDataMapper.monthAverage(year, region); list.sort(Comparator.comparing(PmMonthConcentrationEntity::getId)); List key = new ArrayList<>(); + List keyEn = new ArrayList<>(); List value = new ArrayList<>(); list.forEach(v->{ key.add(v.getMonth()); + keyEn.add(v.getMonthEn()); value.add(v.getValue()); }); - return new PmKeyValueVo(key,value); + return new PmKeyValueEnVo(key,keyEn,value); } } diff --git a/ruoyi-system/src/main/resources/mapper/system/PmDataMapper.xml b/ruoyi-system/src/main/resources/mapper/system/PmDataMapper.xml index 1821b5690..9e42ab3e8 100644 --- a/ruoyi-system/src/main/resources/mapper/system/PmDataMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/PmDataMapper.xml @@ -47,6 +47,7 @@ + @@ -83,8 +84,9 @@