From 96350be7a8fbfcb1163a5826022a442f8feb5fc9 Mon Sep 17 00:00:00 2001 From: zhuo <2089219845@qq.com> Date: 星期四, 13 二月 2025 14:05:26 +0800 Subject: [PATCH] 修改全局Result字段 --- ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 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 c4fab98..e6afa76 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.AjaxResult; +import com.ruoyi.common.core.domain.Result; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.enums.BusinessType; @@ -38,7 +38,7 @@ /** * 浠g爜鐢熸垚 鎿嶄綔澶勭悊 - * + * * @author ruoyi */ @RestController @@ -68,7 +68,7 @@ */ @PreAuthorize("@ss.hasPermi('tool:gen:query')") @GetMapping(value = "/{tableId}") - public AjaxResult getInfo(@PathVariable Long tableId) + public Result 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 AjaxResult importTableSave(String tables) + public Result importTableSave(String tables) { String[] tableNames = Convert.toStrArray(tables); // 鏌ヨ琛ㄤ俊鎭� @@ -127,7 +127,7 @@ @PreAuthorize("@ss.hasRole('admin')") @Log(title = "鍒涘缓琛�", businessType = BusinessType.OTHER) @PostMapping("/createTable") - public AjaxResult createTableSave(String sql) + public Result 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 AjaxResult.success(); + return Result.success(); } catch (Exception e) { logger.error(e.getMessage(), e); - return AjaxResult.error("鍒涘缓琛ㄧ粨鏋勫紓甯�"); + return Result.error("鍒涘缓琛ㄧ粨鏋勫紓甯�"); } } @@ -164,7 +164,7 @@ @PreAuthorize("@ss.hasPermi('tool:gen:edit')") @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult editSave(@Validated @RequestBody GenTable genTable) + public Result 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 AjaxResult remove(@PathVariable Long[] tableIds) + public Result remove(@PathVariable Long[] tableIds) { genTableService.deleteGenTableByIds(tableIds); return success(); @@ -188,7 +188,7 @@ */ @PreAuthorize("@ss.hasPermi('tool:gen:preview')") @GetMapping("/preview/{tableId}") - public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException + public Result 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 AjaxResult genCode(@PathVariable("tableName") String tableName) + public Result genCode(@PathVariable("tableName") String tableName) { if (!GenConfig.isAllowOverwrite()) { - return AjaxResult.error("銆愮郴缁熼璁俱�戜笉鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦�"); + return Result.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 AjaxResult synchDb(@PathVariable("tableName") String tableName) + public Result synchDb(@PathVariable("tableName") String tableName) { genTableService.synchDb(tableName); return success(); @@ -260,4 +260,4 @@ response.setContentType("application/octet-stream; charset=UTF-8"); IOUtils.write(data, response.getOutputStream()); } -} \ No newline at end of file +} -- Gitblit v1.9.3