public class IntegerArray2Varchar extends BaseTypeHandler<Integer[]> { @Override publicvoidsetNonNullParameter(PreparedStatement ps, int i, Integer[] parameter, JdbcType jdbcType)throws SQLException { ps.setString(i, Arrays.toString(parameter)); }
/** * Gets the nullable result. * * @param rs the rs * @param columnName Colunm name, when configuration <code>useColumnLabel</code> is <code>false</code> * @return the nullable result * @throws SQLException the SQL exception */ @Override public Integer[] getNullableResult(ResultSet rs, String columnName) throws SQLException { // 利用ConvertUtils的convert方法将字符串转化为Integer数组 return (Integer[]) ConvertUtils.convert(rs.getString(columnName), Integer[].class); }
@Override public Integer[] getNullableResult(ResultSet rs, int columnIndex) throws SQLException { // 利用ConvertUtils的convert方法将字符串转化为Integer数组 return (Integer[]) ConvertUtils.convert(rs.getString(columnIndex), Integer[].class); }
@Override public Integer[] getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { // 利用ConvertUtils的convert方法将字符串转化为Integer数组 return (Integer[]) ConvertUtils.convert(cs.getString(columnIndex), Integer[].class); } }