這個問題挺白癡的,爲了測試使用map集合給mybatis的動態sql傳參,就複製了例子進行更改測試,結果報錯了:
org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be
returned by selectOne(), but found: 11
看提示應該是返回了多個值,但是指定的是單值返回。原因的mapper.java裏面的接口方法返回類型寫錯了,沒有使用list。
總結下:使用mapper自動映射,決定使用selectone還是使用selectlist的是方法裏的返回類型。