-
@PathVariable: 用于从URI路径中提取变量,通常用于RESTful风格的请求,其中参数包含在路径中的花括号中,例如
/example/{id}
。java代码
@GetMapping("/selectExamStationList/{examManageId}") public String examStationList(@PathVariable Long examManageId, ModelMap map){ HsExamStationRelation relation=new HsExamStationRelation(); //状态正常标识 relation.setStatus("0"); //未删除标识 relation.setDelFlag("0"); relation.setExamManageId(examManageId); List<HsExamStationRelation> relationList=hsExamStationRelationService.selectHsExamStationRelationList(relation); map.put("examRelationList",relationList); return prefix + "/selectExamStationList"; }
-
@RequestParam: 用于从查询字符串中获取参数,通常用于常规的查询参数,例如
/example?id=1
。java代码
@GetMapping("/selectExamStationList") public String examStationList(@RequestParam Long examManageId, ModelMap map){ HsExamStationRelation relation=new HsExamStationRelation(); //状态正常标识 relation.setStatus("0"); //未删除标识 relation.setDelFlag("0"); relation.setExamManageId(examManageId); List<HsExamStationRelation> relationList=hsExamStationRelationService.selectHsExamStationRelationList(relation); map.put("examRelationList",relationList); return prefix + "/selectExamStationList"; }
所以,有/{参数}
的是路径变量,而在URL中使用?参数
拼接的是请求参数。