Class MapperTemplate
java.lang.Object
cn.lm.mybatis.mapper.mapperhelper.MapperTemplate
- Direct Known Subclasses:
EmptyProvider
通用Mapper模板类,扩展通用Mapper时需要继承该类
- Author:
- liuzh
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMethodMap(String methodName, Method method) 添加映射方法org.apache.ibatis.mapping.SqlSourcecreateSqlSource(org.apache.ibatis.mapping.MappedStatement ms, String xmlSql) 通过xmlSql创建sqlSourcedynamicSQL(Object record) 该方法仅仅用来初始化ProviderSqlSourceClass<?>getEntityClass(org.apache.ibatis.mapping.MappedStatement ms) 获取返回值类型 - 实体类型getIDENTITY(EntityColumn column) 获取IDENTITY值的表达式booleanisBEFORE()booleanbooleanprotected voidsetResultType(org.apache.ibatis.mapping.MappedStatement ms, Class<?> entityClass) 设置返回值类型 - 为了让typeHandler在select时有效,改为设置resultMapvoidsetSqlSource(org.apache.ibatis.mapping.MappedStatement ms) 重新设置SqlSourceprotected voidsetSqlSource(org.apache.ibatis.mapping.MappedStatement ms, org.apache.ibatis.mapping.SqlSource sqlSource) 重新设置SqlSourcebooleansupportMethod(String msId) 是否支持该通用方法protected String获取实体类的表名
-
Field Details
-
methodMap
-
entityClassMap
-
mapperClass
-
mapperHelper
-
-
Constructor Details
-
MapperTemplate
-
-
Method Details
-
dynamicSQL
该方法仅仅用来初始化ProviderSqlSource- Parameters:
record-- Returns:
-
addMethodMap
添加映射方法- Parameters:
methodName-method-
-
getIDENTITY
获取IDENTITY值的表达式- Parameters:
column-- Returns:
-
supportMethod
是否支持该通用方法- Parameters:
msId-- Returns:
-
setResultType
设置返回值类型 - 为了让typeHandler在select时有效,改为设置resultMap- Parameters:
ms-entityClass-
-
setSqlSource
protected void setSqlSource(org.apache.ibatis.mapping.MappedStatement ms, org.apache.ibatis.mapping.SqlSource sqlSource) 重新设置SqlSource- Parameters:
ms-sqlSource-
-
createSqlSource
public org.apache.ibatis.mapping.SqlSource createSqlSource(org.apache.ibatis.mapping.MappedStatement ms, String xmlSql) 通过xmlSql创建sqlSource- Parameters:
ms-xmlSql-- Returns:
-
getEntityClass
获取返回值类型 - 实体类型- Parameters:
ms-- Returns:
-
tableName
获取实体类的表名- Parameters:
entityClass-- Returns:
-
getConfig
-
getIDENTITY
-
isBEFORE
public boolean isBEFORE() -
isCheckExampleEntityClass
public boolean isCheckExampleEntityClass() -
isNotEmpty
public boolean isNotEmpty() -
setSqlSource
重新设置SqlSource- Parameters:
ms-- Throws:
InvocationTargetExceptionIllegalAccessExceptionException
-