Browse Source

删除广告计划

云殇忆 1 year ago
parent
commit
e74faa7b61

+ 3 - 1
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/PlanController.java

@@ -32,7 +32,9 @@ public class PlanController {
     @DeleteMapping()
     public R deletePlan(PlanBo bo){
         List<String> planIds = bo.getPlanIds();
-        return null;
+        int total = planIds.size();
+        int i = planService.deletePlan(planIds);
+        return R.ok("选择删除" + total + "个,成功删除" + i + "个");
     }
 
     @PutMapping()

+ 7 - 1
ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/PlanServiceImpl.java

@@ -89,7 +89,13 @@ public class PlanServiceImpl implements PlanService {
 
     @Override
     public int deletePlan(List<String> ids) {
-        return 0;
+        int i = 0;
+        for (String id : ids){
+            QueryWrapper<Plan> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("plan_id",id);
+            i += planMapper.delete(queryWrapper);
+        }
+        return i;
     }
 
     @Override