Class MapperHelper
java.lang.Object
cn.lm.mybatis.mapper.mapperhelper.MapperHelper
处理主要逻辑,最关键的一个类
- Author:
- liuzh
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription获取通用Mapper配置根据 msId 获取 MapperTemplatebooleanisExtendCommonMapper(Class<?> mapperInterface) 判断接口是否包含通用接口,isMapperMethod(String msId) 判断当前的接口方法是否需要进行拦截voidprocessConfiguration(org.apache.ibatis.session.Configuration configuration) 配置完成后,执行下面的操作
处理configuration中全部的MappedStatementvoidprocessConfiguration(org.apache.ibatis.session.Configuration configuration, Class<?> mapperInterface) 配置指定的接口voidprocessMappedStatement(org.apache.ibatis.mapping.MappedStatement ms) 处理 MappedStatementvoidregisterMapper(Class<?> mapperClass) 注册通用Mapper接口voidregisterMapper(String mapperClass) 注册通用Mapper接口void设置通用Mapper配置voidsetProperties(Properties properties) 配置属性voidsetRawSqlSourceMapper(org.apache.ibatis.mapping.MappedStatement ms) 设置原生Mybatis查询的实体映射,voidsetSqlSource(org.apache.ibatis.mapping.MappedStatement ms, MapperTemplate mapperTemplate) 重新设置SqlSource
-
Constructor Details
-
MapperHelper
public MapperHelper()默认构造方法 -
MapperHelper
带配置的构造方法- Parameters:
properties-
-
-
Method Details
-
registerMapper
注册通用Mapper接口- Parameters:
mapperClass-
-
registerMapper
注册通用Mapper接口- Parameters:
mapperClass-
-
isMapperMethod
判断当前的接口方法是否需要进行拦截- Parameters:
msId-- Returns:
-
getMapperTemplateByMsId
根据 msId 获取 MapperTemplate- Parameters:
msId-- Returns:
-
isExtendCommonMapper
判断接口是否包含通用接口,- 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
获取通用Mapper配置- Returns:
-
setConfig
设置通用Mapper配置- Parameters:
config-
-
setProperties
配置属性- 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自动映射
-