流程说明

如下一张表:

 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

CREATE TABLE "dyf"."t_dyf_field" (
  "id" varchar(32) COLLATE "pg_catalog"."default" NOT NULL,
  "org_id" varchar(32) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "is_delete" int2 DEFAULT 0,
  "gmt_create_time" timestamptz(6) DEFAULT now(),
  "field_type" int4 DEFAULT 1,
  "data_type" int4 DEFAULT 1,
  "default_value" varchar(255) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "default_json_schema" jsonb,
  "is_required" int2 DEFAULT 0,
  "is_form_index" int2,
  "alias" varchar(128) COLLATE "pg_catalog"."default"
);

COMMENT ON COLUMN "dyf"."t_dyf_field"."id" IS '主键';
COMMENT ON COLUMN "dyf"."t_dyf_field"."org_id" IS '组织ID(系统表单:-1)';
COMMENT ON COLUMN "dyf"."t_dyf_field"."is_delete" IS '0-未删除;1-删除';
COMMENT ON COLUMN "dyf"."t_dyf_field"."gmt_create_time" IS '创建时间';
COMMENT ON COLUMN "dyf"."t_dyf_field"."field_type" IS '字段类型(1:系统,3:自定义)';
COMMENT ON COLUMN "dyf"."t_dyf_field"."data_type" IS '数据类型(1:字符串,2:整数,3:浮点数,4:布尔,5:日期,6:时间,7:日期时间,9:文件,10:列表,13:表单)';
COMMENT ON COLUMN "dyf"."t_dyf_field"."default_value" IS '默认数据值';
COMMENT ON COLUMN "dyf"."t_dyf_field"."default_json_schema" IS '默认json_schema定义';
COMMENT ON COLUMN "dyf"."t_dyf_field"."is_required" IS '是否必填(0-否,1-是)';
COMMENT ON COLUMN "dyf"."t_dyf_field"."is_form_index" IS '是否为表单查询条件';

初次解析后能得到如下结果


id                  String
orgId               String
is_delete           Enum
gmt_create_time     LocalDateTime
field_type          Enum
data_type           Enum
default_value       String
default_json_schema Object
is_required         Enum
is_form_index       Enum

String、Integer、Long、LocalDate、Object等都相对比较简单,Enum是如何解析到这种类型的呢,是传入某个字段的注释,且这个字段的注释符合预先约定的格式,就可以解析成枚举。

得到这些数据后,我们接下来该做一些什么呢?这些数据将指导我们生成各种实体类