我最近用了2天整理一了个相对来说比较好的ssm框架,目前实现登录功能,有比较完善的权限功能。先上效果图,激发一下你们的学习兴趣。
项目代码目录结构:maven+idea+ssm
数据库连接池用的是阿里的druid:
页面是采用H+框架:
官网展示:http://www.zi-han.net/theme/hplus/
页面源码:http://download.csdn.net/download/m0_37499059/10253204
项目源代码:http://download.csdn.net/download/m0_37499059/10253208
不好意思,开始忘了给sql=======================================================
/*
Navicat MySQL Data Transfer
Source Server : 11
Source Server Version : 50559
Source Database : teemo
Target Server Type : MYSQL
Target Server Version : 50559
File Encoding : 65001
Date: 2018-02-26 18:47:22
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for sys_log
-- ----------------------------
DROP TABLE IF EXISTS `sys_log`;
CREATE TABLE `sys_log` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`type` char(1) DEFAULT '1' COMMENT '日志类型',
`title` varchar(255) DEFAULT '' COMMENT '日志标题',
`content` varchar(1000) DEFAULT '' COMMENT '日志内容',
`create_by` varchar(32) DEFAULT NULL COMMENT '创建者',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`remote_addr` varchar(255) DEFAULT NULL COMMENT '操作IP地址',
`request_uri` varchar(255) DEFAULT NULL COMMENT '请求URI',
`remark` varchar(255) DEFAULT NULL COMMENT '扩展',
PRIMARY KEY (`id`),
KEY `sys_log_create_by` (`create_by`),
KEY `sys_log_request_uri` (`request_uri`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='日志表';
-- ----------------------------
-- Records of sys_log
-- ----------------------------
INSERT INTO `sys_log` VALUES ('1', '1', '1', '1', '1', '2018-02-20 18:26:31', '192.168.1.1', '/user', null);
-- ----------------------------
-- Table structure for u_permission
-- ----------------------------
DROP TABLE IF EXISTS `u_permission`;
CREATE TABLE `u_permission` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL COMMENT '资源名称',
`url` varchar(64) DEFAULT NULL COMMENT 'url地址',
`permission` varchar(256) DEFAULT NULL COMMENT '描述',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of u_permission
-- ----------------------------
INSERT INTO `u_permission` VALUES ('1', '管理员界面', '/admin', null);
INSERT INTO `u_permission` VALUES ('2', '用户界面', '/user', null);
INSERT INTO `u_permission` VALUES ('3', '测试界面', '/test', null);
-- ----------------------------
-- Table structure for u_role
-- ----------------------------
DROP TABLE IF EXISTS `u_role`;
CREATE TABLE `u_role` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(32) DEFAULT NULL COMMENT '角色名称',
`type` varchar(10) DEFAULT NULL COMMENT '角色类型',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of u_role
-- ----------------------------
INSERT INTO `u_role` VALUES ('1', 'admin', '超级管理员');
INSERT INTO `u_role` VALUES ('2', 'user', '管理员');
INSERT INTO `u_role` VALUES ('3', 'test', '测试人员');
-- ----------------------------
-- Table structure for u_role_permission
-- ----------------------------
DROP TABLE IF EXISTS `u_role_permission`;
CREATE TABLE `u_role_permission` (
`rid` bigint(20) DEFAULT NULL COMMENT '角色ID',
`pid` bigint(20) DEFAULT NULL COMMENT '权限ID'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of u_role_permission
-- ----------------------------
INSERT INTO `u_role_permission` VALUES ('1', '1');
INSERT INTO `u_role_permission` VALUES ('2', '2');
INSERT INTO `u_role_permission` VALUES ('3', '3');
-- ----------------------------
-- Table structure for u_user
-- ----------------------------
DROP TABLE IF EXISTS `u_user`;
CREATE TABLE `u_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`realname` varchar(255) DEFAULT NULL COMMENT '真实名称',
`username` varchar(100) NOT NULL COMMENT '用户名',
`portrait` varchar(250) DEFAULT NULL COMMENT '头像',
`password` varchar(100) DEFAULT NULL COMMENT '密码',
`email` varchar(20) DEFAULT NULL COMMENT '邮件',
`phone` varchar(20) DEFAULT NULL COMMENT '联系电话',
`create_by` varchar(32) DEFAULT NULL COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`last_login_time` datetime DEFAULT NULL COMMENT '最后登录时间',
`status` bigint(1) DEFAULT '1' COMMENT '1:有效,0:禁止登录',
`remarks` varchar(255) DEFAULT NULL COMMENT 'openid',
`del_flag` char(1) DEFAULT '1',
PRIMARY KEY (`id`,`username`),
UNIQUE KEY `idx_u_user_username` (`username`),
UNIQUE KEY `idx_u_user_email` (`email`),
UNIQUE KEY `idx_u_user_phone` (`phone`)
) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of u_user
-- ----------------------------
INSERT INTO `u_user` VALUES ('10000', '小一', 'admin', null, 'df655ad8d3229f3269fad2a8bab59b6c', '[email protected]', null, null, null, null, '1', 'B43738161A2026887D10C16FE5341F64', '1');
INSERT INTO `u_user` VALUES ('10001', '小二', 'user', null, '098d2c478e9c11555ce2823231e02ec1', null, null, null, null, null, '1', 'B0CA0ED3FD66F6E85EDC4A050A75DAC3', '1');
INSERT INTO `u_user` VALUES ('10002', '小三', 'test', null, '4292bb58be34c59d28a0dcbd11932d49', null, null, null, null, null, '1', null, '1');
-- ----------------------------
-- Table structure for u_user_role
-- ----------------------------
DROP TABLE IF EXISTS `u_user_role`;
CREATE TABLE `u_user_role` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`uid` bigint(20) DEFAULT NULL COMMENT '用户ID',
`rid` bigint(20) DEFAULT NULL COMMENT '角色ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of u_user_role
-- ----------------------------
INSERT INTO `u_user_role` VALUES ('1', '10000', '1');
INSERT INTO `u_user_role` VALUES ('2', '10001', '2');
INSERT INTO `u_user_role` VALUES ('3', '10002', '3');