@TableField

发布时间 2023-08-07 17:32:17作者: 《END》
@TableField
1.value
  字段值(驼峰命名方式,该值可无)
2.exist
  是否为数据库表字段,默认 true 存在,false 不存在
3.condition
  字段 where 实体查询比较条件,默认 `=` 等值
4.update
  字段 update set 部分注入, 该注解优于 el 注解使用,
  例1:@TableField(.. , update="%s+1") 其中 %s 会填充为字段:输出 SQL 为:update 表 set 字段=字段+1 where ...
  例2:@TableField(.. , update="now()") 使用数据库时间:输出 SQL 为:update 表 set 字段=now() where ...
5.insertStrategy
  字段验证策略之 insert: 当insert操作时,该字段拼接insert语句时的策略;
  IGNORED: 直接拼接 insert into table_a(column) values (#{columnProperty});
  NOT_NULL: insert into table_a(<if test="columnProperty != null">column</if>) values (<if test="columnProperty != null">#{columnProperty}</if>);
  NOT_EMPTY: insert into table_a(<if test="columnProperty != null and columnProperty!=''">column</if>) values (<if test="columnProperty != null and columnProperty!=''">#{columnProperty}</if>)
6.updateStrategy
  字段验证策略之 update: 当更新操作时,该字段拼接set语句时的策略;
  IGNORED: 直接拼接 update table_a set column=#{columnProperty}, 属性为null/空string都会被set进去;
  NOT_NULL: update table_a set <if test="columnProperty != null">column=#{columnProperty}</if>;
  NOT_EMPTY: update table_a set <if test="columnProperty != null and columnProperty!=''">column=#{columnProperty}</if>
7.whereStrategy
  字段验证策略之 where: 表示该字段在拼接where条件时的策略;
  IGNORED: 直接拼接 column=#{columnProperty};
  NOT_NULL: <if test="columnProperty != null">column=#{columnProperty}</if>;
  NOT_EMPTY: <if test="columnProperty != null and columnProperty!=''">column=#{columnProperty}</if>
8.fill
  字段自动填充策略
9.select
  是否进行 select 查询,大字段可设置为 false 不加入 select 查询范围
10.keepGlobalFormat
  是否保持使用全局的 Format 的值,只生效于 既设置了全局的 Format 也设置了上面 {@link #value()} 的值,如果是 false , 全局的 Format 不生效
11.jdbcType
  JDBC类型 (该默认值不代表会按照该值生效)
12.typeHandler
  类型处理器 (该默认值不代表会按照该值生效)
13.numericScale
  指定小数点后保留的位数

不再建议使用
1.el
  当该Field为类对象时, 可使用#{对象.属性}来映射到数据表.
2.strategy
  字段验证策略,默认追随全局配置
FieldStrategy:字段策略枚举类
IGNORED:忽略判断
NOT_NULL:非NULL判断
NOT_EMPTY:非空判断(只对字符串类型字段,其他类型字段依然为非NULL判断)
DEFAULT:默认的,一般只用于注解里:1. 在全局里代表 NOT_NULL;2. 在注解里代表 跟随全局
NEVER:不加入 SQL