0

我的控制器

@DeleteMapping("/courses/{courseId")

public ResponseEntity<HttpStatus> deleteCourse(@PathVariable String courseId )
{   
    try {
        this.courseService.deleteCourse(Long.parseLong(courseId));
        return new ResponseEntity<>(HttpStatus.OK);
    }catch(Exception e)
    {
        return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
    }
}

服务等级

@Override
public void deleteCourse(long parseLong) {
    list=this.list.stream().filter(e->e.getId()!=parseLong).collect(Collectors.toList());
    
}
4

0 回答 0