Skip to content

Commit e656d46

Browse files
author
Xiong Neng
committed
完成springboot-shiro升级重构
1 parent 722cdb2 commit e656d46

File tree

5 files changed

+13
-55
lines changed

5 files changed

+13
-55
lines changed

springboot-shiro/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ SpringBoot和Shiro集成,实现用户登录认证和授权访问页面。
1111
1. admin/12345678
1212
2. aix/12345678
1313

14+
根据登录用户的不通角色可以看到不通的菜单
15+
16+
admin登录后可以看到用户管理菜单,aix登录后可以看到App管理、机具入网监控等业务系统菜单
17+
1418
## 许可证
1519

1620
Copyright (c) 2018 Xiong Neng

springboot-shiro/pom.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
<mysql-connector.version>8.0.7-dmr</mysql-connector.version>
2727
<mybatis-plus.version>2.1.8</mybatis-plus.version>
2828
<mybatisplus-spring-boot-starter.version>1.0.5</mybatisplus-spring-boot-starter.version>
29-
<!--以下两项需要如果不配置,解析themleaft 会有问题-->
30-
<thymeleaf.version>3.0.7.RELEASE</thymeleaf.version>
31-
<thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version>
3229
</properties>
3330

3431
<dependencies>

springboot-shiro/src/main/resources/application.yml

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ spring:
2323
mvc:
2424
view:
2525
prefix: /templates
26-
http:
27-
multipart:
28-
max-request-size: 100MB #最大请求大小
29-
max-file-size: 100MB #最大文件大小
3026

3127
################### mybatis-plus配置 ###################
3228
mybatis-plus:
@@ -45,10 +41,6 @@ mybatis-plus:
4541
lazyLoadingEnabled: true #延时加载的开关
4642
multipleResultSetsEnabled: true #开启的话,延时加载一个属性时会加载该对象全部属性,否则按需加载属性
4743

48-
################### spring security配置 ###################
49-
security:
50-
ignored: /static/**
51-
5244
logging:
5345
level:
5446
org.springframework.web.servlet: ERROR
@@ -61,7 +53,7 @@ logging:
6153
spring:
6254
profiles: dev
6355
datasource:
64-
url: jdbc:mysql://127.0.0.1:3306/pos?useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
56+
url: jdbc:mysql://127.0.0.1:3306/pos?serverTimezone=UTC&useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
6557
username: root
6658
password: 123456
6759
thymeleaf:
@@ -81,36 +73,4 @@ logging:
8173
ROOT: INFO
8274
com:
8375
xncoding: DEBUG
84-
file: E:/logs/app-manage.log
85-
86-
---
87-
88-
#####################################################################
89-
######################## 测试环境profile ##########################
90-
#####################################################################
91-
92-
spring:
93-
profiles: test
94-
datasource:
95-
url: jdbc:mysql://127.0.0.1:3306/pos?useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
96-
username: root
97-
password: 123456
98-
thymeleaf:
99-
cache: false
100-
101-
################### 自定义项目配置 ###################
102-
xncoding:
103-
excel-path: /var/data/
104-
files-path: /usr/share/nginx/html/files/
105-
files-url-prefix: https://show.xncoding.net/files/ # 文件访问URL前缀
106-
pics-path: /usr/share/nginx/html/pics/
107-
pics-url-prefix: https://show.xncoding.net/pics/ # 图片访问URL前缀
108-
# posapi-url-prefix: http://posapi.enzhico.net
109-
posapi-url-prefix: http://127.0.0.1:9095
110-
111-
logging:
112-
level:
113-
ROOT: INFO
114-
com:
115-
xncoding: DEBUG
116-
file: /var/logs/app-manage.log
76+
file: D:/logs/app-manage.log

springboot-shiro/src/main/resources/sql/schema.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ INSERT INTO `t_manager` VALUES (2,'aix','张三','2412d3972722eb186f69a8f4011fbd
2626
DROP TABLE IF EXISTS `t_role`;
2727
CREATE TABLE `t_role` (
2828
`id` INT(11) PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
29-
`role` VARCHAR(16) DEFAULT '' COMMENT '角色名称',
29+
`role` VARCHAR(64) DEFAULT '' COMMENT '角色名称',
3030
`description` VARCHAR(255) DEFAULT '' COMMENT '角色说明',
3131
`created_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
3232
`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
5050
DROP TABLE IF EXISTS `t_permission`;
5151
CREATE TABLE `t_permission` (
5252
`id` INT(11) PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
53-
`permission` VARCHAR(16) DEFAULT '' COMMENT '权限名称',
53+
`permission` VARCHAR(64) DEFAULT '' COMMENT '权限名称',
5454
`description` VARCHAR(255) DEFAULT '' COMMENT '权限说明',
5555
`created_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
5656
`updated_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'

springboot-shiro/src/main/resources/templates/index.html

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,23 @@
2828
</span>
2929
</a>
3030
<ul class="dropdown-menu animated fadeInRight m-t-xs">
31-
<li><a th:href="@{/password}">修改密码</a></li>
31+
<li><a th:href="@{/}">修改密码</a></li>
3232
<li><a href="javascript:void(0);" onclick="logout()">安全退出</a></li>
3333
</ul>
3434
</div>
3535
<div class="logo-element"></div>
3636
</li>
3737
<li shiro:hasRole="admin">
38-
<a id="plink" class="J_menuItem" th:href="@{/project/index.html}"><span class="nav-label">项目管理</span></a>
39-
</li>
40-
<li shiro:hasRole="admin" th:if="${session.projectNum} and (${session.projectNum} gt 0)">
41-
<a class="J_menuItem" th:href="@{/user/index.html}"><span class="nav-label">用户管理</span></a>
38+
<a class="J_menuItem" th:href="@{/}"><span class="nav-label">用户管理</span></a>
4239
</li>
4340
<li shiro:lacksRole="admin">`
44-
<a class="J_menuItem" th:href="@{/device/index.html}"><span class="nav-label">机具入网管理</span></a>
41+
<a class="J_menuItem" th:href="@{/}"><span class="nav-label">机具入网管理</span></a>
4542
</li>
4643
<li shiro:lacksRole="admin">
47-
<a class="J_menuItem" th:href="@{/monitor/index.html}"><span class="nav-label">机具状态监控</span></a>
44+
<a class="J_menuItem" th:href="@{/}"><span class="nav-label">机具状态监控</span></a>
4845
</li>
4946
<li shiro:lacksRole="admin">
50-
<a class="J_menuItem" th:href="@{/app/index.html}" data-index="0">App管理</a>
47+
<a class="J_menuItem" th:href="@{/}" data-index="0">App管理</a>
5148
</li>
5249
</ul>
5350
</div>

0 commit comments

Comments
 (0)