├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── _config.yml ├── database └── db_lazyadmin.sql ├── pom.xml ├── screenshots ├── 权限管理页面.png ├── 权限编辑页面.png ├── 权限错误页面.pong.png ├── 登录信息失败页面.png ├── 登录页面.png ├── 视频管理首页.png ├── 角色管理页面.png ├── 账户管理页面.png └── 账户编辑页面.png └── src ├── main ├── java │ └── lazyadmin │ │ ├── entity │ │ ├── Admin.java │ │ ├── AdminRole.java │ │ ├── Permission.java │ │ ├── Role.java │ │ ├── RolePerssion.java │ │ └── Video.java │ │ ├── mapper │ │ ├── AdminMapper.java │ │ ├── PermissionMapper.java │ │ ├── RoleMapper.java │ │ └── VideoMapper.java │ │ ├── plugin │ │ ├── PasswordHelper.java │ │ ├── ShiroTagFreeMarkerConfigurer.java │ │ └── realm │ │ │ ├── AdminHashedCredentialsMatcher.java │ │ │ └── UserRealm.java │ │ ├── service │ │ ├── AdminService.java │ │ ├── PermissionService.java │ │ ├── RoleService.java │ │ ├── VideoService.java │ │ └── impl │ │ │ ├── AdminServiceImpl.java │ │ │ ├── PermissionServiceImpl.java │ │ │ ├── RoleServiceImpl.java │ │ │ └── VideoServiceImpl.java │ │ └── web │ │ ├── controller │ │ ├── AdminController.java │ │ ├── AuthController.java │ │ ├── PermissionController.java │ │ ├── RoleController.java │ │ └── VideoController.java │ │ └── exception │ │ └── UnauthorizedExceptionHandler.java ├── resources │ ├── log4j.properties │ ├── mapper │ │ ├── AdminMapper.xml │ │ ├── PermissionMapper.xml │ │ ├── RoleMapper.xml │ │ └── VideoMapper.xml │ ├── properties │ │ ├── freemarker.properties │ │ └── jdbc.properties │ ├── spring │ │ ├── spring-dao.xml │ │ ├── spring-freemarker.xml │ │ ├── spring-mvc.xml │ │ └── spring-shiro.xml │ └── xml │ │ └── mybatis-config.xml └── webapp │ ├── WEB-INF │ ├── lib │ │ └── shiro-freemarker-tags-0.1-SNAPSHOT.jar │ ├── views │ │ ├── account │ │ │ ├── detail.ftl │ │ │ └── index.ftl │ │ ├── common │ │ │ ├── error.ftl │ │ │ ├── header.ftl │ │ │ ├── js.ftl │ │ │ ├── messages.ftl │ │ │ ├── sidebar.ftl │ │ │ └── style.ftl │ │ ├── login.ftl │ │ ├── permission │ │ │ └── index.ftl │ │ ├── role │ │ │ ├── detail.ftl │ │ │ └── index.ftl │ │ └── video │ │ │ ├── detail.ftl │ │ │ └── index.ftl │ └── web.xml │ ├── index.jsp │ └── static │ ├── css │ ├── animate.css │ ├── animate.min.css │ ├── bootstrap.css │ ├── bootstrap.min.css │ ├── calendar.css │ ├── editor.css │ ├── file-manager.css │ ├── font-awesome.css │ ├── font-awesome.min.css │ ├── form.css │ ├── generics.css │ ├── icons.css │ ├── lightbox.css │ ├── media-player.css │ ├── photo-gallery-alt.css │ ├── photo-gallery.css │ └── style.css │ ├── fonts │ ├── fontawesome │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ └── fontawesome-webfont.woff │ ├── icons │ │ ├── icon.svg │ │ ├── icon.ttf │ │ └── icon.woff │ └── opan-sans │ │ ├── OpenSans-Light-webfont.eot │ │ ├── OpenSans-Light-webfont.svg │ │ ├── OpenSans-Light-webfont.ttf │ │ ├── OpenSans-Light-webfont.woff │ │ ├── OpenSans-Regular-webfont.eot │ │ ├── OpenSans-Regular-webfont.svg │ │ ├── OpenSans-Regular-webfont.ttf │ │ ├── OpenSans-Regular-webfont.woff │ │ ├── OpenSans-Semibold-webfont.eot │ │ ├── OpenSans-Semibold-webfont.svg │ │ ├── OpenSans-Semibold-webfont.ttf │ │ └── OpenSans-Semibold-webfont.woff │ ├── img │ ├── body │ │ └── violate.jpg │ ├── header.jpg │ ├── icon │ │ ├── add.png │ │ ├── add@2x.png │ │ ├── archive.png │ │ ├── archive@2x.png │ │ ├── back.png │ │ ├── back@2x.png │ │ ├── calendar.png │ │ ├── calendar@2x.png │ │ ├── chart.png │ │ ├── chart@2x.png │ │ ├── day.png │ │ ├── day@2x.png │ │ ├── delete.png │ │ ├── delete@2x.png │ │ ├── file.png │ │ ├── file@2x.png │ │ ├── folder-sm.png │ │ ├── folder-sm@2x.png │ │ ├── folder.png │ │ ├── folder@2x.png │ │ ├── form.png │ │ ├── form@2x.png │ │ ├── forwad.png │ │ ├── forwad@2x.png │ │ ├── home.png │ │ ├── home@2x.png │ │ ├── icon-view.png │ │ ├── icon-view@2x.png │ │ ├── list-view.png │ │ ├── list-view@2x.png │ │ ├── menu.png │ │ ├── menu@2x.png │ │ ├── message.png │ │ ├── message@2x.png │ │ ├── month.png │ │ ├── month@2x.png │ │ ├── move.png │ │ ├── move@2x.png │ │ ├── pages.png │ │ ├── pages@2x.png │ │ ├── photos.png │ │ ├── photos@2x.png │ │ ├── plus-sm.png │ │ ├── plus-sm@2x.png │ │ ├── refresh.png │ │ ├── refresh@2x.png │ │ ├── search-sm.png │ │ ├── search.png │ │ ├── search@2x.png │ │ ├── sorting.png │ │ ├── sorting@2x.png │ │ ├── spam.png │ │ ├── spam@2x.png │ │ ├── table.png │ │ ├── table@2x.png │ │ ├── tile-actions.png │ │ ├── tile-actions@2x.png │ │ ├── typography.png │ │ ├── typography@2x.png │ │ ├── ui.png │ │ ├── ui@2x.png │ │ ├── updates.png │ │ ├── updates@2x.png │ │ ├── upload.png │ │ ├── upload@2x.png │ │ ├── week.png │ │ ├── week@2x.png │ │ ├── widgets.png │ │ └── widgets@2x.png │ └── media-player │ │ ├── background.png │ │ ├── bigplay.png │ │ ├── bigplay.svg │ │ ├── controls-ted.png │ │ ├── controls.png │ │ ├── controls.svg │ │ ├── loading.gif │ │ └── media-player-poster.jpg │ └── js │ ├── autosize.min.js │ ├── bootstrap.min.js │ ├── calendar.min.js │ ├── fileupload.min.js │ ├── functions.js │ ├── icheck.js │ ├── jquery-ui.min.js │ ├── jquery.easing.1.3.js │ ├── jquery.min.js │ ├── media-player.min.js │ ├── pirobox.min.js │ └── scroll.min.js └── test └── java └── lazyadmin └── service └── impl ├── AdminServiceImplTest.java ├── BaseTest.java └── PermissionServiceImplTest.java /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=java 2 | *.css linguist-language=java 3 | *.html linguist-language=java 4 | *.ftl linguist-language=java -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #LazyAdmin 2 | 3 | > LazyAdmin是基于SSM的后端管理系统中权限管理功能的脚手架 4 | 5 | ## 技术选型 6 | * Spring 4.2.6 7 | * Mybatis Plus 2.0 8 | * Shiro 1.2.2 9 | * Hibernate Validator 5.1.3 10 | * Druid 1.0.19 11 | * Redis 2.3.1 12 | * Ehcache 2.6.1 13 | * Freemarker 2.3.20 14 | * JDK 1.7 15 | * Tomcat 8 16 | * Maven 17 | * Bootstrap 3 18 | 19 | 20 | ## 项目功能 21 | 22 | * 基于Shiro的用户登录校验及session定时检查 23 | * 细粒度的权限控制,精确到按钮权限 24 | * 实现常规实体内容的增删改查 25 | * 权限异常统一处理 26 | 27 | ## TO DO 28 | * ~~Add Spring Test~~ 29 | * ~~管理员密码加密设置~~ 30 | * 管理员修改密码功能 31 | * ~~权限信息再次编辑功能~~ 32 | * ~~角色信息再次编辑功能~~ 33 | * ~~账户信息再次编辑功能~~ 34 | 35 | ## 项目截图 36 | 37 | * 登录页面 38 | * ![](http://wx1.sinaimg.cn/mw690/775c483fly1fd3tx1r137j21h90tdgwu.jpg) 39 | * 登录失败 40 | * ![](http://wx1.sinaimg.cn/mw690/775c483fly1fd3twxx6lkj21gi0sz7fj.jpg) 41 | * 视频管理 42 | * ![](http://wx1.sinaimg.cn/mw690/775c483fly1fd3txupe4fj21hb0rfdxj.jpg) 43 | * 账户管理 44 | * ![](http://wx4.sinaimg.cn/mw690/775c483fly1fd3tyopqd3j21ha0taqg5.jpg) 45 | * ![](http://wx3.sinaimg.cn/mw690/775c483fly1fd3tyk9nxmj21h80te162.jpg) 46 | * 角色管理 47 | * ![](http://wx2.sinaimg.cn/mw690/775c483fly1fd3tx65ii6j21hc0teao9.jpg) 48 | * 权限管理 49 | * ![](http://wx1.sinaimg.cn/mw690/775c483fly1fd3txpou02j21hc0tfqju.jpg) 50 | * ![](http://wx4.sinaimg.cn/mw690/775c483fly1fd3txa9v4cj21h70tcalt.jpg) 51 | * 权限错误 52 | * ![](http://wx1.sinaimg.cn/mw690/775c483fly1fd3txdwa77j21h90tdalm.jpg) 53 | 54 | ------- 55 | ### 如果它让你有收获,我很开心 :) 56 | 57 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /database/db_lazyadmin.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat Premium Data Transfer 3 | 4 | Source Server : local 5 | Source Server Type : MySQL 6 | Source Server Version : 50553 7 | Source Host : localhost 8 | Source Database : db_lazyadmin 9 | 10 | Target Server Type : MySQL 11 | Target Server Version : 50553 12 | File Encoding : utf-8 13 | 14 | Date: 03/07/2017 22:20:30 PM 15 | */ 16 | 17 | SET NAMES utf8; 18 | SET FOREIGN_KEY_CHECKS = 0; 19 | 20 | -- ---------------------------- 21 | -- Table structure for `t_admin` 22 | -- ---------------------------- 23 | DROP TABLE IF EXISTS `t_admin`; 24 | CREATE TABLE `t_admin` ( 25 | `id` int(11) NOT NULL AUTO_INCREMENT, 26 | `password` varchar(100) COLLATE utf8_bin DEFAULT NULL, 27 | `salt` varchar(100) COLLATE utf8_bin DEFAULT NULL, 28 | `username` varchar(100) COLLATE utf8_bin DEFAULT NULL, 29 | `createdate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, 30 | PRIMARY KEY (`id`) 31 | ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 32 | 33 | -- ---------------------------- 34 | -- Records of `t_admin` 35 | -- ---------------------------- 36 | BEGIN; 37 | INSERT INTO `t_admin` VALUES ('1', 'a663a847079521db3a558517ed5bc1e1', '0eff1643c24b77b814c1d065987770fb', 'melon', '2017-02-26 11:09:24'), ('5', '0f515f5dba80f0e33a8a4e58d2140d34', '7040d0fda57cd3d5f20cf42aa60b6f02', 'sunny', '2017-02-26 11:09:24'), ('7', '4fd11f1d416335a04bdae924abc119d5', '1e358ffdc7f1d65d9ef42ed4bdd51c1b', 'admin', '2017-02-28 14:46:37'); 38 | COMMIT; 39 | 40 | -- ---------------------------- 41 | -- Table structure for `t_admin_role` 42 | -- ---------------------------- 43 | DROP TABLE IF EXISTS `t_admin_role`; 44 | CREATE TABLE `t_admin_role` ( 45 | `id` int(11) NOT NULL AUTO_INCREMENT, 46 | `admin_id` int(11) NOT NULL, 47 | `role_id` int(11) NOT NULL, 48 | PRIMARY KEY (`id`) 49 | ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 50 | 51 | -- ---------------------------- 52 | -- Records of `t_admin_role` 53 | -- ---------------------------- 54 | BEGIN; 55 | INSERT INTO `t_admin_role` VALUES ('5', '4', '1'), ('14', '7', '1'), ('15', '1', '1'), ('16', '5', '6'); 56 | COMMIT; 57 | 58 | -- ---------------------------- 59 | -- Table structure for `t_permission` 60 | -- ---------------------------- 61 | DROP TABLE IF EXISTS `t_permission`; 62 | CREATE TABLE `t_permission` ( 63 | `id` int(11) NOT NULL AUTO_INCREMENT, 64 | `description` varchar(100) COLLATE utf8_bin NOT NULL, 65 | `permission` varchar(20) COLLATE utf8_bin NOT NULL, 66 | `createdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, 67 | PRIMARY KEY (`id`) 68 | ) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 69 | 70 | -- ---------------------------- 71 | -- Records of `t_permission` 72 | -- ---------------------------- 73 | BEGIN; 74 | INSERT INTO `t_permission` VALUES ('1', '查看管理员', 'admin:view', '2017-02-23 15:34:09'), ('5', '创建管理员', 'admin:create', '2017-02-26 10:00:39'), ('6', '编辑管理员', 'admin:modify', '2017-02-26 10:00:48'), ('7', '删除管理员', 'admin:delete', '2017-02-26 10:00:56'), ('8', '查看角色', 'role:view', '2017-02-26 10:01:09'), ('9', '创建角色', 'role:create', '2017-02-26 10:01:24'), ('10', '编辑角色', 'role:modify', '2017-02-26 10:01:33'), ('11', '删除角色', 'role:delete', '2017-02-26 10:01:47'), ('12', '查看权限', 'permission:view', '2017-02-26 10:01:59'), ('13', '创建权限', 'permission:create', '2017-02-26 10:02:09'), ('14', '编辑权限', 'permission:modify', '2017-02-26 10:02:18'), ('15', '删除权限', 'permission:delete', '2017-02-26 10:02:27'), ('16', '查看视频', 'video:view', '2017-02-26 10:02:35'), ('17', '创建视频', 'video:create', '2017-02-26 10:02:44'), ('18', '编辑视频', 'video:modify', '2017-02-26 10:02:55'), ('19', '删除视频', 'video:delete', '2017-02-26 10:03:12'); 75 | COMMIT; 76 | 77 | -- ---------------------------- 78 | -- Table structure for `t_role` 79 | -- ---------------------------- 80 | DROP TABLE IF EXISTS `t_role`; 81 | CREATE TABLE `t_role` ( 82 | `id` int(11) NOT NULL AUTO_INCREMENT, 83 | `description` varchar(100) COLLATE utf8_bin NOT NULL, 84 | `role` varchar(20) COLLATE utf8_bin NOT NULL, 85 | `createdate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, 86 | PRIMARY KEY (`id`) 87 | ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 88 | 89 | -- ---------------------------- 90 | -- Records of `t_role` 91 | -- ---------------------------- 92 | BEGIN; 93 | INSERT INTO `t_role` VALUES ('1', '超级管理员', 'admin', '2017-02-24 10:44:57'), ('6', '普通管理员', 'manager', '2017-02-26 11:08:49'), ('11', '视频内容管理员', 'videoManager', '2017-02-28 14:39:53'); 94 | COMMIT; 95 | 96 | -- ---------------------------- 97 | -- Table structure for `t_role_permission` 98 | -- ---------------------------- 99 | DROP TABLE IF EXISTS `t_role_permission`; 100 | CREATE TABLE `t_role_permission` ( 101 | `id` int(11) NOT NULL AUTO_INCREMENT, 102 | `permission_id` int(11) NOT NULL, 103 | `role_id` int(11) NOT NULL, 104 | PRIMARY KEY (`id`) 105 | ) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 106 | 107 | -- ---------------------------- 108 | -- Records of `t_role_permission` 109 | -- ---------------------------- 110 | BEGIN; 111 | INSERT INTO `t_role_permission` VALUES ('97', '1', '1'), ('98', '5', '1'), ('99', '6', '1'), ('100', '7', '1'), ('101', '8', '1'), ('102', '9', '1'), ('103', '10', '1'), ('104', '11', '1'), ('105', '12', '1'), ('106', '13', '1'), ('107', '14', '1'), ('108', '15', '1'), ('109', '16', '1'), ('110', '17', '1'), ('111', '18', '1'), ('112', '19', '1'), ('113', '8', '6'), ('114', '9', '6'), ('115', '10', '6'), ('116', '11', '6'), ('117', '12', '6'), ('118', '13', '6'), ('119', '14', '6'), ('120', '15', '6'), ('121', '16', '6'), ('122', '17', '6'), ('123', '18', '6'), ('124', '19', '6'), ('125', '16', '11'), ('126', '17', '11'), ('127', '18', '11'), ('128', '19', '11'); 112 | COMMIT; 113 | 114 | -- ---------------------------- 115 | -- Table structure for `t_video` 116 | -- ---------------------------- 117 | DROP TABLE IF EXISTS `t_video`; 118 | CREATE TABLE `t_video` ( 119 | `id` int(11) NOT NULL AUTO_INCREMENT, 120 | `content` varchar(255) COLLATE utf8_bin NOT NULL, 121 | `createdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 122 | `title` varchar(255) COLLATE utf8_bin NOT NULL, 123 | `url` varchar(255) COLLATE utf8_bin NOT NULL, 124 | PRIMARY KEY (`id`) 125 | ) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 126 | 127 | -- ---------------------------- 128 | -- Records of `t_video` 129 | -- ---------------------------- 130 | BEGIN; 131 | INSERT INTO `t_video` VALUES ('1', 'demo1', '2017-02-26 13:03:13', '视频1', 'http://7xrh7e.com1.z0.glb.clouddn.com/echohereweare.mp4'), ('18', '222', '2017-02-26 13:03:14', '视频1', 'http://7xrh7e.com1.z0.glb.clouddn.com/echohereweare.mp4'), ('20', '4444', '2017-02-26 13:03:17', '视频3', 'http://7xrh7e.com1.z0.glb.clouddn.com/echohereweare.mp4'), ('22', '6666', '2017-02-26 13:03:22', '视频4', 'http://7xrh7e.com1.z0.glb.clouddn.com/echohereweare.mp4'); 132 | COMMIT; 133 | 134 | -------------------------------------------------------------------------------- /screenshots/权限管理页面.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/melonlee/LazyAdmin/2761e15f66e7eaa128e46101252b364866421d65/screenshots/权限管理页面.png -------------------------------------------------------------------------------- /screenshots/权限编辑页面.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/melonlee/LazyAdmin/2761e15f66e7eaa128e46101252b364866421d65/screenshots/权限编辑页面.png -------------------------------------------------------------------------------- /screenshots/权限错误页面.pong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/melonlee/LazyAdmin/2761e15f66e7eaa128e46101252b364866421d65/screenshots/权限错误页面.pong.png -------------------------------------------------------------------------------- /screenshots/登录信息失败页面.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/melonlee/LazyAdmin/2761e15f66e7eaa128e46101252b364866421d65/screenshots/登录信息失败页面.png -------------------------------------------------------------------------------- /screenshots/登录页面.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/melonlee/LazyAdmin/2761e15f66e7eaa128e46101252b364866421d65/screenshots/登录页面.png -------------------------------------------------------------------------------- /screenshots/视频管理首页.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/melonlee/LazyAdmin/2761e15f66e7eaa128e46101252b364866421d65/screenshots/视频管理首页.png -------------------------------------------------------------------------------- /screenshots/角色管理页面.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/melonlee/LazyAdmin/2761e15f66e7eaa128e46101252b364866421d65/screenshots/角色管理页面.png -------------------------------------------------------------------------------- /screenshots/账户管理页面.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/melonlee/LazyAdmin/2761e15f66e7eaa128e46101252b364866421d65/screenshots/账户管理页面.png -------------------------------------------------------------------------------- /screenshots/账户编辑页面.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/melonlee/LazyAdmin/2761e15f66e7eaa128e46101252b364866421d65/screenshots/账户编辑页面.png -------------------------------------------------------------------------------- /src/main/java/lazyadmin/entity/Admin.java: -------------------------------------------------------------------------------- 1 | package lazyadmin.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableId; 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import com.baomidou.mybatisplus.enums.IdType; 7 | 8 | import java.io.Serializable; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by Melon on 17/2/22. 13 | */ 14 | @TableName("t_admin") 15 | public class Admin implements Serializable { 16 | 17 | @TableId(type = IdType.AUTO) 18 | private Long id; 19 | private String username; 20 | private String password; 21 | private String salt; 22 | private String createdate; 23 | 24 | @TableField(exist = false) 25 | private List roles; 26 | 27 | public Long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(Long id) { 32 | this.id = id; 33 | } 34 | 35 | public String getUsername() { 36 | return username; 37 | } 38 | 39 | public void setUsername(String username) { 40 | this.username = username; 41 | } 42 | 43 | public String getPassword() { 44 | return password; 45 | } 46 | 47 | public void setPassword(String password) { 48 | this.password = password; 49 | } 50 | 51 | public String getSalt() { 52 | return salt; 53 | } 54 | 55 | public void setSalt(String salt) { 56 | this.salt = salt; 57 | } 58 | 59 | public List getRoles() { 60 | return roles; 61 | } 62 | 63 | public void setRoles(List roles) { 64 | this.roles = roles; 65 | } 66 | 67 | public String getCreatedate() { 68 | return createdate; 69 | } 70 | 71 | public void setCreatedate(String createdate) { 72 | this.createdate = createdate; 73 | } 74 | 75 | public String getCredentialsSalt() { 76 | return username + salt; 77 | } 78 | 79 | @Override 80 | public String toString() { 81 | return "Admin{" + 82 | "id=" + id + 83 | ", username='" + username + '\'' + 84 | ", password='" + password + '\'' + 85 | ", salt='" + salt + '\'' + 86 | '}'; 87 | } 88 | 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/lazyadmin/entity/AdminRole.java: -------------------------------------------------------------------------------- 1 | package lazyadmin.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by Melon on 17/2/22. 7 | */ 8 | public class AdminRole implements Serializable { 9 | 10 | private Long adminId; 11 | private Long roleId; 12 | 13 | public Long getAdminId() { 14 | return adminId; 15 | } 16 | 17 | public void setAdminId(Long adminId) { 18 | this.adminId = adminId; 19 | } 20 | 21 | public Long getRoleId() { 22 | return roleId; 23 | } 24 | 25 | public void setRoleId(Long roleId) { 26 | this.roleId = roleId; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/lazyadmin/entity/Permission.java: -------------------------------------------------------------------------------- 1 | package lazyadmin.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableId; 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import com.baomidou.mybatisplus.enums.IdType; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * Created by Melon on 17/2/22. 12 | */ 13 | @TableName("t_permission") 14 | public class Permission implements Serializable { 15 | 16 | @TableId(type = IdType.AUTO) 17 | private Long id; 18 | private String permission; //权限标识 程序中判断使用,如"user:create" 19 | private String description; 20 | private String createdate; 21 | 22 | @TableField(exist = false) 23 | private int selected = 0; //供前端判断是否含有该权限使用 24 | 25 | public Long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Long id) { 30 | this.id = id; 31 | } 32 | 33 | public String getPermission() { 34 | return permission; 35 | } 36 | 37 | public void setPermission(String permission) { 38 | this.permission = permission; 39 | } 40 | 41 | public String getDescription() { 42 | return description; 43 | } 44 | 45 | public void setDescription(String description) { 46 | this.description = description; 47 | } 48 | 49 | public String getCreatedate() { 50 | return createdate; 51 | } 52 | 53 | public void setCreatedate(String createdate) { 54 | this.createdate = createdate; 55 | } 56 | 57 | public int getSelected() { 58 | return selected; 59 | } 60 | 61 | public void setSelected(int selected) { 62 | this.selected = selected; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/lazyadmin/entity/Role.java: -------------------------------------------------------------------------------- 1 | package lazyadmin.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableId; 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import com.baomidou.mybatisplus.enums.IdType; 7 | 8 | import java.io.Serializable; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by Melon on 17/2/22. 13 | */ 14 | @TableName("t_role") 15 | public class Role implements Serializable { 16 | @TableId(type = IdType.AUTO) 17 | private Long id; 18 | private String role; //角色标识 程序中判断使用,如"admin" 19 | private String description; 20 | private String createdate; 21 | 22 | @TableField(exist = false) 23 | private List permissions; 24 | 25 | @TableField(exist = false) 26 | private int selected = 0; 27 | 28 | public Long getId() { 29 | return id; 30 | } 31 | 32 | public void setId(Long id) { 33 | this.id = id; 34 | } 35 | 36 | public String getRole() { 37 | return role; 38 | } 39 | 40 | public void setRole(String role) { 41 | this.role = role; 42 | } 43 | 44 | public String getDescription() { 45 | return description; 46 | } 47 | 48 | public void setDescription(String description) { 49 | this.description = description; 50 | } 51 | 52 | public String getCreatedate() { 53 | return createdate; 54 | } 55 | 56 | public void setCreatedate(String createdate) { 57 | this.createdate = createdate; 58 | } 59 | 60 | public List getPermissions() { 61 | return permissions; 62 | } 63 | 64 | public void setPermissions(List permissions) { 65 | this.permissions = permissions; 66 | } 67 | 68 | public int getSelected() { 69 | return selected; 70 | } 71 | 72 | public void setSelected(int selected) { 73 | this.selected = selected; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/lazyadmin/entity/RolePerssion.java: -------------------------------------------------------------------------------- 1 | package lazyadmin.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.enums.IdType; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * Created by Melon on 17/2/22. 10 | */ 11 | public class RolePerssion implements Serializable { 12 | 13 | private Long roleId; 14 | private Long permissionId; 15 | 16 | public Long getRoleId() { 17 | return roleId; 18 | } 19 | 20 | public void setRoleId(Long roleId) { 21 | this.roleId = roleId; 22 | } 23 | 24 | public Long getPermissionId() { 25 | return permissionId; 26 | } 27 | 28 | public void setPermissionId(Long permissionId) { 29 | this.permissionId = permissionId; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/lazyadmin/entity/Video.java: -------------------------------------------------------------------------------- 1 | package lazyadmin.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import com.baomidou.mybatisplus.enums.IdType; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * Created by Melon on 17/2/26. 11 | */ 12 | @TableName("t_video") 13 | public class Video implements Serializable { 14 | 15 | @TableId(type = IdType.AUTO) 16 | private Long id; 17 | private String title; 18 | private String content; 19 | private String url; 20 | private String createdate; 21 | 22 | public Long getId() { 23 | return id; 24 | } 25 | 26 | public void setId(Long id) { 27 | this.id = id; 28 | } 29 | 30 | public String getTitle() { 31 | return title; 32 | } 33 | 34 | public void setTitle(String title) { 35 | this.title = title; 36 | } 37 | 38 | public String getContent() { 39 | return content; 40 | } 41 | 42 | public void setContent(String content) { 43 | this.content = content; 44 | } 45 | 46 | public String getUrl() { 47 | return url; 48 | } 49 | 50 | public void setUrl(String url) { 51 | this.url = url; 52 | } 53 | 54 | public String getCreatedate() { 55 | return createdate; 56 | } 57 | 58 | public void setCreatedate(String createdate) { 59 | this.createdate = createdate; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/lazyadmin/mapper/AdminMapper.java: -------------------------------------------------------------------------------- 1 | package lazyadmin.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import lazyadmin.entity.Admin; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.ArrayList; 8 | import java.util.Set; 9 | 10 | /** 11 | * Created by Melon on 17/2/22. 12 | */ 13 | public interface AdminMapper extends BaseMapper { 14 | 15 | void insertRoles(@Param(value = "adminId") Long adminId, @Param(value = "roleId") Long roleId); 16 | 17 | void deleteRoles(@Param(value = "adminId") Long adminId); 18 | 19 | Admin findByName(@Param(value = "username") String username); 20 | 21 | ArrayList findRoles(@Param(value = "username") String username); 22 | 23 | ArrayList findPermissions(@Param(value = "username") String username); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/lazyadmin/mapper/PermissionMapper.java: -------------------------------------------------------------------------------- 1 | package lazyadmin.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import lazyadmin.entity.Permission; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | 10 | /** 11 | * Created by Melon on 17/2/22. 12 | */ 13 | public interface PermissionMapper extends BaseMapper { 14 | List findByRole(@Param(value = "roleId") Long roleId); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/lazyadmin/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package lazyadmin.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import lazyadmin.entity.Role; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by Melon on 17/2/22. 11 | */ 12 | public interface RoleMapper extends BaseMapper { 13 | 14 | void deletePermissions(@Param(value = "roleId") Long roleId, @Param(value = "permissionId") Long permissionId); 15 | 16 | void insertPermissions(@Param(value = "roleId") Long roleId, @Param(value = "permissionId") Long permissionId); 17 | 18 | void deletePermissionByRole(@Param(value = "roleId") Long roleId); 19 | 20 | List findByAdmin(@Param(value = "adminId") Long adminId); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/lazyadmin/mapper/VideoMapper.java: -------------------------------------------------------------------------------- 1 | package lazyadmin.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import lazyadmin.entity.Video; 5 | 6 | /** 7 | * Created by Melon on 17/2/26. 8 | */ 9 | public interface VideoMapper extends BaseMapper