權(quán)限管理分析
我們做的權(quán)限管理主要是用戶有什么菜單,菜單對(duì)用頁(yè)面地址
用戶對(duì)應(yīng)多個(gè)角色豪诲,角色對(duì)應(yīng)多個(gè)菜單這樣的關(guān)系
比如用戶有超級(jí)管理員和經(jīng)理兩個(gè)角色榆芦,那么用戶就會(huì)擁有這兩個(gè)角色下面的所有菜單 新建表如下
DROP TABLE IF EXISTS `category`;
CREATE TABLE `category` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`categoryname` varchar(255) DEFAULT NULL,
`siteurl` varchar(255) DEFAULT NULL,
`sortno` int(2) DEFAULT NULL,
`icon` varchar(255) DEFAULT NULL,
`createtime` datetime DEFAULT NULL,
`updatetime` datetime DEFAULT NULL,
`isdelete` int(2) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `category` */
/*Table structure for table `role` */
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`rolename` varchar(255) DEFAULT NULL,
`createtime` datetime DEFAULT NULL,
`updatetime` datetime DEFAULT NULL,
`isdelete` int(2) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `role` */
/*Table structure for table `rolecategory` */
DROP TABLE IF EXISTS `rolecategory`;
CREATE TABLE `rolecategory` (
`int` int(11) NOT NULL AUTO_INCREMENT,
`roleid` int(11) DEFAULT NULL,
`categoryid` int(11) DEFAULT NULL,
`createtime` datetime DEFAULT NULL,
`updatetime` datetime DEFAULT NULL,
`isdelete` int(2) DEFAULT NULL,
PRIMARY KEY (`int`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `rolecategory` */
/*Table structure for table `user` */
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`umobile` varchar(11) DEFAULT NULL,
`sex` int(2) DEFAULT NULL,
`createTime` datetime DEFAULT NULL,
`updateTime` datetime DEFAULT NULL,
`isdelete` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*Table structure for table `userrole` */
DROP TABLE IF EXISTS `userrole`;
CREATE TABLE `userrole` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) DEFAULT NULL,
`roleid` int(11) DEFAULT NULL,
`createtime` datetime DEFAULT NULL,
`updatetime` datetime DEFAULT NULL,
`isdelete` int(2) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;