61 lines
2.0 KiB
SQL
61 lines
2.0 KiB
SQL
--用户表
|
|
/*CREATE TABLE `act_id_user` (
|
|
`ID_` varchar(64) COLLATE utf8_bin NOT NULL,
|
|
`REV_` int(11) DEFAULT NULL,
|
|
`FIRST_` varchar(255) COLLATE utf8_bin DEFAULT NULL,
|
|
`LAST_` varchar(255) COLLATE utf8_bin DEFAULT NULL,
|
|
`DISPLAY_NAME_` varchar(255) COLLATE utf8_bin DEFAULT NULL,
|
|
`EMAIL_` varchar(255) COLLATE utf8_bin DEFAULT NULL,
|
|
`PWD_` varchar(255) COLLATE utf8_bin DEFAULT NULL,
|
|
`PICTURE_ID_` varchar(64) COLLATE utf8_bin DEFAULT NULL,
|
|
`TENANT_ID_` varchar(255) COLLATE utf8_bin DEFAULT '',
|
|
PRIMARY KEY (`ID_`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;*/
|
|
drop table if exists ACT_ID_USER;
|
|
CREATE VIEW ACT_ID_USER AS
|
|
SELECT
|
|
SU.user_name AS ID_,
|
|
1 AS REV_,
|
|
SU.user_name AS FIRST_,
|
|
SU.nick_name AS LAST_ ,
|
|
SU.nick_name as DISPLAY_NAME_,
|
|
SU.email AS EMAIL_,
|
|
'123456' AS PWD_ ,
|
|
SU.avatar AS PICTURE_ID_,
|
|
'' AS TENANT_ID_
|
|
FROM SYS_USER AS SU;
|
|
|
|
-- 分组表
|
|
/*CREATE TABLE `act_id_group` (
|
|
`ID_` varchar(64) COLLATE utf8_bin NOT NULL,
|
|
`REV_` int(11) DEFAULT NULL,
|
|
`NAME_` varchar(255) COLLATE utf8_bin DEFAULT NULL,
|
|
`TYPE_` varchar(255) COLLATE utf8_bin DEFAULT NULL,
|
|
PRIMARY KEY (`ID_`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;*/
|
|
drop table if exists ACT_ID_GROUP;
|
|
CREATE VIEW ACT_ID_GROUP AS
|
|
SELECT
|
|
SR.role_id AS ID_ ,
|
|
1 AS REV_,
|
|
SR.role_name AS NAME_,
|
|
SR.role_key as TYPE_
|
|
FROM
|
|
SYS_ROLE AS SR;
|
|
|
|
-- 关系表
|
|
/*CREATE TABLE `act_id_membership` (
|
|
`USER_ID_` varchar(64) COLLATE utf8_bin NOT NULL,
|
|
`GROUP_ID_` varchar(64) COLLATE utf8_bin NOT NULL,
|
|
PRIMARY KEY (`USER_ID_`,`GROUP_ID_`),
|
|
KEY `ACT_FK_MEMB_GROUP` (`GROUP_ID_`),
|
|
CONSTRAINT `ACT_FK_MEMB_GROUP` FOREIGN KEY (`GROUP_ID_`) REFERENCES `act_id_group` (`ID_`),
|
|
CONSTRAINT `ACT_FK_MEMB_USER` FOREIGN KEY (`USER_ID_`) REFERENCES `act_id_user` (`ID_`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;*/
|
|
drop table if exists ACT_ID_MEMBERSHIP;
|
|
CREATE VIEW ACT_ID_MEMBERSHIP AS
|
|
SELECT
|
|
SUR.user_id AS USER_ID_,
|
|
SUR.role_id AS GROUP_ID_
|
|
FROM SYS_USER_ROLE AS SUR;
|