|
@@ -157,6 +157,21 @@ public class HealthPlanController {
|
|
|
return Result.success(tasks);
|
|
return Result.success(tasks);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Operation(summary = "删除健康方案(级联删除方案产生的全部任务,含每日实例)")
|
|
|
|
|
+ @PostMapping("/delete")
|
|
|
|
|
+ public Result<Map<String, Object>> deletePlan(@RequestBody Map<String, Object> params,
|
|
|
|
|
+ @RequestAttribute("userId") Long userId,
|
|
|
|
|
+ @RequestAttribute(value = "familyId", required = false) Long familyId) {
|
|
|
|
|
+ Long planId = ParamUtils.getLong(params.get("planId"));
|
|
|
|
|
+ if (planId == null) return Result.error("planId不能为空");
|
|
|
|
|
+ // familyId 从 JWT 注入:方案不属于该家庭时 Service 返回 null → 拒绝删除(IDOR 防护)
|
|
|
|
|
+ Map<String, Object> result = healthPlanService.deletePlanCascade(planId, familyId);
|
|
|
|
|
+ if (result == null) {
|
|
|
|
|
+ return Result.error("无权删除该方案");
|
|
|
|
|
+ }
|
|
|
|
|
+ return Result.success(result);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Operation(summary = "获取可用规划师列表")
|
|
@Operation(summary = "获取可用规划师列表")
|
|
|
@PostMapping("/available-teachers")
|
|
@PostMapping("/available-teachers")
|
|
|
public Result<List<Map<String, Object>>> availableTeachers(
|
|
public Result<List<Map<String, Object>>> availableTeachers(
|