修改部分规则模块删除无用前端 新增前端界面
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
package com.solution.algo.domain;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.solution.common.annotation.Excel;
|
||||
import com.solution.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 规则对象 algorithm
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-06
|
||||
*/
|
||||
public class Algorithm
|
||||
{
|
||||
|
||||
/** */
|
||||
private Long id;
|
||||
|
||||
/** 算法名称 */
|
||||
@Excel(name = "算法名称")
|
||||
private String name;
|
||||
|
||||
/** 业务类型 */
|
||||
@Excel(name = "业务类型")
|
||||
private String type;
|
||||
|
||||
/** 算法文件路径 */
|
||||
@Excel(name = "算法文件路径")
|
||||
private String codePath;
|
||||
|
||||
/** 算法描述 */
|
||||
@Excel(name = "算法描述")
|
||||
private String description;
|
||||
|
||||
/** 算法参数定义信息 */
|
||||
private List<AlgorithmParam> algorithmParamList;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setCodePath(String codePath)
|
||||
{
|
||||
this.codePath = codePath;
|
||||
}
|
||||
|
||||
public String getCodePath()
|
||||
{
|
||||
return codePath;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public List<AlgorithmParam> getAlgorithmParamList()
|
||||
{
|
||||
return algorithmParamList;
|
||||
}
|
||||
|
||||
public void setAlgorithmParamList(List<AlgorithmParam> algorithmParamList)
|
||||
{
|
||||
this.algorithmParamList = algorithmParamList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("type", getType())
|
||||
.append("codePath", getCodePath())
|
||||
.append("description", getDescription())
|
||||
.append("algorithmParamList", getAlgorithmParamList())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.solution.algo.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.solution.common.annotation.Excel;
|
||||
import com.solution.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 算法参数定义对象 algorithm_param
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-06
|
||||
*/
|
||||
public class AlgorithmParam
|
||||
{
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 算法ID */
|
||||
@Excel(name = "算法ID")
|
||||
private Long algorithmId;
|
||||
|
||||
/** 参数名 */
|
||||
@Excel(name = "参数名")
|
||||
private String paramName;
|
||||
|
||||
/** 默认值 */
|
||||
@Excel(name = "默认值")
|
||||
private String defaultValue;
|
||||
|
||||
/** 描述 */
|
||||
@Excel(name = "描述")
|
||||
private String description;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setAlgorithmId(Long algorithmId)
|
||||
{
|
||||
this.algorithmId = algorithmId;
|
||||
}
|
||||
|
||||
public Long getAlgorithmId()
|
||||
{
|
||||
return algorithmId;
|
||||
}
|
||||
public void setParamName(String paramName)
|
||||
{
|
||||
this.paramName = paramName;
|
||||
}
|
||||
|
||||
public String getParamName()
|
||||
{
|
||||
return paramName;
|
||||
}
|
||||
public void setDefaultValue(String defaultValue)
|
||||
{
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public String getDefaultValue()
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("algorithmId", getAlgorithmId())
|
||||
.append("paramName", getParamName())
|
||||
.append("defaultValue", getDefaultValue())
|
||||
.append("description", getDescription())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,176 +0,0 @@
|
||||
package com.solution.algo.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.solution.common.annotation.Excel;
|
||||
import com.solution.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 动态规则配置对象 sys_algo_config
|
||||
*
|
||||
* @author zouju
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public class SysAlgoConfig extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 算法唯一标识(Type),用于接口路由 */
|
||||
@Excel(name = "算法唯一标识(Type),用于接口路由")
|
||||
private String algoType;
|
||||
|
||||
/** 算法名称,后台展示用 */
|
||||
@Excel(name = "算法名称,后台展示用")
|
||||
private String algoName;
|
||||
|
||||
/** 执行引擎类型: GROOVY, PYTHON, JS, LUA等 */
|
||||
@Excel(name = "执行引擎类型: GROOVY, PYTHON, JS, LUA等")
|
||||
private String engineType;
|
||||
|
||||
/** 参数定义模型(JSON Schema),用于自动校验入参 */
|
||||
@Excel(name = "参数定义模型(JSON Schema),用于自动校验入参")
|
||||
private String inputSchema;
|
||||
|
||||
/** 算法脚本代码或规则表达式 */
|
||||
@Excel(name = "算法脚本代码或规则表达式")
|
||||
private String scriptContent;
|
||||
|
||||
/** 算法描述 */
|
||||
@Excel(name = "算法描述")
|
||||
private String description;
|
||||
|
||||
/** 状态: 1-启用, 0-禁用 */
|
||||
@Excel(name = "状态: 1-启用, 0-禁用")
|
||||
private Long status;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date createdAt;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date updatedAt;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setAlgoType(String algoType)
|
||||
{
|
||||
this.algoType = algoType;
|
||||
}
|
||||
|
||||
public String getAlgoType()
|
||||
{
|
||||
return algoType;
|
||||
}
|
||||
|
||||
public void setAlgoName(String algoName)
|
||||
{
|
||||
this.algoName = algoName;
|
||||
}
|
||||
|
||||
public String getAlgoName()
|
||||
{
|
||||
return algoName;
|
||||
}
|
||||
|
||||
public void setEngineType(String engineType)
|
||||
{
|
||||
this.engineType = engineType;
|
||||
}
|
||||
|
||||
public String getEngineType()
|
||||
{
|
||||
return engineType;
|
||||
}
|
||||
|
||||
public void setInputSchema(String inputSchema)
|
||||
{
|
||||
this.inputSchema = inputSchema;
|
||||
}
|
||||
|
||||
public String getInputSchema()
|
||||
{
|
||||
return inputSchema;
|
||||
}
|
||||
|
||||
public void setScriptContent(String scriptContent)
|
||||
{
|
||||
this.scriptContent = scriptContent;
|
||||
}
|
||||
|
||||
public String getScriptContent()
|
||||
{
|
||||
return scriptContent;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setStatus(Long status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Date createdAt)
|
||||
{
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Date getCreatedAt()
|
||||
{
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Date updatedAt)
|
||||
{
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public Date getUpdatedAt()
|
||||
{
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("algoType", getAlgoType())
|
||||
.append("algoName", getAlgoName())
|
||||
.append("engineType", getEngineType())
|
||||
.append("inputSchema", getInputSchema())
|
||||
.append("scriptContent", getScriptContent())
|
||||
.append("description", getDescription())
|
||||
.append("status", getStatus())
|
||||
.append("createdAt", getCreatedAt())
|
||||
.append("updatedAt", getUpdatedAt())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.solution.algo.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.algo.domain.Algorithm;
|
||||
import com.solution.algo.domain.AlgorithmParam;
|
||||
|
||||
/**
|
||||
* 规则Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-06
|
||||
*/
|
||||
public interface AlgorithmMapper
|
||||
{
|
||||
/**
|
||||
* 查询规则
|
||||
*
|
||||
* @param id 规则主键
|
||||
* @return 规则
|
||||
*/
|
||||
public Algorithm selectAlgorithmById(Long id);
|
||||
|
||||
/**
|
||||
* 查询规则列表
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 规则集合
|
||||
*/
|
||||
public List<Algorithm> selectAlgorithmList(Algorithm algorithm);
|
||||
|
||||
/**
|
||||
* 新增规则
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAlgorithm(Algorithm algorithm);
|
||||
|
||||
/**
|
||||
* 修改规则
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAlgorithm(Algorithm algorithm);
|
||||
|
||||
/**
|
||||
* 删除规则
|
||||
*
|
||||
* @param id 规则主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlgorithmById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除规则
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlgorithmByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量删除算法参数定义
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlgorithmParamByAlgorithmIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量新增算法参数定义
|
||||
*
|
||||
* @param algorithmParamList 算法参数定义列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchAlgorithmParam(List<AlgorithmParam> algorithmParamList);
|
||||
|
||||
|
||||
/**
|
||||
* 通过规则主键删除算法参数定义信息
|
||||
*
|
||||
* @param id 规则ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlgorithmParamByAlgorithmId(Long id);
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.solution.algo.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.algo.domain.SysAlgoConfig;
|
||||
|
||||
/**
|
||||
* 动态规则配置Mapper接口
|
||||
*
|
||||
* @author zouju
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface SysAlgoConfigMapper
|
||||
{
|
||||
/**
|
||||
* 查询动态规则配置
|
||||
*
|
||||
* @param id 动态规则配置主键
|
||||
* @return 动态规则配置
|
||||
*/
|
||||
public SysAlgoConfig selectSysAlgoConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 查询动态规则配置列表
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 动态规则配置集合
|
||||
*/
|
||||
public List<SysAlgoConfig> selectSysAlgoConfigList(SysAlgoConfig sysAlgoConfig);
|
||||
|
||||
/**
|
||||
* 新增动态规则配置
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysAlgoConfig(SysAlgoConfig sysAlgoConfig);
|
||||
|
||||
/**
|
||||
* 修改动态规则配置
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysAlgoConfig(SysAlgoConfig sysAlgoConfig);
|
||||
|
||||
/**
|
||||
* 删除动态规则配置
|
||||
*
|
||||
* @param id 动态规则配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysAlgoConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除动态规则配置
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysAlgoConfigByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.solution.algo.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.algo.domain.Algorithm;
|
||||
|
||||
/**
|
||||
* 规则Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-06
|
||||
*/
|
||||
public interface IAlgorithmService
|
||||
{
|
||||
/**
|
||||
* 查询规则
|
||||
*
|
||||
* @param id 规则主键
|
||||
* @return 规则
|
||||
*/
|
||||
public Algorithm selectAlgorithmById(Long id);
|
||||
|
||||
/**
|
||||
* 查询规则列表
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 规则集合
|
||||
*/
|
||||
public List<Algorithm> selectAlgorithmList(Algorithm algorithm);
|
||||
|
||||
/**
|
||||
* 新增规则
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAlgorithm(Algorithm algorithm);
|
||||
|
||||
/**
|
||||
* 修改规则
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAlgorithm(Algorithm algorithm);
|
||||
|
||||
/**
|
||||
* 批量删除规则
|
||||
*
|
||||
* @param ids 需要删除的规则主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlgorithmByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除规则信息
|
||||
*
|
||||
* @param id 规则主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlgorithmById(Long id);
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.solution.algo.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.algo.domain.SysAlgoConfig;
|
||||
|
||||
/**
|
||||
* 动态规则配置Service接口
|
||||
*
|
||||
* @author zouju
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface ISysAlgoConfigService
|
||||
{
|
||||
/**
|
||||
* 查询动态规则配置
|
||||
*
|
||||
* @param id 动态规则配置主键
|
||||
* @return 动态规则配置
|
||||
*/
|
||||
public SysAlgoConfig selectSysAlgoConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 查询动态规则配置列表
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 动态规则配置集合
|
||||
*/
|
||||
public List<SysAlgoConfig> selectSysAlgoConfigList(SysAlgoConfig sysAlgoConfig);
|
||||
|
||||
/**
|
||||
* 新增动态规则配置
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysAlgoConfig(SysAlgoConfig sysAlgoConfig);
|
||||
|
||||
/**
|
||||
* 修改动态规则配置
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysAlgoConfig(SysAlgoConfig sysAlgoConfig);
|
||||
|
||||
/**
|
||||
* 批量删除动态规则配置
|
||||
*
|
||||
* @param ids 需要删除的动态规则配置主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysAlgoConfigByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除动态规则配置信息
|
||||
*
|
||||
* @param id 动态规则配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysAlgoConfigById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.solution.algo.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import com.solution.common.utils.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.solution.algo.domain.AlgorithmParam;
|
||||
import com.solution.algo.mapper.AlgorithmMapper;
|
||||
import com.solution.algo.domain.Algorithm;
|
||||
import com.solution.algo.service.IAlgorithmService;
|
||||
|
||||
/**
|
||||
* 规则Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-06
|
||||
*/
|
||||
@Service
|
||||
public class AlgorithmServiceImpl implements IAlgorithmService
|
||||
{
|
||||
@Autowired
|
||||
private AlgorithmMapper algorithmMapper;
|
||||
|
||||
/**
|
||||
* 查询规则
|
||||
*
|
||||
* @param id 规则主键
|
||||
* @return 规则
|
||||
*/
|
||||
@Override
|
||||
public Algorithm selectAlgorithmById(Long id)
|
||||
{
|
||||
return algorithmMapper.selectAlgorithmById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询规则列表
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 规则
|
||||
*/
|
||||
@Override
|
||||
public List<Algorithm> selectAlgorithmList(Algorithm algorithm)
|
||||
{
|
||||
return algorithmMapper.selectAlgorithmList(algorithm);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增规则
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int insertAlgorithm(Algorithm algorithm)
|
||||
{
|
||||
int rows = algorithmMapper.insertAlgorithm(algorithm);
|
||||
insertAlgorithmParam(algorithm);
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改规则
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int updateAlgorithm(Algorithm algorithm)
|
||||
{
|
||||
algorithmMapper.deleteAlgorithmParamByAlgorithmId(algorithm.getId());
|
||||
insertAlgorithmParam(algorithm);
|
||||
return algorithmMapper.updateAlgorithm(algorithm);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除规则
|
||||
*
|
||||
* @param ids 需要删除的规则主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int deleteAlgorithmByIds(Long[] ids)
|
||||
{
|
||||
algorithmMapper.deleteAlgorithmParamByAlgorithmIds(ids);
|
||||
return algorithmMapper.deleteAlgorithmByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除规则信息
|
||||
*
|
||||
* @param id 规则主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int deleteAlgorithmById(Long id)
|
||||
{
|
||||
algorithmMapper.deleteAlgorithmParamByAlgorithmId(id);
|
||||
return algorithmMapper.deleteAlgorithmById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增算法参数定义信息
|
||||
*
|
||||
* @param algorithm 规则对象
|
||||
*/
|
||||
public void insertAlgorithmParam(Algorithm algorithm)
|
||||
{
|
||||
List<AlgorithmParam> algorithmParamList = algorithm.getAlgorithmParamList();
|
||||
Long id = algorithm.getId();
|
||||
if (StringUtils.isNotNull(algorithmParamList))
|
||||
{
|
||||
List<AlgorithmParam> list = new ArrayList<AlgorithmParam>();
|
||||
for (AlgorithmParam algorithmParam : algorithmParamList)
|
||||
{
|
||||
algorithmParam.setAlgorithmId(id);
|
||||
list.add(algorithmParam);
|
||||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
algorithmMapper.batchAlgorithmParam(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package com.solution.algo.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.solution.algo.mapper.SysAlgoConfigMapper;
|
||||
import com.solution.algo.domain.SysAlgoConfig;
|
||||
import com.solution.algo.service.ISysAlgoConfigService;
|
||||
|
||||
/**
|
||||
* 动态规则配置Service业务层处理
|
||||
*
|
||||
* @author zouju
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Service
|
||||
public class SysAlgoConfigServiceImpl implements ISysAlgoConfigService
|
||||
{
|
||||
@Autowired
|
||||
private SysAlgoConfigMapper sysAlgoConfigMapper;
|
||||
|
||||
/**
|
||||
* 查询动态规则配置
|
||||
*
|
||||
* @param id 动态规则配置主键
|
||||
* @return 动态规则配置
|
||||
*/
|
||||
@Override
|
||||
public SysAlgoConfig selectSysAlgoConfigById(Long id)
|
||||
{
|
||||
return sysAlgoConfigMapper.selectSysAlgoConfigById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询动态规则配置列表
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 动态规则配置
|
||||
*/
|
||||
@Override
|
||||
public List<SysAlgoConfig> selectSysAlgoConfigList(SysAlgoConfig sysAlgoConfig)
|
||||
{
|
||||
return sysAlgoConfigMapper.selectSysAlgoConfigList(sysAlgoConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增动态规则配置
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysAlgoConfig(SysAlgoConfig sysAlgoConfig)
|
||||
{
|
||||
return sysAlgoConfigMapper.insertSysAlgoConfig(sysAlgoConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改动态规则配置
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysAlgoConfig(SysAlgoConfig sysAlgoConfig)
|
||||
{
|
||||
return sysAlgoConfigMapper.updateSysAlgoConfig(sysAlgoConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除动态规则配置
|
||||
*
|
||||
* @param ids 需要删除的动态规则配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysAlgoConfigByIds(Long[] ids)
|
||||
{
|
||||
return sysAlgoConfigMapper.deleteSysAlgoConfigByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除动态规则配置信息
|
||||
*
|
||||
* @param id 动态规则配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysAlgoConfigById(Long id)
|
||||
{
|
||||
return sysAlgoConfigMapper.deleteSysAlgoConfigById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?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="com.solution.algo.mapper.AlgorithmMapper">
|
||||
|
||||
<resultMap type="Algorithm" id="AlgorithmResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="type" column="type" />
|
||||
<result property="codePath" column="code_path" />
|
||||
<result property="description" column="description" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="AlgorithmAlgorithmParamResult" type="Algorithm" extends="AlgorithmResult">
|
||||
<collection property="algorithmParamList" ofType="AlgorithmParam" column="id" select="selectAlgorithmParamList" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="AlgorithmParam" id="AlgorithmParamResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="algorithmId" column="algorithm_id" />
|
||||
<result property="paramName" column="param_name" />
|
||||
<result property="defaultValue" column="default_value" />
|
||||
<result property="description" column="description" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAlgorithmVo">
|
||||
select id, name, type, code_path, description from algorithm
|
||||
</sql>
|
||||
|
||||
<select id="selectAlgorithmList" parameterType="Algorithm" resultMap="AlgorithmAlgorithmParamResult">
|
||||
<include refid="selectAlgorithmVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="codePath != null and codePath != ''"> and code_path = #{codePath}</if>
|
||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAlgorithmById" parameterType="Long" resultMap="AlgorithmAlgorithmParamResult">
|
||||
select id, name, type, code_path, description
|
||||
from algorithm
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectAlgorithmParamList" resultMap="AlgorithmParamResult">
|
||||
select id, algorithm_id, param_name, default_value, description
|
||||
from algorithm_param
|
||||
where algorithm_id = #{algorithm_id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAlgorithm" parameterType="Algorithm" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into algorithm
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="codePath != null">code_path,</if>
|
||||
<if test="description != null">description,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="codePath != null">#{codePath},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAlgorithm" parameterType="Algorithm">
|
||||
update algorithm
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="codePath != null">code_path = #{codePath},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAlgorithmById" parameterType="Long">
|
||||
delete from algorithm where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAlgorithmByIds" parameterType="String">
|
||||
delete from algorithm where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAlgorithmParamByAlgorithmIds" parameterType="String">
|
||||
delete from algorithm_param where algorithm_id in
|
||||
<foreach item="algorithmId" collection="array" open="(" separator="," close=")">
|
||||
#{algorithmId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAlgorithmParamByAlgorithmId" parameterType="Long">
|
||||
delete from algorithm_param where algorithm_id = #{algorithmId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchAlgorithmParam">
|
||||
insert into algorithm_param( id, algorithm_id, param_name, default_value, description) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.algorithmId}, #{item.paramName}, #{item.defaultValue}, #{item.description})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -1,96 +0,0 @@
|
||||
<?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="com.solution.algo.mapper.SysAlgoConfigMapper">
|
||||
|
||||
<resultMap type="SysAlgoConfig" id="SysAlgoConfigResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="algoType" column="algo_type" />
|
||||
<result property="algoName" column="algo_name" />
|
||||
<result property="engineType" column="engine_type" />
|
||||
<result property="inputSchema" column="input_schema" />
|
||||
<result property="scriptContent" column="script_content" />
|
||||
<result property="description" column="description" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
<result property="updatedAt" column="updated_at" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysAlgoConfigVo">
|
||||
select id, algo_type, algo_name, engine_type, input_schema, script_content, description, status, created_at, updated_at from sys_algo_config
|
||||
</sql>
|
||||
|
||||
<select id="selectSysAlgoConfigList" parameterType="SysAlgoConfig" resultMap="SysAlgoConfigResult">
|
||||
<include refid="selectSysAlgoConfigVo"/>
|
||||
<where>
|
||||
<if test="algoType != null and algoType != ''"> and algo_type = #{algoType}</if>
|
||||
<if test="algoName != null and algoName != ''"> and algo_name like concat('%', #{algoName}, '%')</if>
|
||||
<if test="engineType != null and engineType != ''"> and engine_type = #{engineType}</if>
|
||||
<if test="inputSchema != null and inputSchema != ''"> and input_schema = #{inputSchema}</if>
|
||||
<if test="scriptContent != null and scriptContent != ''"> and script_content = #{scriptContent}</if>
|
||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="createdAt != null "> and created_at = #{createdAt}</if>
|
||||
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysAlgoConfigById" parameterType="Long" resultMap="SysAlgoConfigResult">
|
||||
<include refid="selectSysAlgoConfigVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysAlgoConfig" parameterType="SysAlgoConfig" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_algo_config
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="algoType != null and algoType != ''">algo_type,</if>
|
||||
<if test="algoName != null and algoName != ''">algo_name,</if>
|
||||
<if test="engineType != null and engineType != ''">engine_type,</if>
|
||||
<if test="inputSchema != null">input_schema,</if>
|
||||
<if test="scriptContent != null">script_content,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createdAt != null">created_at,</if>
|
||||
<if test="updatedAt != null">updated_at,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="algoType != null and algoType != ''">#{algoType},</if>
|
||||
<if test="algoName != null and algoName != ''">#{algoName},</if>
|
||||
<if test="engineType != null and engineType != ''">#{engineType},</if>
|
||||
<if test="inputSchema != null">#{inputSchema},</if>
|
||||
<if test="scriptContent != null">#{scriptContent},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createdAt != null">#{createdAt},</if>
|
||||
<if test="updatedAt != null">#{updatedAt},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysAlgoConfig" parameterType="SysAlgoConfig">
|
||||
update sys_algo_config
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="algoType != null and algoType != ''">algo_type = #{algoType},</if>
|
||||
<if test="algoName != null and algoName != ''">algo_name = #{algoName},</if>
|
||||
<if test="engineType != null and engineType != ''">engine_type = #{engineType},</if>
|
||||
<if test="inputSchema != null">input_schema = #{inputSchema},</if>
|
||||
<if test="scriptContent != null">script_content = #{scriptContent},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysAlgoConfigById" parameterType="Long">
|
||||
delete from sys_algo_config where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysAlgoConfigByIds" parameterType="String">
|
||||
delete from sys_algo_config where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user