MybatisPlus批量保存流程
2021-11-25 14:38:13 4 举报
MybatisPlus批量保存流程
作者其他创作
大纲/内容
PreparedStatementHandler
+ batch(Statement statement)
SqlSession
commit()/...getConnection()int insert(String statement)List<BatchResult> flushStatements()
SqlSessionFactory
BaseExecutor
# configuration# transaction
IService<T>
saveBatch(Collection<T> entityList)
PreparedStatement
# MySQLConnection(rewriteBatchedStatements)
+ void addBatch()# executeBatchInternal()# computeBatchSize()
2、执行executeBatch
DefaultSqlSession
- configuration- executor- autoCommit
DefaultSqlSessionFactory
- configuration
+ openSession()- openSessionFromDataSource()
BaseStatementHandler
1、添加数据到batchedArgs
AbstractBaseExecutor
+ update()# doUpdate()
void addBatch()
Executor
List<BatchResult> flushStatements()
StatementImpl
# List<Object> batchedArgs
+ executeBatch()# executeBatchInternal()
Statement
StatementHandler
batch(Statement statement)
MybatisBatchExecutor
- List<Statement> statementList
+ doUpdate(MappedStatement)+ doFlushStatements()
+ saveBatch(Collection<T> entityList)
0 条评论
下一页