From adca995427cd0884c4e1380cc2f1767087d4064f Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Fri, 10 May 2024 15:17:01 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E8=A6=81=E4=BA=8B=E4=BB=B6=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=86=85=E5=AE=B9=E5=8F=82=E6=95=B0=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DcEventImportantFileController.java | 4 ++-- .../service/IDcEventImportantFileService.java | 4 ++-- .../impl/DcEventImportantFileServiceImpl.java | 17 +++++++++++++---- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcEventImportantFileController.java b/zc-business/src/main/java/com/zc/business/controller/DcEventImportantFileController.java index 29d8cf4a..e276c604 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcEventImportantFileController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcEventImportantFileController.java @@ -132,7 +132,7 @@ public class DcEventImportantFileController extends BaseController @PostMapping public AjaxResult add(@RequestBody DcEventImportantFile dcEventImportantFile) { - return toAjax(dcEventImportantFileService.insertDcEventImportantFile(dcEventImportantFile)); + return dcEventImportantFileService.insertDcEventImportantFile(dcEventImportantFile); } /** @@ -143,7 +143,7 @@ public class DcEventImportantFileController extends BaseController @PutMapping public AjaxResult edit(@RequestBody DcEventImportantFile dcEventImportantFile) { - return toAjax(dcEventImportantFileService.updateDcEventImportantFile(dcEventImportantFile)); + return dcEventImportantFileService.updateDcEventImportantFile(dcEventImportantFile); } /** diff --git a/zc-business/src/main/java/com/zc/business/service/IDcEventImportantFileService.java b/zc-business/src/main/java/com/zc/business/service/IDcEventImportantFileService.java index bc862eb3..b1653132 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcEventImportantFileService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcEventImportantFileService.java @@ -35,7 +35,7 @@ public interface IDcEventImportantFileService * @param dcEventImportantFile 重要事件文件内容 * @return 结果 */ - int insertDcEventImportantFile(DcEventImportantFile dcEventImportantFile); + AjaxResult insertDcEventImportantFile(DcEventImportantFile dcEventImportantFile); /** * 修改重要事件文件内容 @@ -43,7 +43,7 @@ public interface IDcEventImportantFileService * @param dcEventImportantFile 重要事件文件内容 * @return 结果 */ - int updateDcEventImportantFile(DcEventImportantFile dcEventImportantFile); + AjaxResult updateDcEventImportantFile(DcEventImportantFile dcEventImportantFile); /** * 批量删除重要事件文件内容 diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java index 251de5de..799dadea 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java @@ -72,8 +72,11 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer * @return 结果 */ @Override - public int insertDcEventImportantFile(DcEventImportantFile dcEventImportantFile) + public AjaxResult insertDcEventImportantFile(DcEventImportantFile dcEventImportantFile) { + if (StringUtils.isEmpty(dcEventImportantFile.getEventId())){ + return AjaxResult.error("事件id不能为空!"); + } int i = dcEventImportantFileMapper.insertDcEventImportantFile(dcEventImportantFile); if (i > 0){ if (StringUtils.isNotEmpty(dcEventImportantFile.getStatus()) && "1".equals(dcEventImportantFile.getStatus())) { @@ -94,8 +97,9 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer dcEventProcess.setContext(context); dcEventProcessService.insertDcEventProcess(dcEventProcess); } + return AjaxResult.success("新增成功!"); } - return i; + return AjaxResult.error("新增失败!"); } /** @@ -105,8 +109,11 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer * @return 结果 */ @Override - public int updateDcEventImportantFile(DcEventImportantFile dcEventImportantFile) + public AjaxResult updateDcEventImportantFile(DcEventImportantFile dcEventImportantFile) { + if (dcEventImportantFile.getId() == null || StringUtils.isEmpty(dcEventImportantFile.getEventId())){ + return AjaxResult.error("参数错误!"); + } int i = dcEventImportantFileMapper.updateDcEventImportantFile(dcEventImportantFile); if (i > 0){ if (StringUtils.isNotEmpty(dcEventImportantFile.getStatus()) && "1".equals(dcEventImportantFile.getStatus())){ @@ -126,8 +133,10 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer dcEventProcess.setContext(context); dcEventProcessService.insertDcEventProcess(dcEventProcess); } + return AjaxResult.success("修改成功"); + } - return i; + return AjaxResult.error("修改失败"); } /**