Class MapperHelper

java.lang.Object
cn.lm.mybatis.mapper.mapperhelper.MapperHelper

public class MapperHelper extends Object
处理主要逻辑,最关键的一个类

项目地址 : https://github.com/abel533/Mapper

Author:
liuzh
  • Constructor Details

    • MapperHelper

      public MapperHelper()
      默认构造方法
    • MapperHelper

      public MapperHelper(Properties properties)
      带配置的构造方法
      Parameters:
      properties -
  • Method Details

    • registerMapper

      public void registerMapper(Class<?> mapperClass)
      注册通用Mapper接口
      Parameters:
      mapperClass -
    • registerMapper

      public void registerMapper(String mapperClass)
      注册通用Mapper接口
      Parameters:
      mapperClass -
    • isMapperMethod

      public MapperTemplate isMapperMethod(String msId)
      判断当前的接口方法是否需要进行拦截
      Parameters:
      msId -
      Returns:
    • getMapperTemplateByMsId

      public MapperTemplate getMapperTemplateByMsId(String msId)
      根据 msId 获取 MapperTemplate
      Parameters:
      msId -
      Returns:
    • isExtendCommonMapper

      public boolean isExtendCommonMapper(Class<?> mapperInterface)
      判断接口是否包含通用接口,
      Parameters:
      mapperInterface -
      Returns:
    • processConfiguration

      public void processConfiguration(org.apache.ibatis.session.Configuration configuration)
      配置完成后,执行下面的操作
      处理configuration中全部的MappedStatement
      Parameters:
      configuration -
    • processConfiguration

      public void processConfiguration(org.apache.ibatis.session.Configuration configuration, Class<?> mapperInterface)
      配置指定的接口
      Parameters:
      configuration -
      mapperInterface -
    • processMappedStatement

      public void processMappedStatement(org.apache.ibatis.mapping.MappedStatement ms)
      处理 MappedStatement
      Parameters:
      ms -
    • getConfig

      public Config getConfig()
      获取通用Mapper配置
      Returns:
    • setConfig

      public void setConfig(Config config)
      设置通用Mapper配置
      Parameters:
      config -
    • setProperties

      public void setProperties(Properties properties)
      配置属性
      Parameters:
      properties -
    • setSqlSource

      public void setSqlSource(org.apache.ibatis.mapping.MappedStatement ms, MapperTemplate mapperTemplate)
      重新设置SqlSource

      执行该方法前必须使用isMapperMethod判断,否则msIdCache会空

      Parameters:
      ms -
      mapperTemplate -
    • setRawSqlSourceMapper

      public void setRawSqlSourceMapper(org.apache.ibatis.mapping.MappedStatement ms)
      设置原生Mybatis查询的实体映射,

      JPA的注解优先级将高于mybatis自动映射