From 0995b5e821185b0fee34165c16c5933449df7c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Sat, 29 Oct 2022 17:38:05 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E8=B0=83?= =?UTF-8?q?=E7=94=A8toAjax=E6=97=B6=E7=9A=84=E5=86=97=E4=BD=99=E4=B8=89?= =?UTF-8?q?=E5=85=83=E6=93=8D=E4=BD=9C=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/demo/controller/TestBatchController.java | 4 ++-- .../java/com/ruoyi/demo/controller/TestDemoController.java | 6 +++--- .../java/com/ruoyi/demo/controller/TestTreeController.java | 6 +++--- .../ruoyi-gen/src/main/resources/vm/java/controller.java.vm | 6 +++--- .../ruoyi/resource/controller/SysOssConfigController.java | 6 +++--- .../com/ruoyi/resource/controller/SysOssController.java | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ruoyi-example/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java b/ruoyi-example/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java index ee124d2b..e4de158e 100644 --- a/ruoyi-example/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java +++ b/ruoyi-example/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java @@ -46,7 +46,7 @@ public class TestBatchController extends BaseController { testDemo.setValue("测试新增"); list.add(testDemo); } - return toAjax(testDemoMapper.insertBatch(list) ? 1 : 0); + return toAjax(testDemoMapper.insertBatch(list)); } /** @@ -73,7 +73,7 @@ public class TestBatchController extends BaseController { testDemo.setId(null); } } - return toAjax(testDemoMapper.insertOrUpdateBatch(list) ? 1 : 0); + return toAjax(testDemoMapper.insertOrUpdateBatch(list)); } /** diff --git a/ruoyi-example/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java b/ruoyi-example/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java index e9c8e67b..1f2dd66e 100644 --- a/ruoyi-example/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java +++ b/ruoyi-example/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java @@ -118,7 +118,7 @@ public class TestDemoController extends BaseController { // 使用校验工具对标 @Validated(AddGroup.class) 注解 // 用于在非 Controller 的地方校验对象 ValidatorUtils.validate(bo, AddGroup.class); - return toAjax(iTestDemoService.insertByBo(bo) ? 1 : 0); + return toAjax(iTestDemoService.insertByBo(bo)); } /** @@ -129,7 +129,7 @@ public class TestDemoController extends BaseController { @RepeatSubmit @PutMapping() public R edit(@Validated(EditGroup.class) @RequestBody TestDemoBo bo) { - return toAjax(iTestDemoService.updateByBo(bo) ? 1 : 0); + return toAjax(iTestDemoService.updateByBo(bo)); } /** @@ -141,6 +141,6 @@ public class TestDemoController extends BaseController { @Log(title = "测试单表", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public R remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) { - return toAjax(iTestDemoService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); + return toAjax(iTestDemoService.deleteWithValidByIds(Arrays.asList(ids), true)); } } diff --git a/ruoyi-example/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java b/ruoyi-example/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java index cf956a5f..3b07dbc6 100644 --- a/ruoyi-example/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java +++ b/ruoyi-example/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java @@ -76,7 +76,7 @@ public class TestTreeController extends BaseController { @RepeatSubmit @PostMapping() public R add(@Validated(AddGroup.class) @RequestBody TestTreeBo bo) { - return toAjax(iTestTreeService.insertByBo(bo) ? 1 : 0); + return toAjax(iTestTreeService.insertByBo(bo)); } /** @@ -87,7 +87,7 @@ public class TestTreeController extends BaseController { @RepeatSubmit @PutMapping() public R edit(@Validated(EditGroup.class) @RequestBody TestTreeBo bo) { - return toAjax(iTestTreeService.updateByBo(bo) ? 1 : 0); + return toAjax(iTestTreeService.updateByBo(bo)); } /** @@ -99,6 +99,6 @@ public class TestTreeController extends BaseController { @Log(title = "测试树表", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public R remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) { - return toAjax(iTestTreeService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); + return toAjax(iTestTreeService.deleteWithValidByIds(Arrays.asList(ids), true)); } } diff --git a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/controller.java.vm b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/controller.java.vm index be9fd5a6..148e6184 100644 --- a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/controller.java.vm +++ b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/controller.java.vm @@ -88,7 +88,7 @@ public class ${ClassName}Controller extends BaseController { @Log(title = "${functionName}", businessType = BusinessType.INSERT) @PostMapping() public R add(@Validated(AddGroup.class) @RequestBody ${ClassName}Bo bo) { - return toAjax(i${ClassName}Service.insertByBo(bo) ? 1 : 0); + return toAjax(i${ClassName}Service.insertByBo(bo)); } /** @@ -98,7 +98,7 @@ public class ${ClassName}Controller extends BaseController { @Log(title = "${functionName}", businessType = BusinessType.UPDATE) @PutMapping() public R edit(@Validated(EditGroup.class) @RequestBody ${ClassName}Bo bo) { - return toAjax(i${ClassName}Service.updateByBo(bo) ? 1 : 0); + return toAjax(i${ClassName}Service.updateByBo(bo)); } /** @@ -110,6 +110,6 @@ public class ${ClassName}Controller extends BaseController { @Log(title = "${functionName}", businessType = BusinessType.DELETE) @DeleteMapping("/{${pkColumn.javaField}s}") public R remove(@NotEmpty(message = "主键不能为空") @PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) { - return toAjax(i${ClassName}Service.deleteWithValidByIds(Arrays.asList(${pkColumn.javaField}s), true) ? 1 : 0); + return toAjax(i${ClassName}Service.deleteWithValidByIds(Arrays.asList(${pkColumn.javaField}s), true)); } } diff --git a/ruoyi-modules/ruoyi-resource/src/main/java/com/ruoyi/resource/controller/SysOssConfigController.java b/ruoyi-modules/ruoyi-resource/src/main/java/com/ruoyi/resource/controller/SysOssConfigController.java index 3cf2eb00..3847d38a 100644 --- a/ruoyi-modules/ruoyi-resource/src/main/java/com/ruoyi/resource/controller/SysOssConfigController.java +++ b/ruoyi-modules/ruoyi-resource/src/main/java/com/ruoyi/resource/controller/SysOssConfigController.java @@ -63,7 +63,7 @@ public class SysOssConfigController extends BaseController { @Log(title = "对象存储配置", businessType = BusinessType.INSERT) @PostMapping() public R add(@Validated(AddGroup.class) @RequestBody SysOssConfigBo bo) { - return toAjax(iSysOssConfigService.insertByBo(bo) ? 1 : 0); + return toAjax(iSysOssConfigService.insertByBo(bo)); } /** @@ -73,7 +73,7 @@ public class SysOssConfigController extends BaseController { @Log(title = "对象存储配置", businessType = BusinessType.UPDATE) @PutMapping() public R edit(@Validated(EditGroup.class) @RequestBody SysOssConfigBo bo) { - return toAjax(iSysOssConfigService.updateByBo(bo) ? 1 : 0); + return toAjax(iSysOssConfigService.updateByBo(bo)); } /** @@ -85,7 +85,7 @@ public class SysOssConfigController extends BaseController { @Log(title = "对象存储配置", businessType = BusinessType.DELETE) @DeleteMapping("/{ossConfigIds}") public R remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ossConfigIds) { - return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true) ? 1 : 0); + return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true)); } /** diff --git a/ruoyi-modules/ruoyi-resource/src/main/java/com/ruoyi/resource/controller/SysOssController.java b/ruoyi-modules/ruoyi-resource/src/main/java/com/ruoyi/resource/controller/SysOssController.java index e5a5f773..4c443021 100644 --- a/ruoyi-modules/ruoyi-resource/src/main/java/com/ruoyi/resource/controller/SysOssController.java +++ b/ruoyi-modules/ruoyi-resource/src/main/java/com/ruoyi/resource/controller/SysOssController.java @@ -123,7 +123,7 @@ public class SysOssController extends BaseController { @Log(title = "OSS对象存储", businessType = BusinessType.DELETE) @DeleteMapping("/{ossIds}") public R remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ossIds) { - return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0); + return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true)); } }