start new programming
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
package io.wdd.server.beans.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.cglib.core.Local;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -39,18 +37,19 @@ public class AppInfoPO implements Serializable {
|
||||
private String appVersion;
|
||||
|
||||
/**
|
||||
*
|
||||
* app associated domain name
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
private String appDomainName;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -81,6 +80,7 @@ public class AppInfoPO implements Serializable {
|
||||
&& (this.getAppName() == null ? other.getAppName() == null : this.getAppName().equals(other.getAppName()))
|
||||
&& (this.getAppInfo() == null ? other.getAppInfo() == null : this.getAppInfo().equals(other.getAppInfo()))
|
||||
&& (this.getAppVersion() == null ? other.getAppVersion() == null : this.getAppVersion().equals(other.getAppVersion()))
|
||||
&& (this.getAppDomainName() == null ? other.getAppDomainName() == null : this.getAppDomainName().equals(other.getAppDomainName()))
|
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
|
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
|
||||
&& (this.getCommont() == null ? other.getCommont() == null : this.getCommont().equals(other.getCommont()))
|
||||
@@ -95,6 +95,7 @@ public class AppInfoPO implements Serializable {
|
||||
result = prime * result + ((getAppName() == null) ? 0 : getAppName().hashCode());
|
||||
result = prime * result + ((getAppInfo() == null) ? 0 : getAppInfo().hashCode());
|
||||
result = prime * result + ((getAppVersion() == null) ? 0 : getAppVersion().hashCode());
|
||||
result = prime * result + ((getAppDomainName() == null) ? 0 : getAppDomainName().hashCode());
|
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
|
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
|
||||
result = prime * result + ((getCommont() == null) ? 0 : getCommont().hashCode());
|
||||
@@ -112,6 +113,7 @@ public class AppInfoPO implements Serializable {
|
||||
sb.append(", appName=").append(appName);
|
||||
sb.append(", appInfo=").append(appInfo);
|
||||
sb.append(", appVersion=").append(appVersion);
|
||||
sb.append(", appDomainName=").append(appDomainName);
|
||||
sb.append(", createTime=").append(createTime);
|
||||
sb.append(", updateTime=").append(updateTime);
|
||||
sb.append(", commont=").append(commont);
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package io.wdd.server.beans.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName server_app_relation
|
||||
*/
|
||||
@TableName(value ="server_app_relation")
|
||||
@Data
|
||||
public class ServerAppRelationPO implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long serverId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long appId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ServerAppRelationPO other = (ServerAppRelationPO) that;
|
||||
return (this.getServerId() == null ? other.getServerId() == null : this.getServerId().equals(other.getServerId()))
|
||||
&& (this.getAppId() == null ? other.getAppId() == null : this.getAppId().equals(other.getAppId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getServerId() == null) ? 0 : getServerId().hashCode());
|
||||
result = prime * result + ((getAppId() == null) ? 0 : getAppId().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", serverId=").append(serverId);
|
||||
sb.append(", appId=").append(appId);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -4,97 +4,120 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName server_info
|
||||
*/
|
||||
@TableName(value = "server_info")
|
||||
@TableName(value ="server_info")
|
||||
@Data
|
||||
public class ServerInfoPO implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* server primary key
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long serverId;
|
||||
|
||||
/**
|
||||
* server host name
|
||||
*/
|
||||
private String serverName;
|
||||
|
||||
/**
|
||||
* server public ipv4
|
||||
|
||||
*/
|
||||
private String serverIpPbV4;
|
||||
|
||||
/**
|
||||
* server inner ipv4
|
||||
|
||||
*/
|
||||
private String serverIpInV4;
|
||||
|
||||
/**
|
||||
* server public ipv6
|
||||
|
||||
*/
|
||||
private String serverIpPbV6;
|
||||
|
||||
/**
|
||||
* server inner ipv6
|
||||
|
||||
*/
|
||||
private String serverIpInV6;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private LocalDateTime registerTime;
|
||||
private Date registerTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private LocalDateTime expireTime;
|
||||
private Date expireTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private String location;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private String provider;
|
||||
|
||||
/**
|
||||
* split by ,
|
||||
*/
|
||||
private String managePort;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private Integer cpuCore;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private String cpuBrand;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private String osInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private String osKernelInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 0 alive || 1 deleted
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* optimistic lock for concurrent
|
||||
*/
|
||||
private Integer version;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
@@ -108,24 +131,24 @@ public class ServerInfoPO implements Serializable {
|
||||
}
|
||||
ServerInfoPO other = (ServerInfoPO) that;
|
||||
return (this.getServerId() == null ? other.getServerId() == null : this.getServerId().equals(other.getServerId()))
|
||||
&& (this.getServerName() == null ? other.getServerName() == null : this.getServerName().equals(other.getServerName()))
|
||||
&& (this.getServerIpPbV4() == null ? other.getServerIpPbV4() == null : this.getServerIpPbV4().equals(other.getServerIpPbV4()))
|
||||
&& (this.getServerIpInV4() == null ? other.getServerIpInV4() == null : this.getServerIpInV4().equals(other.getServerIpInV4()))
|
||||
&& (this.getServerIpPbV6() == null ? other.getServerIpPbV6() == null : this.getServerIpPbV6().equals(other.getServerIpPbV6()))
|
||||
&& (this.getServerIpInV6() == null ? other.getServerIpInV6() == null : this.getServerIpInV6().equals(other.getServerIpInV6()))
|
||||
&& (this.getRegisterTime() == null ? other.getRegisterTime() == null : this.getRegisterTime().equals(other.getRegisterTime()))
|
||||
&& (this.getExpireTime() == null ? other.getExpireTime() == null : this.getExpireTime().equals(other.getExpireTime()))
|
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
|
||||
&& (this.getLocation() == null ? other.getLocation() == null : this.getLocation().equals(other.getLocation()))
|
||||
&& (this.getProvider() == null ? other.getProvider() == null : this.getProvider().equals(other.getProvider()))
|
||||
&& (this.getManagePort() == null ? other.getManagePort() == null : this.getManagePort().equals(other.getManagePort()))
|
||||
&& (this.getCpuCore() == null ? other.getCpuCore() == null : this.getCpuCore().equals(other.getCpuCore()))
|
||||
&& (this.getCpuBrand() == null ? other.getCpuBrand() == null : this.getCpuBrand().equals(other.getCpuBrand()))
|
||||
&& (this.getOsInfo() == null ? other.getOsInfo() == null : this.getOsInfo().equals(other.getOsInfo()))
|
||||
&& (this.getOsKernelInfo() == null ? other.getOsKernelInfo() == null : this.getOsKernelInfo().equals(other.getOsKernelInfo()))
|
||||
&& (this.getComment() == null ? other.getComment() == null : this.getComment().equals(other.getComment()))
|
||||
&& (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()))
|
||||
&& (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()));
|
||||
&& (this.getServerName() == null ? other.getServerName() == null : this.getServerName().equals(other.getServerName()))
|
||||
&& (this.getServerIpPbV4() == null ? other.getServerIpPbV4() == null : this.getServerIpPbV4().equals(other.getServerIpPbV4()))
|
||||
&& (this.getServerIpInV4() == null ? other.getServerIpInV4() == null : this.getServerIpInV4().equals(other.getServerIpInV4()))
|
||||
&& (this.getServerIpPbV6() == null ? other.getServerIpPbV6() == null : this.getServerIpPbV6().equals(other.getServerIpPbV6()))
|
||||
&& (this.getServerIpInV6() == null ? other.getServerIpInV6() == null : this.getServerIpInV6().equals(other.getServerIpInV6()))
|
||||
&& (this.getRegisterTime() == null ? other.getRegisterTime() == null : this.getRegisterTime().equals(other.getRegisterTime()))
|
||||
&& (this.getExpireTime() == null ? other.getExpireTime() == null : this.getExpireTime().equals(other.getExpireTime()))
|
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
|
||||
&& (this.getLocation() == null ? other.getLocation() == null : this.getLocation().equals(other.getLocation()))
|
||||
&& (this.getProvider() == null ? other.getProvider() == null : this.getProvider().equals(other.getProvider()))
|
||||
&& (this.getManagePort() == null ? other.getManagePort() == null : this.getManagePort().equals(other.getManagePort()))
|
||||
&& (this.getCpuCore() == null ? other.getCpuCore() == null : this.getCpuCore().equals(other.getCpuCore()))
|
||||
&& (this.getCpuBrand() == null ? other.getCpuBrand() == null : this.getCpuBrand().equals(other.getCpuBrand()))
|
||||
&& (this.getOsInfo() == null ? other.getOsInfo() == null : this.getOsInfo().equals(other.getOsInfo()))
|
||||
&& (this.getOsKernelInfo() == null ? other.getOsKernelInfo() == null : this.getOsKernelInfo().equals(other.getOsKernelInfo()))
|
||||
&& (this.getComment() == null ? other.getComment() == null : this.getComment().equals(other.getComment()))
|
||||
&& (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()))
|
||||
&& (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -156,30 +179,31 @@ public class ServerInfoPO implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String sb = getClass().getSimpleName() +
|
||||
" [" +
|
||||
"Hash = " + hashCode() +
|
||||
", serverId=" + serverId +
|
||||
", serverName=" + serverName +
|
||||
", serverIpPbV4=" + serverIpPbV4 +
|
||||
", serverIpInV4=" + serverIpInV4 +
|
||||
", serverIpPbV6=" + serverIpPbV6 +
|
||||
", serverIpInV6=" + serverIpInV6 +
|
||||
", registerTime=" + registerTime +
|
||||
", expireTime=" + expireTime +
|
||||
", updateTime=" + updateTime +
|
||||
", location=" + location +
|
||||
", provider=" + provider +
|
||||
", managePort=" + managePort +
|
||||
", cpuCore=" + cpuCore +
|
||||
", cpuBrand=" + cpuBrand +
|
||||
", osInfo=" + osInfo +
|
||||
", osKernelInfo=" + osKernelInfo +
|
||||
", comment=" + comment +
|
||||
", isDelete=" + isDelete +
|
||||
", version=" + version +
|
||||
", serialVersionUID=" + serialVersionUID +
|
||||
"]";
|
||||
return sb;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", serverId=").append(serverId);
|
||||
sb.append(", serverName=").append(serverName);
|
||||
sb.append(", serverIpPbV4=").append(serverIpPbV4);
|
||||
sb.append(", serverIpInV4=").append(serverIpInV4);
|
||||
sb.append(", serverIpPbV6=").append(serverIpPbV6);
|
||||
sb.append(", serverIpInV6=").append(serverIpInV6);
|
||||
sb.append(", registerTime=").append(registerTime);
|
||||
sb.append(", expireTime=").append(expireTime);
|
||||
sb.append(", updateTime=").append(updateTime);
|
||||
sb.append(", location=").append(location);
|
||||
sb.append(", provider=").append(provider);
|
||||
sb.append(", managePort=").append(managePort);
|
||||
sb.append(", cpuCore=").append(cpuCore);
|
||||
sb.append(", cpuBrand=").append(cpuBrand);
|
||||
sb.append(", osInfo=").append(osInfo);
|
||||
sb.append(", osKernelInfo=").append(osKernelInfo);
|
||||
sb.append(", comment=").append(comment);
|
||||
sb.append(", isDelete=").append(isDelete);
|
||||
sb.append(", version=").append(version);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,51 +1,47 @@
|
||||
package io.wdd.server.beans.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.wdd.server.beans.po.AppInfoPO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* (AppInfo)实体类对应的VO类
|
||||
*
|
||||
* @author icederce
|
||||
* @since 2022-11-26 11:42:54
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder(toBuilder = true)
|
||||
public class AppInfoVO {
|
||||
public class AppInfoVO {
|
||||
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
private String appInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
private String appVersion;
|
||||
|
||||
/**
|
||||
*
|
||||
* app associated domain name
|
||||
*/
|
||||
private String appDomainName;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
private String commont;
|
||||
/**
|
||||
* 0 alive || 1 deleted
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.wdd.server.controller;
|
||||
|
||||
|
||||
import io.wdd.server.beans.vo.AppInfoVO;
|
||||
import io.wdd.wddcommon.utils.R;
|
||||
import io.wdd.server.beans.po.ServerInfoPO;
|
||||
import io.wdd.server.beans.vo.ServerInfoVO;
|
||||
@@ -72,4 +73,19 @@ public class ServerController {
|
||||
return R.failed("Delete Server Failed !");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Associated with appInfo
|
||||
* server 1______n app
|
||||
* */
|
||||
|
||||
@GetMapping("/getAllApp")
|
||||
public R<List<AppInfoVO>> getAllAppInfo(
|
||||
@RequestParam(value = "serverId", required = true) Long serverId
|
||||
){
|
||||
|
||||
return R.ok(coreServerService.getAllAppInfo(serverId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.wdd.server.coreService;
|
||||
|
||||
import io.wdd.server.beans.po.ServerInfoPO;
|
||||
import io.wdd.server.beans.vo.AppInfoVO;
|
||||
import io.wdd.server.beans.vo.ServerInfoVO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -18,4 +19,6 @@ public interface CoreServerService {
|
||||
boolean updateServerInfo(ServerInfoPO serverInfoPO);
|
||||
|
||||
boolean deleteServer(Long serverId, String serverName);
|
||||
|
||||
List<AppInfoVO> getAllAppInfo(Long serverId);
|
||||
}
|
||||
|
||||
@@ -2,16 +2,24 @@ package io.wdd.server.coreService.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||
import com.google.errorprone.annotations.Var;
|
||||
import io.wdd.server.beans.po.AppInfoPO;
|
||||
import io.wdd.server.beans.po.ServerAppRelationPO;
|
||||
import io.wdd.server.beans.po.ServerInfoPO;
|
||||
import io.wdd.server.beans.vo.AppInfoVO;
|
||||
import io.wdd.server.beans.vo.ServerInfoVO;
|
||||
import io.wdd.server.coreService.CoreServerService;
|
||||
import io.wdd.server.service.AppInfoService;
|
||||
import io.wdd.server.service.ServerAppRelationService;
|
||||
import io.wdd.server.service.ServerInfoService;
|
||||
import io.wdd.server.utils.EntityUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -20,9 +28,17 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class CoreServerServiceImpl implements CoreServerService {
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
ServerInfoService serverInfoService;
|
||||
|
||||
@Resource
|
||||
ServerAppRelationService serverAppRelationService;
|
||||
|
||||
@Resource
|
||||
AppInfoService appInfoService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<ServerInfoPO> getServerInfoSingle(String serverName, String ipv4, String serverLocation) {
|
||||
|
||||
@@ -47,7 +63,10 @@ public class CoreServerServiceImpl implements CoreServerService {
|
||||
@Override
|
||||
public List<ServerInfoVO> getServerInfoListIncludeDelete() {
|
||||
|
||||
return this.covertServerPOtoVO(serverInfoService.getAll());
|
||||
// todo how to solve the problem?
|
||||
// this.covertServerPOtoVO(serverInfoService.getAll());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,10 +103,29 @@ public class CoreServerServiceImpl implements CoreServerService {
|
||||
.eq(StringUtils.isNoneEmpty(serverName), ServerInfoPO::getServerName, serverName)
|
||||
.set(ServerInfoPO::getIsDelete, 1)
|
||||
.update();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private List<ServerInfoVO> covertServerPOtoVO(List<ServerInfoPO> serverInfoPOList){
|
||||
@Override
|
||||
public List<AppInfoVO> getAllAppInfo(Long serverId) {
|
||||
|
||||
// serverInfo --- server_app_relation --- appInfo
|
||||
|
||||
List<ServerAppRelationPO> serverAppRelationPOList = new LambdaQueryChainWrapper<ServerAppRelationPO>(serverAppRelationService.getBaseMapper()).eq(ServerAppRelationPO::getServerId, serverId).list();
|
||||
|
||||
|
||||
// query the app info with specific server id
|
||||
List<AppInfoPO> appInfoPOList = appInfoService.listByIds(serverAppRelationPOList.stream().map(
|
||||
serverAppRelationPO -> {
|
||||
return serverAppRelationPO.getAppId();
|
||||
}
|
||||
).collect(Collectors.toList()));
|
||||
|
||||
|
||||
return EntityUtils.cvToTarget(appInfoPOList,AppInfoVO.class);
|
||||
}
|
||||
|
||||
private List<ServerInfoVO> covertServerPOtoVO(List<ServerInfoPO> serverInfoPOList) {
|
||||
|
||||
if (null == serverInfoPOList || serverInfoPOList.size() == 0) {
|
||||
return Collections.emptyList();
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
/**
|
||||
* @author wdd
|
||||
* @description 针对表【app_info】的数据库操作Mapper
|
||||
* @createDate 2022-11-20 16:49:20
|
||||
* @createDate 2022-11-27 13:52:13
|
||||
* @Entity io.wdd.server.beans.po.AppInfoPO
|
||||
*/
|
||||
public interface AppInfoMapper extends BaseMapper<AppInfoPO> {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package io.wdd.server.mapper;
|
||||
|
||||
import io.wdd.server.beans.po.ServerAppRelationPO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author wdd
|
||||
* @description 针对表【server_app_relation】的数据库操作Mapper
|
||||
* @createDate 2022-11-27 13:53:22
|
||||
* @Entity io.wdd.server.beans.po.ServerAppRelationPO
|
||||
*/
|
||||
public interface ServerAppRelationMapper extends BaseMapper<ServerAppRelationPO> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,17 +3,14 @@ package io.wdd.server.mapper;
|
||||
import io.wdd.server.beans.po.ServerInfoPO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wdd
|
||||
* @description 针对表【server_info】的数据库操作Mapper
|
||||
* @createDate 2022-11-20 16:16:52
|
||||
* @createDate 2022-11-27 13:46:54
|
||||
* @Entity io.wdd.server.beans.po.ServerInfoPO
|
||||
*/
|
||||
public interface ServerInfoMapper extends BaseMapper<ServerInfoPO> {
|
||||
|
||||
List<ServerInfoPO> getAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
/**
|
||||
* @author wdd
|
||||
* @description 针对表【app_info】的数据库操作Service
|
||||
* @createDate 2022-11-20 16:49:20
|
||||
* @createDate 2022-11-27 13:52:13
|
||||
*/
|
||||
public interface AppInfoService extends IService<AppInfoPO> {
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package io.wdd.server.service;
|
||||
|
||||
import io.wdd.server.beans.po.ServerAppRelationPO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author wdd
|
||||
* @description 针对表【server_app_relation】的数据库操作Service
|
||||
* @createDate 2022-11-27 13:53:22
|
||||
*/
|
||||
public interface ServerAppRelationService extends IService<ServerAppRelationPO> {
|
||||
|
||||
}
|
||||
@@ -3,18 +3,11 @@ package io.wdd.server.service;
|
||||
import io.wdd.server.beans.po.ServerInfoPO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wdd
|
||||
* @description 针对表【server_info】的数据库操作Service
|
||||
* @createDate 2022-11-20 16:16:52
|
||||
* @createDate 2022-11-27 13:46:54
|
||||
*/
|
||||
public interface ServerInfoService extends IService<ServerInfoPO> {
|
||||
|
||||
/**
|
||||
* @return all servers include delete servers
|
||||
*/
|
||||
List<ServerInfoPO> getAll();
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.springframework.stereotype.Service;
|
||||
/**
|
||||
* @author wdd
|
||||
* @description 针对表【app_info】的数据库操作Service实现
|
||||
* @createDate 2022-11-20 16:49:20
|
||||
* @createDate 2022-11-27 13:52:13
|
||||
*/
|
||||
@Service
|
||||
public class AppInfoServiceImpl extends ServiceImpl<AppInfoMapper, AppInfoPO>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package io.wdd.server.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import io.wdd.server.beans.po.ServerAppRelationPO;
|
||||
import io.wdd.server.service.ServerAppRelationService;
|
||||
import io.wdd.server.mapper.ServerAppRelationMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author wdd
|
||||
* @description 针对表【server_app_relation】的数据库操作Service实现
|
||||
* @createDate 2022-11-27 13:53:22
|
||||
*/
|
||||
@Service
|
||||
public class ServerAppRelationServiceImpl extends ServiceImpl<ServerAppRelationMapper, ServerAppRelationPO>
|
||||
implements ServerAppRelationService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,22 +6,15 @@ import io.wdd.server.service.ServerInfoService;
|
||||
import io.wdd.server.mapper.ServerInfoMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wdd
|
||||
* @description 针对表【server_info】的数据库操作Service实现
|
||||
* @createDate 2022-11-20 16:16:52
|
||||
* @createDate 2022-11-27 13:46:54
|
||||
*/
|
||||
@Service
|
||||
public class ServerInfoServiceImpl extends ServiceImpl<ServerInfoMapper, ServerInfoPO>
|
||||
implements ServerInfoService{
|
||||
|
||||
@Override
|
||||
public List<ServerInfoPO> getAll() {
|
||||
|
||||
return this.baseMapper.getAll();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<result property="appName" column="app_name" jdbcType="VARCHAR"/>
|
||||
<result property="appInfo" column="app_info" jdbcType="VARCHAR"/>
|
||||
<result property="appVersion" column="app_version" jdbcType="VARCHAR"/>
|
||||
<result property="appDomainName" column="app_domain_name" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="commont" column="commont" jdbcType="VARCHAR"/>
|
||||
@@ -17,7 +18,7 @@
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
app_id,app_name,app_info,
|
||||
app_version,create_time,update_time,
|
||||
commont,is_delete
|
||||
app_version,app_domain_name,create_time,
|
||||
update_time,commont,is_delete
|
||||
</sql>
|
||||
</mapper>
|
||||
|
||||
15
server/src/main/resources/mapper/ServerAppRelationMapper.xml
Normal file
15
server/src/main/resources/mapper/ServerAppRelationMapper.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="io.wdd.server.mapper.ServerAppRelationMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="io.wdd.server.beans.po.ServerAppRelationPO">
|
||||
<result property="serverId" column="server_id" jdbcType="BIGINT"/>
|
||||
<result property="appId" column="app_id" jdbcType="BIGINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
server_id,app_id
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -35,11 +35,4 @@
|
||||
os_kernel_info,comment,is_delete,
|
||||
version
|
||||
</sql>
|
||||
|
||||
<select id="getAll" resultType="io.wdd.server.beans.po.ServerInfoPO">
|
||||
select
|
||||
<include refid="Base_Column_List"></include>
|
||||
from
|
||||
server_info
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user