Browse Source

优化

master
blank 2 years ago
parent
commit
fbb438800c
  1. 19
      ruoyi-api/src/main/java/com/ruoyi/api/service/impl/DapingServiceImpl.java
  2. 5
      ruoyi-api/src/main/resources/mapper/api/DapingMapper.xml

19
ruoyi-api/src/main/java/com/ruoyi/api/service/impl/DapingServiceImpl.java

@ -35,27 +35,34 @@ public class DapingServiceImpl extends ServiceImpl<DapingMapper, WaterPhotoInfo> @@ -35,27 +35,34 @@ public class DapingServiceImpl extends ServiceImpl<DapingMapper, WaterPhotoInfo>
@Override
public R getWaterLevelTrend() {
Map<String, Object> map = new HashMap<>();
Map<String, Object> valMap = new HashMap<>();
Map<String, Object> valMap;
List<String> valueList;
Set<String> tmList = new HashSet<>();
Set<String> stnmList = new HashSet<>();
List<Map<String, Object>> valuesList = new ArrayList<>();
List<Integer> idList = baseMapper.selectStationInfoId();
for (Integer id : idList) {
List<WaterPhotoInfo> waterPhotoInfos = baseMapper.selectWaterLevelTrend(id);
if (waterPhotoInfos.size()==0){
break;
}
valueList = new ArrayList<>();
String stnm = "";
valMap = new HashMap<>();
String name = "";
for (WaterPhotoInfo waterPhotoInfo : waterPhotoInfos) {
name = waterPhotoInfo.getStnm();
valueList.add(waterPhotoInfo.getValue());
stnmList.add(waterPhotoInfo.getStnm());
stnm = waterPhotoInfo.getStnm();
tmList.add(waterPhotoInfo.getTm());
}
valMap.put(stnm,valueList);
valMap.put("stnm",name);
valMap.put("value",valueList);
valuesList.add(valMap);
}
map.put("values",valMap);
map.put("values",valuesList);
map.put("tms",tmList);
map.put("stnms",stnmList);
return R.ok().put("map",map);
return R.ok().put("data",map);
}
@Override

5
ruoyi-api/src/main/resources/mapper/api/DapingMapper.xml

@ -9,9 +9,10 @@ @@ -9,9 +9,10 @@
longitude,
latitude,
s.id,
create_time,
create_time as start_time,
c.value,
c.img_name
c.img_name,
s.camera_sn
FROM
sc_station_info s
left join sc_water_current_data c on c.stnm_id = s.id

Loading…
Cancel
Save