1. 添加防护对象文件上传下载配置

2. 修改SqlSessionWrapper,添加注释
This commit is contained in:
松岳 陈
2024-01-07 17:54:28 +08:00
parent 0fb8dd87fe
commit db02907f0a
8 changed files with 85 additions and 33 deletions

View File

@@ -16,13 +16,22 @@ public class SqlSessionWrapper {
this.sqlSessionFactory = sqlSessionFactory;
}
/** 启动批量SQL会话
* @param mapperClass MyBatis Mapper类型
* @param batchFunction 批量函数(批量添加、批量删除、批量更新等)
* @param arguments 函数附带的所有参数可以使用Map进行包装
* @param <M> Mapper class
* @param <I> Function input
* @param <O> Function output
* @return 被包装的批量函数返回值
*/
public <M, I, O> O startBatchSession(Class<M> mapperClass,
Function<M, Function<I, O>> wrappedFunction,
Function<M, Function<I, O>> batchFunction,
I arguments) {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
M mapper = sqlSession.getMapper(mapperClass);
try {
O result = wrappedFunction.apply(mapper).apply(arguments);
O result = batchFunction.apply(mapper).apply(arguments);
sqlSession.commit();
sqlSession.clearCache();