已采納回答 / 慕碼人6042610
Unknown column 'register' in 'field list'? ? 是不是字段寫錯了? xml文件里? register
2018-12-22
@麻了一一一
你好,的確,對應(yīng)沒有走到controller層面內(nèi)的錯誤補獲不到,可以采用controlleradvice注解另外定義一個類,然后實現(xiàn)一個方法,類似于這樣
@ControllerAdvice
public class Test {
@ExceptionHandler(value = Exception.class)
@ResponseBody
public CommonReturnType error(HttpServletRequest request, HttpServletResponse response, Exception e)
}
你好,的確,對應(yīng)沒有走到controller層面內(nèi)的錯誤補獲不到,可以采用controlleradvice注解另外定義一個類,然后實現(xiàn)一個方法,類似于這樣
@ControllerAdvice
public class Test {
@ExceptionHandler(value = Exception.class)
@ResponseBody
public CommonReturnType error(HttpServletRequest request, HttpServletResponse response, Exception e)
}
2018-12-22
已采納回答 / 龍蝦三少
因為許多值在原本的itemmodel里是沒有的,比如數(shù)據(jù)庫的默認值,itemmodel里是null,經(jīng)過數(shù)據(jù)庫后變成0或空字符串聚合生成的,比如get方法里還會去聚合轉(zhuǎn)換一些邏輯,比如itemstock庫存是在get方法里會取,但是itemmodel里只有一個庫存數(shù)量,沒有主鍵或者以后其他的更多邏輯對一個restful風(fēng)格的服務(wù),創(chuàng)建方法需要可以返回對象創(chuàng)建后的模型,因此這么做可以將后續(xù)邏輯都收口到get方法里
2018-12-21
public CommonReturnType getUser(@RequestParam(name = "id")Integer id)運行沒有問題。
但是通常寫:@RequestParam(value = "id")Integer id
但是通常寫:@RequestParam(value = "id")Integer id
2018-12-21
講師回答 / 龍蝦三少
你電腦上裝的mysql server的版本要和maven內(nèi)引入的version大版本號一致,視頻里用的是mysql 5.幾的client和server,檢查下是否不一致
2018-12-21