Class Example

java.lang.Object
tk.mybatis.mapper.entity.Example
All Implemented Interfaces:
IDynamicTableName
Direct Known Subclasses:
Condition

public class Example extends Object implements IDynamicTableName
通用的Example查询对象
Author:
liuzh
  • Field Details

    • orderByClause

      protected String orderByClause
    • distinct

      protected boolean distinct
    • exists

      protected boolean exists
    • notNull

      protected boolean notNull
    • forUpdate

      protected boolean forUpdate
    • selectColumns

      protected Set<String> selectColumns
    • excludeColumns

      protected Set<String> excludeColumns
    • countColumn

      protected String countColumn
    • oredCriteria

      protected List<Example.Criteria> oredCriteria
    • entityClass

      protected Class<?> entityClass
    • table

      protected EntityTable table
    • propertyMap

      protected Map<String,EntityColumn> propertyMap
    • tableName

      protected String tableName
    • ORDERBY

      protected Example.OrderBy ORDERBY
  • Constructor Details

    • Example

      public Example(Class<?> entityClass)
      默认exists为true
      Parameters:
      entityClass -
    • Example

      public Example(Class<?> entityClass, boolean exists)
      带exists参数的构造方法,默认notNull为false,允许为空
      Parameters:
      entityClass -
      exists - - true时,如果字段不存在就抛出异常,false时,如果不存在就不使用该字段的条件
    • Example

      public Example(Class<?> entityClass, boolean exists, boolean notNull)
      带exists参数的构造方法
      Parameters:
      entityClass -
      exists - - true时,如果字段不存在就抛出异常,false时,如果不存在就不使用该字段的条件
      notNull - - true时,如果值为空,就会抛出异常,false时,如果为空就不使用该字段的条件
  • Method Details

    • builder

      public static Example.Builder builder(Class<?> entityClass)
    • orderBy

      public Example.OrderBy orderBy(String property)
    • excludeProperties

      public Example excludeProperties(String... properties)
      排除查询字段,优先级低于 selectProperties
      Parameters:
      properties - 属性名的可变参数
      Returns:
    • selectProperties

      public Example selectProperties(String... properties)
      指定要查询的属性列 - 这里会自动映射到表字段
      Parameters:
      properties -
      Returns:
    • or

      public void or(Example.Criteria criteria)
    • or

      public Example.Criteria or()
    • and

      public void and(Example.Criteria criteria)
    • and

      public Example.Criteria and()
    • createCriteria

      public Example.Criteria createCriteria()
    • createCriteriaInternal

      protected Example.Criteria createCriteriaInternal()
    • clear

      public void clear()
    • getPropertyMap

      public Map<String,EntityColumn> getPropertyMap()
    • getCountColumn

      public String getCountColumn()
    • getDynamicTableName

      public String getDynamicTableName()
      Description copied from interface: IDynamicTableName
      获取动态表名 - 只要有返回值,不是null和'',就会用返回值作为表名
      Specified by:
      getDynamicTableName in interface IDynamicTableName
      Returns:
    • getEntityClass

      public Class<?> getEntityClass()
    • getOrderByClause

      public String getOrderByClause()
    • setOrderByClause

      public void setOrderByClause(String orderByClause)
    • getOredCriteria

      public List<Example.Criteria> getOredCriteria()
    • getSelectColumns

      public Set<String> getSelectColumns()
    • isDistinct

      public boolean isDistinct()
    • setDistinct

      public void setDistinct(boolean distinct)
    • isForUpdate

      public boolean isForUpdate()
    • setForUpdate

      public void setForUpdate(boolean forUpdate)
    • setCountProperty

      public void setCountProperty(String property)
      指定 count(property) 查询属性
      Parameters:
      property -
    • setTableName

      public void setTableName(String tableName)
      设置表名
      Parameters:
      tableName -