fix: Fix the bug in Condition regarding 'IN', and add non-empty validation for batch processing functionality

This commit is contained in:
2024-08-22 11:03:43 +08:00
parent e446d9e574
commit 88edec9afa
2 changed files with 10 additions and 1 deletions

View File

@@ -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;

View File

@@ -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(",");