修改月份字段
This commit is contained in:
parent
3fd09cc44a
commit
25897b41d8
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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 + "}";
|
||||
}
|
||||
}
|
||||
|
@ -52,5 +52,5 @@ public interface PmDataService {
|
||||
* @param region 地区
|
||||
* @return
|
||||
*/
|
||||
PmKeyValueVo monthAverage(String year,String region);
|
||||
PmKeyValueEnVo monthAverage(String year,String region);
|
||||
}
|
||||
|
@ -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<PmMonthConcentrationEntity> list = pmDataMapper.monthAverage(year, region);
|
||||
list.sort(Comparator.comparing(PmMonthConcentrationEntity::getId));
|
||||
List<String> key = new ArrayList<>();
|
||||
List<String> keyEn = new ArrayList<>();
|
||||
List<Double> 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);
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,7 @@
|
||||
<result property="id" column="id"/>
|
||||
<result property="year" column="year"/>
|
||||
<result property="month" column="month"/>
|
||||
<result property="monthEn" column="month_en"/>
|
||||
<result property="region" column="region"/>
|
||||
<result property="regionEn" column="region_en"/>
|
||||
<result property="value" column="value"/>
|
||||
@ -83,8 +84,9 @@
|
||||
</select>
|
||||
|
||||
<select id="monthAverage" resultMap="month_average">
|
||||
select id, year,month,region, region_en, value
|
||||
select id, year, month, month_en, region, region_en, value
|
||||
from pm_month_average_concentration
|
||||
where year = #{year} and region = #{region}
|
||||
where year = #{year}
|
||||
and region = #{region}
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user