|
|
package com.sunyo.wlpt.message.bus.service.controller;
|
|
|
|
|
|
|
|
|
import com.sunyo.wlpt.message.bus.service.domain.BusExchange;
|
|
|
import com.sunyo.wlpt.message.bus.service.domain.BusServer;
|
|
|
import com.sunyo.wlpt.message.bus.service.domain.VirtualHost;
|
|
|
import com.sunyo.wlpt.message.bus.service.response.ResultJson;
|
|
|
import com.sunyo.wlpt.message.bus.service.service.BusExchangeService;
|
|
|
import com.sunyo.wlpt.message.bus.service.service.BusServerService;
|
|
|
import com.sunyo.wlpt.message.bus.service.service.VirtualHostService;
|
|
|
import org.springframework.web.bind.annotation.*;
|
...
|
...
|
@@ -26,16 +28,19 @@ public class CascadeController { |
|
|
@Resource
|
|
|
private VirtualHostService virtualHostService;
|
|
|
|
|
|
@Resource
|
|
|
private BusExchangeService busExchangeService;
|
|
|
|
|
|
/**
|
|
|
* 仅,查询服务器列表
|
|
|
*
|
|
|
* @return {@link ResultJson}
|
|
|
*/
|
|
|
@GetMapping("/server")
|
|
|
public ResultJson selectServerList() {
|
|
|
public ResultJson getServerList() {
|
|
|
|
|
|
ResultJson result = new ResultJson();
|
|
|
List<BusServer> busServers = busServerService.selectAll();
|
|
|
List<BusServer> busServers = busServerService.getServerList();
|
|
|
int num = busServers.size();
|
|
|
if (num > 0) {
|
|
|
result.setCode("200");
|
...
|
...
|
@@ -54,9 +59,9 @@ public class CascadeController { |
|
|
* @return {@link ResultJson}
|
|
|
*/
|
|
|
@GetMapping("/host")
|
|
|
public ResultJson selectVirtualHostList() {
|
|
|
public ResultJson getVirtualHostList() {
|
|
|
ResultJson result = new ResultJson();
|
|
|
List<VirtualHost> virtualHosts = virtualHostService.selectAll();
|
|
|
List<VirtualHost> virtualHosts = virtualHostService.getVirtualHostList();
|
|
|
int num = virtualHosts.size();
|
|
|
if (num > 0) {
|
|
|
result.setCode("200");
|
...
|
...
|
@@ -69,6 +74,17 @@ public class CascadeController { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@GetMapping("/exchange")
|
|
|
public ResultJson getExchangeList() {
|
|
|
List<BusExchange> busExchanges = busExchangeService.getExchangeList();
|
|
|
int num = busExchanges.size();
|
|
|
if (num > 0) {
|
|
|
return new ResultJson("200", "查询交换机列表,成功", busExchanges);
|
|
|
} else {
|
|
|
return new ResultJson("500", "查询交换机列表,失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 服务器与虚拟主机是1:n的关系
|
|
|
* 查询,服务器列表(包含虚拟机)
|
...
|
...
|
@@ -76,14 +92,33 @@ public class CascadeController { |
|
|
* @return {@link ResultJson}
|
|
|
*/
|
|
|
@GetMapping("/server_host")
|
|
|
public ResultJson selectServerAndHostList(){
|
|
|
public ResultJson getServerAndHostList() {
|
|
|
ResultJson result = new ResultJson();
|
|
|
List<BusServer> servers = busServerService.getServerAndHostList();
|
|
|
int num = servers.size();
|
|
|
if (num > 0) {
|
|
|
return new ResultJson("200", "查询服务器与虚拟主机信息,成功", servers);
|
|
|
} else {
|
|
|
return new ResultJson("500", "查询服务器与虚拟主机信息,失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 服务器与虚拟主机是1:n的关系
|
|
|
* 虚拟主机与交换机是1: n的关系
|
|
|
* 查询,服务器列表(包含虚拟机、交换机)
|
|
|
*
|
|
|
* @return {@link ResultJson}
|
|
|
*/
|
|
|
@GetMapping("/server_host_exchange")
|
|
|
public ResultJson getServerAndHostAndExchangeList() {
|
|
|
ResultJson result = new ResultJson();
|
|
|
List<BusServer> servers = busServerService.selectServerAndHostList();
|
|
|
List<BusServer> servers = busServerService.getServerAndHostAndExchangeList();
|
|
|
int num = servers.size();
|
|
|
if (num > 0) {
|
|
|
return new ResultJson("200","查询服务器列表,成功",servers);
|
|
|
return new ResultJson("200", "查询服务器与虚拟主机信息,成功", servers);
|
|
|
} else {
|
|
|
return new ResultJson("500","查询服务器列表,失败");
|
|
|
return new ResultJson("500", "查询服务器与虚拟主机信息,失败");
|
|
|
}
|
|
|
}
|
|
|
} |
...
|
...
|
|