反向生成表

Seven 2021-12-16 13:44:39
Categories: > Tags:

依赖

1
implementation 'com.gitee.sunchenbin.mybatis.actable:mybatis-enhance-actable'

配置

1
2
3
4
5
6
7
8
9
mybatis:
table:
auto: update
model:
pack: com.dcits.pojo.po
database:
type: mysql
mybatis-plus:
mapper-locations: classpath*:xxxxxx/*.xml,classpath*:com/gitee/sunchenbin/mybatis/actable/mapping/*/*.xml

实体类

父类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsAutoIncrement;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsKey;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

@Getter
@Setter
public class SuperEntity {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_UUID)
@IsKey
@Column
private String id;
/**
* 创建时间
*/
@Column(name = "create_time",comment = "创建时间") // name指定数据库字段名,comment为备注
private Date createTime;
/**
* 最后修改时间
*/
@Column(name = "update_time",comment = "最后修改时间")
private Date updateTime;
}

子类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import com.dcits.pojo.SuperEntity;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import lombok.Data;

@Data
@Table(name = "blockchain_app")
public class App extends SuperEntity {

@Column(name = "appId",comment = "appId")
private String appId;

@Column(name = "app_secret",comment = "app密钥")
private String appSecret;

@Column(name = "private_key_store_type",comment = "密钥存储方式")
private String privateKeyStoreType;

@Column(name = "status",comment = "状态")
private String status;

}