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("恢复删除失败"); + } + } }