main主干首次提交,包含用户认证模块
This commit is contained in:
23
src/main/resources/sql/data.sql
Normal file
23
src/main/resources/sql/data.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
insert into sys_company (id, company_code, company_name, status) values
|
||||
(1, 'PLATFORM', '平台公司', 'ENABLED'),
|
||||
(2, 'ALPHA', '甲公司', 'ENABLED')
|
||||
on conflict do nothing;
|
||||
|
||||
insert into sys_user (id, company_id, phone, username, role, position, real_name, password_hash, must_change_password, status, session_version) values
|
||||
(1, 1, '13900000000', 'platform-admin', 'ENGINEER', 'ADMIN', '平台管理员', '$2a$10$TGPk5rNNhKNJQvTWImw5J.LVzw9HDFWR6hyNJCkLDcp0GU8/vp0aS', false, 'ENABLED', 1),
|
||||
(2, 2, '13800138000', 'alpha-admin', 'EMPLOYEE', 'ADMIN', '甲公司管理员', '$2a$10$/hSD8ch7A9lFWi/DOb8yJOHdlrhV57p95CBv9Uv93Yky7t6c4Rs/S', true, 'ENABLED', 1),
|
||||
(3, 2, '13700000000', 'alpha-annotator', 'EMPLOYEE', 'ANNOTATOR', '甲公司标注员', '$2a$10$bRMZPcIaiB1BUx6HPw6FSODPSuph8kUi8/JZOM6lACwjjhkbBL5mq', false, 'ENABLED', 1),
|
||||
(4, 2, '13600000000', 'alpha-manager', 'MANAGER', 'REVIEWER', '甲公司经理', '$2a$10$bRMZPcIaiB1BUx6HPw6FSODPSuph8kUi8/JZOM6lACwjjhkbBL5mq', false, 'ENABLED', 1),
|
||||
(5, 2, '13500000000', 'alpha-engineer', 'ENGINEER', 'ADMIN', '甲公司工程师', '$2a$10$bRMZPcIaiB1BUx6HPw6FSODPSuph8kUi8/JZOM6lACwjjhkbBL5mq', false, 'ENABLED', 1)
|
||||
on conflict do nothing;
|
||||
|
||||
insert into sys_menu (id, company_id, permission_code, menu_code, menu_name, path, sort_order) values
|
||||
(201, 2, 'USER_MANAGE', 'USER_MANAGE', '员工管理', '/users', 1),
|
||||
(202, 2, 'DATA_RECORD_VIEW', 'DATA_RECORDS', '数据记录', '/data-records', 2)
|
||||
on conflict do nothing;
|
||||
|
||||
insert into biz_data_record (id, company_id, creator_id, creator_role, record_name) values
|
||||
(401, 2, 3, 'EMPLOYEE', '员工创建的数据'),
|
||||
(402, 2, 4, 'MANAGER', '经理创建的数据'),
|
||||
(403, 2, 5, 'ENGINEER', '工程师创建的数据')
|
||||
on conflict do nothing;
|
||||
47
src/main/resources/sql/schema.sql
Normal file
47
src/main/resources/sql/schema.sql
Normal file
@@ -0,0 +1,47 @@
|
||||
create table if not exists sys_company (
|
||||
id bigint primary key,
|
||||
company_code varchar(64) not null unique,
|
||||
company_name varchar(128) not null,
|
||||
status varchar(32) not null,
|
||||
created_at timestamp default current_timestamp,
|
||||
updated_at timestamp default current_timestamp
|
||||
);
|
||||
|
||||
create table if not exists sys_user (
|
||||
id bigint primary key,
|
||||
company_id bigint not null,
|
||||
phone varchar(32) not null,
|
||||
username varchar(64),
|
||||
role varchar(32) not null,
|
||||
position varchar(32) not null,
|
||||
real_name varchar(64) not null,
|
||||
password_hash varchar(255) not null,
|
||||
must_change_password boolean not null default true,
|
||||
status varchar(32) not null,
|
||||
session_version integer not null default 1,
|
||||
created_at timestamp default current_timestamp,
|
||||
updated_at timestamp default current_timestamp,
|
||||
constraint uq_sys_user_company_phone unique (company_id, phone)
|
||||
);
|
||||
|
||||
create table if not exists sys_menu (
|
||||
id bigint primary key,
|
||||
company_id bigint not null,
|
||||
permission_code varchar(64) not null,
|
||||
menu_code varchar(64) not null,
|
||||
menu_name varchar(128) not null,
|
||||
path varchar(255) not null,
|
||||
sort_order integer not null default 0,
|
||||
created_at timestamp default current_timestamp,
|
||||
updated_at timestamp default current_timestamp
|
||||
);
|
||||
|
||||
create table if not exists biz_data_record (
|
||||
id bigint primary key,
|
||||
company_id bigint not null,
|
||||
creator_id bigint not null,
|
||||
creator_role varchar(32) not null,
|
||||
record_name varchar(255) not null,
|
||||
created_at timestamp default current_timestamp,
|
||||
updated_at timestamp default current_timestamp
|
||||
);
|
||||
Reference in New Issue
Block a user