12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- CREATE TABLE `sys_user` (
- `id` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '用户ID',
- `name` VARCHAR(30) NOT NULL DEFAULT '' COMMENT '名称',
- `password` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '密码',
- `enabled` VARCHAR(1) NOT NULL DEFAULT '' COMMENT '状态',
- PRIMARY KEY (`id`),
- UNIQUE KEY `INDEX_USER_NAME` (`name`)
- ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='系统用户表';
- CREATE TABLE `sys_user_detail` (
- `user_id` VARCHAR(20) NOT NULL DEFAULT '' COMMENT 'ID',
- `user_name` VARCHAR(50) NOT NULL COMMENT '用户名称',
- `nick_name` VARCHAR(50) DEFAULT NULL COMMENT '昵称',
- `real_name` VARCHAR(50) DEFAULT NULL COMMENT '姓名',
- `user_mail` VARCHAR(100) DEFAULT '' COMMENT '邮件',
- `user_mobile` VARCHAR(50) DEFAULT NULL COMMENT '手机',
- `modify_time` DATETIME NOT NULL DEFAULT '2014-12-12 00:00:00' COMMENT '修改时间',
- `user_lasttime` DATETIME DEFAULT NULL COMMENT '最后登录时间',
- `user_lastip` VARCHAR(50) DEFAULT NULL COMMENT '最后登录IP',
- PRIMARY KEY (`user_id`),
- UNIQUE KEY `user_unique_name` (`user_name`),
- UNIQUE KEY `user_mail` (`user_mail`),
- UNIQUE KEY `user_unique_mobile` (`user_mobile`)
- ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='系统用户详细表';
- CREATE TABLE `sys_role` (
- `id` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '主键',
- `name` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '名称',
- `enabled` VARCHAR(1) NOT NULL DEFAULT '' COMMENT '状态',
- PRIMARY KEY (`id`)
- ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='系统角色表';
- CREATE TABLE `sys_user_role` (
- `user_id` VARCHAR(20) NOT NULL DEFAULT '',
- `role_id` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '角色ID',
- PRIMARY KEY (`role_id`,`user_id`),
- KEY `fk_usr_role_user` (`user_id`)
- ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='系统用户和系统角色关联表';
- CREATE TABLE `sys_privilege` (
- `id` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '主键',
- `name` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '权限名称',
- `url` VARCHAR(255) DEFAULT NULL COMMENT 'url地址',
- `description` VARCHAR(255) DEFAULT '' COMMENT '描述',
- PRIMARY KEY (`id`)
- ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='系统权限表';
- CREATE TABLE `sys_role_privilege` (
- `role_id` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '角色ID',
- `privilege_id` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '权限ID',
- PRIMARY KEY (`role_id`,`privilege_id`),
- KEY `fk_role_privilege` (`privilege_id`)
- ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='系统权限和系统角色关联表';
- INSERT INTO `sys_user` (`id`, `name`, `password`, `enabled`) VALUES('1','admin','d2f69715e1d2f5be2dd331099875fdfd','1');
- INSERT INTO `sys_role` (`id`, `name`, `enabled`) VALUES('1','ROLE_USER','1');
- INSERT INTO `sys_user_role` (`user_id`, `role_id`) VALUES('1','1');
- COMMIT;
|