1:后台使用@PathVariable
/**
* 删除了开关灯计划,同时也要将计划对应的回路也删除掉
*
* @param openClosePlanIds
* @return
*/
@ApiOperation("删除开关灯计划")
@DeleteMapping("/deleteLoopPlan/{openClosePlanIds}")
public Result deleteLoopPlan(@PathVariable List<Integer> openClosePlanIds) {
Integer projectId = 1;
boolean flag = true;
for (Integer openClosePlanId : openClosePlanIds) {
boolean b = openClosePlanService.remove(new LambdaQueryWrapper<OpenClosePlan>().eq(OpenClosePlan::getProjectId, projectId).eq(OpenClosePlan::getId, openClosePlanId));
boolean remove = openClosePlanRelationLoopService.remove(new LambdaQueryWrapper<OpenClosePlanRelationLoop>().eq(OpenClosePlanRelationLoop::getPlanId, openClosePlanId));
log.info("开关灯计划删除的结果:" + b + ",openClosePlanId为:" + openClosePlanId + "计划关联的回路的结果:" + remove);
flag = flag && b;
}
if (flag) {
return Result.buildSuccessMessage("删除成功");
} else {
return Result.buildFailedMessage("删除失败");
}
}
image.png
企业微信截图_16421560357676.png
enum Api {
DeletePlan = '/openClosePlan/deleteLoopPlan/',
}
//根据传入的计划id删除计划
export function deletePlan(params: Array<number>) {
return otherHttp.delete({
url: Api.DeletePlan + params,
});
}
网友评论