docker启动数据库和redis
# 数据库
docker run -d --restart=always --name=postgres -p 5432:5432 -e POSTGRES_PASSWORD=fantuan1985 -v /home/lfq/Documents/docker/postgresql:/var/lib/postgresql/data --privileged postgres
# redis
docker run --name=redis --restart=always -p 6379:6379 -d redis
引入数据
-- sqmdb_rpt.acl_area definition
-- Drop table
-- DROP TABLE sqmdb_rpt.acl_area;
CREATE TABLE sqmdb_rpt.acl_area (
area_id int4 NOT NULL,
area_name varchar NOT NULL,
area_type varchar NOT NULL,
type_code int4 NOT NULL,
parent_id int4 NULL
);
-- sqmdb_rpt.acl_client definition
-- Drop table
-- DROP TABLE sqmdb_rpt.acl_client;
CREATE TABLE sqmdb_rpt.acl_client (
client int4 NOT NULL, -- 主键
client_name varchar NOT NULL, -- 客户端名称
CONSTRAINT acl_client_pk PRIMARY KEY (client)
);
COMMENT ON TABLE sqmdb_rpt.acl_client IS '客户端';
-- Column comments
COMMENT ON COLUMN sqmdb_rpt.acl_client.client IS '主键';
COMMENT ON COLUMN sqmdb_rpt.acl_client.client_name IS '客户端名称';
-- sqmdb_rpt.acl_function definition
-- Drop table
-- DROP TABLE sqmdb_rpt.acl_function;
CREATE TABLE sqmdb_rpt.acl_function (
id serial4 NOT NULL, -- 主键
"name" varchar NOT NULL, -- 功能名称
"system" varchar NOT NULL, -- 系统模块
client int4 NOT NULL, -- 展示的客户端
app_url varchar NOT NULL DEFAULT ''::character varying, -- app链接
app_icon varchar NOT NULL DEFAULT ''::character varying, -- app图标链接
app_priority int4 NOT NULL DEFAULT 0, -- app显示优先级,越大越靠前
web_url varchar NOT NULL DEFAULT ''::character varying, -- web链接
web_icon varchar NOT NULL DEFAULT ''::character varying, -- web图标链接
web_priority int4 NOT NULL DEFAULT 0, -- web显示优先级,越大越靠前
function_description varchar NOT NULL DEFAULT ''::character varying, -- 功能说明
CONSTRAINT acl_function_pk PRIMARY KEY (id)
);
COMMENT ON TABLE sqmdb_rpt.acl_function IS '功能';
-- Column comments
COMMENT ON COLUMN sqmdb_rpt.acl_function.id IS '主键';
COMMENT ON COLUMN sqmdb_rpt.acl_function."name" IS '功能名称';
COMMENT ON COLUMN sqmdb_rpt.acl_function."system" IS '系统模块';
COMMENT ON COLUMN sqmdb_rpt.acl_function.client IS '展示的客户端';
COMMENT ON COLUMN sqmdb_rpt.acl_function.app_url IS 'app链接';
COMMENT ON COLUMN sqmdb_rpt.acl_function.app_icon IS 'app图标链接';
COMMENT ON COLUMN sqmdb_rpt.acl_function.app_priority IS 'app显示优先级,越大越靠前';
COMMENT ON COLUMN sqmdb_rpt.acl_function.web_url IS 'web链接';
COMMENT ON COLUMN sqmdb_rpt.acl_function.web_icon IS 'web图标链接';
COMMENT ON COLUMN sqmdb_rpt.acl_function.web_priority IS 'web显示优先级,越大越靠前';
COMMENT ON COLUMN sqmdb_rpt.acl_function.function_description IS '功能说明';
-- sqmdb_rpt.acl_operation_log definition
-- Drop table
-- DROP TABLE sqmdb_rpt.acl_operation_log;
CREATE TABLE sqmdb_rpt.acl_operation_log (
id bigserial NOT NULL, -- 主键
operation_time timestamp NOT NULL, -- 操作时间
operator_id int4 NOT NULL, -- 操作人id
operator_name varchar NOT NULL, -- 操作人姓名
operator_account varchar NOT NULL, -- 操作人账号
operation_name varchar NOT NULL, -- 操作名称
operation_content varchar NOT NULL, -- 操作内容
CONSTRAINT acl_operation_log_pk PRIMARY KEY (id)
);
COMMENT ON TABLE sqmdb_rpt.acl_operation_log IS '操作日志';
-- Column comments
COMMENT ON COLUMN sqmdb_rpt.acl_operation_log.id IS '主键';
COMMENT ON COLUMN sqmdb_rpt.acl_operation_log.operation_time IS '操作时间';
COMMENT ON COLUMN sqmdb_rpt.acl_operation_log.operator_id IS '操作人id';
COMMENT ON COLUMN sqmdb_rpt.acl_operation_log.operator_name IS '操作人姓名';
COMMENT ON COLUMN sqmdb_rpt.acl_operation_log.operator_account IS '操作人账号';
COMMENT ON COLUMN sqmdb_rpt.acl_operation_log.operation_name IS '操作名称';
COMMENT ON COLUMN sqmdb_rpt.acl_operation_log.operation_content IS '操作内容';
-- sqmdb_rpt.acl_org definition
-- Drop table
-- DROP TABLE sqmdb_rpt.acl_org;
CREATE TABLE sqmdb_rpt.acl_org (
org_id int8 NOT NULL, -- 组织id
org_name varchar NOT NULL, -- 组织名称
province_id int4 NULL, -- 省份id
city_id int4 NULL, -- 地市id
area_id int4 NULL, -- 区县id
CONSTRAINT acl_org_pk PRIMARY KEY (org_id)
);
COMMENT ON TABLE sqmdb_rpt.acl_org IS '组织';
-- Column comments
COMMENT ON COLUMN sqmdb_rpt.acl_org.org_id IS '组织id';
COMMENT ON COLUMN sqmdb_rpt.acl_org.org_name IS '组织名称';
COMMENT ON COLUMN sqmdb_rpt.acl_org.province_id IS '省份id';
COMMENT ON COLUMN sqmdb_rpt.acl_org.city_id IS '地市id';
COMMENT ON COLUMN sqmdb_rpt.acl_org.area_id IS '区县id';
-- sqmdb_rpt.acl_role definition
-- Drop table
-- DROP TABLE sqmdb_rpt.acl_role;
CREATE TABLE sqmdb_rpt.acl_role (
role_id serial4 NOT NULL,
role_name varchar NULL,
"system" varchar NULL,
function_id int4 NULL,
role_description varchar NULL DEFAULT ''::character varying, -- 角色说明
CONSTRAINT role_pk PRIMARY KEY (role_id)
);
-- Column comments
COMMENT ON COLUMN sqmdb_rpt.acl_role.role_description IS '角色说明';
-- sqmdb_rpt.acl_system definition
-- Drop table
-- DROP TABLE sqmdb_rpt.acl_system;
CREATE TABLE sqmdb_rpt.acl_system (
"system" varchar NOT NULL, -- system id
system_name varchar NOT NULL, -- system中文名称
CONSTRAINT acl_system_pk PRIMARY KEY (system)
);
COMMENT ON TABLE sqmdb_rpt.acl_system IS 'acl系统';
-- Column comments
COMMENT ON COLUMN sqmdb_rpt.acl_system."system" IS 'system id';
COMMENT ON COLUMN sqmdb_rpt.acl_system.system_name IS 'system中文名称';
-- sqmdb_rpt.acl_top_user definition
-- Drop table
-- DROP TABLE sqmdb_rpt.acl_top_user;
CREATE TABLE sqmdb_rpt.acl_top_user (
login_name varchar NULL,
org_id int8 NULL,
org_name varchar NULL,
user_id varchar NULL,
user_name varchar NULL,
phone varchar NULL,
employee_code varchar NULL
);
-- sqmdb_rpt.acl_user definition
-- Drop table
-- DROP TABLE sqmdb_rpt.acl_user;
CREATE TABLE sqmdb_rpt.acl_user (
user_id serial4 NOT NULL,
login_name varchar NULL,
user_name varchar NULL,
phone varchar NULL,
email varchar NULL,
city_id int4 NULL,
area_id int4 NULL,
province_id int4 NULL,
org varchar NULL,
deleted int4 NOT NULL DEFAULT 0,
CONSTRAINT user_pk PRIMARY KEY (user_id)
);
-- sqmdb_rpt.acl_user_function definition
-- Drop table
-- DROP TABLE sqmdb_rpt.acl_user_function;
CREATE TABLE sqmdb_rpt.acl_user_function (
user_id int4 NOT NULL, -- 用户id
function_id int4 NOT NULL, -- 功能id
CONSTRAINT acl_user_function_pk PRIMARY KEY (user_id, function_id)
);
COMMENT ON TABLE sqmdb_rpt.acl_user_function IS '用户功能关联';
-- Column comments
COMMENT ON COLUMN sqmdb_rpt.acl_user_function.user_id IS '用户id';
COMMENT ON COLUMN sqmdb_rpt.acl_user_function.function_id IS '功能id';
-- sqmdb_rpt.acl_user_role_city definition
-- Drop table
-- DROP TABLE sqmdb_rpt.acl_user_role_city;
CREATE TABLE sqmdb_rpt.acl_user_role_city (
id serial4 NOT NULL,
user_id int4 NOT NULL,
role_id int4 NOT NULL,
city_id int4 NOT NULL,
CONSTRAINT user_role_city_pk PRIMARY KEY (id)
);
-- sqmdb_rpt.acl_verification_log definition
-- Drop table
-- DROP TABLE sqmdb_rpt.acl_verification_log;
CREATE TABLE sqmdb_rpt.acl_verification_log (
id bigserial NOT NULL, -- 主键
user_id int4 NOT NULL, -- 用户id
login_name varchar NOT NULL, -- 用户账号
user_name varchar NOT NULL, -- 用户姓名
city_id int4 NOT NULL, -- 所属地市
"system" varchar NOT NULL, -- 登入模块
login_time timestamp NOT NULL, -- 登录时间
success int4 NULL, -- 是否登录成功
res varchar NULL, -- 返回结果
CONSTRAINT acl_verification_log_pk PRIMARY KEY (id)
);
COMMENT ON TABLE sqmdb_rpt.acl_verification_log IS '用户登录日志';
-- Column comments
COMMENT ON COLUMN sqmdb_rpt.acl_verification_log.id IS '主键';
COMMENT ON COLUMN sqmdb_rpt.acl_verification_log.user_id IS '用户id';
COMMENT ON COLUMN sqmdb_rpt.acl_verification_log.login_name IS '用户账号';
COMMENT ON COLUMN sqmdb_rpt.acl_verification_log.user_name IS '用户姓名';
COMMENT ON COLUMN sqmdb_rpt.acl_verification_log.city_id IS '所属地市';
COMMENT ON COLUMN sqmdb_rpt.acl_verification_log."system" IS '登入模块';
COMMENT ON COLUMN sqmdb_rpt.acl_verification_log.login_time IS '登录时间';
COMMENT ON COLUMN sqmdb_rpt.acl_verification_log.success IS '是否登录成功';
COMMENT ON COLUMN sqmdb_rpt.acl_verification_log.res IS '返回结果';