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("修改失败"); } /**