改造 exists 相关方法。
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package xyz.zhouxy.plusone.jdbc;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -66,17 +65,16 @@ public abstract class PlusoneJdbcDaoSupport {
|
||||
}
|
||||
|
||||
protected final <T> Stream<T> queryForStream(String sql, String paramName, Object value, Class<T> elementType) {
|
||||
return this.jdbc.queryForList(sql, new MapSqlParameterSource(paramName, value), elementType).stream();
|
||||
return queryForStream(sql, new MapSqlParameterSource(paramName, value), elementType);
|
||||
}
|
||||
|
||||
protected final boolean queryExists(String sql, SqlParameterSource parameterSource) {
|
||||
Boolean isExists = this.jdbc.query(sql, parameterSource, ResultSet::next);
|
||||
Boolean isExists = this.jdbc.queryForObject(sql, parameterSource, Boolean.TYPE);
|
||||
return Boolean.TRUE.equals(isExists);
|
||||
}
|
||||
|
||||
protected final boolean queryExists(String sql, String paramName, Object value) {
|
||||
Boolean isExists = this.jdbc.query(sql, new MapSqlParameterSource(paramName, value), ResultSet::next);
|
||||
return Boolean.TRUE.equals(isExists);
|
||||
return queryExists(sql, new MapSqlParameterSource(paramName, value));
|
||||
}
|
||||
|
||||
protected final int update(String sql, SqlParameterSource parameterSource) {
|
||||
@@ -84,7 +82,7 @@ public abstract class PlusoneJdbcDaoSupport {
|
||||
}
|
||||
|
||||
protected final int update(String sql, String paramName, Object value) {
|
||||
return this.jdbc.update(sql, new MapSqlParameterSource(paramName, value));
|
||||
return update(sql, new MapSqlParameterSource(paramName, value));
|
||||
}
|
||||
|
||||
protected final int batchUpdate(String sql, SqlParameterSource[] batchArgs) {
|
||||
|
Reference in New Issue
Block a user