From 9774070d9399d160a08d55bff050f0c11c64e7a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E7=8B=BC=E8=93=9D=E5=A4=A9?= Date: Thu, 14 Nov 2024 11:04:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B4=BB=E5=8A=A8=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ActivateController.java | 28 +++++++++++++++- .../harmony/service/ActivateService.java | 6 ++++ .../service/impl/ActivateServiceImpl.java | 32 +++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/guaiguailang/harmony/controller/ActivateController.java b/src/main/java/com/guaiguailang/harmony/controller/ActivateController.java index 71ed10d..07c80e1 100644 --- a/src/main/java/com/guaiguailang/harmony/controller/ActivateController.java +++ b/src/main/java/com/guaiguailang/harmony/controller/ActivateController.java @@ -42,5 +42,31 @@ public class ActivateController { public ResponseEntity updateActivate(@RequestBody ActiveBaseInfo activeBaseInfo){ return ResponseEntity.ok(activateService.updateActivate(activeBaseInfo)); } - + @Operation( + summary = "活动 删除(逻辑)", + description = "删除活动", + tags = {"活动相关接口"} + ) + @PostMapping("/del/status") + public ResponseEntity delActivateStatus(@RequestBody ActiveBaseInfo activeBaseInfo){ + return ResponseEntity.ok(activateService.delActivateStatus(activeBaseInfo)); + } + @Operation( + summary = "活动 删除(物理)", + description = "删除活动", + tags = {"活动相关接口"} + ) + @PostMapping("/del/real") + public ResponseEntity delActivateReal(@RequestBody ActiveBaseInfo activeBaseInfo){ + return ResponseEntity.ok(activateService.delActivateReal(activeBaseInfo)); + } + @Operation( + summary = "活动 删除恢复", + description = "恢复逻辑删除的数据", + tags = {"活动相关接口"} + ) + @PostMapping("/del/not") + public ResponseEntity delActivateNot(@RequestBody ActiveBaseInfo activeBaseInfo){ + return ResponseEntity.ok(activateService.delActivateNot(activeBaseInfo)); + } } diff --git a/src/main/java/com/guaiguailang/harmony/service/ActivateService.java b/src/main/java/com/guaiguailang/harmony/service/ActivateService.java index a348177..8473e3f 100644 --- a/src/main/java/com/guaiguailang/harmony/service/ActivateService.java +++ b/src/main/java/com/guaiguailang/harmony/service/ActivateService.java @@ -14,4 +14,10 @@ public interface ActivateService { ResponseResult loadActivate(); ResponseResult updateActivate(ActiveBaseInfo activeBaseInfo); + + ResponseResult delActivateStatus(ActiveBaseInfo activeBaseInfo); + + ResponseResult delActivateReal(ActiveBaseInfo activeBaseInfo); + + ResponseResult delActivateNot(ActiveBaseInfo activeBaseInfo); } diff --git a/src/main/java/com/guaiguailang/harmony/service/impl/ActivateServiceImpl.java b/src/main/java/com/guaiguailang/harmony/service/impl/ActivateServiceImpl.java index 0d94af6..5a08dc4 100644 --- a/src/main/java/com/guaiguailang/harmony/service/impl/ActivateServiceImpl.java +++ b/src/main/java/com/guaiguailang/harmony/service/impl/ActivateServiceImpl.java @@ -80,4 +80,36 @@ public class ActivateServiceImpl implements ActivateService { return ResponseResult.error("更新失败"); } } + + @Override + public ResponseResult delActivateStatus(ActiveBaseInfo activeBaseInfo) { + activeBaseInfo.setStatus(-1); + int i = activateMapper.updateById(activeBaseInfo); + if(i>0){ + return ResponseResult.success(activeBaseInfo); + }else{ + return ResponseResult.error("删除失败"); + } + } + + @Override + public ResponseResult delActivateReal(ActiveBaseInfo activeBaseInfo) { + int i = activateMapper.deleteById(activeBaseInfo.getId()); + if(i>0){ + return ResponseResult.success(); + }else{ + return ResponseResult.error("删除失败"); + } + } + + @Override + public ResponseResult delActivateNot(ActiveBaseInfo activeBaseInfo) { + activeBaseInfo.setStatus(0); + int i = activateMapper.updateById(activeBaseInfo); + if(i>0){ + return ResponseResult.success(activeBaseInfo); + }else{ + return ResponseResult.error("恢复删除失败"); + } + } }