权限管理表结构

Posted mozq

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了权限管理表结构相关的知识,希望对你有一定的参考价值。

技术图片
  1 /*
  2 SQLyog Ultimate - mysql GUI v8.2 
  3 MySQL - 5.5.27 : Database - jpa
  4 *********************************************************************
  5 */
  6 
  7 
  8 /*!40101 SET NAMES utf8 */;
  9 
 10 /*!40101 SET SQL_MODE=‘‘*/;
 11 
 12 /*!40014 SET @[email protected]@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
 13 /*!40014 SET @[email protected]@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
 14 /*!40101 SET @[email protected]@SQL_MODE, SQL_MODE=‘NO_AUTO_VALUE_ON_ZERO‘ */;
 15 /*!40111 SET @[email protected]@SQL_NOTES, SQL_NOTES=0 */;
 16 CREATE DATABASE /*!32312 IF NOT EXISTS*/`jpa` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */;
 17 
 18 USE `jpa`;
 19 
 20 /*Table structure for table `t_menu` */
 21 
 22 DROP TABLE IF EXISTS `t_menu`;
 23 
 24 CREATE TABLE `t_menu` (
 25   `C_ID` int(11) NOT NULL,
 26   `C_DESCRIPTION` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 27   `C_NAME` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 28   `C_PAGE` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 29   `C_PRIORITY` int(11) DEFAULT NULL,
 30   `C_PID` int(11) DEFAULT NULL,
 31   PRIMARY KEY (`C_ID`),
 32   KEY `FKs2ggrqemelgirb6wwetbjqmct` (`C_PID`),
 33   CONSTRAINT `FKs2ggrqemelgirb6wwetbjqmct` FOREIGN KEY (`C_PID`) REFERENCES `t_menu` (`C_ID`)
 34 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 35 
 36 /*Data for the table `t_menu` */
 37 
 38 insert  into `t_menu`(`C_ID`,`C_DESCRIPTION`,`C_NAME`,`C_PAGE`,`C_PRIORITY`,`C_PID`) values (11,NULL,基础档案,NULL,1,NULL),(12,NULL,受理,NULL,2,NULL),(13,NULL,调度,NULL,3,NULL),(14,NULL,分拣管理,NULL,4,NULL),(111,NULL,基础档案设置,pages/base/archives.html,1,11),(112,NULL,收派标准,pages/base/standard.html,2,11),(113,NULL,班车管理,pages/base/vehicle.html,3,11),(114,NULL,快递员设置/替班,pages/base/courier.html,4,11),(115,NULL,区域设置,pages/base/area.html,5,11),(116,NULL,管理分区,pages/base/sub_area.html,6,11),(117,NULL,管理定区/调度排班,pages/base/fixed_area.html,7,11),(118,NULL,收派时间管理,pages/base/take_time.html,8,11),(121,NULL,业务受理,pages/take_delivery/order.html,1,12),(122,NULL,运单快速录入,pages/take_delivery/waybill_quick.html,2,12),(123,NULL,运单录入,pages/take_delivery/waybill.html,3,12),(124,NULL,运单导入,pages/take_delivery/waybill_import.html,4,12),(125,NULL,运单管理,pages/take_delivery/waybill_manage.html,5,12),(126,NULL,异调运单,pages/take_delivery/different_waybill.html,6,12),(127,NULL,运单打印,pages/take_delivery/waybill_print.html,7,12),(131,NULL,查台转单,pages/take_delivery/change_work_order.html,1,13),(132,NULL,人工调度,pages/take_delivery/dispatcher.html,2,13),(133,NULL,取派调度监控,pages/take_delivery/dispatcher_monitor.html,3,13),(134,NULL,签收录入,pages/take_delivery/sign_input.html,4,13),(135,NULL,取消签收申请,pages/take_delivery/sign_cancel.html,5,13),(136,NULL,宣传任务,pages/take_delivery/promotion.html,6,13),(141,NULL,入库,pages/transit/in_storage.html,1,14),(142,NULL,出库,pages/transit/out_storage.html,2,14),(143,NULL,盘库,pages/transit/make_storage.html,3,14),(144,NULL,合包,pages/transit/compose_package.html,4,14),(145,NULL,到达时间录入,pages/transit/arrive_time.html,5,14),(146,NULL,出入库查询,pages/transit/in_out_search.html,6,14),(147,NULL,库存查询,pages/transit/remain_search.html,7,14),(148,NULL,合包查询,pages/transit/package_search.html,8,14);
 39 
 40 /*Table structure for table `t_permission` */
 41 
 42 DROP TABLE IF EXISTS `t_permission`;
 43 
 44 CREATE TABLE `t_permission` (
 45   `C_ID` int(11) NOT NULL,
 46   `C_DESCRIPTION` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 47   `C_KEYWORD` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 48   `C_NAME` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 49   PRIMARY KEY (`C_ID`)
 50 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 51 
 52 /*Data for the table `t_permission` */
 53 
 54 insert  into `t_permission`(`C_ID`,`C_DESCRIPTION`,`C_KEYWORD`,`C_NAME`) values (1001,添加快递员功能,courier:add,添加快递员),(1002,快递员列表查询功能,courier:list,查询快递员),(1003,区域列表查询功能,region:list,区域列表查询),(1004,运单管理功能,waybill,运单管理);
 55 
 56 /*Table structure for table `t_role` */
 57 
 58 DROP TABLE IF EXISTS `t_role`;
 59 
 60 CREATE TABLE `t_role` (
 61   `C_ID` int(11) NOT NULL,
 62   `C_DESCRIPTION` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 63   `C_KEYWORD` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 64   `C_NAME` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 65   PRIMARY KEY (`C_ID`)
 66 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 67 
 68 /*Data for the table `t_role` */
 69 
 70 insert  into `t_role`(`C_ID`,`C_DESCRIPTION`,`C_KEYWORD`,`C_NAME`) values (1001,负责基础数据录入,base,基础数据录入员),(1002,负责运单管理功能,qupai,取派业务客服);
 71 
 72 /*Table structure for table `t_role_menu` */
 73 
 74 DROP TABLE IF EXISTS `t_role_menu`;
 75 
 76 CREATE TABLE `t_role_menu` (
 77   `C_ROLE_ID` int(11) NOT NULL,
 78   `C_MENU_ID` int(11) NOT NULL,
 79   PRIMARY KEY (`C_ROLE_ID`,`C_MENU_ID`),
 80   KEY `FKonmmfagv5hx8w5ydxvqo73xha` (`C_MENU_ID`),
 81   CONSTRAINT `FK6w94mfb5v0k7wxcmd6entwl7v` FOREIGN KEY (`C_ROLE_ID`) REFERENCES `t_role` (`C_ID`),
 82   CONSTRAINT `FKonmmfagv5hx8w5ydxvqo73xha` FOREIGN KEY (`C_MENU_ID`) REFERENCES `t_menu` (`C_ID`)
 83 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 84 
 85 /*Data for the table `t_role_menu` */
 86 
 87 insert  into `t_role_menu`(`C_ROLE_ID`,`C_MENU_ID`) values (1001,11),(1001,12),(1001,13),(1001,14);
 88 
 89 /*Table structure for table `t_role_permission` */
 90 
 91 DROP TABLE IF EXISTS `t_role_permission`;
 92 
 93 CREATE TABLE `t_role_permission` (
 94   `C_ROLE_ID` int(11) NOT NULL,
 95   `C_PERMISSION_ID` int(11) NOT NULL,
 96   PRIMARY KEY (`C_ROLE_ID`,`C_PERMISSION_ID`),
 97   KEY `FKsognhthyjube5xnbw15157osf` (`C_PERMISSION_ID`),
 98   CONSTRAINT `FKrbtwedl099smouxupmk5jb4np` FOREIGN KEY (`C_ROLE_ID`) REFERENCES `t_role` (`C_ID`),
 99   CONSTRAINT `FKsognhthyjube5xnbw15157osf` FOREIGN KEY (`C_PERMISSION_ID`) REFERENCES `t_permission` (`C_ID`)
100 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
101 
102 /*Data for the table `t_role_permission` */
103 
104 insert  into `t_role_permission`(`C_ROLE_ID`,`C_PERMISSION_ID`) values (1001,1001),(1001,1002),(1001,1003),(1002,1004);
105 
106 /*Table structure for table `t_user` */
107 
108 DROP TABLE IF EXISTS `t_user`;
109 
110 CREATE TABLE `t_user` (
111   `C_ID` int(11) NOT NULL,
112   `C_BIRTHDAY` datetime DEFAULT NULL,
113   `C_GENDER` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
114   `C_NICKNAME` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
115   `C_PASSWORD` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
116   `C_REMARK` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
117   `C_STATION` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
118   `C_TELEPHONE` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
119   `C_USERNAME` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
120   PRIMARY KEY (`C_ID`)
121 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
122 
123 /*Data for the table `t_user` */
124 
125 insert  into `t_user`(`C_ID`,`C_BIRTHDAY`,`C_GENDER`,`C_NICKNAME`,`C_PASSWORD`,`C_REMARK`,`C_STATION`,`C_TELEPHONE`,`C_USERNAME`) values (2001,NULL,NULL,NULL,123,NULL,NULL,NULL,zhangsan),(2002,NULL,NULL,NULL,123,NULL,NULL,NULL,lisi);
126 
127 /*Table structure for table `t_user_role` */
128 
129 DROP TABLE IF EXISTS `t_user_role`;
130 
131 CREATE TABLE `t_user_role` (
132   `C_USER_ID` int(11) NOT NULL,
133   `C_ROLE_ID` int(11) NOT NULL,
134   PRIMARY KEY (`C_USER_ID`,`C_ROLE_ID`),
135   KEY `FK78e5qd0riaeat0wquhuwcc3cq` (`C_ROLE_ID`),
136   CONSTRAINT `FK78e5qd0riaeat0wquhuwcc3cq` FOREIGN KEY (`C_ROLE_ID`) REFERENCES `t_role` (`C_ID`),
137   CONSTRAINT `FK9948hcippkrdy7llaf96fyq81` FOREIGN KEY (`C_USER_ID`) REFERENCES `t_user` (`C_ID`)
138 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
139 
140 /*Data for the table `t_user_role` */
141 
142 insert  into `t_user_role`(`C_USER_ID`,`C_ROLE_ID`) values (2001,1001),(2002,1002);
143 
144 /*!40101 SET [email protected]_SQL_MODE */;
145 /*!40014 SET [email protected]_FOREIGN_KEY_CHECKS */;
146 /*!40014 SET [email protected]_UNIQUE_CHECKS */;
147 /*!40111 SET [email protected]_SQL_NOTES */;
权限管理表结构

技术图片

以上是关于权限管理表结构的主要内容,如果未能解决你的问题,请参考以下文章

[数据库设计]用户和角色:通用权限管理系统数据库表结构如何设计?

用户权限管理表结构实现user role menu user_role ,role_menu表

权限管理表结构

php后台管理员权限相关表结构

结合RBAC模型讲解权限管理系统需求及表结构创建

权限管理表结构设计