1、reponse中添加cookie
2、用户和项目管理的表设计
分析关联关系如下:
--
-- Create model GenrAdmin
--
CREATE TABLE `usermnge_genradmin` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`name` VARCHAR (255) NOT NULL,
`password` VARCHAR (10) NOT NULL
);
--
-- Create model Menu
--
CREATE TABLE `usermnge_menu` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`name` VARCHAR (255) NOT NULL,
`menuId` INTEGER NOT NULL
);
--
-- Create model Pro
--
CREATE TABLE `usermnge_pro` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`name` VARCHAR (255) NOT NULL,
`detail` VARCHAR (255) NOT NULL
);
--
-- Create model SysAdmin
--
CREATE TABLE `usermnge_sysadmin` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`name` VARCHAR (255) NOT NULL,
`password` VARCHAR (10) NOT NULL
);
CREATE TABLE `usermnge_sysadmin_genradmins` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`sysadmin_id` INTEGER NOT NULL,
`genradmin_id` INTEGER NOT NULL
);
--
-- Create model Role
--
CREATE TABLE `usermnge_role` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`name` VARCHAR (255) NOT NULL,
`roleId` INTEGER NOT NULL
);
CREATE TABLE `usermnge_role_menus` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`role_id` INTEGER NOT NULL,
`menu_id` INTEGER NOT NULL
);
--
-- Create model NmlUser
--
CREATE TABLE `usermnge_nmluser` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`name` VARCHAR (255) NOT NULL,
`password` VARCHAR (10) NOT NULL
);
CREATE TABLE `usermnge_nmluser_pros` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`nmluser_id` INTEGER NOT NULL,
`pro_id` INTEGER NOT NULL
);
CREATE TABLE `usermnge_nmluser_roles` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`nmluser_id` INTEGER NOT NULL,
`role_id` INTEGER NOT NULL
);
--
-- Create model Group
--
CREATE TABLE `usermnge_group` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`name` VARCHAR (255) NOT NULL
);
CREATE TABLE `usermnge_group_nmlusers` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`group_id` INTEGER NOT NULL,
`nmluser_id` INTEGER NOT NULL
);
CREATE TABLE `usermnge_group_pros` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`group_id` INTEGER NOT NULL,
`pro_id` INTEGER NOT NULL
);
CREATE TABLE `usermnge_group_roles` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`group_id` INTEGER NOT NULL,
`role_id` INTEGER NOT NULL
);
--
-- Add field groups to genradmin
--
CREATE TABLE `usermnge_genradmin_groups` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`genradmin_id` INTEGER NOT NULL,
`group_id` INTEGER NOT NULL
);
--
-- Add field nmlusers to genradmin
--
CREATE TABLE `usermnge_genradmin_nmlusers` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`genradmin_id` INTEGER NOT NULL,
`nmluser_id` INTEGER NOT NULL
);
--
-- Add field pros to genradmin
--
CREATE TABLE `usermnge_genradmin_pros` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`genradmin_id` INTEGER NOT NULL,
`pro_id` INTEGER NOT NULL
);
--
-- Add field roles to genradmin
--
CREATE TABLE `usermnge_genradmin_roles` (
`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
`genradmin_id` INTEGER NOT NULL,
`role_id` INTEGER NOT NULL
);
ALTER TABLE `usermnge_sysadmin_genradmins` ADD CONSTRAINT `usermnge_sysadmin_ge_sysadmin_id_0edf5b6c_fk_usermnge_` FOREIGN KEY (`sysadmin_id`) REFERENCES `usermnge_sysadmin` (`id`);
ALTER TABLE `usermnge_sysadmin_genradmins` ADD CONSTRAINT `usermnge_sysadmin_ge_genradmin_id_9a2759a0_fk_usermnge_` FOREIGN KEY (`genradmin_id`) REFERENCES `usermnge_genradmin` (`id`);
ALTER TABLE `usermnge_sysadmin_genradmins` ADD CONSTRAINT `usermnge_sysadmin_genrad_sysadmin_id_genradmin_id_c3329359_uniq` UNIQUE (
`sysadmin_id`,
`genradmin_id`
);
ALTER TABLE `usermnge_role_menus` ADD CONSTRAINT `usermnge_role_menus_role_id_445fe66c_fk_usermnge_role_id` FOREIGN KEY (`role_id`) REFERENCES `usermnge_role` (`id`);
ALTER TABLE `usermnge_role_menus` ADD CONSTRAINT `usermnge_role_menus_menu_id_8ddb9fc6_fk_usermnge_menu_id` FOREIGN KEY (`menu_id`) REFERENCES `usermnge_menu` (`id`);
ALTER TABLE `usermnge_role_menus` ADD CONSTRAINT `usermnge_role_menus_role_id_menu_id_b395340f_uniq` UNIQUE (`role_id`, `menu_id`);
ALTER TABLE `usermnge_nmluser_pros` ADD CONSTRAINT `usermnge_nmluser_pros_nmluser_id_e76c4da9_fk_usermnge_nmluser_id` FOREIGN KEY (`nmluser_id`) REFERENCES `usermnge_nmluser` (`id`);
ALTER TABLE `usermnge_nmluser_pros` ADD CONSTRAINT `usermnge_nmluser_pros_pro_id_a8f28853_fk_usermnge_pro_id` FOREIGN KEY (`pro_id`) REFERENCES `usermnge_pro` (`id`);
ALTER TABLE `usermnge_nmluser_pros` ADD CONSTRAINT `usermnge_nmluser_pros_nmluser_id_pro_id_ad3c95db_uniq` UNIQUE (`nmluser_id`, `pro_id`);
ALTER TABLE `usermnge_nmluser_roles` ADD CONSTRAINT `usermnge_nmluser_rol_nmluser_id_d0f9415f_fk_usermnge_` FOREIGN KEY (`nmluser_id`) REFERENCES `usermnge_nmluser` (`id`);
ALTER TABLE `usermnge_nmluser_roles` ADD CONSTRAINT `usermnge_nmluser_roles_role_id_28acf475_fk_usermnge_role_id` FOREIGN KEY (`role_id`) REFERENCES `usermnge_role` (`id`);
ALTER TABLE `usermnge_nmluser_roles` ADD CONSTRAINT `usermnge_nmluser_roles_nmluser_id_role_id_d8604942_uniq` UNIQUE (`nmluser_id`, `role_id`);
ALTER TABLE `usermnge_group_nmlusers` ADD CONSTRAINT `usermnge_group_nmlusers_group_id_7eb6a34f_fk_usermnge_group_id` FOREIGN KEY (`group_id`) REFERENCES `usermnge_group` (`id`);
ALTER TABLE `usermnge_group_nmlusers` ADD CONSTRAINT `usermnge_group_nmlus_nmluser_id_a171f78b_fk_usermnge_` FOREIGN KEY (`nmluser_id`) REFERENCES `usermnge_nmluser` (`id`);
ALTER TABLE `usermnge_group_nmlusers` ADD CONSTRAINT `usermnge_group_nmlusers_group_id_nmluser_id_de22f2ee_uniq` UNIQUE (`group_id`, `nmluser_id`);
ALTER TABLE `usermnge_group_pros` ADD CONSTRAINT `usermnge_group_pros_group_id_f983696a_fk_usermnge_group_id` FOREIGN KEY (`group_id`) REFERENCES `usermnge_group` (`id`);
ALTER TABLE `usermnge_group_pros` ADD CONSTRAINT `usermnge_group_pros_pro_id_2ccde89a_fk_usermnge_pro_id` FOREIGN KEY (`pro_id`) REFERENCES `usermnge_pro` (`id`);
ALTER TABLE `usermnge_group_pros` ADD CONSTRAINT `usermnge_group_pros_group_id_pro_id_8fac7bee_uniq` UNIQUE (`group_id`, `pro_id`);
ALTER TABLE `usermnge_group_roles` ADD CONSTRAINT `usermnge_group_roles_group_id_13a5ac38_fk_usermnge_group_id` FOREIGN KEY (`group_id`) REFERENCES `usermnge_group` (`id`);
ALTER TABLE `usermnge_group_roles` ADD CONSTRAINT `usermnge_group_roles_role_id_977e8aaf_fk_usermnge_role_id` FOREIGN KEY (`role_id`) REFERENCES `usermnge_role` (`id`);
ALTER TABLE `usermnge_group_roles` ADD CONSTRAINT `usermnge_group_roles_group_id_role_id_50bdbb4c_uniq` UNIQUE (`group_id`, `role_id`);
ALTER TABLE `usermnge_genradmin_groups` ADD CONSTRAINT `usermnge_genradmin_g_genradmin_id_040de644_fk_usermnge_` FOREIGN KEY (`genradmin_id`) REFERENCES `usermnge_genradmin` (`id`);
ALTER TABLE `usermnge_genradmin_groups` ADD CONSTRAINT `usermnge_genradmin_groups_group_id_cf6ec134_fk_usermnge_group_id` FOREIGN KEY (`group_id`) REFERENCES `usermnge_group` (`id`);
ALTER TABLE `usermnge_genradmin_groups` ADD CONSTRAINT `usermnge_genradmin_groups_genradmin_id_group_id_65864f23_uniq` UNIQUE (`genradmin_id`, `group_id`);
ALTER TABLE `usermnge_genradmin_nmlusers` ADD CONSTRAINT `usermnge_genradmin_n_genradmin_id_3b702606_fk_usermnge_` FOREIGN KEY (`genradmin_id`) REFERENCES `usermnge_genradmin` (`id`);
ALTER TABLE `usermnge_genradmin_nmlusers` ADD CONSTRAINT `usermnge_genradmin_n_nmluser_id_d719bc72_fk_usermnge_` FOREIGN KEY (`nmluser_id`) REFERENCES `usermnge_nmluser` (`id`);
ALTER TABLE `usermnge_genradmin_nmlusers` ADD CONSTRAINT `usermnge_genradmin_nmlus_genradmin_id_nmluser_id_252f403e_uniq` UNIQUE (
`genradmin_id`,
`nmluser_id`
);
ALTER TABLE `usermnge_genradmin_pros` ADD CONSTRAINT `usermnge_genradmin_p_genradmin_id_33f678e9_fk_usermnge_` FOREIGN KEY (`genradmin_id`) REFERENCES `usermnge_genradmin` (`id`);
ALTER TABLE `usermnge_genradmin_pros` ADD CONSTRAINT `usermnge_genradmin_pros_pro_id_58a9e0fb_fk_usermnge_pro_id` FOREIGN KEY (`pro_id`) REFERENCES `usermnge_pro` (`id`);
ALTER TABLE `usermnge_genradmin_pros` ADD CONSTRAINT `usermnge_genradmin_pros_genradmin_id_pro_id_834f9d44_uniq` UNIQUE (`genradmin_id`, `pro_id`);
ALTER TABLE `usermnge_genradmin_roles` ADD CONSTRAINT `usermnge_genradmin_r_genradmin_id_51f2704c_fk_usermnge_` FOREIGN KEY (`genradmin_id`) REFERENCES `usermnge_genradmin` (`id`);
ALTER TABLE `usermnge_genradmin_roles` ADD CONSTRAINT `usermnge_genradmin_roles_role_id_7e0e9c28_fk_usermnge_role_id` FOREIGN KEY (`role_id`) REFERENCES `usermnge_role` (`id`);
ALTER TABLE `usermnge_genradmin_roles` ADD CONSTRAINT `usermnge_genradmin_roles_genradmin_id_role_id_4de4fe19_uniq` UNIQUE (`genradmin_id`, `role_id`);
COMMIT;