Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

2 Commits

Repository files navigation

template

POJO 说明

PO 作用

跟数据库表结构一一对应,不能手动增加和修改字段类型和名称。如果手动编辑字段在动态SQL时会出现 字段不存在 异常。在字段上增加自定义注解不会影响动态SQL。

EO 作用

用于扩展PO类,可以在些类上新增字段实现关联查询、接受前端返回的数据等。因为该不参与动态SQL生成,不会出现异常。

代码生成

代码生成由 SqlCodeGenerator 来实现,输入数据库表名即可。

@SpringBootTestpublicclassSqlCodeGenerator {
@TestpublicvoidygwManager() {
// 在这输入要生成的数据库表名generator("ygw_operator");
}
}

注意事项

  1. 生成的类会覆盖原有的文件
  2. 需手动比对覆盖文件自定义内容
  3. 把自定义内容合并到新文件

数据脱敏

@SafeSerialize

经过 Jackson 序列化时序列化成 null

@SafeDeserialize

经过 Jackson 反序列化时序列化 null

注解使用

@Data@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("ygw_operator")
publicclassYgwManagerPoimplementsSerializable {
@TableId(value = "id", type = IdType.AUTO)
privateLongid;
privateStringusername;
@SafeSerializeprivateStringpassword;
privateStringmobile;
privateBooleanstatus;
privateBooleanerase;
privateStringsupplier;
privateStringavatar;
@TableField("start_time")
privateLocalTimestartTime;
@TableField("end_time")
privateLocalTimeendTime;
@SafeDeserializeprivateLocalDateTimelatest;
@TableField("in_time")
privateLocalDateTimeinTime;
}

注意事项

一定是要经过 Jackson 序列化 和 反序列化

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages