From 000f8d4bc595493f79a7edf8e759ad90410d0b8f Mon Sep 17 00:00:00 2001 From: zouju <2393724835@qq.com> Date: Thu, 5 Feb 2026 17:12:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A7=84=E5=88=99=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=20=E6=96=B0=E5=A2=9E=E8=A7=84=E5=88=99=E6=A8=A1?= =?UTF-8?q?=E5=9D=97CRUD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auto-solution-admin/pom.xml | 9 + .../algo/SysAlgoConfigController.java | 104 +++++++++++ auto-solution-algo/pom.xml | 28 +++ .../solution/algo/domain/SysAlgoConfig.java | 176 ++++++++++++++++++ .../algo/mapper/SysAlgoConfigMapper.java | 61 ++++++ .../algo/service/ISysAlgoConfigService.java | 61 ++++++ .../impl/SysAlgoConfigServiceImpl.java | 93 +++++++++ .../mapper/algo/SysAlgoConfigMapper.xml | 96 ++++++++++ pom.xml | 9 + 9 files changed, 637 insertions(+) create mode 100644 auto-solution-admin/src/main/java/com/solution/web/controller/algo/SysAlgoConfigController.java create mode 100644 auto-solution-algo/pom.xml create mode 100644 auto-solution-algo/src/main/java/com/solution/algo/domain/SysAlgoConfig.java create mode 100644 auto-solution-algo/src/main/java/com/solution/algo/mapper/SysAlgoConfigMapper.java create mode 100644 auto-solution-algo/src/main/java/com/solution/algo/service/ISysAlgoConfigService.java create mode 100644 auto-solution-algo/src/main/java/com/solution/algo/service/impl/SysAlgoConfigServiceImpl.java create mode 100644 auto-solution-algo/src/main/resources/mapper/algo/SysAlgoConfigMapper.xml diff --git a/auto-solution-admin/pom.xml b/auto-solution-admin/pom.xml index c50f35e..62008f0 100644 --- a/auto-solution-admin/pom.xml +++ b/auto-solution-admin/pom.xml @@ -61,6 +61,15 @@ solution-generator + + com.solution + solution-behaviour + + + + com.solution + solution-algo + diff --git a/auto-solution-admin/src/main/java/com/solution/web/controller/algo/SysAlgoConfigController.java b/auto-solution-admin/src/main/java/com/solution/web/controller/algo/SysAlgoConfigController.java new file mode 100644 index 0000000..8f6bf83 --- /dev/null +++ b/auto-solution-admin/src/main/java/com/solution/web/controller/algo/SysAlgoConfigController.java @@ -0,0 +1,104 @@ +package com.solution.web.controller.algo; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.solution.common.annotation.Log; +import com.solution.common.core.controller.BaseController; +import com.solution.common.core.domain.AjaxResult; +import com.solution.common.enums.BusinessType; +import com.solution.algo.domain.SysAlgoConfig; +import com.solution.algo.service.ISysAlgoConfigService; +import com.solution.common.utils.poi.ExcelUtil; +import com.solution.common.core.page.TableDataInfo; + +/** + * 动态规则配置Controller + * + * @author zouju + * @date 2026-02-05 + */ +@RestController +@RequestMapping("/algo/algo") +public class SysAlgoConfigController extends BaseController +{ + @Autowired + private ISysAlgoConfigService sysAlgoConfigService; + + /** + * 查询动态规则配置列表 + */ + @PreAuthorize("@ss.hasPermi('algo:algo:list')") + @GetMapping("/list") + public TableDataInfo list(SysAlgoConfig sysAlgoConfig) + { + startPage(); + List list = sysAlgoConfigService.selectSysAlgoConfigList(sysAlgoConfig); + return getDataTable(list); + } + + /** + * 导出动态规则配置列表 + */ + @PreAuthorize("@ss.hasPermi('algo:algo:export')") + @Log(title = "动态规则配置", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysAlgoConfig sysAlgoConfig) + { + List list = sysAlgoConfigService.selectSysAlgoConfigList(sysAlgoConfig); + ExcelUtil util = new ExcelUtil(SysAlgoConfig.class); + util.exportExcel(response, list, "动态规则配置数据"); + } + + /** + * 获取动态规则配置详细信息 + */ + @PreAuthorize("@ss.hasPermi('algo:algo:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(sysAlgoConfigService.selectSysAlgoConfigById(id)); + } + + /** + * 新增动态规则配置 + */ + @PreAuthorize("@ss.hasPermi('algo:algo:add')") + @Log(title = "动态规则配置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysAlgoConfig sysAlgoConfig) + { + return toAjax(sysAlgoConfigService.insertSysAlgoConfig(sysAlgoConfig)); + } + + /** + * 修改动态规则配置 + */ + @PreAuthorize("@ss.hasPermi('algo:algo:edit')") + @Log(title = "动态规则配置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysAlgoConfig sysAlgoConfig) + { + return toAjax(sysAlgoConfigService.updateSysAlgoConfig(sysAlgoConfig)); + } + + /** + * 删除动态规则配置 + */ + @PreAuthorize("@ss.hasPermi('algo:algo:remove')") + @Log(title = "动态规则配置", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(sysAlgoConfigService.deleteSysAlgoConfigByIds(ids)); + } +} diff --git a/auto-solution-algo/pom.xml b/auto-solution-algo/pom.xml new file mode 100644 index 0000000..af7a6ec --- /dev/null +++ b/auto-solution-algo/pom.xml @@ -0,0 +1,28 @@ + + + + solution + com.solution + 3.9.1 + + 4.0.0 + + solution-algo + + + algo模块 + + + + + + + com.solution + solution-common + + + + + \ No newline at end of file diff --git a/auto-solution-algo/src/main/java/com/solution/algo/domain/SysAlgoConfig.java b/auto-solution-algo/src/main/java/com/solution/algo/domain/SysAlgoConfig.java new file mode 100644 index 0000000..8a9a774 --- /dev/null +++ b/auto-solution-algo/src/main/java/com/solution/algo/domain/SysAlgoConfig.java @@ -0,0 +1,176 @@ +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(); + } +} diff --git a/auto-solution-algo/src/main/java/com/solution/algo/mapper/SysAlgoConfigMapper.java b/auto-solution-algo/src/main/java/com/solution/algo/mapper/SysAlgoConfigMapper.java new file mode 100644 index 0000000..e4b36f5 --- /dev/null +++ b/auto-solution-algo/src/main/java/com/solution/algo/mapper/SysAlgoConfigMapper.java @@ -0,0 +1,61 @@ +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 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); +} diff --git a/auto-solution-algo/src/main/java/com/solution/algo/service/ISysAlgoConfigService.java b/auto-solution-algo/src/main/java/com/solution/algo/service/ISysAlgoConfigService.java new file mode 100644 index 0000000..563e61e --- /dev/null +++ b/auto-solution-algo/src/main/java/com/solution/algo/service/ISysAlgoConfigService.java @@ -0,0 +1,61 @@ +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 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); +} diff --git a/auto-solution-algo/src/main/java/com/solution/algo/service/impl/SysAlgoConfigServiceImpl.java b/auto-solution-algo/src/main/java/com/solution/algo/service/impl/SysAlgoConfigServiceImpl.java new file mode 100644 index 0000000..0a4a318 --- /dev/null +++ b/auto-solution-algo/src/main/java/com/solution/algo/service/impl/SysAlgoConfigServiceImpl.java @@ -0,0 +1,93 @@ +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 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); + } +} diff --git a/auto-solution-algo/src/main/resources/mapper/algo/SysAlgoConfigMapper.xml b/auto-solution-algo/src/main/resources/mapper/algo/SysAlgoConfigMapper.xml new file mode 100644 index 0000000..ae07dd8 --- /dev/null +++ b/auto-solution-algo/src/main/resources/mapper/algo/SysAlgoConfigMapper.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + select id, algo_type, algo_name, engine_type, input_schema, script_content, description, status, created_at, updated_at from sys_algo_config + + + + + + + + insert into sys_algo_config + + algo_type, + algo_name, + engine_type, + input_schema, + script_content, + description, + status, + created_at, + updated_at, + + + #{algoType}, + #{algoName}, + #{engineType}, + #{inputSchema}, + #{scriptContent}, + #{description}, + #{status}, + #{createdAt}, + #{updatedAt}, + + + + + update sys_algo_config + + algo_type = #{algoType}, + algo_name = #{algoName}, + engine_type = #{engineType}, + input_schema = #{inputSchema}, + script_content = #{scriptContent}, + description = #{description}, + status = #{status}, + created_at = #{createdAt}, + updated_at = #{updatedAt}, + + where id = #{id} + + + + delete from sys_algo_config where id = #{id} + + + + delete from sys_algo_config where id in + + #{id} + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index dc87f78..8640467 100644 --- a/pom.xml +++ b/pom.xml @@ -224,12 +224,21 @@ ${solution.version} + + + com.solution + solution-algo + ${solution.version} + + auto-solution-admin auto-solution-behaviour + + auto-solution-algo auto-solution-framework auto-solution-system auto-solution-quartz