mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-04-16 13:23:42 +00:00
feat: 全局格式化代码
This commit is contained in:
@@ -7,10 +7,13 @@ import org.springframework.ai.tool.ToolCallbackProvider;
|
||||
import org.springframework.ai.tool.definition.ToolDefinition;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 动态MCP工具回调提供者
|
||||
*
|
||||
* <p>
|
||||
* 这个类有大问题 ,没有测试!!!!!!!
|
||||
*/
|
||||
@Component
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package org.ruoyi.mcp.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
public class McpConfig {
|
||||
@JsonProperty("mcpServers")
|
||||
|
||||
@@ -5,10 +5,15 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.ruoyi.mcp.service.McpInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class McpProcessManager {
|
||||
@@ -22,6 +27,7 @@ public class McpProcessManager {
|
||||
|
||||
@Autowired
|
||||
private McpInfoService mcpInfoService;
|
||||
|
||||
/**
|
||||
* 启动 MCP 服务器进程(支持环境变量)
|
||||
*/
|
||||
@@ -97,6 +103,7 @@ public class McpProcessManager {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送 MCP 消息
|
||||
*/
|
||||
@@ -193,6 +200,7 @@ public class McpProcessManager {
|
||||
|
||||
return commandList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否为 Windows 系统
|
||||
*/
|
||||
@@ -216,6 +224,7 @@ public class McpProcessManager {
|
||||
System.err.println("Failed to read error output: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止 MCP 服务器进程
|
||||
*/
|
||||
@@ -333,9 +342,20 @@ public class McpProcessManager {
|
||||
}
|
||||
|
||||
// Getters
|
||||
public String getName() { return name; }
|
||||
public Process getProcess() { return process; }
|
||||
public McpServerConfig getConfig() { return config; }
|
||||
public LocalDateTime getStartTime() { return startTime; }
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Process getProcess() {
|
||||
return process;
|
||||
}
|
||||
|
||||
public McpServerConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public LocalDateTime getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package org.ruoyi.mcp.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.info.ProcessInfo;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
@@ -19,7 +17,6 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
|
||||
@Component
|
||||
public class McpProcessSSEManager {
|
||||
|
||||
@@ -94,6 +91,7 @@ public class McpProcessSSEManager {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private String getProcessId(Process process) {
|
||||
try {
|
||||
return String.valueOf(process.pid());
|
||||
@@ -101,6 +99,7 @@ public class McpProcessSSEManager {
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
private void readProcessOutput(String serverName, Process process) {
|
||||
try (BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream()))) {
|
||||
@@ -112,6 +111,7 @@ public class McpProcessSSEManager {
|
||||
System.err.println("Error reading output from " + serverName + ": " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取错误输出
|
||||
*/
|
||||
@@ -127,6 +127,7 @@ public class McpProcessSSEManager {
|
||||
System.err.println("Failed to read error output: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化 SSE 连接
|
||||
*/
|
||||
@@ -201,7 +202,6 @@ public class McpProcessSSEManager {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 构建命令列表
|
||||
*/
|
||||
@@ -220,6 +220,7 @@ public class McpProcessSSEManager {
|
||||
|
||||
return commandList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否为 Windows 系统
|
||||
*/
|
||||
@@ -260,6 +261,7 @@ public class McpProcessSSEManager {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查 MCP 服务器是否运行
|
||||
*/
|
||||
@@ -267,6 +269,7 @@ public class McpProcessSSEManager {
|
||||
Process process = runningProcesses.get(serverName);
|
||||
return process != null && process.isAlive();
|
||||
}
|
||||
|
||||
/**
|
||||
* 进程信息类
|
||||
*/
|
||||
@@ -274,11 +277,21 @@ public class McpProcessSSEManager {
|
||||
private String pid;
|
||||
private long startTime;
|
||||
|
||||
public String getPid() { return pid; }
|
||||
public void setPid(String pid) { this.pid = pid; }
|
||||
public String getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public long getStartTime() { return startTime; }
|
||||
public void setStartTime(long startTime) { this.startTime = startTime; }
|
||||
public void setPid(String pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(long startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public long getUptime() {
|
||||
return System.currentTimeMillis() - startTime;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.ruoyi.mcp.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
@@ -162,6 +160,25 @@ public class McpSSEToolInvoker {
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map<String, Object> convertToMap(Object parameters) {
|
||||
if (parameters instanceof Map) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
Map<?, ?> paramMap = (Map<?, ?>) parameters;
|
||||
for (Map.Entry<?, ?> entry : paramMap.entrySet()) {
|
||||
if (entry.getKey() instanceof String) {
|
||||
result.put((String) entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
private void registerStreamHandler(String requestId, StreamHandler streamHandler) {
|
||||
// 实现流式处理器注册逻辑
|
||||
}
|
||||
|
||||
/**
|
||||
* 流式处理器
|
||||
*/
|
||||
@@ -184,23 +201,4 @@ public class McpSSEToolInvoker {
|
||||
emitter.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map<String, Object> convertToMap(Object parameters) {
|
||||
if (parameters instanceof Map) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
Map<?, ?> paramMap = (Map<?, ?>) parameters;
|
||||
for (Map.Entry<?, ?> entry : paramMap.entrySet()) {
|
||||
if (entry.getKey() instanceof String) {
|
||||
result.put((String) entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
private void registerStreamHandler(String requestId, StreamHandler streamHandler) {
|
||||
// 实现流式处理器注册逻辑
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ public class McpServerConfig {
|
||||
private Map<String, String> env;
|
||||
private String Description;
|
||||
private String workingDirectory;
|
||||
|
||||
// getters and setters
|
||||
public String getCommand() {
|
||||
return command;
|
||||
@@ -41,6 +42,7 @@ public class McpServerConfig {
|
||||
public void setDescription(String description) {
|
||||
Description = description;
|
||||
}
|
||||
|
||||
public String getWorkingDirectory() {
|
||||
return workingDirectory;
|
||||
}
|
||||
@@ -48,6 +50,7 @@ public class McpServerConfig {
|
||||
public void setWorkingDirectory(String workingDirectory) {
|
||||
this.workingDirectory = workingDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "McpServerConfig{" +
|
||||
|
||||
@@ -67,6 +67,7 @@ public class McpToolInvoker {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理 MCP 服务器的响应消息
|
||||
*/
|
||||
|
||||
@@ -1,32 +1,31 @@
|
||||
package org.ruoyi.mcp.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.ruoyi.domain.McpInfo;
|
||||
import org.ruoyi.domain.bo.McpInfoBo;
|
||||
import org.ruoyi.domain.vo.McpInfoVo;
|
||||
import org.ruoyi.mcp.config.McpConfig;
|
||||
import org.ruoyi.mcp.config.McpServerConfig;
|
||||
import org.ruoyi.mcp.domain.McpInfoRequest;
|
||||
import org.ruoyi.mcp.service.McpInfoService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.ruoyi.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.ruoyi.common.log.annotation.Log;
|
||||
import org.ruoyi.common.web.core.BaseController;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.ruoyi.common.core.domain.R;
|
||||
import org.ruoyi.common.core.validate.AddGroup;
|
||||
import org.ruoyi.common.core.validate.EditGroup;
|
||||
import org.ruoyi.common.log.enums.BusinessType;
|
||||
import org.ruoyi.common.excel.utils.ExcelUtil;
|
||||
|
||||
import org.ruoyi.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.ruoyi.common.log.annotation.Log;
|
||||
import org.ruoyi.common.log.enums.BusinessType;
|
||||
import org.ruoyi.common.web.core.BaseController;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.domain.McpInfo;
|
||||
import org.ruoyi.domain.bo.McpInfoBo;
|
||||
import org.ruoyi.domain.vo.McpInfoVo;
|
||||
import org.ruoyi.mcp.config.McpServerConfig;
|
||||
import org.ruoyi.mcp.domain.McpInfoRequest;
|
||||
import org.ruoyi.mcp.service.McpInfoService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* MCP
|
||||
@@ -42,11 +41,11 @@ public class McpInfoController extends BaseController {
|
||||
|
||||
private final McpInfoService mcpInfoService;
|
||||
|
||||
/**
|
||||
* 查询MCP列表
|
||||
*/
|
||||
@SaCheckPermission("operator:mcpInfo:list")
|
||||
@GetMapping("/list")
|
||||
/**
|
||||
* 查询MCP列表
|
||||
*/
|
||||
@SaCheckPermission("operator:mcpInfo:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<McpInfoVo> list(McpInfoBo bo, PageQuery pageQuery) {
|
||||
return mcpInfoService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
@@ -70,7 +69,7 @@ public class McpInfoController extends BaseController {
|
||||
@SaCheckPermission("operator:mcpInfo:query")
|
||||
@GetMapping("/{mcpId}")
|
||||
public R<McpInfoVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Integer mcpId) {
|
||||
@PathVariable Integer mcpId) {
|
||||
return R.ok(mcpInfoService.queryById(mcpId));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,18 +11,43 @@ public class McpInfoRequest {
|
||||
private String description;
|
||||
|
||||
// getters and setters
|
||||
public String getServerName() { return serverName; }
|
||||
public void setServerName(String serverName) { this.serverName = serverName; }
|
||||
public String getServerName() {
|
||||
return serverName;
|
||||
}
|
||||
|
||||
public String getCommand() { return command; }
|
||||
public void setCommand(String command) { this.command = command; }
|
||||
public void setServerName(String serverName) {
|
||||
this.serverName = serverName;
|
||||
}
|
||||
|
||||
public List<String> getArgs() { return args; }
|
||||
public void setArgs(List<String> args) { this.args = args; }
|
||||
public String getCommand() {
|
||||
return command;
|
||||
}
|
||||
|
||||
public Map<String, String> getEnv() { return env; }
|
||||
public void setEnv(Map<String, String> env) { this.env = env; }
|
||||
public void setCommand(String command) {
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
public String getDescription() { return description; }
|
||||
public void setDescription(String description) { this.description = description; }
|
||||
public List<String> getArgs() {
|
||||
return args;
|
||||
}
|
||||
|
||||
public void setArgs(List<String> args) {
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
public Map<String, String> getEnv() {
|
||||
return env;
|
||||
}
|
||||
|
||||
public void setEnv(Map<String, String> env) {
|
||||
this.env = env;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package org.ruoyi.mcp.service;
|
||||
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import org.ruoyi.domain.McpInfo;
|
||||
import org.ruoyi.domain.bo.McpInfoBo;
|
||||
import org.ruoyi.domain.vo.McpInfoVo;
|
||||
import org.ruoyi.mcp.config.McpConfig;
|
||||
import org.ruoyi.mcp.config.McpServerConfig;
|
||||
import org.ruoyi.mcp.domain.McpInfoRequest;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.domain.McpInfo;
|
||||
import org.ruoyi.domain.bo.McpInfoBo;
|
||||
import org.ruoyi.domain.vo.McpInfoVo;
|
||||
import org.ruoyi.mcp.config.McpConfig;
|
||||
import org.ruoyi.mcp.config.McpServerConfig;
|
||||
import org.ruoyi.mcp.domain.McpInfoRequest;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -23,12 +23,12 @@ public interface McpInfoService {
|
||||
/**
|
||||
* 查询MCP
|
||||
*/
|
||||
McpInfoVo queryById(Integer mcpId);
|
||||
McpInfoVo queryById(Integer mcpId);
|
||||
|
||||
/**
|
||||
* 查询MCP列表
|
||||
*/
|
||||
TableDataInfo<McpInfoVo> queryPageList(McpInfoBo bo, PageQuery pageQuery);
|
||||
/**
|
||||
* 查询MCP列表
|
||||
*/
|
||||
TableDataInfo<McpInfoVo> queryPageList(McpInfoBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询MCP列表
|
||||
|
||||
@@ -7,9 +7,10 @@ import org.ruoyi.mcp.config.McpServerConfig;
|
||||
import org.ruoyi.mcp.domain.McpInfoRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
@@ -39,7 +40,7 @@ public class McpToolManagementService {
|
||||
System.out.println("Starting MCP server: " + serverName);
|
||||
System.out.println("Starting MCP serverConfig: " + serverConfig);
|
||||
// 启动 MCP 服务器进程
|
||||
boolean started = mcpProcessManager.startMcpServer(serverName,serverConfig);
|
||||
boolean started = mcpProcessManager.startMcpServer(serverName, serverConfig);
|
||||
|
||||
if (started) {
|
||||
successCount++;
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package org.ruoyi.mcp.service.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.ruoyi.common.core.utils.MapstructUtils;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.ruoyi.common.core.utils.MapstructUtils;
|
||||
import org.ruoyi.common.core.utils.StringUtils;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.domain.McpInfo;
|
||||
import org.ruoyi.domain.bo.McpInfoBo;
|
||||
import org.ruoyi.domain.vo.McpInfoVo;
|
||||
@@ -19,8 +20,6 @@ import org.ruoyi.mcp.domain.McpInfoRequest;
|
||||
import org.ruoyi.mcp.service.McpInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import org.ruoyi.common.core.utils.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -35,6 +34,7 @@ public class McpInfoServiceImpl implements McpInfoService {
|
||||
|
||||
private final McpInfoMapper baseMapper;
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
/**
|
||||
* 查询MCP
|
||||
*/
|
||||
@@ -43,15 +43,15 @@ public class McpInfoServiceImpl implements McpInfoService {
|
||||
return baseMapper.selectVoById(mcpId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询MCP列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<McpInfoVo> queryPageList(McpInfoBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<McpInfo> lqw = buildQueryWrapper(bo);
|
||||
Page<McpInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
/**
|
||||
* 查询MCP列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<McpInfoVo> queryPageList(McpInfoBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<McpInfo> lqw = buildQueryWrapper(bo);
|
||||
Page<McpInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询MCP列表
|
||||
@@ -64,10 +64,10 @@ public class McpInfoServiceImpl implements McpInfoService {
|
||||
|
||||
private LambdaQueryWrapper<McpInfo> buildQueryWrapper(McpInfoBo bo) {
|
||||
LambdaQueryWrapper<McpInfo> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getServerName()), McpInfo::getServerName, bo.getServerName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getTransportType()), McpInfo::getTransportType, bo.getTransportType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCommand()), McpInfo::getCommand, bo.getCommand());
|
||||
lqw.eq(bo.getStatus() != null, McpInfo::getStatus, bo.getStatus());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getServerName()), McpInfo::getServerName, bo.getServerName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getTransportType()), McpInfo::getTransportType, bo.getTransportType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCommand()), McpInfo::getCommand, bo.getCommand());
|
||||
lqw.eq(bo.getStatus() != null, McpInfo::getStatus, bo.getStatus());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class McpInfoServiceImpl implements McpInfoService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(McpInfoBo bo) {
|
||||
McpInfo add = MapstructUtils.convert(bo, McpInfo. class);
|
||||
McpInfo add = MapstructUtils.convert(bo, McpInfo.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
@@ -90,7 +90,7 @@ public class McpInfoServiceImpl implements McpInfoService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(McpInfoBo bo) {
|
||||
McpInfo update = MapstructUtils.convert(bo, McpInfo. class);
|
||||
McpInfo update = MapstructUtils.convert(bo, McpInfo.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
@@ -228,7 +228,8 @@ public class McpInfoServiceImpl implements McpInfoService {
|
||||
try {
|
||||
// 解析 args
|
||||
if (tool.getArguments() != null && !tool.getArguments().isEmpty()) {
|
||||
List<String> args = objectMapper.readValue(tool.getArguments(), new TypeReference<List<String>>() {});
|
||||
List<String> args = objectMapper.readValue(tool.getArguments(), new TypeReference<List<String>>() {
|
||||
});
|
||||
config.setArgs(args);
|
||||
} else {
|
||||
config.setArgs(new ArrayList<>());
|
||||
@@ -236,7 +237,8 @@ public class McpInfoServiceImpl implements McpInfoService {
|
||||
|
||||
// 解析 env
|
||||
if (tool.getEnv() != null && !tool.getEnv().isEmpty()) {
|
||||
Map<String, String> env = objectMapper.readValue(tool.getEnv(), new TypeReference<Map<String, String>>() {});
|
||||
Map<String, String> env = objectMapper.readValue(tool.getEnv(), new TypeReference<Map<String, String>>() {
|
||||
});
|
||||
config.setEnv(env);
|
||||
} else {
|
||||
config.setEnv(new HashMap<>());
|
||||
|
||||
Reference in New Issue
Block a user