类 MapperTemplate

  • 直接已知子类:
    EmptyProvider

    public abstract class MapperTemplate
    extends Object
    通用Mapper模板类,扩展通用Mapper时需要继承该类
    作者:
    liuzh
    • 构造器详细资料

      • MapperTemplate

        public MapperTemplate​(Class<?> mapperClass,
                              MapperHelper mapperHelper)
    • 方法详细资料

      • dynamicSQL

        public String dynamicSQL​(Object record)
        该方法仅仅用来初始化ProviderSqlSource
        参数:
        record -
        返回:
      • 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 -
        返回:
      • tableName

        protected String tableName​(Class<?> entityClass)
        获取实体类的表名
        参数:
        entityClass -
        返回:
      • getConfig

        public Config getConfig()
      • getIDENTITY

        public String getIDENTITY()
      • isBEFORE

        public boolean isBEFORE()
      • isCheckExampleEntityClass

        public boolean isCheckExampleEntityClass()
      • isNotEmpty

        public boolean isNotEmpty()