fix: Fix the bug in Condition regarding 'IN', and add non-empty validation for batch processing functionality
This commit is contained in:
@@ -650,6 +650,10 @@ public class BaseMapperImpl implements BaseMapper {
|
||||
@Override
|
||||
public int saveBatch(String tableName, String pkName, List<Map<String, Object>> list) {
|
||||
JudgesNull(tableName, "tableName can not be null!");
|
||||
JudgesNull(pkName, "pkName can not be null!");
|
||||
if(list==null|| list.isEmpty()){
|
||||
throw new ServiceException("list can not empty");
|
||||
}
|
||||
// JudgesNull(data, "tableName can not be null!");
|
||||
String key;
|
||||
DatasourceConfig datasourceConfig = new DatasourceConfig();
|
||||
@@ -687,6 +691,11 @@ public class BaseMapperImpl implements BaseMapper {
|
||||
|
||||
@Override
|
||||
public int updateBatchByPk(String tableName, String pkName, List<Map<String, Object>> list) {
|
||||
JudgesNull(tableName, "tableName can not be null!");
|
||||
JudgesNull(pkName, "pkName can not be null!");
|
||||
if(list==null|| list.isEmpty()){
|
||||
throw new ServiceException("list can not empty");
|
||||
}
|
||||
StringBuilder sql = new StringBuilder();
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
int index = 0;
|
||||
|
||||
@@ -310,7 +310,7 @@ public class Condition implements Serializable {
|
||||
int i = 1;
|
||||
for (Object object : value) {
|
||||
String sqlKey = "item_" + IdUtil.fastUUID();
|
||||
this.paramMap.put(sqlKey, value);
|
||||
this.paramMap.put(sqlKey, object);
|
||||
inStr.append("#{").append(sqlKey).append("}");
|
||||
if (i != value.size()) {
|
||||
inStr.append(",");
|
||||
|
||||
Reference in New Issue
Block a user