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>
@Override @Override
public R getWaterLevelTrend() { public R getWaterLevelTrend() {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Map<String, Object> valMap = new HashMap<>(); Map<String, Object> valMap;
List<String> valueList; List<String> valueList;
Set<String> tmList = new HashSet<>(); Set<String> tmList = new HashSet<>();
Set<String> stnmList = new HashSet<>(); Set<String> stnmList = new HashSet<>();
List<Map<String, Object>> valuesList = new ArrayList<>();
List<Integer> idList = baseMapper.selectStationInfoId(); List<Integer> idList = baseMapper.selectStationInfoId();
for (Integer id : idList) { for (Integer id : idList) {
List<WaterPhotoInfo> waterPhotoInfos = baseMapper.selectWaterLevelTrend(id); List<WaterPhotoInfo> waterPhotoInfos = baseMapper.selectWaterLevelTrend(id);
if (waterPhotoInfos.size()==0){
break;
}
valueList = new ArrayList<>(); valueList = new ArrayList<>();
String stnm = ""; valMap = new HashMap<>();
String name = "";
for (WaterPhotoInfo waterPhotoInfo : waterPhotoInfos) { for (WaterPhotoInfo waterPhotoInfo : waterPhotoInfos) {
name = waterPhotoInfo.getStnm();
valueList.add(waterPhotoInfo.getValue()); valueList.add(waterPhotoInfo.getValue());
stnmList.add(waterPhotoInfo.getStnm()); stnmList.add(waterPhotoInfo.getStnm());
stnm = waterPhotoInfo.getStnm();
tmList.add(waterPhotoInfo.getTm()); 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("tms",tmList);
map.put("stnms",stnmList); map.put("stnms",stnmList);
return R.ok().put("map",map); return R.ok().put("data",map);
} }
@Override @Override

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

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

Loading…
Cancel
Save