# easyui-admin **Repository Path**: WjlInfoAdmin/easyui-admin ## Basic Information - **Project Name**: easyui-admin - **Description**: springboot + mybatis + mybatis-plus实现的增删查改完整项目,前端使用了easyui前端框架。 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-06-27 - **Last Updated**: 2024-06-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # easyui-admin ## 一、项目介绍 基于`jquery easyui`前端框架实现的管理系统项目,实现了权限控制、菜单控制等关键的系统功能。 ## 二、技术选型 ### 1、后端技术 | 技术 | 说明 | 官网 | | -------------- | ------------------- | ------------------------------------------- | | `Spring Boot` | 容器+`MVC`框架 | https://spring.io/projects/spring-boot | | `Apache Shiro` | 认证和授权框架 | https://shiro.apache.org/ | | `MyBatis` | `ORM`框架 | https://blog.mybatis.org/ | | `MyBatis-Plus` | `MyBatis`增强工具 | https://www.baomidou.com/ | | `Knife4j` | 接口文档生成工具 | https://doc.xiaominfo.com/docs/quick-start/ | | `Redis` | 分布式缓存 | https://redis.io/ | | `Flyway` | 数据库版本管理工具 | https://github.com/flyway/flyway | | `Fastjson` | 序列化/反序列化工具 | https://github.com/alibaba/fastjson | | `Easy Excel` | 操作`excel`的工具 | https://easyexcel.opensource.alibaba.com/ | ### 2、前端技术 | 技术 | 说明 | 官网 | | --------------- | -------------- | ------------------------------ | | `JQuery Easyui` | 前端`UI`框架 | https://www.jeasyui.net/ | | `JQuery` | `Javascript`库 | https://jquery.com/ | | `Ajax` | 前后端交互框架 | https://learn.jquery.com/ajax/ | | `HTML` | 超文本标记语言 | https://html.com/ | | `CSS` | 层叠样式表 | https://www.w3.org/Style/CSS/ | ## 三、功能介绍 1、通过`excel`工具`easy-excel`完成数据导入/导出; 2、基于`easyui`的`js`插件实现的表格数据过滤功能; 3、基于角色的权限访问控制功能,通过一个过滤器`AuthorizationFilter`完成鉴权; ```java package cn.edu.sgu.www.easyui.filter; import cn.edu.sgu.www.easyui.restful.JsonResult; import cn.edu.sgu.www.easyui.restful.ResponseCode; import cn.edu.sgu.www.easyui.util.HttpUtils; import com.alibaba.fastjson.JSON; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.SecurityUtils; import org.apache.shiro.subject.Subject; import javax.servlet.*; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * 鉴权过滤器 * @author heyunlin * @version 1.0 */ @Slf4j @WebFilter public class AuthorizationFilter implements Filter { @Override public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException { HttpServletRequest request = (HttpServletRequest) req; // 获取请求url String requestURI = request.getRequestURI(); // 开始鉴权操作 Subject subject = SecurityUtils.getSubject(); if (subject != null && !subject.isPermitted(requestURI)) { String message = "正在访问未授权的资源:[" + requestURI + "]"; // 定义状态码 ResponseCode responseCode = ResponseCode.UNAUTHORIZED; // 获取Response对象 HttpServletResponse response = HttpUtils.getResponse(resp, responseCode); // 构建返回对象 JsonResult jsonResult = JsonResult.error(responseCode, message); // 返回响应 response.getWriter().write(JSON.toJSONString(jsonResult)); log.debug(message); return; } chain.doFilter(req, resp); } } ``` 4、基于角色的菜单管理功能,菜单直接分配给角色; 5、用户可以控制显示哪些菜单,基于角色的菜单自定义显示/隐藏; > 勾选则代表显示,取消勾选则隐藏。 ![](doc\文档图片\用户菜单控制.png) ## 四、常见问题 1、启动项目后,系统的功能使用不了,提示表不存在。 > 第一次启动项目时开启`flyway`,即修改`spring.flyway.enabled`的值为`true` ``` spring: flyway: enabled: true # 第一次启动项目时,这个配置改成true encoding: UTF-8 validate-on-migrate: true baseline-on-migrate: true sql-migration-separator: __ table: flyway_schema_history locations: classpath:db/migration ``` 2、不小心把用户对应角色的权限管理相关的权限取消了,导致访问权限管理相关接口失败,无法重新为角色分配权限管理功能的权限。 > 把`system.settings.enable-authorization`设置为`false`,然后重启项目,为角色分配完权限之后,再恢复成`true`。 ```yaml # 系统设置 system: settings: enable-authorization: true # 是否开启鉴权 enable-table-auto-creation: true # 是否自动创建数据库,在第一次启动项目时需要配置为true ``` 3、启动项目时`flyway`报错。 > 一般这个问题不是在第一次启动项目时出现的,关闭`flyway`即可 ```yaml spring: flyway: enabled: false encoding: UTF-8 validate-on-migrate: true baseline-on-migrate: true sql-migration-separator: __ table: flyway_schema_history locations: classpath:db/migration ```