类 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(org.apache.ibatis.session.Configuration configuration, Class<?> entityType)
      参数:
      configuration - 配置对象
      entityType - 实体类型
      从以下版本开始:
      3.4.4
  • 方法详细资料

    • 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 片段
    • chooseSelect

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

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

      insert into table (字段) values (值)

      位于 "值" 部位

      返回:
      sql 脚本片段
    • getKeyInsertSqlColumn

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

      insert into table (字段) values (值)

      位于 "字段" 部位

      返回:
      sql 脚本片段
    • getAllInsertSqlPropertyMaybeIf

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

      insert into table (字段) values (值)

      位于 "值" 部位

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

      public String getAllInsertSqlPropertyMaybeIf(String prefix, boolean ignoreAutoIncrementColumn)
      获取所有 insert 时候插入值 sql 脚本片段
      参数:
      prefix - 前缀
      ignoreAutoIncrementColumn - 是否忽略自增主键字段
      返回:
      sql 脚本片段
      从以下版本开始:
      3.5.4
    • getAllInsertSqlColumnMaybeIf

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

      insert into table (字段) values (值)

      位于 "字段" 部位

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

      public String getAllInsertSqlColumnMaybeIf(String prefix, boolean ignoreAutoIncrementColumn)
      获取 insert 时候字段 sql 脚本片段
      参数:
      prefix - 前缀
      ignoreAutoIncrementColumn - 是否忽略自增主键字段
      返回:
      sql脚本内容
      从以下版本开始:
      3.5.4
    • getAllSqlWhere

      public String getAllSqlWhere(boolean fistAnd, boolean ignoreLogicDelFiled, boolean withId, String prefix)
      获取所有的查询的 sql 片段
      参数:
      fistAnd - 首个条件是否添加 AND 关键字
      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 脚本
    • formatLogicDeleteSql

      protected String formatLogicDeleteSql(boolean isWhere)
      format logic delete SQL, can be overrided by subclass github #1386
      参数:
      isWhere - true: logicDeleteValue, false: logicNotDeleteValue
      返回:
      sql
    • getFieldList

      public List<TableFieldInfo> getFieldList()
    • getOrderByFields

      public List<OrderFieldInfo> getOrderByFields()
    • isLogicDelete

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

      public Object getPropertyValue(Object entity, String property)
      获取对象属性值
      参数:
      entity - 对象
      property - 属性名
      返回:
      属性值
      从以下版本开始:
      3.4.4
    • setPropertyValue

      public void setPropertyValue(Object entity, String property, Object... values)
      设置对象属性值
      参数:
      entity - 实体对象
      property - 属性名
      values - 参数
      从以下版本开始:
      3.4.4
    • newInstance

      public <T> T newInstance()
      创建实例
      类型参数:
      T - 泛型
      返回:
      初始化实例
      从以下版本开始:
      3.5.0
    • 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

      @Deprecated public org.apache.ibatis.session.Configuration getConfiguration()
      已过时。
      3.5.3.2 初始化阶段可以使用一下,后期尽量避免在容器初始化完成之后再继续调用此方法
      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
    • setOrderByFields

      public TableInfo setOrderByFields(List<OrderFieldInfo> orderByFields)
      排序列表
      返回:
      this.
    • getReflector

      public org.apache.ibatis.reflection.Reflector getReflector()
      从以下版本开始:
      3.4.4