mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-03-25 10:33:43 +08:00
feature: 新增生成前端文件模板接口
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.generator.controller;
|
||||
|
||||
import cn.hutool.core.net.URLDecoder;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.ruoyi.common.core.domain.R;
|
||||
@@ -8,10 +9,11 @@ import org.ruoyi.generator.service.IGenTableService;
|
||||
import org.ruoyi.generator.service.SchemaFieldService;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* 代码生成 操作处理
|
||||
*
|
||||
@@ -46,4 +48,18 @@ public class GenController extends BaseController {
|
||||
genTableService.generateCodeToClasspathByTableNames(tableNameStr);
|
||||
return R.ok("代码生成成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成前端代码
|
||||
*
|
||||
* @param workPath 执行命令路径
|
||||
* @param previewCode 执行生成前端文件命令
|
||||
*/
|
||||
@GetMapping("/batchGenFrontendCode")
|
||||
public R<String> batchGenFrontendCode(@NotNull(message = "路径不能为空") String workPath, @NotNull(message = "指令不能为空") String previewCode) {
|
||||
String decodedWorkPath = URLDecoder.decode(workPath, StandardCharsets.UTF_8);
|
||||
String decodedPreviewCode = URLDecoder.decode(previewCode, StandardCharsets.UTF_8);
|
||||
genTableService.generateFrontendTemplateFiles(decodedWorkPath, decodedPreviewCode);
|
||||
return R.ok("代码生成成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,12 @@ public interface IGenTableService {
|
||||
* @param tableName 表名称数组
|
||||
*/
|
||||
void generateCodeToClasspathByTableNames(String tableName);
|
||||
|
||||
/**
|
||||
* 生成前端文件
|
||||
*
|
||||
* @param workPath 执行命令路径
|
||||
* @param previewCode 执行生成前端文件命令
|
||||
*/
|
||||
void generateFrontendTemplateFiles(String workPath, String previewCode);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
|
||||
-- 菜单
|
||||
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_dept`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1946483381643743233, '知识库角色管理', 1775500307898949634, '12', 'knowledgeRole', 'system/knowledgeRole/index', NULL, 1, 0, 'C', '0', '0', NULL, 'ri:user-3-fill', 103, 1, '2025-07-19 16:41:17', NULL, NULL, '知识库角色管理');
|
||||
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_dept`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1946483381643743233, '知识库角色管理', 1775500307898949634, '12', 'knowledgeRole', 'operator/knowledgeRole/index', NULL, 1, 0, 'C', '0', '0', NULL, 'ri:user-3-fill', 103, 1, '2025-07-19 16:41:17', NULL, NULL, '知识库角色管理');
|
||||
|
||||
-- 用户表添加字段
|
||||
ALTER TABLE sys_user
|
||||
|
||||
Reference in New Issue
Block a user