返回

Vue+Element UI+Spring MVC+Shiro 打造权限管理系统

人工智能

基于 Vue+Element UI+SSM+Shiro 的权限框架

引言心声现在的Java世界,各种资源很丰富,不得不说,从分布式,服务化,orm,再到前端控制,权限等等玲琅满目,网上有句话说,语言框架迭代太快了,我学不动了,不如回去搬砖吧,可是天这么热,砖烫手啊。程

## 概述 随着企业级应用的日益复杂,权限控制的需求也随之而来。权限框架是一个用来管理用户权限的软件系统,它可以帮助企业管理员控制用户对各种资源的访问权限。在本文中,我们将介绍如何使用 Vue、Element UI、Spring MVC 和 Shiro 来构建一个权限框架。

## 项目搭建 首先,我们需要搭建一个项目。可以使用 Spring Initializr 来快速创建一个 Spring MVC 项目。在创建项目时,选择 Web 依赖项,并添加 Vue 和 Element UI 的依赖项。 ```xml org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-security com.baomidou mybatis-plus-boot-starter cn.hutool hutool-all com.google.code.gson gson org.apache.shiro shiro-spring-boot-starter org.apache.shiro shiro-ehcache org.springframework.boot spring-boot-starter-validation io.jsonwebtoken jjwt-api io.jsonwebtoken jjwt-impl runtime io.jsonwebtoken jjwt-jackson runtime com.google.guava guava org.apache.commons commons-lang3 org.apache.poi poi org.apache.poi poi-ooxml org.apache.poi poi-ooxml-schemas org.apache.poi poi-scratchpad net.sourceforge.jexcelapi jxl com.fasterxml.jackson.core jackson-databind com.fasterxml.jackson.core jackson-core commons-fileupload commons-fileupload org.mybatis mybatis org.mybatis mybatis-spring mysql mysql-connector-java com.alibaba druid-spring-boot-starter org.springframework.boot spring-boot-devtools runtime org.projectlombok lombok true org.springframework.boot spring-boot-configuration-processor true com.github.xiaoymin swagger-bootstrap-ui com.github.xiaoymin swagger-spring-boot-starter org.springframework.cloud spring-cloud-starter-netflix-eureka-client org.springframework.cloud spring-cloud-starter-netflix-hystrix org.springframework.cloud spring-cloud-starter-openfeign org.springframework.cloud spring-cloud-starter-zipkin org.springframework.amqp spring-rabbit org.springframework.boot spring-boot-starter-actuator org.springframework.boot spring-boot-starter-test test ``` 然后,在项目中添加 Vue 和 Element UI 的依赖项。 ```xml vuejs vue 2.6.14 element-ui element-ui 2.15.9 ``` 最后,在项目中添加 Spring Security 和 Shiro 的依赖项。 ```xml org.springframework.boot spring-boot-starter-security org.apache.shiro shiro-spring-boot-starter ``` ## 功能设计 权限框架需要实现的功能包括: * 用户管理:管理用户,包括添加、删除、修改用户信息。 * 角色管理:管理角色,包括添加、删除、修改角色信息。 * 权限管理:管理权限,包括添加、删除、修改权限信息。 * 用户角色管理:管理用户和角色之间的关系。 * 角色权限管理:管理角色和权限之间的关系。 ## 权限管理 权限框架的核心是权限管理。权限管理可以分为两部分: * 基于角色的权限管理:根据用户所属的角色来控制用户对资源的访问权限。 * 基于资源的权限管理:根据用户对资源的访问权限来控制用户对资源的操作权限。 ## 前端页面 权限框架的前