From 1fd2a709d850c743a6d1da8b65133fc8e51c92d2 Mon Sep 17 00:00:00 2001
From: fuyongxin <110568259@qq.com>
Date: Wed, 03 Jun 2026 14:59:30 +0800
Subject: [PATCH] 修改ruoyi-改为sgd
---
ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/controller/GenController.java | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/controller/GenController.java b/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/controller/GenController.java
index 82d1540..0bad3c8 100644
--- a/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/controller/GenController.java
+++ b/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/controller/GenController.java
@@ -4,7 +4,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@@ -15,6 +15,7 @@
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.core.web.controller.BaseController;
@@ -23,6 +24,7 @@
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
+import com.ruoyi.gen.config.GenConfig;
import com.ruoyi.gen.domain.GenTable;
import com.ruoyi.gen.domain.GenTableColumn;
import com.ruoyi.gen.service.IGenTableColumnService;
@@ -56,7 +58,7 @@
}
/**
- * 修改代码生成业务
+ * 获取代码生成信息
*/
@RequiresPermissions("tool:gen:query")
@GetMapping(value = "/{tableId}")
@@ -69,7 +71,7 @@
map.put("info", table);
map.put("rows", list);
map.put("tables", tables);
- return AjaxResult.success(map);
+ return success(map);
}
/**
@@ -87,7 +89,7 @@
/**
* 查询数据表字段列表
*/
- @GetMapping(value = "/column/{talbleId}")
+ @GetMapping(value = "/column/{tableId}")
public TableDataInfo columnList(Long tableId)
{
TableDataInfo dataInfo = new TableDataInfo();
@@ -103,13 +105,13 @@
@RequiresPermissions("tool:gen:import")
@Log(title = "代码生成", businessType = BusinessType.IMPORT)
@PostMapping("/importTable")
- public AjaxResult importTableSave(String tables)
+ public AjaxResult importTableSave(@RequestParam("tables") String tables, @RequestParam("tplWebType") String tplWebType)
{
String[] tableNames = Convert.toStrArray(tables);
// 查询表信息
List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
- genTableService.importGenTable(tableList);
- return AjaxResult.success();
+ genTableService.importGenTable(tableList, tplWebType);
+ return success();
}
/**
@@ -122,7 +124,7 @@
{
genTableService.validateEdit(genTable);
genTableService.updateGenTable(genTable);
- return AjaxResult.success();
+ return success();
}
/**
@@ -134,7 +136,7 @@
public AjaxResult remove(@PathVariable Long[] tableIds)
{
genTableService.deleteGenTableByIds(tableIds);
- return AjaxResult.success();
+ return success();
}
/**
@@ -145,7 +147,7 @@
public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException
{
Map<String, String> dataMap = genTableService.previewCode(tableId);
- return AjaxResult.success(dataMap);
+ return success(dataMap);
}
/**
@@ -168,8 +170,12 @@
@GetMapping("/genCode/{tableName}")
public AjaxResult genCode(@PathVariable("tableName") String tableName)
{
+ if (!GenConfig.isAllowOverwrite())
+ {
+ return AjaxResult.error("【系统预设】不允许生成文件覆盖到本地");
+ }
genTableService.generatorCode(tableName);
- return AjaxResult.success();
+ return success();
}
/**
@@ -181,7 +187,7 @@
public AjaxResult synchDb(@PathVariable("tableName") String tableName)
{
genTableService.synchDb(tableName);
- return AjaxResult.success();
+ return success();
}
/**
--
Gitblit v1.9.3