/*
 Navicat Premium Data Transfer

 Source Server         : sw-system
 Source Server Type    : PostgreSQL
 Source Server Version : 90204 (90204)
 Source Host           : 192.168.10.130:5432
 Source Catalog        : sw_system
 Source Schema         : public

 Target Server Type    : PostgreSQL
 Target Server Version : 90204 (90204)
 File Encoding         : 65001

 Date: 15/07/2025 15:21:22
*/


-- ----------------------------
-- Table structure for system_dept
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_dept";
CREATE TABLE "public"."system_dept" (
  "id" int8 NOT NULL DEFAULT nextval('system_dept_seq'::regclass),
  "name" varchar(30) COLLATE "pg_catalog"."default",
  "parent_id" int8 NOT NULL DEFAULT 0,
  "sort" int4 NOT NULL DEFAULT 0,
  "leader_user_id" int8,
  "phone" varchar(11) COLLATE "pg_catalog"."default",
  "email" varchar(50) COLLATE "pg_catalog"."default",
  "type" varchar(10) COLLATE "pg_catalog"."default",
  "code" varchar(50) COLLATE "pg_catalog"."default",
  "status" int2 NOT NULL,
  "creator" varchar(64) COLLATE "pg_catalog"."default",
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0,
  "longitude" numeric(10,7),
  "latitude" numeric(10,7),
  "remark" varchar(500) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."system_dept" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_dept"."id" IS '部门id';
COMMENT ON COLUMN "public"."system_dept"."name" IS '部门名称';
COMMENT ON COLUMN "public"."system_dept"."parent_id" IS '父部门id';
COMMENT ON COLUMN "public"."system_dept"."sort" IS '显示顺序';
COMMENT ON COLUMN "public"."system_dept"."leader_user_id" IS '负责人';
COMMENT ON COLUMN "public"."system_dept"."phone" IS '联系电话';
COMMENT ON COLUMN "public"."system_dept"."email" IS '邮箱';
COMMENT ON COLUMN "public"."system_dept"."type" IS '部门类型';
COMMENT ON COLUMN "public"."system_dept"."code" IS '部门代码';
COMMENT ON COLUMN "public"."system_dept"."status" IS '部门状态（0正常 1停用）';
COMMENT ON COLUMN "public"."system_dept"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_dept"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_dept"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_dept"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_dept"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_dept"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_dept" IS '部门表';

-- ----------------------------
-- Table structure for system_dict_data
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_dict_data";
CREATE TABLE "public"."system_dict_data" (
  "id" int8 NOT NULL,
  "sort" int4 NOT NULL DEFAULT 0,
  "label" varchar(100) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "value" varchar(100) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "dict_type" varchar(100) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "status" int2 NOT NULL DEFAULT 0,
  "color_type" varchar(100) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "css_class" varchar(100) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "remark" varchar(500) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_dict_data" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_dict_data"."id" IS '字典编码';
COMMENT ON COLUMN "public"."system_dict_data"."sort" IS '字典排序';
COMMENT ON COLUMN "public"."system_dict_data"."label" IS '字典标签';
COMMENT ON COLUMN "public"."system_dict_data"."value" IS '字典键值';
COMMENT ON COLUMN "public"."system_dict_data"."dict_type" IS '字典类型';
COMMENT ON COLUMN "public"."system_dict_data"."status" IS '状态（0正常 1停用）';
COMMENT ON COLUMN "public"."system_dict_data"."color_type" IS '颜色类型';
COMMENT ON COLUMN "public"."system_dict_data"."css_class" IS 'css 样式';
COMMENT ON COLUMN "public"."system_dict_data"."remark" IS '备注';
COMMENT ON COLUMN "public"."system_dict_data"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_dict_data"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_dict_data"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_dict_data"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_dict_data"."deleted" IS '是否删除';
COMMENT ON TABLE "public"."system_dict_data" IS '字典数据表';

-- ----------------------------
-- Table structure for system_dict_type
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_dict_type";
CREATE TABLE "public"."system_dict_type" (
  "id" int8 NOT NULL,
  "name" varchar(100) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "type" varchar(100) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "status" int2 NOT NULL DEFAULT 0,
  "remark" varchar(500) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "deleted_time" timestamp(6)
)
;
ALTER TABLE "public"."system_dict_type" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_dict_type"."id" IS '字典主键';
COMMENT ON COLUMN "public"."system_dict_type"."name" IS '字典名称';
COMMENT ON COLUMN "public"."system_dict_type"."type" IS '字典类型';
COMMENT ON COLUMN "public"."system_dict_type"."status" IS '状态（0正常 1停用）';
COMMENT ON COLUMN "public"."system_dict_type"."remark" IS '备注';
COMMENT ON COLUMN "public"."system_dict_type"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_dict_type"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_dict_type"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_dict_type"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_dict_type"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_dict_type"."deleted_time" IS '删除时间';
COMMENT ON TABLE "public"."system_dict_type" IS '字典类型表';

-- ----------------------------
-- Table structure for system_login_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_login_log";
CREATE TABLE "public"."system_login_log" (
  "id" int8 NOT NULL,
  "log_type" int8 NOT NULL,
  "trace_id" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "user_id" int8 NOT NULL DEFAULT 0,
  "user_type" int2 NOT NULL DEFAULT 0,
  "username" varchar(50) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "result" int2 NOT NULL,
  "user_ip" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "user_agent" varchar(512) COLLATE "pg_catalog"."default" NOT NULL,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_login_log" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_login_log"."id" IS '访问ID';
COMMENT ON COLUMN "public"."system_login_log"."log_type" IS '日志类型';
COMMENT ON COLUMN "public"."system_login_log"."trace_id" IS '链路追踪编号';
COMMENT ON COLUMN "public"."system_login_log"."user_id" IS '用户编号';
COMMENT ON COLUMN "public"."system_login_log"."user_type" IS '用户类型';
COMMENT ON COLUMN "public"."system_login_log"."username" IS '用户账号';
COMMENT ON COLUMN "public"."system_login_log"."result" IS '登陆结果';
COMMENT ON COLUMN "public"."system_login_log"."user_ip" IS '用户 IP';
COMMENT ON COLUMN "public"."system_login_log"."user_agent" IS '浏览器 UA';
COMMENT ON COLUMN "public"."system_login_log"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_login_log"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_login_log"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_login_log"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_login_log"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_login_log"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_login_log" IS '系统访问记录';

-- ----------------------------
-- Table structure for system_mail_account
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_mail_account";
CREATE TABLE "public"."system_mail_account" (
  "id" int8 NOT NULL,
  "mail" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "username" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "password" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "host" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "port" int4 NOT NULL,
  "ssl_enable" bool NOT NULL DEFAULT false,
  "starttls_enable" bool NOT NULL DEFAULT false,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_mail_account" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_mail_account"."id" IS '主键';
COMMENT ON COLUMN "public"."system_mail_account"."mail" IS '邮箱';
COMMENT ON COLUMN "public"."system_mail_account"."username" IS '用户名';
COMMENT ON COLUMN "public"."system_mail_account"."password" IS '密码';
COMMENT ON COLUMN "public"."system_mail_account"."host" IS 'SMTP 服务器域名';
COMMENT ON COLUMN "public"."system_mail_account"."port" IS 'SMTP 服务器端口';
COMMENT ON COLUMN "public"."system_mail_account"."ssl_enable" IS '是否开启 SSL';
COMMENT ON COLUMN "public"."system_mail_account"."starttls_enable" IS '是否开启 STARTTLS';
COMMENT ON COLUMN "public"."system_mail_account"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_mail_account"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_mail_account"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_mail_account"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_mail_account"."deleted" IS '是否删除';
COMMENT ON TABLE "public"."system_mail_account" IS '邮箱账号表';

-- ----------------------------
-- Table structure for system_mail_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_mail_log";
CREATE TABLE "public"."system_mail_log" (
  "id" int8 NOT NULL,
  "user_id" int8,
  "user_type" int2,
  "to_mail" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "account_id" int8 NOT NULL,
  "from_mail" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "template_id" int8 NOT NULL,
  "template_code" varchar(63) COLLATE "pg_catalog"."default" NOT NULL,
  "template_nickname" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "template_title" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "template_content" varchar(10240) COLLATE "pg_catalog"."default" NOT NULL,
  "template_params" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "send_status" int2 NOT NULL DEFAULT 0,
  "send_time" timestamp(6),
  "send_message_id" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "send_exception" varchar(4096) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_mail_log" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_mail_log"."id" IS '编号';
COMMENT ON COLUMN "public"."system_mail_log"."user_id" IS '用户编号';
COMMENT ON COLUMN "public"."system_mail_log"."user_type" IS '用户类型';
COMMENT ON COLUMN "public"."system_mail_log"."to_mail" IS '接收邮箱地址';
COMMENT ON COLUMN "public"."system_mail_log"."account_id" IS '邮箱账号编号';
COMMENT ON COLUMN "public"."system_mail_log"."from_mail" IS '发送邮箱地址';
COMMENT ON COLUMN "public"."system_mail_log"."template_id" IS '模板编号';
COMMENT ON COLUMN "public"."system_mail_log"."template_code" IS '模板编码';
COMMENT ON COLUMN "public"."system_mail_log"."template_nickname" IS '模版发送人名称';
COMMENT ON COLUMN "public"."system_mail_log"."template_title" IS '邮件标题';
COMMENT ON COLUMN "public"."system_mail_log"."template_content" IS '邮件内容';
COMMENT ON COLUMN "public"."system_mail_log"."template_params" IS '邮件参数';
COMMENT ON COLUMN "public"."system_mail_log"."send_status" IS '发送状态';
COMMENT ON COLUMN "public"."system_mail_log"."send_time" IS '发送时间';
COMMENT ON COLUMN "public"."system_mail_log"."send_message_id" IS '发送返回的消息 ID';
COMMENT ON COLUMN "public"."system_mail_log"."send_exception" IS '发送异常';
COMMENT ON COLUMN "public"."system_mail_log"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_mail_log"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_mail_log"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_mail_log"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_mail_log"."deleted" IS '是否删除';
COMMENT ON TABLE "public"."system_mail_log" IS '邮件日志表';

-- ----------------------------
-- Table structure for system_mail_template
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_mail_template";
CREATE TABLE "public"."system_mail_template" (
  "id" int8 NOT NULL,
  "name" varchar(63) COLLATE "pg_catalog"."default" NOT NULL,
  "code" varchar(63) COLLATE "pg_catalog"."default" NOT NULL,
  "account_id" int8 NOT NULL,
  "nickname" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "title" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "content" varchar(10240) COLLATE "pg_catalog"."default" NOT NULL,
  "params" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "status" int2 NOT NULL,
  "remark" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_mail_template" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_mail_template"."id" IS '编号';
COMMENT ON COLUMN "public"."system_mail_template"."name" IS '模板名称';
COMMENT ON COLUMN "public"."system_mail_template"."code" IS '模板编码';
COMMENT ON COLUMN "public"."system_mail_template"."account_id" IS '发送的邮箱账号编号';
COMMENT ON COLUMN "public"."system_mail_template"."nickname" IS '发送人名称';
COMMENT ON COLUMN "public"."system_mail_template"."title" IS '模板标题';
COMMENT ON COLUMN "public"."system_mail_template"."content" IS '模板内容';
COMMENT ON COLUMN "public"."system_mail_template"."params" IS '参数数组';
COMMENT ON COLUMN "public"."system_mail_template"."status" IS '开启状态';
COMMENT ON COLUMN "public"."system_mail_template"."remark" IS '备注';
COMMENT ON COLUMN "public"."system_mail_template"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_mail_template"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_mail_template"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_mail_template"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_mail_template"."deleted" IS '是否删除';
COMMENT ON TABLE "public"."system_mail_template" IS '邮件模版表';

-- ----------------------------
-- Table structure for system_menu
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_menu";
CREATE TABLE "public"."system_menu" (
  "id" int8 NOT NULL DEFAULT nextval('system_menu_seq'::regclass),
  "name" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "permission" varchar(100) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "type" int2 NOT NULL,
  "sort" int4 NOT NULL DEFAULT 0,
  "parent_id" int8 NOT NULL DEFAULT 0,
  "path" varchar(200) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "icon" varchar(100) COLLATE "pg_catalog"."default" DEFAULT '#'::character varying,
  "component" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "component_name" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "status" int2 NOT NULL DEFAULT 0,
  "visible" bool NOT NULL DEFAULT true,
  "keep_alive" bool NOT NULL DEFAULT true,
  "always_show" bool NOT NULL DEFAULT true,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_menu" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_menu"."id" IS '菜单ID';
COMMENT ON COLUMN "public"."system_menu"."name" IS '菜单名称';
COMMENT ON COLUMN "public"."system_menu"."permission" IS '权限标识';
COMMENT ON COLUMN "public"."system_menu"."type" IS '菜单类型';
COMMENT ON COLUMN "public"."system_menu"."sort" IS '显示顺序';
COMMENT ON COLUMN "public"."system_menu"."parent_id" IS '父菜单ID';
COMMENT ON COLUMN "public"."system_menu"."path" IS '路由地址';
COMMENT ON COLUMN "public"."system_menu"."icon" IS '菜单图标';
COMMENT ON COLUMN "public"."system_menu"."component" IS '组件路径';
COMMENT ON COLUMN "public"."system_menu"."component_name" IS '组件名';
COMMENT ON COLUMN "public"."system_menu"."status" IS '菜单状态';
COMMENT ON COLUMN "public"."system_menu"."visible" IS '是否可见';
COMMENT ON COLUMN "public"."system_menu"."keep_alive" IS '是否缓存';
COMMENT ON COLUMN "public"."system_menu"."always_show" IS '是否总是显示';
COMMENT ON COLUMN "public"."system_menu"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_menu"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_menu"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_menu"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_menu"."deleted" IS '是否删除';
COMMENT ON TABLE "public"."system_menu" IS '菜单权限表';

-- ----------------------------
-- Table structure for system_notice
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_notice";
CREATE TABLE "public"."system_notice" (
  "id" int8 NOT NULL,
  "title" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "content" text COLLATE "pg_catalog"."default" NOT NULL,
  "type" int2 NOT NULL,
  "status" int2 NOT NULL DEFAULT 0,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_notice" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_notice"."id" IS '公告ID';
COMMENT ON COLUMN "public"."system_notice"."title" IS '公告标题';
COMMENT ON COLUMN "public"."system_notice"."content" IS '公告内容';
COMMENT ON COLUMN "public"."system_notice"."type" IS '公告类型（1通知 2公告）';
COMMENT ON COLUMN "public"."system_notice"."status" IS '公告状态（0正常 1关闭）';
COMMENT ON COLUMN "public"."system_notice"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_notice"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_notice"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_notice"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_notice"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_notice"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_notice" IS '通知公告表';

-- ----------------------------
-- Table structure for system_notify_message
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_notify_message";
CREATE TABLE "public"."system_notify_message" (
  "id" int8 NOT NULL,
  "user_id" int8 NOT NULL,
  "user_type" int2 NOT NULL,
  "template_id" int8 NOT NULL,
  "template_code" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "template_nickname" varchar(63) COLLATE "pg_catalog"."default" NOT NULL,
  "template_content" varchar(1024) COLLATE "pg_catalog"."default" NOT NULL,
  "template_type" int4 NOT NULL,
  "template_params" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "read_status" bool NOT NULL,
  "read_time" timestamp(6),
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_notify_message" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_notify_message"."id" IS '用户ID';
COMMENT ON COLUMN "public"."system_notify_message"."user_id" IS '用户id';
COMMENT ON COLUMN "public"."system_notify_message"."user_type" IS '用户类型';
COMMENT ON COLUMN "public"."system_notify_message"."template_id" IS '模版编号';
COMMENT ON COLUMN "public"."system_notify_message"."template_code" IS '模板编码';
COMMENT ON COLUMN "public"."system_notify_message"."template_nickname" IS '模版发送人名称';
COMMENT ON COLUMN "public"."system_notify_message"."template_content" IS '模版内容';
COMMENT ON COLUMN "public"."system_notify_message"."template_type" IS '模版类型';
COMMENT ON COLUMN "public"."system_notify_message"."template_params" IS '模版参数';
COMMENT ON COLUMN "public"."system_notify_message"."read_status" IS '是否已读';
COMMENT ON COLUMN "public"."system_notify_message"."read_time" IS '阅读时间';
COMMENT ON COLUMN "public"."system_notify_message"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_notify_message"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_notify_message"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_notify_message"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_notify_message"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_notify_message"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_notify_message" IS '站内信消息表';

-- ----------------------------
-- Table structure for system_notify_template
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_notify_template";
CREATE TABLE "public"."system_notify_template" (
  "id" int8 NOT NULL,
  "name" varchar(63) COLLATE "pg_catalog"."default" NOT NULL,
  "code" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "nickname" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "content" varchar(1024) COLLATE "pg_catalog"."default" NOT NULL,
  "type" int2 NOT NULL,
  "params" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "status" int2 NOT NULL,
  "remark" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_notify_template" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_notify_template"."id" IS '主键';
COMMENT ON COLUMN "public"."system_notify_template"."name" IS '模板名称';
COMMENT ON COLUMN "public"."system_notify_template"."code" IS '模版编码';
COMMENT ON COLUMN "public"."system_notify_template"."nickname" IS '发送人名称';
COMMENT ON COLUMN "public"."system_notify_template"."content" IS '模版内容';
COMMENT ON COLUMN "public"."system_notify_template"."type" IS '类型';
COMMENT ON COLUMN "public"."system_notify_template"."params" IS '参数数组';
COMMENT ON COLUMN "public"."system_notify_template"."status" IS '状态';
COMMENT ON COLUMN "public"."system_notify_template"."remark" IS '备注';
COMMENT ON COLUMN "public"."system_notify_template"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_notify_template"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_notify_template"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_notify_template"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_notify_template"."deleted" IS '是否删除';
COMMENT ON TABLE "public"."system_notify_template" IS '站内信模板表';

-- ----------------------------
-- Table structure for system_oauth2_access_token
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_oauth2_access_token";
CREATE TABLE "public"."system_oauth2_access_token" (
  "id" int8 NOT NULL,
  "user_id" int8 NOT NULL,
  "user_type" int2 NOT NULL,
  "user_info" varchar(512) COLLATE "pg_catalog"."default" NOT NULL,
  "access_token" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "refresh_token" varchar(32) COLLATE "pg_catalog"."default" NOT NULL,
  "client_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "scopes" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "expires_time" timestamp(6) NOT NULL,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_oauth2_access_token" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_oauth2_access_token"."id" IS '编号';
COMMENT ON COLUMN "public"."system_oauth2_access_token"."user_id" IS '用户编号';
COMMENT ON COLUMN "public"."system_oauth2_access_token"."user_type" IS '用户类型';
COMMENT ON COLUMN "public"."system_oauth2_access_token"."user_info" IS '用户信息';
COMMENT ON COLUMN "public"."system_oauth2_access_token"."access_token" IS '访问令牌';
COMMENT ON COLUMN "public"."system_oauth2_access_token"."refresh_token" IS '刷新令牌';
COMMENT ON COLUMN "public"."system_oauth2_access_token"."client_id" IS '客户端编号';
COMMENT ON COLUMN "public"."system_oauth2_access_token"."scopes" IS '授权范围';
COMMENT ON COLUMN "public"."system_oauth2_access_token"."expires_time" IS '过期时间';
COMMENT ON COLUMN "public"."system_oauth2_access_token"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_oauth2_access_token"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_oauth2_access_token"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_oauth2_access_token"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_oauth2_access_token"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_oauth2_access_token"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_oauth2_access_token" IS 'OAuth2 访问令牌';

-- ----------------------------
-- Table structure for system_oauth2_approve
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_oauth2_approve";
CREATE TABLE "public"."system_oauth2_approve" (
  "id" int8 NOT NULL,
  "user_id" int8 NOT NULL,
  "user_type" int2 NOT NULL,
  "client_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "scope" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "approved" bool NOT NULL DEFAULT false,
  "expires_time" timestamp(6) NOT NULL,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_oauth2_approve" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_oauth2_approve"."id" IS '编号';
COMMENT ON COLUMN "public"."system_oauth2_approve"."user_id" IS '用户编号';
COMMENT ON COLUMN "public"."system_oauth2_approve"."user_type" IS '用户类型';
COMMENT ON COLUMN "public"."system_oauth2_approve"."client_id" IS '客户端编号';
COMMENT ON COLUMN "public"."system_oauth2_approve"."scope" IS '授权范围';
COMMENT ON COLUMN "public"."system_oauth2_approve"."approved" IS '是否接受';
COMMENT ON COLUMN "public"."system_oauth2_approve"."expires_time" IS '过期时间';
COMMENT ON COLUMN "public"."system_oauth2_approve"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_oauth2_approve"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_oauth2_approve"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_oauth2_approve"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_oauth2_approve"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_oauth2_approve"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_oauth2_approve" IS 'OAuth2 批准表';

-- ----------------------------
-- Table structure for system_oauth2_client
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_oauth2_client";
CREATE TABLE "public"."system_oauth2_client" (
  "id" int8 NOT NULL,
  "client_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "secret" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "logo" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "description" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "status" int2 NOT NULL,
  "access_token_validity_seconds" int4 NOT NULL,
  "refresh_token_validity_seconds" int4 NOT NULL,
  "redirect_uris" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "authorized_grant_types" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "scopes" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "auto_approve_scopes" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "authorities" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "resource_ids" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "additional_information" varchar(4096) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_oauth2_client" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_oauth2_client"."id" IS '编号';
COMMENT ON COLUMN "public"."system_oauth2_client"."client_id" IS '客户端编号';
COMMENT ON COLUMN "public"."system_oauth2_client"."secret" IS '客户端密钥';
COMMENT ON COLUMN "public"."system_oauth2_client"."name" IS '应用名';
COMMENT ON COLUMN "public"."system_oauth2_client"."logo" IS '应用图标';
COMMENT ON COLUMN "public"."system_oauth2_client"."description" IS '应用描述';
COMMENT ON COLUMN "public"."system_oauth2_client"."status" IS '状态';
COMMENT ON COLUMN "public"."system_oauth2_client"."access_token_validity_seconds" IS '访问令牌的有效期';
COMMENT ON COLUMN "public"."system_oauth2_client"."refresh_token_validity_seconds" IS '刷新令牌的有效期';
COMMENT ON COLUMN "public"."system_oauth2_client"."redirect_uris" IS '可重定向的 URI 地址';
COMMENT ON COLUMN "public"."system_oauth2_client"."authorized_grant_types" IS '授权类型';
COMMENT ON COLUMN "public"."system_oauth2_client"."scopes" IS '授权范围';
COMMENT ON COLUMN "public"."system_oauth2_client"."auto_approve_scopes" IS '自动通过的授权范围';
COMMENT ON COLUMN "public"."system_oauth2_client"."authorities" IS '权限';
COMMENT ON COLUMN "public"."system_oauth2_client"."resource_ids" IS '资源';
COMMENT ON COLUMN "public"."system_oauth2_client"."additional_information" IS '附加信息';
COMMENT ON COLUMN "public"."system_oauth2_client"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_oauth2_client"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_oauth2_client"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_oauth2_client"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_oauth2_client"."deleted" IS '是否删除';
COMMENT ON TABLE "public"."system_oauth2_client" IS 'OAuth2 客户端表';

-- ----------------------------
-- Table structure for system_oauth2_code
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_oauth2_code";
CREATE TABLE "public"."system_oauth2_code" (
  "id" int8 NOT NULL,
  "user_id" int8 NOT NULL,
  "user_type" int2 NOT NULL,
  "code" varchar(32) COLLATE "pg_catalog"."default" NOT NULL,
  "client_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "scopes" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "expires_time" timestamp(6) NOT NULL,
  "redirect_uri" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "state" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_oauth2_code" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_oauth2_code"."id" IS '编号';
COMMENT ON COLUMN "public"."system_oauth2_code"."user_id" IS '用户编号';
COMMENT ON COLUMN "public"."system_oauth2_code"."user_type" IS '用户类型';
COMMENT ON COLUMN "public"."system_oauth2_code"."code" IS '授权码';
COMMENT ON COLUMN "public"."system_oauth2_code"."client_id" IS '客户端编号';
COMMENT ON COLUMN "public"."system_oauth2_code"."scopes" IS '授权范围';
COMMENT ON COLUMN "public"."system_oauth2_code"."expires_time" IS '过期时间';
COMMENT ON COLUMN "public"."system_oauth2_code"."redirect_uri" IS '可重定向的 URI 地址';
COMMENT ON COLUMN "public"."system_oauth2_code"."state" IS '状态';
COMMENT ON COLUMN "public"."system_oauth2_code"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_oauth2_code"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_oauth2_code"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_oauth2_code"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_oauth2_code"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_oauth2_code"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_oauth2_code" IS 'OAuth2 授权码表';

-- ----------------------------
-- Table structure for system_oauth2_refresh_token
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_oauth2_refresh_token";
CREATE TABLE "public"."system_oauth2_refresh_token" (
  "id" int8 NOT NULL,
  "user_id" int8 NOT NULL,
  "refresh_token" varchar(32) COLLATE "pg_catalog"."default" NOT NULL,
  "user_type" int2 NOT NULL,
  "client_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "scopes" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "expires_time" timestamp(6) NOT NULL,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_oauth2_refresh_token" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_oauth2_refresh_token"."id" IS '编号';
COMMENT ON COLUMN "public"."system_oauth2_refresh_token"."user_id" IS '用户编号';
COMMENT ON COLUMN "public"."system_oauth2_refresh_token"."refresh_token" IS '刷新令牌';
COMMENT ON COLUMN "public"."system_oauth2_refresh_token"."user_type" IS '用户类型';
COMMENT ON COLUMN "public"."system_oauth2_refresh_token"."client_id" IS '客户端编号';
COMMENT ON COLUMN "public"."system_oauth2_refresh_token"."scopes" IS '授权范围';
COMMENT ON COLUMN "public"."system_oauth2_refresh_token"."expires_time" IS '过期时间';
COMMENT ON COLUMN "public"."system_oauth2_refresh_token"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_oauth2_refresh_token"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_oauth2_refresh_token"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_oauth2_refresh_token"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_oauth2_refresh_token"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_oauth2_refresh_token"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_oauth2_refresh_token" IS 'OAuth2 刷新令牌';

-- ----------------------------
-- Table structure for system_operate_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_operate_log";
CREATE TABLE "public"."system_operate_log" (
  "id" int8 NOT NULL,
  "trace_id" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "user_id" int8 NOT NULL,
  "user_type" int2 NOT NULL DEFAULT 0,
  "type" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "sub_type" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "biz_id" int8 NOT NULL,
  "action" varchar(2000) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "extra" varchar(2000) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "request_method" varchar(16) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "request_url" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "user_ip" varchar(50) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "user_agent" varchar(200) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_operate_log" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_operate_log"."id" IS '日志主键';
COMMENT ON COLUMN "public"."system_operate_log"."trace_id" IS '链路追踪编号';
COMMENT ON COLUMN "public"."system_operate_log"."user_id" IS '用户编号';
COMMENT ON COLUMN "public"."system_operate_log"."user_type" IS '用户类型';
COMMENT ON COLUMN "public"."system_operate_log"."type" IS '操作模块类型';
COMMENT ON COLUMN "public"."system_operate_log"."sub_type" IS '操作名';
COMMENT ON COLUMN "public"."system_operate_log"."biz_id" IS '操作数据模块编号';
COMMENT ON COLUMN "public"."system_operate_log"."action" IS '操作内容';
COMMENT ON COLUMN "public"."system_operate_log"."extra" IS '拓展字段';
COMMENT ON COLUMN "public"."system_operate_log"."request_method" IS '请求方法名';
COMMENT ON COLUMN "public"."system_operate_log"."request_url" IS '请求地址';
COMMENT ON COLUMN "public"."system_operate_log"."user_ip" IS '用户 IP';
COMMENT ON COLUMN "public"."system_operate_log"."user_agent" IS '浏览器 UA';
COMMENT ON COLUMN "public"."system_operate_log"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_operate_log"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_operate_log"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_operate_log"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_operate_log"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_operate_log"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_operate_log" IS '操作日志记录 V2 版本';

-- ----------------------------
-- Table structure for system_post
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_post";
CREATE TABLE "public"."system_post" (
  "id" int8 NOT NULL,
  "code" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "name" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "sort" int4 NOT NULL,
  "status" int2 NOT NULL,
  "remark" varchar(500) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_post" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_post"."id" IS '岗位ID';
COMMENT ON COLUMN "public"."system_post"."code" IS '岗位编码';
COMMENT ON COLUMN "public"."system_post"."name" IS '岗位名称';
COMMENT ON COLUMN "public"."system_post"."sort" IS '显示顺序';
COMMENT ON COLUMN "public"."system_post"."status" IS '状态（0正常 1停用）';
COMMENT ON COLUMN "public"."system_post"."remark" IS '备注';
COMMENT ON COLUMN "public"."system_post"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_post"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_post"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_post"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_post"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_post"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_post" IS '岗位信息表';

-- ----------------------------
-- Table structure for system_role
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_role";
CREATE TABLE "public"."system_role" (
  "id" int8 NOT NULL,
  "name" varchar(30) COLLATE "pg_catalog"."default" NOT NULL,
  "code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "sort" int4 NOT NULL,
  "data_scope" int2 NOT NULL DEFAULT 1,
  "data_scope_dept_ids" varchar(500) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "status" int2 NOT NULL,
  "type" int2 NOT NULL,
  "remark" varchar(500) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_role" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_role"."id" IS '角色ID';
COMMENT ON COLUMN "public"."system_role"."name" IS '角色名称';
COMMENT ON COLUMN "public"."system_role"."code" IS '角色权限字符串';
COMMENT ON COLUMN "public"."system_role"."sort" IS '显示顺序';
COMMENT ON COLUMN "public"."system_role"."data_scope" IS '数据范围（1：全部数据权限 2：自定数据权限 3：本部门数据权限 4：本部门及以下数据权限）';
COMMENT ON COLUMN "public"."system_role"."data_scope_dept_ids" IS '数据范围(指定部门数组)';
COMMENT ON COLUMN "public"."system_role"."status" IS '角色状态（0正常 1停用）';
COMMENT ON COLUMN "public"."system_role"."type" IS '角色类型';
COMMENT ON COLUMN "public"."system_role"."remark" IS '备注';
COMMENT ON COLUMN "public"."system_role"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_role"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_role"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_role"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_role"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_role"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_role" IS '角色信息表';

-- ----------------------------
-- Table structure for system_role_menu
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_role_menu";
CREATE TABLE "public"."system_role_menu" (
  "id" int8 NOT NULL,
  "role_id" int8 NOT NULL,
  "menu_id" int8 NOT NULL,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_role_menu" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_role_menu"."id" IS '自增编号';
COMMENT ON COLUMN "public"."system_role_menu"."role_id" IS '角色ID';
COMMENT ON COLUMN "public"."system_role_menu"."menu_id" IS '菜单ID';
COMMENT ON COLUMN "public"."system_role_menu"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_role_menu"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_role_menu"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_role_menu"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_role_menu"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_role_menu"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_role_menu" IS '角色和菜单关联表';

-- ----------------------------
-- Table structure for system_sms_channel
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_sms_channel";
CREATE TABLE "public"."system_sms_channel" (
  "id" int8 NOT NULL,
  "signature" varchar(12) COLLATE "pg_catalog"."default" NOT NULL,
  "code" varchar(63) COLLATE "pg_catalog"."default" NOT NULL,
  "status" int2 NOT NULL,
  "remark" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "api_key" varchar(128) COLLATE "pg_catalog"."default" NOT NULL,
  "api_secret" varchar(128) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "callback_url" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_sms_channel" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_sms_channel"."id" IS '编号';
COMMENT ON COLUMN "public"."system_sms_channel"."signature" IS '短信签名';
COMMENT ON COLUMN "public"."system_sms_channel"."code" IS '渠道编码';
COMMENT ON COLUMN "public"."system_sms_channel"."status" IS '开启状态';
COMMENT ON COLUMN "public"."system_sms_channel"."remark" IS '备注';
COMMENT ON COLUMN "public"."system_sms_channel"."api_key" IS '短信 API 的账号';
COMMENT ON COLUMN "public"."system_sms_channel"."api_secret" IS '短信 API 的秘钥';
COMMENT ON COLUMN "public"."system_sms_channel"."callback_url" IS '短信发送回调 URL';
COMMENT ON COLUMN "public"."system_sms_channel"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_sms_channel"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_sms_channel"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_sms_channel"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_sms_channel"."deleted" IS '是否删除';
COMMENT ON TABLE "public"."system_sms_channel" IS '短信渠道';

-- ----------------------------
-- Table structure for system_sms_code
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_sms_code";
CREATE TABLE "public"."system_sms_code" (
  "id" int8 NOT NULL,
  "mobile" varchar(11) COLLATE "pg_catalog"."default" NOT NULL,
  "code" varchar(6) COLLATE "pg_catalog"."default" NOT NULL,
  "create_ip" varchar(15) COLLATE "pg_catalog"."default" NOT NULL,
  "scene" int2 NOT NULL,
  "today_index" int2 NOT NULL,
  "used" int2 NOT NULL,
  "used_time" timestamp(6),
  "used_ip" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_sms_code" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_sms_code"."id" IS '编号';
COMMENT ON COLUMN "public"."system_sms_code"."mobile" IS '手机号';
COMMENT ON COLUMN "public"."system_sms_code"."code" IS '验证码';
COMMENT ON COLUMN "public"."system_sms_code"."create_ip" IS '创建 IP';
COMMENT ON COLUMN "public"."system_sms_code"."scene" IS '发送场景';
COMMENT ON COLUMN "public"."system_sms_code"."today_index" IS '今日发送的第几条';
COMMENT ON COLUMN "public"."system_sms_code"."used" IS '是否使用';
COMMENT ON COLUMN "public"."system_sms_code"."used_time" IS '使用时间';
COMMENT ON COLUMN "public"."system_sms_code"."used_ip" IS '使用 IP';
COMMENT ON COLUMN "public"."system_sms_code"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_sms_code"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_sms_code"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_sms_code"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_sms_code"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_sms_code"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_sms_code" IS '手机验证码';

-- ----------------------------
-- Table structure for system_sms_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_sms_log";
CREATE TABLE "public"."system_sms_log" (
  "id" int8 NOT NULL,
  "channel_id" int8 NOT NULL,
  "channel_code" varchar(63) COLLATE "pg_catalog"."default" NOT NULL,
  "template_id" int8 NOT NULL,
  "template_code" varchar(63) COLLATE "pg_catalog"."default" NOT NULL,
  "template_type" int2 NOT NULL,
  "template_content" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "template_params" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "api_template_id" varchar(63) COLLATE "pg_catalog"."default" NOT NULL,
  "mobile" varchar(11) COLLATE "pg_catalog"."default" NOT NULL,
  "user_id" int8,
  "user_type" int2,
  "send_status" int2 NOT NULL DEFAULT 0,
  "send_time" timestamp(6),
  "api_send_code" varchar(63) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "api_send_msg" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "api_request_id" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "api_serial_no" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "receive_status" int2 NOT NULL DEFAULT 0,
  "receive_time" timestamp(6),
  "api_receive_code" varchar(63) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "api_receive_msg" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_sms_log" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_sms_log"."id" IS '编号';
COMMENT ON COLUMN "public"."system_sms_log"."channel_id" IS '短信渠道编号';
COMMENT ON COLUMN "public"."system_sms_log"."channel_code" IS '短信渠道编码';
COMMENT ON COLUMN "public"."system_sms_log"."template_id" IS '模板编号';
COMMENT ON COLUMN "public"."system_sms_log"."template_code" IS '模板编码';
COMMENT ON COLUMN "public"."system_sms_log"."template_type" IS '短信类型';
COMMENT ON COLUMN "public"."system_sms_log"."template_content" IS '短信内容';
COMMENT ON COLUMN "public"."system_sms_log"."template_params" IS '短信参数';
COMMENT ON COLUMN "public"."system_sms_log"."api_template_id" IS '短信 API 的模板编号';
COMMENT ON COLUMN "public"."system_sms_log"."mobile" IS '手机号';
COMMENT ON COLUMN "public"."system_sms_log"."user_id" IS '用户编号';
COMMENT ON COLUMN "public"."system_sms_log"."user_type" IS '用户类型';
COMMENT ON COLUMN "public"."system_sms_log"."send_status" IS '发送状态';
COMMENT ON COLUMN "public"."system_sms_log"."send_time" IS '发送时间';
COMMENT ON COLUMN "public"."system_sms_log"."api_send_code" IS '短信 API 发送结果的编码';
COMMENT ON COLUMN "public"."system_sms_log"."api_send_msg" IS '短信 API 发送失败的提示';
COMMENT ON COLUMN "public"."system_sms_log"."api_request_id" IS '短信 API 发送返回的唯一请求 ID';
COMMENT ON COLUMN "public"."system_sms_log"."api_serial_no" IS '短信 API 发送返回的序号';
COMMENT ON COLUMN "public"."system_sms_log"."receive_status" IS '接收状态';
COMMENT ON COLUMN "public"."system_sms_log"."receive_time" IS '接收时间';
COMMENT ON COLUMN "public"."system_sms_log"."api_receive_code" IS 'API 接收结果的编码';
COMMENT ON COLUMN "public"."system_sms_log"."api_receive_msg" IS 'API 接收结果的说明';
COMMENT ON COLUMN "public"."system_sms_log"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_sms_log"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_sms_log"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_sms_log"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_sms_log"."deleted" IS '是否删除';
COMMENT ON TABLE "public"."system_sms_log" IS '短信日志';

-- ----------------------------
-- Table structure for system_sms_template
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_sms_template";
CREATE TABLE "public"."system_sms_template" (
  "id" int8 NOT NULL,
  "type" int2 NOT NULL,
  "status" int2 NOT NULL,
  "code" varchar(63) COLLATE "pg_catalog"."default" NOT NULL,
  "name" varchar(63) COLLATE "pg_catalog"."default" NOT NULL,
  "content" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "params" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "remark" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "api_template_id" varchar(63) COLLATE "pg_catalog"."default" NOT NULL,
  "channel_id" int8 NOT NULL,
  "channel_code" varchar(63) COLLATE "pg_catalog"."default" NOT NULL,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_sms_template" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_sms_template"."id" IS '编号';
COMMENT ON COLUMN "public"."system_sms_template"."type" IS '模板类型';
COMMENT ON COLUMN "public"."system_sms_template"."status" IS '开启状态';
COMMENT ON COLUMN "public"."system_sms_template"."code" IS '模板编码';
COMMENT ON COLUMN "public"."system_sms_template"."name" IS '模板名称';
COMMENT ON COLUMN "public"."system_sms_template"."content" IS '模板内容';
COMMENT ON COLUMN "public"."system_sms_template"."params" IS '参数数组';
COMMENT ON COLUMN "public"."system_sms_template"."remark" IS '备注';
COMMENT ON COLUMN "public"."system_sms_template"."api_template_id" IS '短信 API 的模板编号';
COMMENT ON COLUMN "public"."system_sms_template"."channel_id" IS '短信渠道编号';
COMMENT ON COLUMN "public"."system_sms_template"."channel_code" IS '短信渠道编码';
COMMENT ON COLUMN "public"."system_sms_template"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_sms_template"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_sms_template"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_sms_template"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_sms_template"."deleted" IS '是否删除';
COMMENT ON TABLE "public"."system_sms_template" IS '短信模板';

-- ----------------------------
-- Table structure for system_social_client
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_social_client";
CREATE TABLE "public"."system_social_client" (
  "id" int8 NOT NULL,
  "name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "social_type" int2 NOT NULL,
  "user_type" int2 NOT NULL,
  "client_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "client_secret" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "agent_id" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "status" int2 NOT NULL,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_social_client" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_social_client"."id" IS '编号';
COMMENT ON COLUMN "public"."system_social_client"."name" IS '应用名';
COMMENT ON COLUMN "public"."system_social_client"."social_type" IS '社交平台的类型';
COMMENT ON COLUMN "public"."system_social_client"."user_type" IS '用户类型';
COMMENT ON COLUMN "public"."system_social_client"."client_id" IS '客户端编号';
COMMENT ON COLUMN "public"."system_social_client"."client_secret" IS '客户端密钥';
COMMENT ON COLUMN "public"."system_social_client"."agent_id" IS '代理编号';
COMMENT ON COLUMN "public"."system_social_client"."status" IS '状态';
COMMENT ON COLUMN "public"."system_social_client"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_social_client"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_social_client"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_social_client"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_social_client"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_social_client"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_social_client" IS '社交客户端表';

-- ----------------------------
-- Table structure for system_social_user
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_social_user";
CREATE TABLE "public"."system_social_user" (
  "id" int8 NOT NULL,
  "type" int2 NOT NULL,
  "openid" varchar(32) COLLATE "pg_catalog"."default" NOT NULL,
  "token" varchar(256) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "raw_token_info" varchar(1024) COLLATE "pg_catalog"."default" NOT NULL,
  "nickname" varchar(32) COLLATE "pg_catalog"."default" NOT NULL,
  "avatar" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "raw_user_info" varchar(1024) COLLATE "pg_catalog"."default" NOT NULL,
  "code" varchar(256) COLLATE "pg_catalog"."default" NOT NULL,
  "state" varchar(256) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_social_user" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_social_user"."id" IS '主键(自增策略)';
COMMENT ON COLUMN "public"."system_social_user"."type" IS '社交平台的类型';
COMMENT ON COLUMN "public"."system_social_user"."openid" IS '社交 openid';
COMMENT ON COLUMN "public"."system_social_user"."token" IS '社交 token';
COMMENT ON COLUMN "public"."system_social_user"."raw_token_info" IS '原始 Token 数据，一般是 JSON 格式';
COMMENT ON COLUMN "public"."system_social_user"."nickname" IS '用户昵称';
COMMENT ON COLUMN "public"."system_social_user"."avatar" IS '用户头像';
COMMENT ON COLUMN "public"."system_social_user"."raw_user_info" IS '原始用户数据，一般是 JSON 格式';
COMMENT ON COLUMN "public"."system_social_user"."code" IS '最后一次的认证 code';
COMMENT ON COLUMN "public"."system_social_user"."state" IS '最后一次的认证 state';
COMMENT ON COLUMN "public"."system_social_user"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_social_user"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_social_user"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_social_user"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_social_user"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_social_user"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_social_user" IS '社交用户表';

-- ----------------------------
-- Table structure for system_social_user_bind
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_social_user_bind";
CREATE TABLE "public"."system_social_user_bind" (
  "id" int8 NOT NULL,
  "user_id" int8 NOT NULL,
  "user_type" int2 NOT NULL,
  "social_type" int2 NOT NULL,
  "social_user_id" int8 NOT NULL,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_social_user_bind" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_social_user_bind"."id" IS '主键(自增策略)';
COMMENT ON COLUMN "public"."system_social_user_bind"."user_id" IS '用户编号';
COMMENT ON COLUMN "public"."system_social_user_bind"."user_type" IS '用户类型';
COMMENT ON COLUMN "public"."system_social_user_bind"."social_type" IS '社交平台的类型';
COMMENT ON COLUMN "public"."system_social_user_bind"."social_user_id" IS '社交用户的编号';
COMMENT ON COLUMN "public"."system_social_user_bind"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_social_user_bind"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_social_user_bind"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_social_user_bind"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_social_user_bind"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_social_user_bind"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_social_user_bind" IS '社交绑定表';

-- ----------------------------
-- Table structure for system_tenant
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_tenant";
CREATE TABLE "public"."system_tenant" (
  "id" int8 NOT NULL,
  "name" varchar(30) COLLATE "pg_catalog"."default" NOT NULL,
  "contact_user_id" int8,
  "contact_name" varchar(30) COLLATE "pg_catalog"."default" NOT NULL,
  "contact_mobile" varchar(500) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "status" int2 NOT NULL DEFAULT 0,
  "website" varchar(256) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "package_id" int8 NOT NULL,
  "expire_time" timestamp(6) NOT NULL,
  "account_count" int4 NOT NULL,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_tenant" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_tenant"."id" IS '租户编号';
COMMENT ON COLUMN "public"."system_tenant"."name" IS '租户名';
COMMENT ON COLUMN "public"."system_tenant"."contact_user_id" IS '联系人的用户编号';
COMMENT ON COLUMN "public"."system_tenant"."contact_name" IS '联系人';
COMMENT ON COLUMN "public"."system_tenant"."contact_mobile" IS '联系手机';
COMMENT ON COLUMN "public"."system_tenant"."status" IS '租户状态（0正常 1停用）';
COMMENT ON COLUMN "public"."system_tenant"."website" IS '绑定域名';
COMMENT ON COLUMN "public"."system_tenant"."package_id" IS '租户套餐编号';
COMMENT ON COLUMN "public"."system_tenant"."expire_time" IS '过期时间';
COMMENT ON COLUMN "public"."system_tenant"."account_count" IS '账号数量';
COMMENT ON COLUMN "public"."system_tenant"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_tenant"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_tenant"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_tenant"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_tenant"."deleted" IS '是否删除';
COMMENT ON TABLE "public"."system_tenant" IS '租户表';

-- ----------------------------
-- Table structure for system_tenant_package
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_tenant_package";
CREATE TABLE "public"."system_tenant_package" (
  "id" int8 NOT NULL,
  "name" varchar(30) COLLATE "pg_catalog"."default" NOT NULL,
  "status" int2 NOT NULL DEFAULT 0,
  "remark" varchar(256) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "menu_ids" varchar(4096) COLLATE "pg_catalog"."default" NOT NULL,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_tenant_package" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_tenant_package"."id" IS '套餐编号';
COMMENT ON COLUMN "public"."system_tenant_package"."name" IS '套餐名';
COMMENT ON COLUMN "public"."system_tenant_package"."status" IS '租户状态（0正常 1停用）';
COMMENT ON COLUMN "public"."system_tenant_package"."remark" IS '备注';
COMMENT ON COLUMN "public"."system_tenant_package"."menu_ids" IS '关联的菜单编号';
COMMENT ON COLUMN "public"."system_tenant_package"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_tenant_package"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_tenant_package"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_tenant_package"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_tenant_package"."deleted" IS '是否删除';
COMMENT ON TABLE "public"."system_tenant_package" IS '租户套餐表';

-- ----------------------------
-- Table structure for system_user_form_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_user_form_config";
CREATE TABLE "public"."system_user_form_config" (
  "id" int8 NOT NULL DEFAULT nextval('system_user_form_config_seq'::regclass),
  "user_id" int8,
  "role_id" int8,
  "config_type" int2 NOT NULL,
  "menu_id" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "column_key" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "column_title" varchar(100) COLLATE "pg_catalog"."default",
  "column_width" int4,
  "is_visible" int2 NOT NULL DEFAULT 1,
  "is_printable" int2 NOT NULL DEFAULT 0,
  "sort_order" int4 NOT NULL DEFAULT 0,
  "creator" varchar(64) COLLATE "pg_catalog"."default",
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_user_form_config" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_user_form_config"."id" IS '主键';
COMMENT ON COLUMN "public"."system_user_form_config"."user_id" IS '用户ID，个人配置时使用';
COMMENT ON COLUMN "public"."system_user_form_config"."role_id" IS '角色ID，角色配置时使用';
COMMENT ON COLUMN "public"."system_user_form_config"."config_type" IS '配置类型：1-个人配置，2-角色配置';
COMMENT ON COLUMN "public"."system_user_form_config"."menu_id" IS '表格标识，关联system_menu';
COMMENT ON COLUMN "public"."system_user_form_config"."column_key" IS '列字段标识';
COMMENT ON COLUMN "public"."system_user_form_config"."column_title" IS '自定义列标题';
COMMENT ON COLUMN "public"."system_user_form_config"."column_width" IS '列宽度';
COMMENT ON COLUMN "public"."system_user_form_config"."is_visible" IS '是否显示：0-隐藏，1-显示';
COMMENT ON COLUMN "public"."system_user_form_config"."is_printable" IS '是否可打印：0-否，1-是';
COMMENT ON COLUMN "public"."system_user_form_config"."sort_order" IS '排序序号';
COMMENT ON COLUMN "public"."system_user_form_config"."creator" IS '创建人';
COMMENT ON COLUMN "public"."system_user_form_config"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_user_form_config"."updater" IS '更新人';
COMMENT ON COLUMN "public"."system_user_form_config"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_user_form_config"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_user_form_config"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_user_form_config" IS '系统表格列配置表';

-- ----------------------------
-- Table structure for system_user_post
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_user_post";
CREATE TABLE "public"."system_user_post" (
  "id" int8 NOT NULL,
  "user_id" int8 NOT NULL DEFAULT 0,
  "post_id" int8 NOT NULL DEFAULT 0,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_user_post" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_user_post"."id" IS 'id';
COMMENT ON COLUMN "public"."system_user_post"."user_id" IS '用户ID';
COMMENT ON COLUMN "public"."system_user_post"."post_id" IS '岗位ID';
COMMENT ON COLUMN "public"."system_user_post"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_user_post"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_user_post"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_user_post"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_user_post"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_user_post"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_user_post" IS '用户岗位表';

-- ----------------------------
-- Table structure for system_user_role
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_user_role";
CREATE TABLE "public"."system_user_role" (
  "id" int8 NOT NULL,
  "user_id" int8 NOT NULL,
  "role_id" int8 NOT NULL,
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_user_role" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_user_role"."id" IS '自增编号';
COMMENT ON COLUMN "public"."system_user_role"."user_id" IS '用户ID';
COMMENT ON COLUMN "public"."system_user_role"."role_id" IS '角色ID';
COMMENT ON COLUMN "public"."system_user_role"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_user_role"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_user_role"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_user_role"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_user_role"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_user_role"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_user_role" IS '用户和角色关联表';

-- ----------------------------
-- Table structure for system_users
-- ----------------------------
DROP TABLE IF EXISTS "public"."system_users";
CREATE TABLE "public"."system_users" (
  "id" int8 NOT NULL,
  "username" varchar(30) COLLATE "pg_catalog"."default" NOT NULL,
  "password" varchar(100) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "nickname" varchar(30) COLLATE "pg_catalog"."default" NOT NULL,
  "remark" varchar(500) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "dept_id" int8,
  "post_ids" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "email" varchar(50) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "mobile" varchar(11) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "sex" int2 DEFAULT 0,
  "avatar" varchar(512) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "status" int2 NOT NULL DEFAULT 0,
  "login_ip" varchar(50) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "login_date" timestamp(6),
  "creator" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "create_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "updater" varchar(64) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "update_time" timestamp(6) NOT NULL DEFAULT pg_systimestamp(),
  "deleted" int2 NOT NULL DEFAULT 0,
  "tenant_id" int8 NOT NULL DEFAULT 0
)
;
ALTER TABLE "public"."system_users" OWNER TO "sw_system";
COMMENT ON COLUMN "public"."system_users"."id" IS '用户ID';
COMMENT ON COLUMN "public"."system_users"."username" IS '用户账号';
COMMENT ON COLUMN "public"."system_users"."password" IS '密码';
COMMENT ON COLUMN "public"."system_users"."nickname" IS '用户昵称';
COMMENT ON COLUMN "public"."system_users"."remark" IS '备注';
COMMENT ON COLUMN "public"."system_users"."dept_id" IS '部门ID';
COMMENT ON COLUMN "public"."system_users"."post_ids" IS '岗位编号数组';
COMMENT ON COLUMN "public"."system_users"."email" IS '用户邮箱';
COMMENT ON COLUMN "public"."system_users"."mobile" IS '手机号码';
COMMENT ON COLUMN "public"."system_users"."sex" IS '用户性别';
COMMENT ON COLUMN "public"."system_users"."avatar" IS '头像地址';
COMMENT ON COLUMN "public"."system_users"."status" IS '帐号状态（0正常 1停用）';
COMMENT ON COLUMN "public"."system_users"."login_ip" IS '最后登录IP';
COMMENT ON COLUMN "public"."system_users"."login_date" IS '最后登录时间';
COMMENT ON COLUMN "public"."system_users"."creator" IS '创建者';
COMMENT ON COLUMN "public"."system_users"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."system_users"."updater" IS '更新者';
COMMENT ON COLUMN "public"."system_users"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."system_users"."deleted" IS '是否删除';
COMMENT ON COLUMN "public"."system_users"."tenant_id" IS '租户编号';
COMMENT ON TABLE "public"."system_users" IS '用户信息表';

-- ----------------------------
-- Indexes structure for table system_dept
-- ----------------------------
CREATE INDEX "idx_system_dept_code" ON "public"."system_dept" USING btree (
  "code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_system_dept_parent_id" ON "public"."system_dept" USING btree (
  "parent_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_system_dept_tenant" ON "public"."system_dept" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table system_dict_data
-- ----------------------------
ALTER TABLE "public"."system_dict_data" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_dict_type
-- ----------------------------
ALTER TABLE "public"."system_dict_type" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_login_log
-- ----------------------------
ALTER TABLE "public"."system_login_log" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_mail_account
-- ----------------------------
ALTER TABLE "public"."system_mail_account" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_mail_log
-- ----------------------------
ALTER TABLE "public"."system_mail_log" ADD CONSTRAINT "pk_system_mail_log" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_mail_template
-- ----------------------------
ALTER TABLE "public"."system_mail_template" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_menu
-- ----------------------------
ALTER TABLE "public"."system_menu" ADD CONSTRAINT "pk_system_menu" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_notice
-- ----------------------------
ALTER TABLE "public"."system_notice" ADD CONSTRAINT "pk_system_notice" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_notify_message
-- ----------------------------
ALTER TABLE "public"."system_notify_message" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_notify_template
-- ----------------------------
ALTER TABLE "public"."system_notify_template" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table system_oauth2_access_token
-- ----------------------------
CREATE INDEX "idx_system_oauth2_access_token_01" ON "public"."system_oauth2_access_token" USING btree (
  "access_token" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_system_oauth2_access_token_02" ON "public"."system_oauth2_access_token" USING btree (
  "refresh_token" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table system_oauth2_access_token
-- ----------------------------
ALTER TABLE "public"."system_oauth2_access_token" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_oauth2_approve
-- ----------------------------
ALTER TABLE "public"."system_oauth2_approve" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_oauth2_client
-- ----------------------------
ALTER TABLE "public"."system_oauth2_client" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_oauth2_code
-- ----------------------------
ALTER TABLE "public"."system_oauth2_code" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_oauth2_refresh_token
-- ----------------------------
ALTER TABLE "public"."system_oauth2_refresh_token" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_operate_log
-- ----------------------------
ALTER TABLE "public"."system_operate_log" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_post
-- ----------------------------
ALTER TABLE "public"."system_post" ADD CONSTRAINT "pk_system_post" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_role
-- ----------------------------
ALTER TABLE "public"."system_role" ADD CONSTRAINT "pk_system_role" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_role_menu
-- ----------------------------
ALTER TABLE "public"."system_role_menu" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_sms_channel
-- ----------------------------
ALTER TABLE "public"."system_sms_channel" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table system_sms_code
-- ----------------------------
CREATE INDEX "idx_system_sms_code_01" ON "public"."system_sms_code" USING btree (
  "mobile" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table system_sms_code
-- ----------------------------
ALTER TABLE "public"."system_sms_code" ADD CONSTRAINT "pk_system_sms_code" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_sms_log
-- ----------------------------
ALTER TABLE "public"."system_sms_log" ADD CONSTRAINT "pk_system_sms_log" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_sms_template
-- ----------------------------
ALTER TABLE "public"."system_sms_template" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_social_client
-- ----------------------------
ALTER TABLE "public"."system_social_client" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_social_user
-- ----------------------------
ALTER TABLE "public"."system_social_user" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_social_user_bind
-- ----------------------------
ALTER TABLE "public"."system_social_user_bind" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_tenant
-- ----------------------------
ALTER TABLE "public"."system_tenant" ADD CONSTRAINT "pk_system_tenant" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_tenant_package
-- ----------------------------
ALTER TABLE "public"."system_tenant_package" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table system_user_form_config
-- ----------------------------
CREATE INDEX "idx_system_user_form_config_column_key" ON "public"."system_user_form_config" USING btree (
  "column_key" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_system_user_form_config_config_type" ON "public"."system_user_form_config" USING btree (
  "config_type" "pg_catalog"."int2_ops" ASC NULLS LAST
);
CREATE INDEX "idx_system_user_form_config_menu_id" ON "public"."system_user_form_config" USING btree (
  "menu_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "idx_system_user_form_config_role_id" ON "public"."system_user_form_config" USING btree (
  "role_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_system_user_form_config_tenant" ON "public"."system_user_form_config" USING btree (
  "tenant_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_system_user_form_config_user_id" ON "public"."system_user_form_config" USING btree (
  "user_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table system_user_form_config
-- ----------------------------
ALTER TABLE "public"."system_user_form_config" ADD CONSTRAINT "system_user_form_config_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_user_post
-- ----------------------------
ALTER TABLE "public"."system_user_post" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_user_role
-- ----------------------------
ALTER TABLE "public"."system_user_role" ADD CONSTRAINT "[REDACTED] PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table system_users
-- ----------------------------
ALTER TABLE "public"."system_users" ADD CONSTRAINT "pk_system_users" PRIMARY KEY ("id");
