-- ----------------------------
-- 表名：base_tenant
-- ----------------------------
CREATE TABLE base_tenant (
	f_id varchar(50) NOT NULL PRIMARY KEY,
	f_en_code varchar(50),
	f_full_name varchar(50),
	f_db_name varchar(50),
	f_description varchar(500),
	f_sort_code bigint,
	f_enabled_mark integer,
	f_creator_time timestamp(0),
	f_creator_user_id varchar(50),
	f_last_modify_time timestamp(0),
	f_last_modify_user_id varchar(50),
	f_delete_mark integer,
	f_delete_time timestamp(0),
	f_delete_user_id varchar(50),
	f_tenant_id varchar(50),
	f_start_time timestamp(0),
	f_end_time timestamp(0),
	f_account_num bigint,
	f_type integer,
	f_db_type varchar(50),
	f_unit_info_json text,
	f_user_info_json text
);
COMMENT ON TABLE base_tenant IS '租户表';
COMMENT ON COLUMN base_tenant.f_id IS '自然主键';
COMMENT ON COLUMN base_tenant.f_en_code IS '编号';
COMMENT ON COLUMN base_tenant.f_full_name IS '名称';
COMMENT ON COLUMN base_tenant.f_db_name IS '服务名称';
COMMENT ON COLUMN base_tenant.f_description IS '描述';
COMMENT ON COLUMN base_tenant.f_sort_code IS '排序';
COMMENT ON COLUMN base_tenant.f_enabled_mark IS '有效标志';
COMMENT ON COLUMN base_tenant.f_creator_time IS '创建时间';
COMMENT ON COLUMN base_tenant.f_creator_user_id IS '创建用户';
COMMENT ON COLUMN base_tenant.f_last_modify_time IS '修改时间';
COMMENT ON COLUMN base_tenant.f_last_modify_user_id IS '修改用户';
COMMENT ON COLUMN base_tenant.f_delete_mark IS '删除标志';
COMMENT ON COLUMN base_tenant.f_delete_time IS '删除时间';
COMMENT ON COLUMN base_tenant.f_delete_user_id IS '删除用户';
COMMENT ON COLUMN base_tenant.f_tenant_id IS '租户主键';
COMMENT ON COLUMN base_tenant.f_start_time IS '起始时间';
COMMENT ON COLUMN base_tenant.f_end_time IS '过期时间';
COMMENT ON COLUMN base_tenant.f_account_num IS '账号额度';
COMMENT ON COLUMN base_tenant.f_type IS '类型(0-库隔离 1-id隔离 2-连接隔离)';
COMMENT ON COLUMN base_tenant.f_db_type IS '数据库类型';
COMMENT ON COLUMN base_tenant.f_unit_info_json IS '单位信息';
COMMENT ON COLUMN base_tenant.f_user_info_json IS '联系人信息';
-- ----------------------------
-- 表名：base_tenant_account
-- ----------------------------
CREATE TABLE base_tenant_account (
	f_id varchar(50) NOT NULL PRIMARY KEY,
	f_account varchar(50),
	f_password varchar(50),
	f_real_name varchar(50),
	f_gender integer,
	f_is_administrator integer,
	f_description varchar(500),
	f_sort_code bigint,
	f_enabled_mark integer,
	f_creator_time timestamp(0),
	f_creator_user_id varchar(50),
	f_last_modify_time timestamp(0),
	f_last_modify_user_id varchar(50),
	f_delete_time timestamp(0),
	f_delete_user_id varchar(50),
	f_delete_mark integer,
	f_tenant_id varchar(50),
	f_mobile_phone varchar(50)
);
COMMENT ON TABLE base_tenant_account IS '用户信息';
COMMENT ON COLUMN base_tenant_account.f_id IS '自然主键';
COMMENT ON COLUMN base_tenant_account.f_account IS '账户';
COMMENT ON COLUMN base_tenant_account.f_password IS '密码';
COMMENT ON COLUMN base_tenant_account.f_real_name IS '姓名';
COMMENT ON COLUMN base_tenant_account.f_gender IS '性别';
COMMENT ON COLUMN base_tenant_account.f_is_administrator IS '是否管理员';
COMMENT ON COLUMN base_tenant_account.f_description IS '描述';
COMMENT ON COLUMN base_tenant_account.f_sort_code IS '排序';
COMMENT ON COLUMN base_tenant_account.f_enabled_mark IS '有效标志';
COMMENT ON COLUMN base_tenant_account.f_creator_time IS '创建时间';
COMMENT ON COLUMN base_tenant_account.f_creator_user_id IS '创建用户';
COMMENT ON COLUMN base_tenant_account.f_last_modify_time IS '修改时间';
COMMENT ON COLUMN base_tenant_account.f_last_modify_user_id IS '修改用户';
COMMENT ON COLUMN base_tenant_account.f_delete_time IS '删除时间';
COMMENT ON COLUMN base_tenant_account.f_delete_user_id IS '删除用户';
COMMENT ON COLUMN base_tenant_account.f_delete_mark IS '删除标志';
COMMENT ON COLUMN base_tenant_account.f_tenant_id IS '租户主键';
COMMENT ON COLUMN base_tenant_account.f_mobile_phone IS '手机号码';
DELETE FROM base_tenant_account;
INSERT INTO base_tenant_account (f_enabled_mark,f_password,f_tenant_id,f_creator_user_id,f_last_modify_user_id,f_delete_mark,f_delete_user_id,f_is_administrator,f_delete_time,f_mobile_phone,f_account,f_real_name,f_description,f_gender,f_sort_code,f_id,f_last_modify_time,f_creator_time) VALUES (1,'14e1b600b1fd579f47433b88e8d85291',Null,'1',Null,Null,Null,1,Null,Null,'admin','管理员','admin',1,1,'47ff0279-aa26a4fbeb59f630c8776f759',Null,'2021-09-18 18:01:08');
-- ----------------------------
-- 表名：base_tenant_authorize
-- ----------------------------
CREATE TABLE base_tenant_authorize (
	f_id varchar(50) NOT NULL PRIMARY KEY,
	f_module_id varchar(50),
	f_tenant_id varchar(50),
	f_url_address varchar(500),
	f_sort_code bigint,
	f_creator_time timestamp(0),
	f_creator_user_id varchar(50),
	f_last_modify_time timestamp(0),
	f_last_modify_user_id varchar(50),
	f_delete_mark integer,
	f_delete_time timestamp(0),
	f_delete_user_id varchar(50)
);
COMMENT ON TABLE base_tenant_authorize IS '租户权限';
COMMENT ON COLUMN base_tenant_authorize.f_id IS '自然主键';
COMMENT ON COLUMN base_tenant_authorize.f_module_id IS '未授权菜单id';
COMMENT ON COLUMN base_tenant_authorize.f_url_address IS '功能地址';
COMMENT ON COLUMN base_tenant_authorize.f_tenant_id IS '租户主键';
COMMENT ON COLUMN base_tenant_authorize.f_sort_code IS '排序';
COMMENT ON COLUMN base_tenant_authorize.f_creator_time IS '创建时间';
COMMENT ON COLUMN base_tenant_authorize.f_creator_user_id IS '创建用户';
COMMENT ON COLUMN base_tenant_authorize.f_last_modify_time IS '修改时间';
COMMENT ON COLUMN base_tenant_authorize.f_last_modify_user_id IS '修改用户';
COMMENT ON COLUMN base_tenant_authorize.f_delete_mark IS '删除标志';
COMMENT ON COLUMN base_tenant_authorize.f_delete_time IS '删除时间';
COMMENT ON COLUMN base_tenant_authorize.f_delete_user_id IS '删除用户';
-- ----------------------------
-- 表名：base_tenant_link
-- ----------------------------
CREATE TABLE base_tenant_link (
	f_id varchar(50) NOT NULL PRIMARY KEY,
	f_full_name varchar(50),
	f_config_type integer,
	f_host varchar(50),
	f_port integer,
	f_user_name varchar(50),
	f_password varchar(50),
	f_service_name varchar(50),
	f_description text,
	f_sort_code bigint,
	f_enabled_mark integer,
	f_creator_time timestamp(0),
	f_creator_user_id varchar(50),
	f_last_modify_time timestamp(0),
	f_last_modify_user_id varchar(50),
	f_delete_mark integer,
	f_delete_time timestamp(0),
	f_delete_user_id varchar(50),
	f_db_schema varchar(50),
	f_table_space varchar(50),
	f_oracle_param text,
	f_connection_str text,
	f_tenant_id varchar(50),
	f_db_type varchar(50)
);
COMMENT ON TABLE base_tenant_link IS '租户数据连接';
COMMENT ON COLUMN base_tenant_link.f_id IS '自然主键';
COMMENT ON COLUMN base_tenant_link.f_full_name IS '连接名称';
COMMENT ON COLUMN base_tenant_link.f_config_type IS '配置类型（0：主，1：从）';
COMMENT ON COLUMN base_tenant_link.f_host IS '主机地址';
COMMENT ON COLUMN base_tenant_link.f_port IS '端口';
COMMENT ON COLUMN base_tenant_link.f_user_name IS '用户';
COMMENT ON COLUMN base_tenant_link.f_password IS '密码';
COMMENT ON COLUMN base_tenant_link.f_service_name IS '服务名称';
COMMENT ON COLUMN base_tenant_link.f_description IS '描述';
COMMENT ON COLUMN base_tenant_link.f_sort_code IS '排序';
COMMENT ON COLUMN base_tenant_link.f_enabled_mark IS '有效标志';
COMMENT ON COLUMN base_tenant_link.f_creator_time IS '创建时间';
COMMENT ON COLUMN base_tenant_link.f_creator_user_id IS '创建用户';
COMMENT ON COLUMN base_tenant_link.f_last_modify_time IS '修改时间';
COMMENT ON COLUMN base_tenant_link.f_last_modify_user_id IS '修改用户';
COMMENT ON COLUMN base_tenant_link.f_delete_mark IS '删除标志';
COMMENT ON COLUMN base_tenant_link.f_delete_time IS '删除时间';
COMMENT ON COLUMN base_tenant_link.f_delete_user_id IS '删除用户';
COMMENT ON COLUMN base_tenant_link.f_db_schema IS '表模式';
COMMENT ON COLUMN base_tenant_link.f_table_space IS '表空间';
COMMENT ON COLUMN base_tenant_link.f_oracle_param IS 'oracle参数';
COMMENT ON COLUMN base_tenant_link.f_connection_str IS '自定义连接语句';
COMMENT ON COLUMN base_tenant_link.f_tenant_id IS '租户id';
COMMENT ON COLUMN base_tenant_link.f_db_type IS '数据库类型';
-- ----------------------------
-- 表名：base_tenant_log
-- ----------------------------
CREATE TABLE base_tenant_log (
	f_id varchar(255) NOT NULL PRIMARY KEY,
	f_tenant_id varchar(50),
	f_login_account varchar(50),
	f_login_ip_address varchar(50),
	f_login_ip_address_name varchar(50),
	f_login_source_website varchar(255),
	f_login_time timestamp(0),
	f_description varchar(500),
	f_sort_code bigint,
	f_creator_time timestamp(0),
	f_creator_user_id varchar(50),
	f_last_modify_time timestamp(0),
	f_last_modify_user_id varchar(50),
	f_delete_mark integer,
	f_delete_time timestamp(0),
	f_delete_user_id varchar(50)
);
COMMENT ON TABLE base_tenant_log IS '租户日志表';
COMMENT ON COLUMN base_tenant_log.f_id IS '自然主键';
COMMENT ON COLUMN base_tenant_log.f_tenant_id IS '租户主键';
COMMENT ON COLUMN base_tenant_log.f_login_account IS '登录账户';
COMMENT ON COLUMN base_tenant_log.f_login_ip_address IS 'IP地址';
COMMENT ON COLUMN base_tenant_log.f_login_ip_address_name IS 'IP所在城市';
COMMENT ON COLUMN base_tenant_log.f_login_source_website IS '来源网站';
COMMENT ON COLUMN base_tenant_log.f_login_time IS '登录时间';
COMMENT ON COLUMN base_tenant_log.f_description IS '描述';
COMMENT ON COLUMN base_tenant_log.f_sort_code IS '排序';
COMMENT ON COLUMN base_tenant_log.f_creator_time IS '创建时间';
COMMENT ON COLUMN base_tenant_log.f_creator_user_id IS '创建用户';
COMMENT ON COLUMN base_tenant_log.f_last_modify_time IS '修改时间';
COMMENT ON COLUMN base_tenant_log.f_last_modify_user_id IS '修改用户';
COMMENT ON COLUMN base_tenant_log.f_delete_mark IS '删除标志';
COMMENT ON COLUMN base_tenant_log.f_delete_time IS '删除时间';
COMMENT ON COLUMN base_tenant_log.f_delete_user_id IS '删除用户';
-- ----------------------------
-- 表名：base_tenant_socials
-- ----------------------------
CREATE TABLE base_tenant_socials (
	f_id varchar(50) NOT NULL PRIMARY KEY,
	f_user_id varchar(50),
	f_account varchar(50),
	f_account_name varchar(255),
	f_social_type varchar(50),
	f_social_id varchar(100),
	f_social_name varchar(100),
	f_tenant_id varchar(100),
	f_description varchar(100),
	f_sort_code bigint,
	f_creator_user_id varchar(50),
	f_creator_time timestamp(0),
	f_last_modify_time timestamp(0),
	f_last_modify_user_id varchar(50),
	f_delete_mark integer,
	f_delete_time timestamp(0),
	f_delete_user_id varchar(50)
);
COMMENT ON TABLE base_tenant_socials IS '多租户第三方绑定表';
COMMENT ON COLUMN base_tenant_socials.f_id IS '自然主键';
COMMENT ON COLUMN base_tenant_socials.f_user_id IS '用户id';
COMMENT ON COLUMN base_tenant_socials.f_account IS '用户账号';
COMMENT ON COLUMN base_tenant_socials.f_account_name IS '用户账号名称';
COMMENT ON COLUMN base_tenant_socials.f_social_type IS '第三方类型';
COMMENT ON COLUMN base_tenant_socials.f_social_id IS '第三方账号id';
COMMENT ON COLUMN base_tenant_socials.f_social_name IS '第三方账号';
COMMENT ON COLUMN base_tenant_socials.f_tenant_id IS '租户id';
COMMENT ON COLUMN base_tenant_socials.f_description IS '备注';
COMMENT ON COLUMN base_tenant_socials.f_sort_code IS '排序';
COMMENT ON COLUMN base_tenant_socials.f_creator_user_id IS '创建用户';
COMMENT ON COLUMN base_tenant_socials.f_creator_time IS '创建时间';
COMMENT ON COLUMN base_tenant_socials.f_last_modify_time IS '修改时间';
COMMENT ON COLUMN base_tenant_socials.f_last_modify_user_id IS '修改用户';
COMMENT ON COLUMN base_tenant_socials.f_delete_mark IS '删除标记';
COMMENT ON COLUMN base_tenant_socials.f_delete_time IS '删除时间';
COMMENT ON COLUMN base_tenant_socials.f_delete_user_id IS '删除用户';
