1. 优化分配菜单的逻辑,使用批量插入

2. 修复 CodegenEngine 生成代码时,Mapper.XML 地址不对
This commit is contained in:
YunaiV
2022-04-01 22:40:19 +08:00
parent e3ddb29c18
commit 1bb204adb5
9 changed files with 71 additions and 29 deletions

View File

@ -75,12 +75,20 @@ public interface BaseMapperX<T> extends BaseMapper<T> {
return selectList(new LambdaQueryWrapper<T>().in(field, values));
}
/**
* 逐条插入,适合少量数据插入,或者对性能要求不高的场景
*
* 如果大量,请使用 {@link com.baomidou.mybatisplus.extension.service.impl.ServiceImpl#saveBatch(Collection)} 方法
* 使用示例,可见 RoleMenuBatchInsertMapper、UserRoleBatchInsertMapper 类
*
* @param entities 实体们
*/
default void insertBatch(Collection<T> entities) {
// TODO 芋艿:修改成支持批量的
entities.forEach(this::insert);
}
default void updateBatch(T update) {
update(update, new QueryWrapper<>());
}
}