From dd046d8bed00a7815bb6a61a9e4f4d8964f0b2a1 Mon Sep 17 00:00:00 2001
From: zhuo <2089219845@qq.com>
Date: 星期四, 13 二月 2025 14:57:27 +0800
Subject: [PATCH] 全局Result重新修改
---
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java
index e6afa76..ac040ed 100644
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java
+++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java
@@ -24,7 +24,7 @@
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCreateTableStatement;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.BusinessType;
@@ -68,7 +68,7 @@
*/
@PreAuthorize("@ss.hasPermi('tool:gen:query')")
@GetMapping(value = "/{tableId}")
- public Result getInfo(@PathVariable Long tableId)
+ public AjaxResult getInfo(@PathVariable Long tableId)
{
GenTable table = genTableService.selectGenTableById(tableId);
List<GenTable> tables = genTableService.selectGenTableAll();
@@ -112,7 +112,7 @@
@PreAuthorize("@ss.hasPermi('tool:gen:import')")
@Log(title = "浠g爜鐢熸垚", businessType = BusinessType.IMPORT)
@PostMapping("/importTable")
- public Result importTableSave(String tables)
+ public AjaxResult importTableSave(String tables)
{
String[] tableNames = Convert.toStrArray(tables);
// 鏌ヨ琛ㄤ俊鎭�
@@ -127,7 +127,7 @@
@PreAuthorize("@ss.hasRole('admin')")
@Log(title = "鍒涘缓琛�", businessType = BusinessType.OTHER)
@PostMapping("/createTable")
- public Result createTableSave(String sql)
+ public AjaxResult createTableSave(String sql)
{
try
{
@@ -149,12 +149,12 @@
List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames.toArray(new String[tableNames.size()]));
String operName = SecurityUtils.getUsername();
genTableService.importGenTable(tableList, operName);
- return Result.success();
+ return AjaxResult.success();
}
catch (Exception e)
{
logger.error(e.getMessage(), e);
- return Result.error("鍒涘缓琛ㄧ粨鏋勫紓甯�");
+ return AjaxResult.error("鍒涘缓琛ㄧ粨鏋勫紓甯�");
}
}
@@ -164,7 +164,7 @@
@PreAuthorize("@ss.hasPermi('tool:gen:edit')")
@Log(title = "浠g爜鐢熸垚", businessType = BusinessType.UPDATE)
@PutMapping
- public Result editSave(@Validated @RequestBody GenTable genTable)
+ public AjaxResult editSave(@Validated @RequestBody GenTable genTable)
{
genTableService.validateEdit(genTable);
genTableService.updateGenTable(genTable);
@@ -177,7 +177,7 @@
@PreAuthorize("@ss.hasPermi('tool:gen:remove')")
@Log(title = "浠g爜鐢熸垚", businessType = BusinessType.DELETE)
@DeleteMapping("/{tableIds}")
- public Result remove(@PathVariable Long[] tableIds)
+ public AjaxResult remove(@PathVariable Long[] tableIds)
{
genTableService.deleteGenTableByIds(tableIds);
return success();
@@ -188,7 +188,7 @@
*/
@PreAuthorize("@ss.hasPermi('tool:gen:preview')")
@GetMapping("/preview/{tableId}")
- public Result preview(@PathVariable("tableId") Long tableId) throws IOException
+ public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException
{
Map<String, String> dataMap = genTableService.previewCode(tableId);
return success(dataMap);
@@ -212,11 +212,11 @@
@PreAuthorize("@ss.hasPermi('tool:gen:code')")
@Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE)
@GetMapping("/genCode/{tableName}")
- public Result genCode(@PathVariable("tableName") String tableName)
+ public AjaxResult genCode(@PathVariable("tableName") String tableName)
{
if (!GenConfig.isAllowOverwrite())
{
- return Result.error("銆愮郴缁熼璁俱�戜笉鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦�");
+ return AjaxResult.error("銆愮郴缁熼璁俱�戜笉鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦�");
}
genTableService.generatorCode(tableName);
return success();
@@ -228,7 +228,7 @@
@PreAuthorize("@ss.hasPermi('tool:gen:edit')")
@Log(title = "浠g爜鐢熸垚", businessType = BusinessType.UPDATE)
@GetMapping("/synchDb/{tableName}")
- public Result synchDb(@PathVariable("tableName") String tableName)
+ public AjaxResult synchDb(@PathVariable("tableName") String tableName)
{
genTableService.synchDb(tableName);
return success();
--
Gitblit v1.9.3