类 TableInfo

java.lang.Object
com.baomidou.mybatisplus.core.metadata.TableInfo
所有已实现的接口:
Constants, StringPool, Serializable

public class TableInfo
extends Object
implements Constants
数据库表反射信息
从以下版本开始:
2016-01-23
作者:
hubin
另请参阅:
序列化表格
  • 构造器详细资料

    • TableInfo

      public TableInfo​(Class<?> entityType)
  • 方法详细资料

    • getSqlStatement

      @Deprecated public String getSqlStatement​(String sqlMethod)
      已过时。
      3.4.0 如果存在的多mapper共用一个实体的情况,这里可能会出现获取命名空间错误的情况
      获得注入的 SQL Statement
      参数:
      sqlMethod - MybatisPlus 支持 SQL 方法
      返回:
      SQL Statement
    • havePK

      public boolean havePK()
      是否有主键
      返回:
      是否有
    • getKeySqlSelect

      public String getKeySqlSelect()
      获取主键的 select sql 片段
      返回:
      sql 片段
    • getAllSqlSelect

      public String getAllSqlSelect()
      获取包含主键及字段的 select sql 片段
      返回:
      sql 片段
    • chooseSelect

      public String chooseSelect​(Predicate<TableFieldInfo> predicate)
      获取需要进行查询的 select sql 片段
      参数:
      predicate - 过滤条件
      返回:
      sql 片段
    • getKeyInsertSqlProperty

      public String getKeyInsertSqlProperty​(String prefix, boolean newLine)
      获取 insert 时候主键 sql 脚本片段

      insert into table (字段) values (值)

      位于 "值" 部位

      返回:
      sql 脚本片段
    • getKeyInsertSqlColumn

      public String getKeyInsertSqlColumn​(boolean newLine)
      获取 insert 时候主键 sql 脚本片段

      insert into table (字段) values (值)

      位于 "字段" 部位

      返回:
      sql 脚本片段
    • getAllInsertSqlPropertyMaybeIf

      public String getAllInsertSqlPropertyMaybeIf​(String prefix)
      获取所有 insert 时候插入值 sql 脚本片段

      insert into table (字段) values (值)

      位于 "值" 部位

    • 自动选部位,根据规则会生成 if 标签
    • 返回:
      sql 脚本片段
    • getAllInsertSqlColumnMaybeIf

      public String getAllInsertSqlColumnMaybeIf​(String prefix)
      获取 insert 时候字段 sql 脚本片段

      insert into table (字段) values (值)

      位于 "字段" 部位

    • 自动选部位,根据规则会生成 if 标签
    • 返回:
      sql 脚本片段
    • getAllSqlWhere

      public String getAllSqlWhere​(boolean ignoreLogicDelFiled, boolean withId, String prefix)
      获取所有的查询的 sql 片段
      参数:
      ignoreLogicDelFiled - 是否过滤掉逻辑删除字段
      withId - 是否包含 id 项
      prefix - 前缀
      返回:
      sql 脚本片段
    • getAllSqlSet

      public String getAllSqlSet​(boolean ignoreLogicDelFiled, String prefix)
      获取所有的 sql set 片段
      参数:
      ignoreLogicDelFiled - 是否过滤掉逻辑删除字段
      prefix - 前缀
      返回:
      sql 脚本片段
    • getLogicDeleteSql

      public String getLogicDeleteSql​(boolean startWithAnd, boolean isWhere)
      获取逻辑删除字段的 sql 脚本
      参数:
      startWithAnd - 是否以 and 开头
      isWhere - 是否需要的是逻辑删除值
      返回:
      sql 脚本
    • getFieldList

      public List<TableFieldInfo> getFieldList()
    • isLogicDelete

      @Deprecated public boolean isLogicDelete()
      已过时。
    • getEntityType

      public Class<?> getEntityType()
      实体类型
    • getIdType

      public com.baomidou.mybatisplus.annotation.IdType getIdType()
      表主键ID 类型
    • getTableName

      public String getTableName()
      表名称
    • getResultMap

      public String getResultMap()
      表映射结果集
    • isAutoInitResultMap

      public boolean isAutoInitResultMap()
      是否是需要自动生成的 resultMap
    • isKeyRelated

      public boolean isKeyRelated()
      主键是否有存在字段名与属性名关联

      true: 表示要进行 as

    • getKeyColumn

      public String getKeyColumn()
      表主键ID 字段名
    • getKeyProperty

      public String getKeyProperty()
      表主键ID 属性名
    • getKeyType

      public Class<?> getKeyType()
      表主键ID 属性类型
    • getKeySequence

      public com.baomidou.mybatisplus.annotation.KeySequence getKeySequence()
      表主键ID Sequence
    • getCurrentNamespace

      public String getCurrentNamespace()
      命名空间 (对应的 mapper 接口的全类名)
    • isUnderCamel

      public boolean isUnderCamel()
      是否开启下划线转驼峰

      未注解指定字段名的情况下,用于自动从 property 推算 column 的命名

    • equals

      public boolean equals​(Object o)
      覆盖:
      equals 在类中 Object
    • canEqual

      protected boolean canEqual​(Object other)
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 Object
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object
    • getConfiguration

      public org.apache.ibatis.session.Configuration getConfiguration()
      MybatisConfiguration 标记 (Configuration内存地址值)
    • isWithInsertFill

      public boolean isWithInsertFill()
      表字段是否启用了插入填充
      从以下版本开始:
      3.3.0
    • isWithUpdateFill

      public boolean isWithUpdateFill()
      表字段是否启用了更新填充
      从以下版本开始:
      3.3.0
    • isWithLogicDelete

      public boolean isWithLogicDelete()
      表字段是否启用了逻辑删除
      从以下版本开始:
      3.4.0
    • getLogicDeleteFieldInfo

      public TableFieldInfo getLogicDeleteFieldInfo()
      逻辑删除字段
      从以下版本开始:
      3.4.0
    • isWithVersion

      public boolean isWithVersion()
      表字段是否启用了乐观锁
      从以下版本开始:
      3.3.1
    • getVersionFieldInfo

      public TableFieldInfo getVersionFieldInfo()
      乐观锁字段
      从以下版本开始:
      3.3.1