类 MapperTemplate
- java.lang.Object
-
- tk.mybatis.mapper.mapperhelper.MapperTemplate
-
- 直接已知子类:
EmptyProvider
public abstract class MapperTemplate extends Object
通用Mapper模板类,扩展通用Mapper时需要继承该类- 作者:
- liuzh
-
-
字段概要
字段 修饰符和类型 字段 说明 protected Map<String,Class<?>>entityClassMapprotected Class<?>mapperClassprotected MapperHelpermapperHelperprotected Map<String,Method>methodMap
-
构造器概要
构造器 构造器 说明 MapperTemplate(Class<?> mapperClass, MapperHelper mapperHelper)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddMethodMap(String methodName, Method method)添加映射方法org.apache.ibatis.mapping.SqlSourcecreateSqlSource(org.apache.ibatis.mapping.MappedStatement ms, String xmlSql)通过xmlSql创建sqlSourceStringdynamicSQL(Object record)该方法仅仅用来初始化ProviderSqlSourceConfiggetConfig()Class<?>getEntityClass(org.apache.ibatis.mapping.MappedStatement ms)获取返回值类型 - 实体类型StringgetIDENTITY()StringgetIDENTITY(EntityColumn column)获取IDENTITY值的表达式booleanisBEFORE()booleanisCheckExampleEntityClass()booleanisNotEmpty()protected 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 StringtableName(Class<?> entityClass)获取实体类的表名
-
-
-
构造器详细资料
-
MapperTemplate
public MapperTemplate(Class<?> mapperClass, MapperHelper mapperHelper)
-
-
方法详细资料
-
addMethodMap
public void addMethodMap(String methodName, Method method)
添加映射方法- 参数:
methodName-method-
-
getIDENTITY
public String getIDENTITY(EntityColumn column)
获取IDENTITY值的表达式- 参数:
column-- 返回:
-
supportMethod
public boolean supportMethod(String msId)
是否支持该通用方法- 参数:
msId-- 返回:
-
setResultType
protected void setResultType(org.apache.ibatis.mapping.MappedStatement ms, Class<?> entityClass)设置返回值类型 - 为了让typeHandler在select时有效,改为设置resultMap- 参数:
ms-entityClass-
-
setSqlSource
protected void setSqlSource(org.apache.ibatis.mapping.MappedStatement ms, org.apache.ibatis.mapping.SqlSource sqlSource)重新设置SqlSource- 参数:
ms-sqlSource-
-
createSqlSource
public org.apache.ibatis.mapping.SqlSource createSqlSource(org.apache.ibatis.mapping.MappedStatement ms, String xmlSql)通过xmlSql创建sqlSource- 参数:
ms-xmlSql-- 返回:
-
getEntityClass
public Class<?> getEntityClass(org.apache.ibatis.mapping.MappedStatement ms)
获取返回值类型 - 实体类型- 参数:
ms-- 返回:
-
getConfig
public Config getConfig()
-
getIDENTITY
public String getIDENTITY()
-
isBEFORE
public boolean isBEFORE()
-
isCheckExampleEntityClass
public boolean isCheckExampleEntityClass()
-
isNotEmpty
public boolean isNotEmpty()
-
setSqlSource
public void setSqlSource(org.apache.ibatis.mapping.MappedStatement ms) throws Exception重新设置SqlSource- 参数:
ms-- 抛出:
InvocationTargetExceptionIllegalAccessExceptionException
-
-