Spring Boot は、単一の String 型パラメーターのアノテーションを受け取ります

アノテーションを渡す@PathVariable()パラメータ

( Long型およびString型のパラメータを受け取ります) 例:


@RestController
@RequestMapping("/api")
public class Controller {

    @Autowired
    private IUserService userService;

    @PostMapping("/getlist/{id}/{name}")
    private AjaxResult getlist(@PathVariable("id") Long id,
                               @PathVariable("name") String name) {
        List<user> list= userService.getlist(id, name);
        return AjaxResult.success(list);
    }

}

おすすめ

転載: blog.csdn.net/qq_61726905/article/details/126890119