# simple-blowball-admin **Repository Path**: geqian618/simple-blowball-admin ## Basic Information - **Project Name**: simple-blowball-admin - **Description**: 基于 SpringBoot + SpringSecurity + MybatisPlus +阿里云对象存储OSS + Vue2 + Element ui 后台权限管理系统 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 5 - **Forks**: 1 - **Created**: 2023-12-07 - **Last Updated**: 2024-11-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

BlowballAdmin

![SpringBoot 2.4.2](https://img.shields.io/badge/SpringBoot-2.4.2-blue) ![SpringSecurity 2.4.2](https://img.shields.io/badge/SpringSecurity-2.4.2-blue) ![Vue 2](https://img.shields.io/badge/VUE-2-blue) ![elementui](https://img.shields.io/badge/ElementUI--blue) ![JWT](https://img.shields.io/badge/JWT--blue) ![Redis](https://img.shields.io/badge/Redis--blue) ![Guava](https://img.shields.io/badge/Guava--blue) ![caffeine](https://img.shields.io/badge/caffeine--blue) ![MySQL 8](https://img.shields.io/badge/MySQL-8-blue) ![MybatisPlus](https://img.shields.io/badge/MybatisPlus--blue) ![阿里云对象存储OSS](https://img.shields.io/badge/阿里云OSS--blue) ![ip2region](https://img.shields.io/badge/ip2region--blue) ## 技术栈 ### 后端 - 采用 SpringBoot 作为后端基础框架 - 采用 SpringSecurity + JWT 进行认证授权 - 采用 Redis 作为默认系统缓存,同时也支持切换 guava、caffeine 本地缓存作为系统缓存 - 采用 MySQL 数据库,MybatisPlus 作为 ORM 框架 - 采用阿里云对象存储OSS 作为默认存储访问文件资源,同时也支持切换本地存储访问文件资源 - 采用 ip2region 解析IP地址归属地 ### 前端 - 采用 Vue2 作为前端基础框架 - 采用 Element ui 作为前端组件库

## 项目架构 前后端分离的 B/S 架构

## 项目演示 1. 登录页面 ![输入图片说明](images/登录.png) 2. 首页 ![image-20230719013337074](images/首页.png) 3. 菜单管理 ![image-20230719013403179](images/菜单管理.png) 4. 用户管理 ![image-20230719013433699](images/用户管理.png) 5. 角色管理 ![image-20230719013433699](images/角色管理.png) 6. api 日志 ![image-20230719013433699](images/api日志.png)

## 使用说明 ### 默认账号 - 账号:admin - 密码:123456

### 修改后端配置文件 1. 获取blowball-web下的sql文件,并执行sql文件 2. 更改数据源配置 ```properties spring.datasource.url=jdbc:mysql://localhost:3306/management_system?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.username=root spring.datasource.password=root ``` 3. 更改 Redis 配置 ``` ################################# redis配置 ############################# #Redis服务器地址 spring.redis.host=192.168.119.100 #Redis服务器连接端口 spring.redis.port=6379 #使用的数据库索引,默认是0 spring.redis.database=0 #Redis服务器连接密码(默认为空) spring.redis.password=123456 #连接超时时间(毫秒) spring.redis.timeout=30000 #连接池最大连接数(使用负值表示没有限制) spring.redis.jedis.pool.max-active=3 #连接池最大阻塞等待时间(使用负值表示没有限制) spring.redis.jedis.pool.max-wait=-1 #连接池中的最大空闲连接 spring.redis.jedis.pool.max-idle=2 #连接池中的最小空闲连接 spring.redis.jedis.pool.min-idle=1 ``` 4. 更改阿里云对象存储OSS相关配置 ```properties ################################# 阿里云oss对象存储配置 ############################# alibaba.cloud.access-key=<你的> alibaba.cloud.secret-key=<你的> alibaba.cloud.oss.endpoint=<你的> alibaba.cloud.oss.bucket=<你的> alibaba.cloud.oss.file.expiration-days=30 ```

## 切换系统缓存 系统默认采用 Redis 作为系统缓存。为了方便一些简单的场景,也对本地缓存 guava、caffeine 进行了支持(**本地缓存不支持数据持久化**) 1. 排除默认的 redis 依赖,并导入 guava、caffeine 依赖 ```pom com.geqian blowball-cache 0.0.1-SNAPSHOT org.springframework.boot spring-boot-starter-data-redis com.github.ben-manes.caffeine caffeine ``` 2. 构建一个 guava 或 caffeine 缓存对象作为 bean 注入 Spring 容器 ```java @Configuration public class CaffeineCacheConfig { @Bean public LoadingCache loadingCache() { return Caffeine.newBuilder() //设置缓存中保存数据的最大量 .maximumSize(Integer.MAX_VALUE) //初始化缓存空间大小 .initialCapacity(100) //设置过期时间 .expireAfterAccess(60, TimeUnit.MINUTES) //构建Cache实例 .build(new CacheLoader() { @Override public Object load(String s) throws Exception { return null; } }); } } ``` 3. 注入缓存模板 SimpleCacheTemplate,进行缓存相关操作 ```java @Resource private SimpleCacheTemplate simpleCacheTemplate; ``` > 由于本地缓存功能有限,SimpleCacheTemplate 设计的缓存功能也相对比较简单,设置复杂的存储功能时,还是需要使用 RedisTemplate 之类的进行缓存操作

## 切换文件存储 默认使用阿里云 OSS 作为文件存储,为了方便一些简单场景使用,也对本地存储作了支持,步骤如下: 1. 注释阿里云 OSS 依赖 ```pom ``` 2. 更改本地缓存配置 ```properties ################################# 本地文件存储配置 ############################# # 上传文件本地保存位置 local-storage.file.save-path=${user.dir}\\blowball-web\\src\\main\\resources\\static\\images\\ # 访问本地资源文件请求url前缀 local-storage.file.request.url-prefix=http://localhost:8888/api/system/images/ ```