feat: 活动删除功能完成

This commit is contained in:
萌狼蓝天 2024-11-14 11:04:46 +08:00
parent 97b6f2ddb3
commit 9774070d93
3 changed files with 65 additions and 1 deletions

View File

@ -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));
}
}

View File

@ -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);
}

View File

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