<strong><span style="font-size:14px;">public <T> T selectOne(String statement, Object parameter) {<span style="color:#009900;">
// Popular vote was to return null on 0 results and throw exception on too many.
</span>List<T> list = this.<T>selectList(statement, parameter);
if (list.size() == 1) {
return list.get(0);
} else if (list.size() > 1) {
throw new TooManyResultsException("Expected one result (or null) to be returned by selectOne(), but found: " + list.size());
} else {
return null;
}<span style="color:#009900;">
</span> }</span></strong>
1、 selectOne和selectList区别 观看源码理解public T selectOne(String statement, Object parameter) { // Popular vote was to return null on 0 results and throw exception on too many. List lis