1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-04 22:41:24 +08:00

Added UserManagement

This commit is contained in:
2023-05-17 15:39:28 +08:00
parent e1bdb21756
commit e5a3cb83be
13 changed files with 656 additions and 58 deletions

View File

@@ -97,13 +97,49 @@ VALUES (1656219345971326978, 1, 1655784840189972481),
SET FOREIGN_KEY_CHECKS = 1;
select * from t_role
left join t_power_role tpr on t_role.id = tpr.role_id
left join t_power tp on tp.id = tpr.power_id
left join t_menu tm on tp.id = tm.power_id
left join t_element te on tp.id = te.power_id
left join t_operation t on tp.id = t.power_id;
select *
from t_role
left join t_power_role tpr on t_role.id = tpr.role_id
left join t_power tp on tp.id = tpr.power_id
left join t_menu tm on tp.id = tm.power_id
left join t_element te on tp.id = te.power_id
left join t_operation t on tp.id = t.power_id;
select *
from t_group
left join t_role_group trg on t_group.id = trg.group_id
left join t_role tr on tr.id = trg.role_id;
update t_user
set deleted = id
where id = 1658537970212278274;
select *
from t_user
inner join t_user_role tur on t_user.id = tur.user_id
inner join t_role tr on tr.id = tur.role_id
inner join t_user_group tug on t_user.id = tug.user_id
inner join t_group tg on tg.id = tug.group_id;
select t_user.id as user_id,
t_user.username as user_username,
t_user.department_id as user_department,
t_user.enable as user_enable,
t_user.deleted as user_deleted,
t_user.version as user_version,
tr.id as role_id,
tr.name as role_name,
tr.deleted as role_deleted,
tr.version as role_version,
tg.id as group_id,
tg.name as group_name,
tg.deleted as group_deleted,
tg.version as group_version
from t_user
left join (select * from t_user_role where deleted = 0) as tur on t_user.id = tur.user_id
left join (select * from t_role where deleted = 0) as tr on tr.id = tur.role_id
left join (select * from t_user_group where deleted = 0) as tug on t_user.id = tug.user_id
left join (select * from t_group where deleted = 0) as tg on tg.id = tug.group_id
where t_user.deleted = 0;
select * from t_group
left join t_role_group trg on t_group.id = trg.group_id
left join t_role tr on tr.id = trg.role_id

View File

@@ -84,7 +84,7 @@ create table `t_department`
`name` varchar(50) not null comment '部门名',
`tel` varchar(20) null comment '部门电话',
`address` varchar(20) null comment '部门地址',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0
) comment '部门';
@@ -95,16 +95,17 @@ create table `t_user`
`passwd` char(70) not null comment '密码',
`department_id` bigint null comment '部门',
`enable` int not null comment '启用',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0,
constraint t_user_department_id_fk foreign key (department_id) references t_department (id)
constraint t_user_department_id_fk foreign key (department_id) references t_department (id),
constraint t_user_unique unique (username, deleted)
) comment '用户';
create table `t_group`
(
`id` bigint not null primary key,
`name` varchar(30) not null comment '用户组名',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0
) comment '用户组';
@@ -113,7 +114,7 @@ create table `t_user_group`
`id` bigint not null primary key,
`user_id` bigint not null comment '用户',
`group_id` bigint not null comment '用户组',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0,
constraint t_user_group_user_id_fk foreign key (user_id) references t_user (id),
constraint t_user_group_group_id_fk foreign key (group_id) references t_group (id)
@@ -123,7 +124,7 @@ create table `t_role`
(
`id` bigint not null primary key,
`name` varchar(20) not null comment '角色名',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0
) comment '角色';
@@ -132,7 +133,7 @@ create table `t_role_group`
`id` bigint not null primary key,
`role_id` bigint not null comment '角色',
`group_id` bigint not null comment '群组',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0,
constraint t_role_group_role_id_fk foreign key (role_id) references t_role (id),
constraint t_role_group_group_id_fk foreign key (group_id) references t_group (id)
@@ -143,7 +144,7 @@ create table `t_user_role`
`id` bigint not null primary key,
`user_id` bigint not null comment '用户',
`role_id` bigint not null comment '角色',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0,
constraint t_user_role_user_id_fk foreign key (user_id) references t_user (id),
constraint t_user_role_role_id_fk foreign key (role_id) references t_role (id)
@@ -154,7 +155,7 @@ create table `t_power_role`
`id` bigint not null primary key,
`power_id` bigint not null comment '权限',
`role_id` bigint not null comment '角色',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0,
constraint t_power_role_power_id_fk foreign key (power_id) references t_power (id),
constraint t_power_role_role_id_fk foreign key (role_id) references t_role (id)
@@ -167,7 +168,7 @@ create table `t_operation_log`
`operation_id` bigint not null comment '功能',
`content` varchar(500) not null comment '操作内容',
`operating_time` datetime not null default (utc_timestamp()) comment '操作时间',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0,
constraint t_operation_log_user_id_fk foreign key (user_id) references t_user (id),
constraint t_operation_log_operation_id_fk foreign key (operation_id) references t_operation (id)
@@ -184,7 +185,7 @@ create table `t_staff`
`email` varchar(50) null comment '邮箱',
`tel` varchar(20) null comment '电话',
`address` varchar(50) null comment '地址',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0,
constraint t_staff_user_id_fk foreign key (user_id) references t_user (id)
) comment '员工';
@@ -194,7 +195,7 @@ create table `t_notice_type`
`id` bigint not null primary key,
`name` varchar(20) not null comment '公告类型名',
`enable` int not null default 1 comment '启用',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0
) comment '公告类型';
@@ -213,7 +214,7 @@ create table `t_notice`
`modify_time` datetime not null default (utc_timestamp()) comment '修改时间',
`origin_id` bigint null comment '源ID',
`old` int not null default 0 comment '已修改',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0,
constraint t_notice_type_id_fk foreign key (type_id) references t_notice_type (id),
constraint t_notice_sender_id_fk foreign key (sender_id) references t_user (id)
@@ -225,7 +226,7 @@ create table `t_notice_receive`
`user_id` bigint not null comment '用户',
`notice_id` bigint not null comment '公告',
`already_read` int not null default 0 comment '已读',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0,
constraint t_notice_receive_user_id_fk foreign key (user_id) references t_user (id),
constraint t_notice_receive_notice_if_fk foreign key (notice_id) references t_notice (id)
@@ -241,7 +242,7 @@ create table `t_work`
`modify_time` datetime not null default (utc_timestamp()) comment '修改时间',
`old` int not null default 0 comment '已修改',
`origin_id` bigint null comment '源ID',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0,
constraint t_work_publisher_id_fk foreign key (publisher_id) references t_user (id)
) comment '工作事项';
@@ -252,7 +253,7 @@ create table `t_user_work`
`user_id` bigint not null comment '用户',
`work_id` bigint not null comment '工作事项',
`status` int not null default 0 comment '工作状态',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0,
constraint t_user_work_user_id_fk foreign key (user_id) references t_user (id),
constraint t_user_work_work_id_fk foreign key (work_id) references t_work (id)
@@ -263,7 +264,7 @@ create table `t_affair_type`
`id` bigint not null primary key,
`name` varchar(20) not null comment '事务类型名',
`enable` int not null default 1 comment '启用',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0
) comment '事务类型';
@@ -282,7 +283,7 @@ create table `t_affair`
`modify_time` datetime default (utc_timestamp()) comment '修改时间',
`origin_id` bigint null comment '源ID',
`old` int not null default 0 comment '已修改',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0,
constraint t_affair_type_id_fk foreign key (type_id) references t_affair_type (id),
constraint t_affair_applicant_id_fk foreign key (applicant_id) references t_user (id),
@@ -297,7 +298,7 @@ create table `t_attendance`
`status` int not null default 0 comment '考勤状态',
`modify_id` bigint not null comment '修改人',
`modify_time` datetime not null default (utc_timestamp()) comment '修改时间',
`deleted` int not null default 0,
`deleted` bigint not null default 0,
`version` int not null default 0,
constraint t_attendance_user_id_fk foreign key (user_id) references t_user (id),
constraint t_attendance_modify_id_fk foreign key (modify_id) references t_user (id)