MyBatis 层次结构

MyBatis 层次结构图.png

mybaits SQL生成和拼接

  1. org.apache.ibatis.builder.StaticSqlSource#getBoundSql => return new BoundSql(configuration, sql, parameterMappings, parameterObject);
  2. org.apache.ibatis.scripting.defaults.RawSqlSource#getBoundSql => return sqlSource.getBoundSql(parameterObject);
  3. org.apache.ibatis.mapping.MappedStatement#getBoundSql => BoundSql boundSql = sqlSource.getBoundSql(parameterObject);
  4. org.apache.ibatis.executor.CachingExecutor#query => BoundSql boundSql = ms.getBoundSql(parameterObject);
  5. org.apache.ibatis.session.defaults.DefaultSqlSession#selectList => return executor.query(ms, wrapCollection(parameter), rowBounds, Executor.NO_RESULT_HANDLER);
  6. org.mybatis.spring.SqlSessionTemplate#selectList => return this.sqlSessionProxy.selectList(statement, parameter);
  7. org.apache.ibatis.binding.MapperMethod#executeForMany => result = sqlSession.selectList(command.getName(), param);
  8. org.apache.ibatis.binding.MapperMethod#execute => switch (command.getType()) { case SELECT: result = executeForMany(sqlSession, args);
  9. org.apache.ibatis.binding.MapperProxy#invoke => return mapperMethod.execute(sqlSession, args);