|
|
package com.monitor.other.dashboardportal;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.model.DashboardPortal;
|
|
|
import com.monitor.model.response.BaseResponse;
|
|
|
import com.monitor.mysql.mapper.DashboardPortalMapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
@Controller
|
|
|
@RequestMapping("/dashboardPortal")
|
|
|
public class DashboardPortalCtrl {
|
|
|
@Autowired
|
|
|
private DashboardPortalMapper dashboardPortalMapper;
|
|
|
|
|
|
@RequestMapping("/queryAll")
|
|
|
@ResponseBody
|
|
|
public BaseResponse queryAll(){
|
|
|
List<DashboardPortal> portals=dashboardPortalMapper.selectAll();
|
|
|
// Map<String,List<DashboardPortal>> map=new LinkedHashMap<>();
|
|
|
Map<String,Map<String,List<DashboardPortal>>> map=new LinkedHashMap<>();
|
|
|
if(portals!=null&&portals.size()>0){
|
|
|
for(DashboardPortal portal:portals){
|
|
|
String firstType=portal.getTopType();
|
|
|
if(!map.keySet().contains(firstType)){
|
|
|
map.put(firstType,new LinkedHashMap<>());
|
|
|
}
|
|
|
String secondType=portal.getSecondType();
|
|
|
if(!map.get(firstType).keySet().contains(secondType)){
|
|
|
map.get(firstType).put(secondType,new ArrayList<>());
|
|
|
}
|
|
|
map.get(firstType).get(secondType).add(portal);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
BaseResponse res= new BaseResponse() ;
|
|
|
res.setData(map);
|
|
|
return res;
|
|
|
}
|
|
|
} |
...
|
...
|
|