This commit is contained in:
machao 2022-11-03 09:54:19 +08:00
parent da51b2a55d
commit 53fb8da5c1
16 changed files with 1295 additions and 3 deletions

View File

@ -0,0 +1,71 @@
package com.ruoyi.web.controller.yada;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain_yada.OceanTemperatureVO;
import com.ruoyi.system.domain_yada.vo.PmKeyValueEnVo;
import com.ruoyi.system.domain_yada.vo.PmKeyValueVo;
import com.ruoyi.system.domain_yada.vo.PmYearConcentrationRatioVo;
import com.ruoyi.system.service_yada.PmDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author Mr.C
*/
@Api(tags = "pm2.5数据变化")
@RestController
@RequestMapping(value = "/business-service/api/PM", produces = "application/json;charset=UTF-8")
public class PmDataController {
@Resource
private PmDataService pmDataService;
@RequestMapping(value = "/Average", method = {RequestMethod.GET})
@ApiOperation(value = "PM2.5年平均浓度", httpMethod = "GET")
public AjaxResult pmYearAverage(@RequestParam(value = "region") String region) {
PmKeyValueVo byRegion = pmDataService.findByRegion(region);
return AjaxResult.success(byRegion);
}
@RequestMapping(value = "/ChangeRate", method = {RequestMethod.GET})
@ApiOperation(value = "年澜湄5国PM2.5年平均浓度变化率", httpMethod = "GET")
public AjaxResult changeRate() {
PmKeyValueEnVo pmKeyValueEnVo = pmDataService.changeRate();
return AjaxResult.success(pmKeyValueEnVo);
}
@RequestMapping(value = "/YearRate", method = {RequestMethod.GET})
@ApiOperation(value = "PM2.5年平均浓度占比", httpMethod = "GET")
public AjaxResult yearRatio(@RequestParam(value = "year") String year,
@RequestParam(value = "region") String region) {
List<PmYearConcentrationRatioVo> pmYearConcentrationRatioVos = pmDataService.yearRatio(year,region);
return AjaxResult.success(pmYearConcentrationRatioVos);
}
@RequestMapping(value = "/YearAverage", method = {RequestMethod.GET})
@ApiOperation(value = "澜湄5国PM2.5年平均浓度", httpMethod = "GET")
public AjaxResult average(@RequestParam(value = "year") String year) {
PmKeyValueEnVo average = pmDataService.average(year);
return AjaxResult.success(average);
}
@RequestMapping(value = "/ChangeRateRatio", method = {RequestMethod.GET})
@ApiOperation(value = "2016-2020年PM2.5年平均浓度变化率占比", httpMethod = "GET")
public AjaxResult changeRateRatio(@RequestParam(value = "region") String region) {
List<PmYearConcentrationRatioVo> pmYearConcentrationRatioVos = pmDataService.changeRateRatio(region);
return AjaxResult.success(pmYearConcentrationRatioVos);
}
@RequestMapping(value = "/MonthAverage", method = {RequestMethod.GET})
@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);
}
}

View File

@ -6,8 +6,8 @@ spring:
driver-class-name: org.postgresql.Driver driver-class-name: org.postgresql.Driver
druid: druid:
master: master:
url: jdbc:postgresql://121.36.229.60:5432/yada?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai #url: jdbc:postgresql://121.36.229.60:5432/yada?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai
#url: jdbc:postgresql://192.168.2.9:5432/yada?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai url: jdbc:postgresql://192.168.2.9:5432/yada?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: sjs username: sjs
password: song5325 password: song5325
# url: jdbc:mysql://192.168.2.9:3306/nuoyi?AllowPublicKeyRetrieval=True&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai # url: jdbc:mysql://192.168.2.9:3306/nuoyi?AllowPublicKeyRetrieval=True&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai

View File

@ -115,7 +115,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.antMatchers("/*/api-docs").anonymous() .antMatchers("/*/api-docs").anonymous()
.antMatchers("/druid/**").anonymous() .antMatchers("/druid/**").anonymous()
// // 除上面外的所有请求全部需要鉴权认证 // // 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated() //.anyRequest().authenticated()
.and() .and()
.headers().frameOptions().disable(); .headers().frameOptions().disable();
httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler); httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);

View File

@ -0,0 +1,115 @@
package com.ruoyi.system.domain_yada.entity;
/**
* pm2.5年平均浓度
* @author Mr.C
*/
public class PmAverageConcentrationEntity {
private Integer id;
private String year;
private String region;
private String regionEn;
private Double value;
public PmAverageConcentrationEntity() {
}
public PmAverageConcentrationEntity(Integer id, String year, String region, String regionEn, Double value) {
this.id = id;
this.year = year;
this.region = region;
this.regionEn = regionEn;
this.value = value;
}
/**
* 获取
* @return id
*/
public Integer getId() {
return id;
}
/**
* 设置
* @param id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取
* @return year
*/
public String getYear() {
return year;
}
/**
* 设置
* @param year
*/
public void setYear(String year) {
this.year = year;
}
/**
* 获取
* @return region
*/
public String getRegion() {
return region;
}
/**
* 设置
* @param region
*/
public void setRegion(String region) {
this.region = region;
}
/**
* 获取
* @return regionEn
*/
public String getRegionEn() {
return regionEn;
}
/**
* 设置
* @param regionEn
*/
public void setRegionEn(String regionEn) {
this.regionEn = regionEn;
}
/**
* 获取
* @return value
*/
public Double getValue() {
return value;
}
/**
* 设置
* @param value
*/
public void setValue(Double value) {
this.value = value;
}
@Override
public String toString() {
return "PmAverageConcentrationEntity{id = " + id + ", year = " + year + ", region = " + region + ", regionEn = " + regionEn + ", value = " + value + "}";
}
}

View File

@ -0,0 +1,92 @@
package com.ruoyi.system.domain_yada.entity;
/**
* 2016-2020澜湄五国年平均浓度变化率
* @author Mr.C
*/
public class PmChangeRateEntity {
private Integer id;
private String country;
private String countryEn;
private Double ratio;
public PmChangeRateEntity() {
}
public PmChangeRateEntity(Integer id, String country, String countryEn, Double ratio) {
this.id = id;
this.country = country;
this.countryEn = countryEn;
this.ratio = ratio;
}
/**
* 获取
* @return id
*/
public Integer getId() {
return id;
}
/**
* 设置
* @param id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取
* @return country
*/
public String getCountry() {
return country;
}
/**
* 设置
* @param country
*/
public void setCountry(String country) {
this.country = country;
}
/**
* 获取
* @return countryEn
*/
public String getCountryEn() {
return countryEn;
}
/**
* 设置
* @param countryEn
*/
public void setCountryEn(String countryEn) {
this.countryEn = countryEn;
}
/**
* 获取
* @return ratio
*/
public Double getRatio() {
return ratio;
}
/**
* 设置
* @param ratio
*/
public void setRatio(Double ratio) {
this.ratio = ratio;
}
@Override
public String toString() {
return "PmChangeRateEntity{id = " + id + ", country = " + country + ", countryEn = " + countryEn + ", ratio = " + ratio + "}";
}
}

View File

@ -0,0 +1,114 @@
package com.ruoyi.system.domain_yada.entity;
/**
* 2016-2020年PM2.5年平均浓度变化率占比
* @author Mr.C
*/
public class PmChangeRateRatioEntity {
private Integer id;
private String region;
private String regionEn;
private String level;
private Double value;
public PmChangeRateRatioEntity() {
}
public PmChangeRateRatioEntity(Integer id, String region, String regionEn, String level, Double value) {
this.id = id;
this.region = region;
this.regionEn = regionEn;
this.level = level;
this.value = value;
}
/**
* 获取
* @return id
*/
public Integer getId() {
return id;
}
/**
* 设置
* @param id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取
* @return region
*/
public String getRegion() {
return region;
}
/**
* 设置
* @param region
*/
public void setRegion(String region) {
this.region = region;
}
/**
* 获取
* @return regionEn
*/
public String getRegionEn() {
return regionEn;
}
/**
* 设置
* @param regionEn
*/
public void setRegionEn(String regionEn) {
this.regionEn = regionEn;
}
/**
* 获取
* @return level
*/
public String getLevel() {
return level;
}
/**
* 设置
* @param level
*/
public void setLevel(String level) {
this.level = level;
}
/**
* 获取
* @return value
*/
public Double getValue() {
return value;
}
/**
* 设置
* @param value
*/
public void setValue(Double value) {
this.value = value;
}
@Override
public String toString() {
return "PmChangeRateRatioEntity{id = " + id + ", region = " + region + ", regionEn = " + regionEn + ", level = " + level + ", value = " + value + "}";
}
}

View File

@ -0,0 +1,133 @@
package com.ruoyi.system.domain_yada.entity;
/**
* PM2.5月平均浓度
* @author Mr.C
*/
public class PmMonthConcentrationEntity {
private Integer id;
private String year;
private String month;
private String region;
private String regionEn;
private Double value;
public PmMonthConcentrationEntity() {
}
public PmMonthConcentrationEntity(Integer id, String year, String month, String region, String regionEn, Double value) {
this.id = id;
this.year = year;
this.month = month;
this.region = region;
this.regionEn = regionEn;
this.value = value;
}
/**
* 获取
* @return id
*/
public Integer getId() {
return id;
}
/**
* 设置
* @param id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取
* @return year
*/
public String getYear() {
return year;
}
/**
* 设置
* @param year
*/
public void setYear(String year) {
this.year = year;
}
/**
* 获取
* @return month
*/
public String getMonth() {
return month;
}
/**
* 设置
* @param month
*/
public void setMonth(String month) {
this.month = month;
}
/**
* 获取
* @return region
*/
public String getRegion() {
return region;
}
/**
* 设置
* @param region
*/
public void setRegion(String region) {
this.region = region;
}
/**
* 获取
* @return regionEn
*/
public String getRegionEn() {
return regionEn;
}
/**
* 设置
* @param regionEn
*/
public void setRegionEn(String regionEn) {
this.regionEn = regionEn;
}
/**
* 获取
* @return value
*/
public Double getValue() {
return value;
}
/**
* 设置
* @param value
*/
public void setValue(Double value) {
this.value = value;
}
@Override
public String toString() {
return "PmMonthConcentrationEntity{id = " + id + ", year = " + year + ", month = " + month + ", region = " + region + ", regionEn = " + regionEn + ", value = " + value + "}";
}
}

View File

@ -0,0 +1,109 @@
package com.ruoyi.system.domain_yada.entity;
/**
* 澜湄5国PM2.5年平均浓度
* @author Mr.C
*/
public class PmYearConcentrationEntity {
private Integer id;
private String year;
private String country;
private String countryEn;
private Double ratio;
public PmYearConcentrationEntity() {
}
public PmYearConcentrationEntity(Integer id, String year, String country, String countryEn, Double ratio) {
this.id = id;
this.year = year;
this.country = country;
this.countryEn = countryEn;
this.ratio = ratio;
}
/**
* 获取
* @return id
*/
public Integer getId() {
return id;
}
/**
* 设置
* @param id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取
* @return year
*/
public String getYear() {
return year;
}
/**
* 设置
* @param year
*/
public void setYear(String year) {
this.year = year;
}
/**
* 获取
* @return country
*/
public String getCountry() {
return country;
}
/**
* 设置
* @param country
*/
public void setCountry(String country) {
this.country = country;
}
/**
* 获取
* @return countryEn
*/
public String getCountryEn() {
return countryEn;
}
/**
* 设置
* @param countryEn
*/
public void setCountryEn(String countryEn) {
this.countryEn = countryEn;
}
/**
* 获取
* @return ratio
*/
public Double getRatio() {
return ratio;
}
/**
* 设置
* @param ratio
*/
public void setRatio(Double ratio) {
this.ratio = ratio;
}
@Override
public String toString() {
return "PmYearConcentrationEntity{id = " + id + ", year = " + year + ", country = " + country + ", countryEn = " + countryEn + ", ratio = " + ratio + "}";
}
}

View File

@ -0,0 +1,128 @@
package com.ruoyi.system.domain_yada.entity;
/**
* PM2.5年平均浓度占比
* @author Mr.C
*/
public class PmYearConcentrationRatioEntity {
private Integer id;
private String year;
private String region;
private String regionEn;
private String level;
private Double value;
public PmYearConcentrationRatioEntity() {
}
public PmYearConcentrationRatioEntity(Integer id, String year, String region, String regionEn, String level, Double value) {
this.id = id;
this.year = year;
this.region = region;
this.regionEn = regionEn;
this.level = level;
this.value = value;
}
/**
* 获取
* @return id
*/
public Integer getId() {
return id;
}
/**
* 设置
* @param id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取
* @return year
*/
public String getYear() {
return year;
}
/**
* 设置
* @param year
*/
public void setYear(String year) {
this.year = year;
}
/**
* 获取
* @return region
*/
public String getRegion() {
return region;
}
/**
* 设置
* @param region
*/
public void setRegion(String region) {
this.region = region;
}
/**
* 获取
* @return regionEn
*/
public String getRegionEn() {
return regionEn;
}
/**
* 设置
* @param regionEn
*/
public void setRegionEn(String regionEn) {
this.regionEn = regionEn;
}
/**
* 获取
* @return level
*/
public String getLevel() {
return level;
}
/**
* 设置
* @param level
*/
public void setLevel(String level) {
this.level = level;
}
/**
* 获取
* @return value
*/
public Double getValue() {
return value;
}
/**
* 设置
* @param value
*/
public void setValue(Double value) {
this.value = value;
}
@Override
public String toString() {
return "PmYearConcentrationRatioEntity{id = " + id + ", year = " + year + ", region = " + region + ", regionEn = " + regionEn + ", level = " + level + ", value = " + value + "}";
}
}

View File

@ -0,0 +1,75 @@
package com.ruoyi.system.domain_yada.vo;
import java.util.List;
/**
* @author Mr.C
*/
public class PmKeyValueEnVo {
private List<String> key;
private List<String> keyEn;
private List<Double> value;
public PmKeyValueEnVo() {
}
public PmKeyValueEnVo(List<String> key, List<String> keyEn, List<Double> value) {
this.key = key;
this.keyEn = keyEn;
this.value = value;
}
/**
* 获取
* @return key
*/
public List<String> getKey() {
return key;
}
/**
* 设置
* @param key
*/
public void setKey(List<String> key) {
this.key = key;
}
/**
* 获取
* @return keyEn
*/
public List<String> getKeyEn() {
return keyEn;
}
/**
* 设置
* @param keyEn
*/
public void setKeyEn(List<String> keyEn) {
this.keyEn = keyEn;
}
/**
* 获取
* @return value
*/
public List<Double> getValue() {
return value;
}
/**
* 设置
* @param value
*/
public void setValue(List<Double> value) {
this.value = value;
}
@Override
public String toString() {
return "PmKeyValueEnVo{key = " + key + ", keyEn = " + keyEn + ", value = " + value + "}";
}
}

View File

@ -0,0 +1,58 @@
package com.ruoyi.system.domain_yada.vo;
import java.util.List;
/**
* @author Mr.C
*/
public class PmKeyValueVo {
private List<String> key;
private List<Double> value;
public PmKeyValueVo() {
}
public PmKeyValueVo(List<String> key, List<Double> value) {
this.key = key;
this.value = value;
}
/**
* 获取
* @return key
*/
public List<String> getKey() {
return key;
}
/**
* 设置
* @param key
*/
public void setKey(List<String> key) {
this.key = key;
}
/**
* 获取
* @return value
*/
public List<Double> getValue() {
return value;
}
/**
* 设置
* @param value
*/
public void setValue(List<Double> value) {
this.value = value;
}
@Override
public String toString() {
return "PmKeyValueVo{key = " + key + ", value = " + value + "}";
}
}

View File

@ -0,0 +1,93 @@
package com.ruoyi.system.domain_yada.vo;
/**
* PM2.5年平均浓度占比
* @author Mr.C
*/
public class PmYearConcentrationRatioVo {
private String region;
private String regionEn;
private String level;
private Double value;
public PmYearConcentrationRatioVo() {
}
public PmYearConcentrationRatioVo(String region, String regionEn, String level, Double value) {
this.region = region;
this.regionEn = regionEn;
this.level = level;
this.value = value;
}
/**
* 获取
* @return region
*/
public String getRegion() {
return region;
}
/**
* 设置
* @param region
*/
public void setRegion(String region) {
this.region = region;
}
/**
* 获取
* @return regionEn
*/
public String getRegionEn() {
return regionEn;
}
/**
* 设置
* @param regionEn
*/
public void setRegionEn(String regionEn) {
this.regionEn = regionEn;
}
/**
* 获取
* @return level
*/
public String getLevel() {
return level;
}
/**
* 设置
* @param level
*/
public void setLevel(String level) {
this.level = level;
}
/**
* 获取
* @return value
*/
public Double getValue() {
return value;
}
/**
* 设置
* @param value
*/
public void setValue(Double value) {
this.value = value;
}
@Override
public String toString() {
return "PmYearConcentrationRatioVo{region = " + region + ", regionEn = " + regionEn + ", level = " + level + ", value = " + value + "}";
}
}

View File

@ -0,0 +1,57 @@
package com.ruoyi.system.mapper_yada;
import com.ruoyi.system.domain_yada.entity.*;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author Mr.C
*/
public interface PmDataMapper {
/**
* pm2.5年平均浓度
* @param region
* @return
*/
List<PmAverageConcentrationEntity> findByRegion(@Param("region") String region);
/**
* 2016-2020年澜湄5国PM2.5年平均浓度变化率
* @return
*/
List<PmChangeRateEntity> changRate();
/**
* PM2.5年平均浓度占比
* @param year 年份
* @param region 地区
* @return
*/
List<PmYearConcentrationRatioEntity> yearRatio(@Param("year") String year,
@Param("region") String region);
/**
* 澜湄5国PM2.5年平均浓度
* @param year 年份
* @return
*/
List<PmYearConcentrationEntity> average(@Param("year") String year);
/**
* 2016-2020年PM2.5年平均浓度变化率占比
* @param region 地区
* @return
*/
List<PmChangeRateRatioEntity> changeRateRatio(@Param("region") String region);
/**
* PM2.5月平均浓度
* @param year 年份
* @param region 地区
* @return
*/
List<PmMonthConcentrationEntity> monthAverage(@Param("year") String year,
@Param("region") String region);
}

View File

@ -0,0 +1,56 @@
package com.ruoyi.system.service_yada;
import com.ruoyi.system.domain_yada.vo.PmKeyValueEnVo;
import com.ruoyi.system.domain_yada.vo.PmKeyValueVo;
import com.ruoyi.system.domain_yada.vo.PmYearConcentrationRatioVo;
import java.util.List;
/**
* @author Mr.C
*/
public interface PmDataService {
/**
* 年PM2.5平均浓度
* @param region 区域
* @return PmKeyValueVo
*/
PmKeyValueVo findByRegion(String region);
/**
* 2016-2020年澜湄5国PM2.5年平均浓度变化率
* @return
*/
PmKeyValueEnVo changeRate();
/**
* PM2.5年平均浓度占比
* @param year 年份
* @param region 地区
* @return
*/
List<PmYearConcentrationRatioVo> yearRatio(String year, String region);
/**
* 澜湄5国PM2.5年平均浓度
* @param year 年份
* @return
*/
PmKeyValueEnVo average(String year);
/**
* 2016-2020年PM2.5年平均浓度变化率占比
* @param region 地区
* @return
*/
List<PmYearConcentrationRatioVo> changeRateRatio(String region);
/**
* PM2.5月平均浓度
* @param year 年份
* @param region 地区
* @return
*/
PmKeyValueVo monthAverage(String year,String region);
}

View File

@ -0,0 +1,101 @@
package com.ruoyi.system.service_yada.impl;
import com.ruoyi.system.domain_yada.entity.*;
import com.ruoyi.system.domain_yada.vo.PmKeyValueEnVo;
import com.ruoyi.system.domain_yada.vo.PmKeyValueVo;
import com.ruoyi.system.domain_yada.vo.PmYearConcentrationRatioVo;
import com.ruoyi.system.mapper_yada.PmDataMapper;
import com.ruoyi.system.service_yada.PmDataService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
/**
* @author Mr.C
*/
@Service
public class PmDataImpl implements PmDataService {
@Resource
private PmDataMapper pmDataMapper;
@Override
public PmKeyValueVo findByRegion(String region) {
List<PmAverageConcentrationEntity> byRegion = pmDataMapper.findByRegion(region);
byRegion.sort(Comparator.comparing(PmAverageConcentrationEntity::getYear));
List<String> key = new ArrayList<>();
List<Double> value = new ArrayList<>();
byRegion.forEach(v->{
key.add(v.getYear());
value.add(v.getValue());
});
return new PmKeyValueVo(key,value);
}
@Override
public PmKeyValueEnVo changeRate() {
List<PmChangeRateEntity> pmChangeRateEntities = pmDataMapper.changRate();
List<String> key = new ArrayList<>();
List<String> keyEn = new ArrayList<>();
List<Double> value = new ArrayList<>();
pmChangeRateEntities.forEach(v->{
key.add(v.getCountry());
keyEn.add(v.getCountryEn());
value.add(v.getRatio());
});
return new PmKeyValueEnVo(key,keyEn,value);
}
@Override
public List<PmYearConcentrationRatioVo> yearRatio(String year, String region) {
List<PmYearConcentrationRatioEntity> list = pmDataMapper.yearRatio(year, region);
List<PmYearConcentrationRatioVo> lists = new ArrayList<>();
list.forEach(v->{
PmYearConcentrationRatioVo vo = new PmYearConcentrationRatioVo(v.getRegion(),v.getRegionEn(),v.getLevel(),v.getValue());
lists.add(vo);
});
return lists;
}
@Override
public PmKeyValueEnVo average(String year) {
List<PmYearConcentrationEntity> average = pmDataMapper.average(year);
List<String> key = new ArrayList<>();
List<String> keyEn = new ArrayList<>();
List<Double> value = new ArrayList<>();
average.forEach(v->{
key.add(v.getCountry());
keyEn.add(v.getCountryEn());
value.add(v.getRatio());
});
return new PmKeyValueEnVo(key,keyEn,value);
}
@Override
public List<PmYearConcentrationRatioVo> changeRateRatio(String region) {
List<PmChangeRateRatioEntity> list = pmDataMapper.changeRateRatio(region);
List<PmYearConcentrationRatioVo> lists = new ArrayList<>();
list.forEach(v->{
PmYearConcentrationRatioVo vo = new PmYearConcentrationRatioVo(v.getRegion(),v.getRegionEn(), v.getLevel(), v.getValue());
lists.add(vo);
});
return lists;
}
@Override
public PmKeyValueVo monthAverage(String year, String region) {
List<PmMonthConcentrationEntity> list = pmDataMapper.monthAverage(year, region);
list.sort(Comparator.comparing(PmMonthConcentrationEntity::getId));
List<String> key = new ArrayList<>();
List<Double> value = new ArrayList<>();
list.forEach(v->{
key.add(v.getMonth());
value.add(v.getValue());
});
return new PmKeyValueVo(key,value);
}
}

View File

@ -0,0 +1,90 @@
<?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.ruoyi.system.mapper_yada.PmDataMapper">
<resultMap id="year_average" type="com.ruoyi.system.domain_yada.entity.PmAverageConcentrationEntity">
<result property="id" column="id"/>
<result property="year" column="year"/>
<result property="region" column="region"/>
<result property="regionEn" column="region_en"/>
<result property="value" column="value"/>
</resultMap>
<resultMap id="change_rate" type="com.ruoyi.system.domain_yada.entity.PmChangeRateEntity">
<result property="id" column="id"/>
<result property="country" column="country"/>
<result property="countryEn" column="country_en"/>
<result property="ratio" column="ratio"/>
</resultMap>
<resultMap id="year_ratio" type="com.ruoyi.system.domain_yada.entity.PmYearConcentrationRatioEntity">
<result property="id" column="id"/>
<result property="year" column="year"/>
<result property="region" column="region"/>
<result property="regionEn" column="region_en"/>
<result property="level" column="level"/>
<result property="value" column="value"/>
</resultMap>
<resultMap id="year_five_average" type="com.ruoyi.system.domain_yada.entity.PmYearConcentrationEntity">
<result property="id" column="id"/>
<result property="year" column="year"/>
<result property="country" column="country"/>
<result property="countryEn" column="country_en"/>
<result property="ratio" column="ratio"/>
</resultMap>
<resultMap id="change_rate_ratio" type="com.ruoyi.system.domain_yada.entity.PmChangeRateRatioEntity">
<result property="id" column="id"/>
<result property="region" column="region"/>
<result property="regionEn" column="region_en"/>
<result property="level" column="level"/>
<result property="value" column="value"/>
</resultMap>
<resultMap id="month_average" type="com.ruoyi.system.domain_yada.entity.PmMonthConcentrationEntity">
<result property="id" column="id"/>
<result property="year" column="year"/>
<result property="month" column="month"/>
<result property="region" column="region"/>
<result property="regionEn" column="region_en"/>
<result property="value" column="value"/>
</resultMap>
<select id="findByRegion" resultMap="year_average">
select id, year, region, region_en, value
from pm_year_average_concentration
where region = #{region}
</select>
<select id="changRate" resultMap="change_rate">
select id, country, country_en, ratio
from pm_five_country_pm_change_rate
</select>
<select id="yearRatio" resultMap="year_ratio">
select pm.id, pm.year, pm.region, pm.region_en, pm.level, pm.value
from pm_year_concentration_ratio pm
where pm.year = #{year}
and pm.region = #{region}
</select>
<select id="average" resultMap="year_five_average">
select id, year, country, country_en, ratio
from pm_five_country_year_concentration
where year = #{year}
</select>
<select id="changeRateRatio" resultMap="change_rate_ratio">
select id, region, region_en, level, value
from pm_change_rate_ratio
where region = #{region}
</select>
<select id="monthAverage" resultMap="month_average">
select id, year,month,region, region_en, value
from pm_month_average_concentration
where year = #{year} and region = #{region}
</select>
</mapper>