完成springboot-shiro升级重构

This commit is contained in:
Xiong Neng 2018-09-15 15:49:46 +08:00
parent 722cdb2e38
commit e656d466c2
5 changed files with 13 additions and 55 deletions

View File

@ -11,6 +11,10 @@ SpringBoot和Shiro集成实现用户登录认证和授权访问页面。
1. admin/12345678 1. admin/12345678
2. aix/12345678 2. aix/12345678
根据登录用户的不通角色可以看到不通的菜单
admin登录后可以看到用户管理菜单aix登录后可以看到App管理、机具入网监控等业务系统菜单
## 许可证 ## 许可证
Copyright (c) 2018 Xiong Neng Copyright (c) 2018 Xiong Neng

View File

@ -26,9 +26,6 @@
<mysql-connector.version>8.0.7-dmr</mysql-connector.version> <mysql-connector.version>8.0.7-dmr</mysql-connector.version>
<mybatis-plus.version>2.1.8</mybatis-plus.version> <mybatis-plus.version>2.1.8</mybatis-plus.version>
<mybatisplus-spring-boot-starter.version>1.0.5</mybatisplus-spring-boot-starter.version> <mybatisplus-spring-boot-starter.version>1.0.5</mybatisplus-spring-boot-starter.version>
<!--以下两项需要如果不配置解析themleaft 会有问题-->
<thymeleaf.version>3.0.7.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version>
</properties> </properties>
<dependencies> <dependencies>

View File

@ -23,10 +23,6 @@ spring:
mvc: mvc:
view: view:
prefix: /templates prefix: /templates
http:
multipart:
max-request-size: 100MB #最大请求大小
max-file-size: 100MB #最大文件大小
################### mybatis-plus配置 ################### ################### mybatis-plus配置 ###################
mybatis-plus: mybatis-plus:
@ -45,10 +41,6 @@ mybatis-plus:
lazyLoadingEnabled: true #延时加载的开关 lazyLoadingEnabled: true #延时加载的开关
multipleResultSetsEnabled: true #开启的话,延时加载一个属性时会加载该对象全部属性,否则按需加载属性 multipleResultSetsEnabled: true #开启的话,延时加载一个属性时会加载该对象全部属性,否则按需加载属性
################### spring security配置 ###################
security:
ignored: /static/**
logging: logging:
level: level:
org.springframework.web.servlet: ERROR org.springframework.web.servlet: ERROR
@ -61,7 +53,7 @@ logging:
spring: spring:
profiles: dev profiles: dev
datasource: datasource:
url: jdbc:mysql://127.0.0.1:3306/pos?useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8 url: jdbc:mysql://127.0.0.1:3306/pos?serverTimezone=UTC&useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
username: root username: root
password: 123456 password: 123456
thymeleaf: thymeleaf:
@ -81,36 +73,4 @@ logging:
ROOT: INFO ROOT: INFO
com: com:
xncoding: DEBUG xncoding: DEBUG
file: E:/logs/app-manage.log file: D:/logs/app-manage.log
---
#####################################################################
######################## 测试环境profile ##########################
#####################################################################
spring:
profiles: test
datasource:
url: jdbc:mysql://127.0.0.1:3306/pos?useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
username: root
password: 123456
thymeleaf:
cache: false
################### 自定义项目配置 ###################
xncoding:
excel-path: /var/data/
files-path: /usr/share/nginx/html/files/
files-url-prefix: https://show.xncoding.net/files/ # 文件访问URL前缀
pics-path: /usr/share/nginx/html/pics/
pics-url-prefix: https://show.xncoding.net/pics/ # 图片访问URL前缀
# posapi-url-prefix: http://posapi.enzhico.net
posapi-url-prefix: http://127.0.0.1:9095
logging:
level:
ROOT: INFO
com:
xncoding: DEBUG
file: /var/logs/app-manage.log

View File

@ -26,7 +26,7 @@ INSERT INTO `t_manager` VALUES (2,'aix','张三','2412d3972722eb186f69a8f4011fbd
DROP TABLE IF EXISTS `t_role`; DROP TABLE IF EXISTS `t_role`;
CREATE TABLE `t_role` ( CREATE TABLE `t_role` (
`id` INT(11) PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID', `id` INT(11) PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
`role` VARCHAR(16) DEFAULT '' COMMENT '角色名称', `role` VARCHAR(64) DEFAULT '' COMMENT '角色名称',
`description` VARCHAR(255) DEFAULT '' COMMENT '角色说明', `description` VARCHAR(255) DEFAULT '' COMMENT '角色说明',
`created_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `created_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' `updated_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
@ -50,7 +50,7 @@ INSERT INTO `t_manager_role` VALUES (2, 2, 2, '2017-05-05 00:00:00','2017-05-05
DROP TABLE IF EXISTS `t_permission`; DROP TABLE IF EXISTS `t_permission`;
CREATE TABLE `t_permission` ( CREATE TABLE `t_permission` (
`id` INT(11) PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID', `id` INT(11) PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
`permission` VARCHAR(16) DEFAULT '' COMMENT '权限名称', `permission` VARCHAR(64) DEFAULT '' COMMENT '权限名称',
`description` VARCHAR(255) DEFAULT '' COMMENT '权限说明', `description` VARCHAR(255) DEFAULT '' COMMENT '权限说明',
`created_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `created_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' `updated_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'

View File

@ -28,26 +28,23 @@
</span> </span>
</a> </a>
<ul class="dropdown-menu animated fadeInRight m-t-xs"> <ul class="dropdown-menu animated fadeInRight m-t-xs">
<li><a th:href="@{/password}">修改密码</a></li> <li><a th:href="@{/}">修改密码</a></li>
<li><a href="javascript:void(0);" onclick="logout()">安全退出</a></li> <li><a href="javascript:void(0);" onclick="logout()">安全退出</a></li>
</ul> </ul>
</div> </div>
<div class="logo-element"></div> <div class="logo-element"></div>
</li> </li>
<li shiro:hasRole="admin"> <li shiro:hasRole="admin">
<a id="plink" class="J_menuItem" th:href="@{/project/index.html}"><span class="nav-label">项目管理</span></a> <a class="J_menuItem" th:href="@{/}"><span class="nav-label">用户管理</span></a>
</li>
<li shiro:hasRole="admin" th:if="${session.projectNum} and (${session.projectNum} gt 0)">
<a class="J_menuItem" th:href="@{/user/index.html}"><span class="nav-label">用户管理</span></a>
</li> </li>
<li shiro:lacksRole="admin">` <li shiro:lacksRole="admin">`
<a class="J_menuItem" th:href="@{/device/index.html}"><span class="nav-label">机具入网管理</span></a> <a class="J_menuItem" th:href="@{/}"><span class="nav-label">机具入网管理</span></a>
</li> </li>
<li shiro:lacksRole="admin"> <li shiro:lacksRole="admin">
<a class="J_menuItem" th:href="@{/monitor/index.html}"><span class="nav-label">机具状态监控</span></a> <a class="J_menuItem" th:href="@{/}"><span class="nav-label">机具状态监控</span></a>
</li> </li>
<li shiro:lacksRole="admin"> <li shiro:lacksRole="admin">
<a class="J_menuItem" th:href="@{/app/index.html}" data-index="0">App管理</a> <a class="J_menuItem" th:href="@{/}" data-index="0">App管理</a>
</li> </li>
</ul> </ul>
</div> </div>