mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add method
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package cn.hutool.db;
|
||||
|
||||
import cn.hutool.core.collection.ArrayIter;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
@@ -13,8 +13,19 @@ import cn.hutool.db.sql.SqlUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ParameterMetaData;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.Types;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Statement和PreparedStatement工具类
|
||||
@@ -191,7 +202,7 @@ public class StatementUtil {
|
||||
//null参数的类型缓存,避免循环中重复获取类型
|
||||
final Map<Integer, Integer> nullTypeMap = new HashMap<>();
|
||||
for (Entity entity : entities) {
|
||||
fillParams(ps, CollectionUtil.valuesOfKeys(entity, fields), nullTypeMap);
|
||||
fillParams(ps, CollUtil.valuesOfKeys(entity, fields), nullTypeMap);
|
||||
ps.addBatch();
|
||||
}
|
||||
return ps;
|
||||
|
@@ -101,7 +101,7 @@ public class SqlBuilder implements Builder<String>{
|
||||
* 插入会忽略空的字段名及其对应值,但是对于有字段名对应值为{@code null}的情况不忽略
|
||||
*
|
||||
* @param entity 实体
|
||||
* @param dialectName 方言名
|
||||
* @param dialectName 方言名,用于对特殊数据库特殊处理
|
||||
* @return 自己
|
||||
*/
|
||||
public SqlBuilder insert(Entity entity, DialectName dialectName) {
|
||||
|
Reference in New Issue
Block a user