批注接口 TableField


@Documented @Retention(RUNTIME) @Target({FIELD,ANNOTATION_TYPE}) public @interface TableField
表字段标识
从以下版本开始:
2016-09-09
作者:
hubin sjy tantan
  • 元素详细资料

    • value

      String value
      数据库字段值

      不需要配置该值的情况:

    • 引用无效
      com.baomidou.mybatisplus.core.MybatisConfiguration#mapUnderscoreToCamelCase
      为 true 时, (mp下默认是true,mybatis默认是false), 数据库字段值.replace("_","").toUpperCase() == 实体属性名.toUpperCase()
    • 引用无效
      com.baomidou.mybatisplus.core.MybatisConfiguration#mapUnderscoreToCamelCase
      为 false 时, 数据库字段值.toUpperCase() == 实体属性名.toUpperCase()
    • 默认值:
      ""
    • exist

      boolean exist
      是否为数据库表字段

      默认 true 存在,false 不存在

      默认值:
      true
    • condition

      String condition
      字段 where 实体查询比较条件

      默认 SqlCondition.EQUAL

      默认值:
      ""
    • update

      String update
      字段 update set 部分注入, 该注解优于 el 注解使用

      例1:@TableField(.. , update="%s+1") 其中 %s 会填充为字段 输出 SQL 为:update 表 set 字段=字段+1 where ...

      例2:@TableField(.. , update="now()") 使用数据库时间 输出 SQL 为:update 表 set 字段=now() where ...

      默认值:
      ""
    • insertStrategy

      FieldStrategy insertStrategy
      字段验证策略之 insert: 当insert操作时,该字段拼接insert语句时的策略

      ALWAYS: 直接拼接 insert into table_a(column) values (#{columnProperty}); NOT_NULL: insert into table_a(column) values (#{columnProperty}) NOT_EMPTY: insert into table_a(column) values (#{columnProperty}) NEVER: 该字段不参加 insert 语句

      NOT_EMPTY 如果针对的是非 CharSequence 类型的字段则效果等于 NOT_NULL

      从以下版本开始:
      3.1.2
      默认值:
      DEFAULT
    • updateStrategy

      FieldStrategy updateStrategy
      字段验证策略之 update: 当更新操作时,该字段拼接set语句时的策略

      ALWAYS: 直接拼接 update table_a set column=#{columnProperty}, 属性为null/空string都会被set进去 NOT_NULL: update table_a set column=#{columnProperty} NOT_EMPTY: update table_a set column=#{columnProperty} NEVER: 该字段不参加 update 语句

      NOT_EMPTY 如果针对的是非 CharSequence 类型的字段则效果等于 NOT_NULL

      从以下版本开始:
      3.1.2
      默认值:
      DEFAULT
    • whereStrategy

      FieldStrategy whereStrategy
      字段验证策略之 where: 表示该字段在拼接where条件时的策略

      ALWAYS: 直接拼接 column=#{columnProperty} NOT_NULL: column=#{columnProperty} NOT_EMPTY: column=#{columnProperty} NEVER: 该字段不参加 where 语句

      NOT_EMPTY 如果针对的是非 CharSequence 类型的字段则效果等于 NOT_NULL

      从以下版本开始:
      3.1.2
      默认值:
      DEFAULT
    • fill

      FieldFill fill
      字段自动填充策略

      在对应模式下将会忽略 insertStrategy 或 updateStrategy 的配置,等于断言该字段必有值

      默认值:
      DEFAULT
    • select

      boolean select
      是否进行 select 查询

      大字段可设置为 false 不加入 select 查询范围

      默认值:
      true
    • keepGlobalFormat

      boolean keepGlobalFormat
      是否保持使用全局的 columnFormat 的值

      只生效于 既设置了全局的 columnFormat 也设置了上面 value() 的值 如果是 false , 全局的 columnFormat 不生效

      从以下版本开始:
      3.1.1
      默认值:
      false
    • property

      String property
      ResultMapping.property and ParameterMapping.property
      从以下版本开始:
      3.4.4
      默认值:
      ""
    • jdbcType

      org.apache.ibatis.type.JdbcType jdbcType
      JDBC类型 (该默认值不代表会按照该值生效), 只生效于 mp 自动注入的 method, 建议配合 TableName.autoResultMap() 一起使用

      ResultMapping.jdbcType and ParameterMapping.jdbcType

      从以下版本开始:
      3.1.2
      默认值:
      UNDEFINED
    • typeHandler

      Class<? extends org.apache.ibatis.type.TypeHandler> typeHandler
      类型处理器 (该默认值不代表会按照该值生效), 只生效于 mp 自动注入的 method, 建议配合 TableName.autoResultMap() 一起使用

      ResultMapping.typeHandler and ParameterMapping.typeHandler

      从以下版本开始:
      3.1.2
      默认值:
      org.apache.ibatis.type.UnknownTypeHandler.class
    • javaType

      boolean javaType
      只在使用了 typeHandler() 时判断是否辅助追加 javaType

      一般情况下不推荐使用 ParameterMapping.javaType

      从以下版本开始:
      3.4.0 @2020-07-23
      默认值:
      false
    • numericScale

      String numericScale
      指定小数点后保留的位数, 只生效于 mp 自动注入的 method, 建议配合 TableName.autoResultMap() 一起使用

      ParameterMapping.numericScale

      从以下版本开始:
      3.1.2
      默认值:
      ""