Closed claywong closed 1 month ago
@claywong 能否贴一下方法的具体实现?
public class CommonService<M extends CommonMapper<T>, T> extends ServiceImpl<M, T> {
private static final int BATCH_SIZE = 1000;
public CommonService() {
}
@Transactional(
rollbackFor = {Exception.class}
)
public boolean realSaveBatch(List<T> list, int batchSize) {
if (CollectionUtils.isEmpty(list)) {
return true;
} else {
batchSize = batchSize < 1 ? 1000 : batchSize;
if (list.size() <= batchSize) {
return this.retBool(((CommonMapper)this.baseMapper).insertBatchSomeColumn(list));
} else {
int fromIdx = 0;
int endIdx = batchSize;
while(true) {
if (endIdx > list.size()) {
endIdx = list.size();
}
((CommonMapper)this.baseMapper).insertBatchSomeColumn(list.subList(fromIdx, endIdx));
if (endIdx == list.size()) {
return true;
}
fromIdx += batchSize;
endIdx += batchSize;
}
}
}
}
}
public interface CommonMapper<T> extends BaseMapper<T> {
Integer insertBatchSomeColumn(Collection<T> list);
}
@claywong 已经支持,请拉取主分支最新代码进行验证
Search before asking
AREX Test Service
AREX Java Agent (arextest/arex-agent-java)
Current Behavior
List list
![image](https://github.com/arextest/arex-agent-java/assets/222770/8923d462-1612-4d8b-b0a5-8436305beff8)
操作之后,list中Log的id字段没有自增填充
Expected Behavior
Log中id被设置
Steps To Reproduce
最新打包的agent,mybatis-plus 3.1.0
Anything else
No response
Are you willing to submit a pull request to fix on your own?