需要的参数怎么分开传递?
@RequestMapping(value = "/saveInfo/{userName}", method = RequestMethod.POST)
@ResponseBody
public int saveInfos(@RequestParam("userName") String userName,
@PathVariable("record") StationeryInfo record){
return staInfoService.saveSelectInfo(record);
}
userName是StationeryInfo没有的,但是我要存在staInfoService这个对应mapper里面,该怎么写这个Controller层?急求
重写staInfoService方法,让他接受一个参数,或者写成变长参数的函数来接受它。
staInfoService.saveSelectInfo(selectInfo.setXxx(userName)) 这样就行了 因为你方法里面传的是string 类型的。