...
|
...
|
@@ -38,7 +38,8 @@ public class BusServerController { |
|
|
public ResultJson selectBusServerList(
|
|
|
@RequestParam(value = "serverName", required = false) String serverName,
|
|
|
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
|
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize)
|
|
|
{
|
|
|
// 获取查询参数
|
|
|
BusServer busServer = BusServer.builder().serverName(serverName).build();
|
|
|
// 分页查询
|
...
|
...
|
@@ -55,7 +56,8 @@ public class BusServerController { |
|
|
* @return {@link ResultJson}
|
|
|
*/
|
|
|
@DeleteMapping("/delete")
|
|
|
public ResultJson deleteBusServer(@RequestBody BusServer busServer) {
|
|
|
public ResultJson deleteBusServer(@RequestBody BusServer busServer)
|
|
|
{
|
|
|
return busServerService.deleteByPrimaryKey(busServer.getId()) > 0
|
|
|
? new ResultJson<>("200", "删除MQ服务器,成功")
|
|
|
: new ResultJson<>("500", "删除MQ服务器,失败");
|
...
|
...
|
@@ -68,7 +70,8 @@ public class BusServerController { |
|
|
* @return {@link ResultJson}
|
|
|
*/
|
|
|
@GetMapping("/batchRemove")
|
|
|
public ResultJson batchRemoveBusServer(String ids) {
|
|
|
public ResultJson batchRemoveBusServer(String ids)
|
|
|
{
|
|
|
return busServerService.deleteByPrimaryKey(ids) > 0
|
|
|
? new ResultJson<>("200", "批量删除服务器,成功")
|
|
|
: new ResultJson<>("500", "批量删除服务器,失败");
|
...
|
...
|
@@ -81,7 +84,8 @@ public class BusServerController { |
|
|
* @return {@link ResultJson}
|
|
|
*/
|
|
|
@PutMapping("/update")
|
|
|
public ResultJson updateBusServer(@RequestBody BusServer busServer) {
|
|
|
public ResultJson updateBusServer(@RequestBody BusServer busServer)
|
|
|
{
|
|
|
//先验证,修改好的核心信息(ip和port,同时存在)是否已存在
|
|
|
String message = validateBusServer(busServer);
|
|
|
if (EXIST_SERVERNAME.equals(message)) {
|
...
|
...
|
@@ -101,7 +105,8 @@ public class BusServerController { |
|
|
* @return {@link ResultJson}
|
|
|
*/
|
|
|
@PostMapping("/insert")
|
|
|
public ResultJson insertBusServer(@RequestBody BusServer busServer) {
|
|
|
public ResultJson insertBusServer(@RequestBody BusServer busServer)
|
|
|
{
|
|
|
//先验证,增加的服务器的核心信息(ip和port,同时存在)是否已存在
|
|
|
String message = validateBusServer(busServer);
|
|
|
if (EXIST_SERVERNAME.equals(message)) {
|
...
|
...
|
@@ -122,14 +127,15 @@ public class BusServerController { |
|
|
* @param busServer {@link BusServer}
|
|
|
* @return 通过,无返回消息
|
|
|
*/
|
|
|
private String validateBusServer(BusServer busServer) {
|
|
|
private String validateBusServer(BusServer busServer)
|
|
|
{
|
|
|
if ("".equals(busServer.getServerName()) || busServer.getServerName() == null) {
|
|
|
return "该服务器信息中,没有服务器名称";
|
|
|
}
|
|
|
if ("".equals(busServer.getServerIp()) || busServer.getServerIp() == null) {
|
|
|
return "该服务器信息中,没有服务器IP";
|
|
|
}
|
|
|
if ("".equals(busServer.getServerPort()) || busServer.getServerPort() == null) {
|
|
|
if (busServer.getServerPort() == null) {
|
|
|
return "该服务器信息中,没有服务器Port";
|
|
|
}
|
|
|
|
...
|
...
|
@@ -153,7 +159,7 @@ public class BusServerController { |
|
|
* 则校验 该 ServerIp以及ServerPort(同时) 是否已存在
|
|
|
*/
|
|
|
if (
|
|
|
!oldBusServer.getServerPort().equals(busServer.getServerPort()) ||
|
|
|
oldBusServer.getServerPort().equals(busServer.getServerPort()) ||
|
|
|
!oldBusServer.getServerIp().equals(busServer.getServerIp())) {
|
|
|
|
|
|
// 根据 ServerIp以及ServerPort(同时),进行查询校验
|
...
|
...
|
|