public static PreparedStatement fillParams(PreparedStatement ps, Object... params) throws SQLException {
		if (ArrayUtil.isEmpty(params)) {
			return ps;// 无参数
		}
		Object param;
		for (int i = 0; i < params.length; i++) {
			int paramIndex = i + 1;
			param = params[i];
			if (null != param) {
				if (param instanceof java.util.Date) {
					// 日期特殊处理
					if (param instanceof java.sql.Date) {
						ps.setDate(paramIndex, (java.sql.Date) param);
					} else if (param instanceof java.sql.Time) {
						ps.setTime(paramIndex, (java.sql.Time) param);
					} else {
						ps.setTimestamp(paramIndex, SqlUtil.toSqlTimestamp((java.util.Date) param));
					}
				} else if (param instanceof Number) {
					// 针对大数字类型的特殊处理
					if (param instanceof BigInteger) {
						// BigInteger转为Long
						ps.setLong(paramIndex, ((BigInteger) param).longValue());
					} else if (param instanceof BigDecimal) {
						// BigDecimal的转换交给JDBC驱动处理
						ps.setBigDecimal(paramIndex, (BigDecimal) param);
					} else {
						// 普通数字类型按照默认传入
						ps.setObject(paramIndex, param);
					}
				} else {
					ps.setObject(paramIndex, param);
				}
			} else {
				final ParameterMetaData pmd = ps.getParameterMetaData();
				int sqlType = Types.VARCHAR;
				try {
					sqlType = pmd.getParameterType(paramIndex);
				} catch (SQLException e) {
					// ignore
					// log.warn("Null param of index [{}] type get failed, by: {}", paramIndex, e.getMessage());
				}
				ps.setNull(paramIndex, sqlType);
			}
		}
		return ps;
	}
public static PreparedStatement fillParams ( PreparedStatement ps , Object ... params ) throws SQLException { if ( ArrayUtil . isEmpty ( params ) ) { return ps ; } Object param ; for ( int i = 0 ; i < params . length ; i ++ ) { int paramIndex = i + 1 ; param = params [ i ] ; if ( null != param ) { if ( param instanceof java . util . Date ) { if ( param instanceof java . sql . Date ) { ps . setDate ( paramIndex , ( java . sql . Date ) param ) ; } else if ( param instanceof java . sql . Time ) { ps . setTime ( paramIndex , ( java . sql . Time ) param ) ; } else { ps . setTimestamp ( paramIndex , SqlUtil . toSqlTimestamp ( ( java . util . Date ) param ) ) ; } } else if ( param instanceof Number ) { if ( param instanceof BigInteger ) { ps . setLong ( paramIndex , ( ( BigInteger ) param ) . longValue ( ) ) ; } else if ( param instanceof BigDecimal ) { ps . setBigDecimal ( paramIndex , ( BigDecimal ) param ) ; } else { ps . setObject ( paramIndex , param ) ; } } else { ps . setObject ( paramIndex , param ) ; } } else { final ParameterMetaData pmd = ps . getParameterMetaData ( ) ; int sqlType = Types . VARCHAR ; try { sqlType = pmd . getParameterType ( paramIndex ) ; } catch ( SQLException e ) { } ps . setNull ( paramIndex , sqlType ) ; } } return ps ; }
填充SQL的参数。<br>
对于日期对象特殊处理：传入java.util.Date默认按照Timestamp处理

@param ps PreparedStatement
@param params SQL参数
@return {@link PreparedStatement}
@throws SQLException SQL执行异常