Commit 2e0b562b29a5f8c9764b75347ca4f1675b89b6c5

Authored by guzijian
1 parent 5cd28d56

feat: first commit

Showing 58 changed files with 4796 additions and 0 deletions

Too many changes to show.

To preserve performance only 58 of 340 files are displayed.

.gitignore
  1 +<<<<<<< HEAD
  2 +=======
  3 +<<<<<<< HEAD
  4 +######################################################################
  5 +# Build Tools
  6 +
  7 +.gradle
  8 +/build/
  9 +!gradle/wrapper/gradle-wrapper.jar
  10 +
  11 +target/
  12 +!.mvn/wrapper/maven-wrapper.jar
  13 +
  14 +######################################################################
  15 +# IDE
  16 +
  17 +### STS ###
  18 +.apt_generated
  19 +.classpath
  20 +.factorypath
  21 +.project
  22 +.settings
  23 +.springBeans
  24 +
  25 +### IntelliJ IDEA ###
  26 +.idea
  27 +*.iws
  28 +*.iml
  29 +*.ipr
  30 +
  31 +### JRebel ###
  32 +rebel.xml
  33 +
  34 +### NetBeans ###
  35 +nbproject/private/
  36 +build/*
  37 +nbbuild/
  38 +dist/
  39 +nbdist/
  40 +.nb-gradle/
  41 +
  42 +######################################################################
  43 +# Others
  44 +*.log
  45 +*.xml.versionsBackup
  46 +*.swp
  47 +
  48 +!*/build/*.java
  49 +!*/build/*.html
  50 +!*/build/*.xml
  51 +=======
  52 +>>>>>>> 39465be (feat: first commit)
1 # Build and Release Folders 53 # Build and Release Folders
2 bin-debug/ 54 bin-debug/
3 bin-release/ 55 bin-release/
@@ -16,3 +68,7 @@ bin-release/ @@ -16,3 +68,7 @@ bin-release/
16 # Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties` 68 # Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
17 # should NOT be excluded as they contain compiler settings and other important 69 # should NOT be excluded as they contain compiler settings and other important
18 # information for Eclipse / Flash Builder. 70 # information for Eclipse / Flash Builder.
  71 +<<<<<<< HEAD
  72 +=======
  73 +>>>>>>> origin/master
  74 +>>>>>>> 39465be (feat: first commit)
LICENSE 0 → 100644
  1 +The MIT License (MIT)
  2 +
  3 +Copyright (c) 2018 RuoYi
  4 +
  5 +Permission is hereby granted, free of charge, to any person obtaining a copy of
  6 +this software and associated documentation files (the "Software"), to deal in
  7 +the Software without restriction, including without limitation the rights to
  8 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  9 +the Software, and to permit persons to whom the Software is furnished to do so,
  10 +subject to the following conditions:
  11 +
  12 +The above copyright notice and this permission notice shall be included in all
  13 +copies or substantial portions of the Software.
  14 +
  15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17 +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18 +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  19 +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0 \ No newline at end of file 21 \ No newline at end of file
README.md 0 → 100644
  1 +<p align="center">
  2 + <img alt="logo" src="https://oscimg.oschina.net/oscnet/up-d3d0a9303e11d522a06cd263f3079027715.png">
  3 +</p>
  4 +<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.8.5</h1>
  5 +<h4 align="center">基于SpringBoot+Vue前后端分离的Java快速开发框架</h4>
  6 +<p align="center">
  7 + <a href="https://gitee.com/y_project/RuoYi-Vue/stargazers"><img src="https://gitee.com/y_project/RuoYi-Vue/badge/star.svg?theme=dark"></a>
  8 + <a href="https://gitee.com/y_project/RuoYi-Vue"><img src="https://img.shields.io/badge/RuoYi-v3.8.5-brightgreen.svg"></a>
  9 + <a href="https://gitee.com/y_project/RuoYi-Vue/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
  10 +</p>
  11 +
  12 +## 平台简介
  13 +
  14 +若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
  15 +
  16 +* 前端采用Vue、Element UI。
  17 +* 后端采用Spring Boot、Spring Security、Redis & Jwt。
  18 +* 权限认证使用Jwt,支持多终端认证系统。
  19 +* 支持加载动态权限菜单,多方式轻松权限控制。
  20 +* 高效率开发,使用代码生成器可以一键生成前后端代码。
  21 +* 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev))版本[RuoYi-Vue3](https://github.com/yangzongzhuan/RuoYi-Vue3),保持同步更新。
  22 +* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast),Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
  23 +* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
  24 +* 特别鸣谢:[element](https://github.com/ElemeFE/element),[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://github.com/elunez/eladmin-web)。
  25 +* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)&nbsp;&nbsp;
  26 +* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)&nbsp;&nbsp;
  27 +
  28 +## 内置功能
  29 +
  30 +1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
  31 +2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
  32 +3. 岗位管理:配置系统用户所属担任职务。
  33 +4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
  34 +5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
  35 +6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
  36 +7. 参数管理:对系统动态配置常用参数。
  37 +8. 通知公告:系统通知公告信息发布维护。
  38 +9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
  39 +10. 登录日志:系统登录日志记录查询包含登录异常。
  40 +11. 在线用户:当前系统中活跃用户状态监控。
  41 +12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
  42 +13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。
  43 +14. 系统接口:根据业务代码自动生成相关的api接口文档。
  44 +15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。
  45 +16. 缓存监控:对系统的缓存信息查询,命令统计等。
  46 +17. 在线构建器:拖动表单元素生成相应的HTML代码。
  47 +18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。
  48 +
  49 +## 在线体验
  50 +
  51 +- admin/admin123
  52 +- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
  53 +
  54 +演示地址:http://vue.ruoyi.vip
  55 +文档地址:http://doc.ruoyi.vip
  56 +
  57 +## 演示图
  58 +
  59 +<table>
  60 + <tr>
  61 + <td><img src="https://oscimg.oschina.net/oscnet/cd1f90be5f2684f4560c9519c0f2a232ee8.jpg"/></td>
  62 + <td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td>
  63 + </tr>
  64 + <tr>
  65 + <td><img src="https://oscimg.oschina.net/oscnet/up-8074972883b5ba0622e13246738ebba237a.png"/></td>
  66 + <td><img src="https://oscimg.oschina.net/oscnet/up-9f88719cdfca9af2e58b352a20e23d43b12.png"/></td>
  67 + </tr>
  68 + <tr>
  69 + <td><img src="https://oscimg.oschina.net/oscnet/up-39bf2584ec3a529b0d5a3b70d15c9b37646.png"/></td>
  70 + <td><img src="https://oscimg.oschina.net/oscnet/up-936ec82d1f4872e1bc980927654b6007307.png"/></td>
  71 + </tr>
  72 + <tr>
  73 + <td><img src="https://oscimg.oschina.net/oscnet/up-b2d62ceb95d2dd9b3fbe157bb70d26001e9.png"/></td>
  74 + <td><img src="https://oscimg.oschina.net/oscnet/up-d67451d308b7a79ad6819723396f7c3d77a.png"/></td>
  75 + </tr>
  76 + <tr>
  77 + <td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td>
  78 + <td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td>
  79 + </tr>
  80 + <tr>
  81 + <td><img src="https://oscimg.oschina.net/oscnet/up-8370a0d02977eebf6dbf854c8450293c937.png"/></td>
  82 + <td><img src="https://oscimg.oschina.net/oscnet/up-49003ed83f60f633e7153609a53a2b644f7.png"/></td>
  83 + </tr>
  84 + <tr>
  85 + <td><img src="https://oscimg.oschina.net/oscnet/up-d4fe726319ece268d4746602c39cffc0621.png"/></td>
  86 + <td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td>
  87 + </tr>
  88 + <tr>
  89 + <td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td>
  90 + <td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td>
  91 + </tr>
  92 +</table>
  93 +
  94 +
  95 +## 若依前后端分离交流群
  96 +
  97 +QQ群: [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/已满-201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [![加入QQ群](https://img.shields.io/badge/已满-101456076-blue.svg)](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [![加入QQ群](https://img.shields.io/badge/已满-101539465-blue.svg)](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [![加入QQ群](https://img.shields.io/badge/已满-264312783-blue.svg)](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [![加入QQ群](https://img.shields.io/badge/已满-167385320-blue.svg)](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [![加入QQ群](https://img.shields.io/badge/已满-104748341-blue.svg)](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [![加入QQ群](https://img.shields.io/badge/已满-160110482-blue.svg)](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [![加入QQ群](https://img.shields.io/badge/已满-170801498-blue.svg)](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) [![加入QQ群](https://img.shields.io/badge/已满-108482800-blue.svg)](https://jq.qq.com/?_wv=1027&k=eCx8eyoJ) [![加入QQ群](https://img.shields.io/badge/已满-101046199-blue.svg)](https://jq.qq.com/?_wv=1027&k=SpyH2875) [![加入QQ群](https://img.shields.io/badge/136919097-blue.svg)](https://jq.qq.com/?_wv=1027&k=tKEt51dz) 点击按钮入群。
0 \ No newline at end of file 98 \ No newline at end of file
doc/若依环境使用手册.docx 0 → 100644
No preview for this file type
docker-compose.yml 0 → 100644
  1 +version: 3.8.5
  2 +services:
  3 + admin-server:
  4 + container_name: admin-server
  5 + build:
  6 + context: .
  7 + dockerfile: ./ruoyi-admin/admin-dockerfile
  8 + volumes:
  9 + - /ruoyi/back/logs:/home/ruoyi/logs
  10 + - /ruoyi/back/uploadPath:/home/ruoyi/uploadPath
  11 + restart: on-failure
  12 + ports:
  13 + - 8080:8080
  14 +
  15 + mysql-server:
  16 + container_name: mysql_server
  17 + image: mysql:5.7
  18 + build:
  19 + context: .
  20 + dockerfile: mysql-dockerfile
  21 + volumes:
  22 + - /ruoyi/mysql/conf.d:/etc/mysql/conf.d
  23 + - /ruoyi/mysql/logs:/logs
  24 + - /ruoyi/mysql/data:/var/lib/mysql
  25 + environment:
  26 + MYSQL_ROOT_PASSWORD: guzijian
  27 + MYSQL_ROOT_HOST: '%'
  28 + TZ: Asia/Shanghai
  29 + restart: always
  30 + command:
  31 + --character-set-server=utf8mb4
  32 + --collation-server=utf8mb4_general_ci
  33 + --explicit_defaults_for_timestamp=true
  34 + --lower_case_table_names=1
  35 + --max_allowed_packet=128M
  36 + --default-authentication-plugin=caching_sha2_password
  37 + ports:
  38 + - 3306:3306
  39 +
  40 + redis-server:
  41 + container_name: redis_server
  42 + build:
  43 + context: .
  44 + dockerfile: redis-dockerfile
  45 + entrypoint:
  46 + volumes:
  47 + - /ruoyi/redis/redis.conf:/etc/redis/redis.conf
  48 + - /ruoyi/redis/data:/data
  49 + restart: always
  50 + ports:
  51 + - 6379:6379
0 \ No newline at end of file 52 \ No newline at end of file
mysql-dockerfile 0 → 100644
  1 +FROM mysql:5.7
  2 +# 作者
  3 +MAINTAINER guzijian
  4 +# sql文件
  5 +ADD ./sql/*.sql /docker-entrypoint-initdb.d/
pom.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <modelVersion>4.0.0</modelVersion>
  6 +
  7 + <groupId>com.ruoyi</groupId>
  8 + <artifactId>ruoyi</artifactId>
  9 + <version>3.8.5</version>
  10 +
  11 + <name>ruoyi</name>
  12 + <url>http://www.ruoyi.vip</url>
  13 + <description>若依管理系统</description>
  14 +
  15 + <properties>
  16 + <ruoyi.version>3.8.5</ruoyi.version>
  17 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  18 + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  19 + <java.version>1.8</java.version>
  20 + <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
  21 + <druid.version>1.2.16</druid.version>
  22 + <bitwalker.version>1.21</bitwalker.version>
  23 + <swagger.version>3.0.0</swagger.version>
  24 + <kaptcha.version>2.3.3</kaptcha.version>
  25 + <pagehelper.boot.version>1.4.6</pagehelper.boot.version>
  26 + <fastjson.version>2.0.25</fastjson.version>
  27 + <oshi.version>6.4.0</oshi.version>
  28 + <commons.io.version>2.11.0</commons.io.version>
  29 + <commons.collections.version>3.2.2</commons.collections.version>
  30 + <poi.version>4.1.2</poi.version>
  31 + <velocity.version>2.3</velocity.version>
  32 + <jwt.version>0.9.1</jwt.version>
  33 + </properties>
  34 +
  35 + <!-- 依赖声明 -->
  36 + <dependencyManagement>
  37 + <dependencies>
  38 +
  39 + <!-- SpringBoot的依赖配置-->
  40 + <dependency>
  41 + <groupId>org.springframework.boot</groupId>
  42 + <artifactId>spring-boot-dependencies</artifactId>
  43 + <version>2.5.15</version>
  44 + <type>pom</type>
  45 + <scope>import</scope>
  46 + </dependency>
  47 +
  48 + <!-- 阿里数据库连接池 -->
  49 + <dependency>
  50 + <groupId>com.alibaba</groupId>
  51 + <artifactId>druid-spring-boot-starter</artifactId>
  52 + <version>${druid.version}</version>
  53 + </dependency>
  54 +
  55 + <!-- 解析客户端操作系统、浏览器等 -->
  56 + <dependency>
  57 + <groupId>eu.bitwalker</groupId>
  58 + <artifactId>UserAgentUtils</artifactId>
  59 + <version>${bitwalker.version}</version>
  60 + </dependency>
  61 +
  62 + <!-- pagehelper 分页插件 -->
  63 + <dependency>
  64 + <groupId>com.github.pagehelper</groupId>
  65 + <artifactId>pagehelper-spring-boot-starter</artifactId>
  66 + <version>${pagehelper.boot.version}</version>
  67 + </dependency>
  68 +
  69 + <!-- 获取系统信息 -->
  70 + <dependency>
  71 + <groupId>com.github.oshi</groupId>
  72 + <artifactId>oshi-core</artifactId>
  73 + <version>${oshi.version}</version>
  74 + </dependency>
  75 +
  76 + <!-- Swagger3依赖 -->
  77 + <dependency>
  78 + <groupId>io.springfox</groupId>
  79 + <artifactId>springfox-boot-starter</artifactId>
  80 + <version>${swagger.version}</version>
  81 + <exclusions>
  82 + <exclusion>
  83 + <groupId>io.swagger</groupId>
  84 + <artifactId>swagger-models</artifactId>
  85 + </exclusion>
  86 + </exclusions>
  87 + </dependency>
  88 +
  89 + <!-- io常用工具类 -->
  90 + <dependency>
  91 + <groupId>commons-io</groupId>
  92 + <artifactId>commons-io</artifactId>
  93 + <version>${commons.io.version}</version>
  94 + </dependency>
  95 +
  96 + <!-- excel工具 -->
  97 + <dependency>
  98 + <groupId>org.apache.poi</groupId>
  99 + <artifactId>poi-ooxml</artifactId>
  100 + <version>${poi.version}</version>
  101 + </dependency>
  102 +
  103 + <!-- velocity代码生成使用模板 -->
  104 + <dependency>
  105 + <groupId>org.apache.velocity</groupId>
  106 + <artifactId>velocity-engine-core</artifactId>
  107 + <version>${velocity.version}</version>
  108 + </dependency>
  109 +
  110 + <!-- collections工具类 -->
  111 + <dependency>
  112 + <groupId>commons-collections</groupId>
  113 + <artifactId>commons-collections</artifactId>
  114 + <version>${commons.collections.version}</version>
  115 + </dependency>
  116 +
  117 + <!-- 阿里JSON解析器 -->
  118 + <dependency>
  119 + <groupId>com.alibaba.fastjson2</groupId>
  120 + <artifactId>fastjson2</artifactId>
  121 + <version>${fastjson.version}</version>
  122 + </dependency>
  123 +
  124 + <!-- Token生成与解析-->
  125 + <dependency>
  126 + <groupId>io.jsonwebtoken</groupId>
  127 + <artifactId>jjwt</artifactId>
  128 + <version>${jwt.version}</version>
  129 + </dependency>
  130 +
  131 + <!-- 验证码 -->
  132 + <dependency>
  133 + <groupId>pro.fessional</groupId>
  134 + <artifactId>kaptcha</artifactId>
  135 + <version>${kaptcha.version}</version>
  136 + </dependency>
  137 +
  138 + <!-- 定时任务-->
  139 + <dependency>
  140 + <groupId>com.ruoyi</groupId>
  141 + <artifactId>ruoyi-quartz</artifactId>
  142 + <version>${ruoyi.version}</version>
  143 + </dependency>
  144 +
  145 + <!-- 代码生成-->
  146 + <dependency>
  147 + <groupId>com.ruoyi</groupId>
  148 + <artifactId>ruoyi-generator</artifactId>
  149 + <version>${ruoyi.version}</version>
  150 + </dependency>
  151 +
  152 + <!-- 核心模块-->
  153 + <dependency>
  154 + <groupId>com.ruoyi</groupId>
  155 + <artifactId>ruoyi-framework</artifactId>
  156 + <version>${ruoyi.version}</version>
  157 + </dependency>
  158 +
  159 + <!-- 系统模块-->
  160 + <dependency>
  161 + <groupId>com.ruoyi</groupId>
  162 + <artifactId>ruoyi-system</artifactId>
  163 + <version>${ruoyi.version}</version>
  164 + </dependency>
  165 +
  166 + <!-- 通用工具-->
  167 + <dependency>
  168 + <groupId>com.ruoyi</groupId>
  169 + <artifactId>ruoyi-common</artifactId>
  170 + <version>${ruoyi.version}</version>
  171 + </dependency>
  172 +
  173 + </dependencies>
  174 + </dependencyManagement>
  175 +
  176 + <modules>
  177 + <module>ruoyi-admin</module>
  178 + <module>ruoyi-framework</module>
  179 + <module>ruoyi-system</module>
  180 + <module>ruoyi-quartz</module>
  181 + <module>ruoyi-generator</module>
  182 + <module>ruoyi-common</module>
  183 + </modules>
  184 + <packaging>pom</packaging>
  185 +
  186 + <build>
  187 + <plugins>
  188 + <plugin>
  189 + <groupId>org.apache.maven.plugins</groupId>
  190 + <artifactId>maven-compiler-plugin</artifactId>
  191 + <version>3.1</version>
  192 + <configuration>
  193 + <source>${java.version}</source>
  194 + <target>${java.version}</target>
  195 + <encoding>${project.build.sourceEncoding}</encoding>
  196 + </configuration>
  197 + </plugin>
  198 + </plugins>
  199 + </build>
  200 +
  201 + <repositories>
  202 + <repository>
  203 + <id>public</id>
  204 + <name>aliyun nexus</name>
  205 + <url>https://maven.aliyun.com/repository/public</url>
  206 + <releases>
  207 + <enabled>true</enabled>
  208 + </releases>
  209 + </repository>
  210 + </repositories>
  211 +
  212 + <pluginRepositories>
  213 + <pluginRepository>
  214 + <id>public</id>
  215 + <name>aliyun nexus</name>
  216 + <url>https://maven.aliyun.com/repository/public</url>
  217 + <releases>
  218 + <enabled>true</enabled>
  219 + </releases>
  220 + <snapshots>
  221 + <enabled>false</enabled>
  222 + </snapshots>
  223 + </pluginRepository>
  224 + </pluginRepositories>
  225 +
  226 +</project>
0 \ No newline at end of file 227 \ No newline at end of file
redis-dockerfile 0 → 100644
  1 +FROM redis:7
  2 +MAINTAINER guzijian
0 \ No newline at end of file 3 \ No newline at end of file
ruoyi-admin/admin-dockerfile 0 → 100644
  1 +FROM java:8
  2 +# 作者
  3 +MAINTAINER guzijian
  4 +# 获取jar包名字
  5 +ARG server_name
  6 +# 获取参数
  7 +ENV jar_name = $server_name
  8 +# 工作区
  9 +RUN mkdir -p "/home/docker/"
  10 +# 指定工作区
  11 +WORKDIR /home/docker/
  12 +# 把jar包复制到容器内
  13 +COPY ./*.jar /home/docker/
  14 +# 执行命令
  15 +ENTRYPOINT java -jar ${jar_name}.jar
0 \ No newline at end of file 16 \ No newline at end of file
ruoyi-admin/pom.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <parent>
  6 + <artifactId>ruoyi</artifactId>
  7 + <groupId>com.ruoyi</groupId>
  8 + <version>3.8.5</version>
  9 + </parent>
  10 + <modelVersion>4.0.0</modelVersion>
  11 + <packaging>jar</packaging>
  12 + <artifactId>ruoyi-admin</artifactId>
  13 +
  14 + <description>
  15 + web服务入口
  16 + </description>
  17 +
  18 + <dependencies>
  19 +
  20 + <!-- spring-boot-devtools -->
  21 + <dependency>
  22 + <groupId>org.springframework.boot</groupId>
  23 + <artifactId>spring-boot-devtools</artifactId>
  24 + <optional>true</optional> <!-- 表示依赖不会传递 -->
  25 + </dependency>
  26 +
  27 + <!-- swagger3-->
  28 + <dependency>
  29 + <groupId>io.springfox</groupId>
  30 + <artifactId>springfox-boot-starter</artifactId>
  31 + </dependency>
  32 +
  33 + <!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
  34 + <dependency>
  35 + <groupId>io.swagger</groupId>
  36 + <artifactId>swagger-models</artifactId>
  37 + <version>1.6.2</version>
  38 + </dependency>
  39 +
  40 + <!-- Mysql驱动包 -->
  41 + <dependency>
  42 + <groupId>mysql</groupId>
  43 + <artifactId>mysql-connector-java</artifactId>
  44 + </dependency>
  45 +
  46 + <!-- 核心模块-->
  47 + <dependency>
  48 + <groupId>com.ruoyi</groupId>
  49 + <artifactId>ruoyi-framework</artifactId>
  50 + </dependency>
  51 +
  52 + <!-- 定时任务-->
  53 + <dependency>
  54 + <groupId>com.ruoyi</groupId>
  55 + <artifactId>ruoyi-quartz</artifactId>
  56 + </dependency>
  57 +
  58 + <!-- 代码生成-->
  59 + <dependency>
  60 + <groupId>com.ruoyi</groupId>
  61 + <artifactId>ruoyi-generator</artifactId>
  62 + </dependency>
  63 +
  64 + </dependencies>
  65 +
  66 + <build>
  67 + <plugins>
  68 + <plugin>
  69 + <groupId>org.springframework.boot</groupId>
  70 + <artifactId>spring-boot-maven-plugin</artifactId>
  71 + <version>2.1.1.RELEASE</version>
  72 + <configuration>
  73 + <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
  74 + </configuration>
  75 + <executions>
  76 + <execution>
  77 + <goals>
  78 + <goal>repackage</goal>
  79 + </goals>
  80 + </execution>
  81 + </executions>
  82 + </plugin>
  83 + <plugin>
  84 + <groupId>org.apache.maven.plugins</groupId>
  85 + <artifactId>maven-war-plugin</artifactId>
  86 + <version>3.1.0</version>
  87 + <configuration>
  88 + <failOnMissingWebXml>false</failOnMissingWebXml>
  89 + <warName>${project.artifactId}</warName>
  90 + </configuration>
  91 + </plugin>
  92 + </plugins>
  93 + <finalName>${project.artifactId}</finalName>
  94 + </build>
  95 +
  96 +</project>
0 \ No newline at end of file 97 \ No newline at end of file
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java 0 → 100644
  1 +package com.ruoyi;
  2 +
  3 +import org.slf4j.Logger;
  4 +import org.slf4j.LoggerFactory;
  5 +import org.springframework.beans.factory.annotation.Value;
  6 +import org.springframework.boot.SpringApplication;
  7 +import org.springframework.boot.autoconfigure.SpringBootApplication;
  8 +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  9 +import org.springframework.context.ConfigurableApplicationContext;
  10 +import org.springframework.core.env.ConfigurableEnvironment;
  11 +
  12 +import javax.annotation.PostConstruct;
  13 +import java.net.InetAddress;
  14 +import java.net.UnknownHostException;
  15 +import java.util.ArrayList;
  16 +import java.util.List;
  17 +import java.util.regex.Matcher;
  18 +import java.util.regex.Pattern;
  19 +
  20 +/**
  21 + * 启动程序
  22 + *
  23 + * @author guzijian
  24 + */
  25 +@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
  26 +public class RuoYiApplication {
  27 +
  28 + private final static Logger log = LoggerFactory.getLogger(RuoYiApplication.class);
  29 +
  30 + public static void main(String[] args) throws UnknownHostException {
  31 + // System.setProperty("spring.devtools.restart.enabled", "false");
  32 + ConfigurableApplicationContext app = SpringApplication.run(RuoYiApplication.class, args);
  33 + ConfigurableEnvironment env = app.getEnvironment();
  34 + log.info("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
  35 + " .-------. ____ __ \n" +
  36 + " | _ _ \\ \\ \\ / / \n" +
  37 + " | ( ' ) | \\ _. / ' \n" +
  38 + " |(_ o _) / _( )_ .' \n" +
  39 + " | (_,_).' __ ___(_ o _)' \n" +
  40 + " | |\\ \\ | || |(_,_)' \n" +
  41 + " | | \\ `' /| `-' / \n" +
  42 + " | | \\ / \\ / \n" +
  43 + " ''-' `'-' `-..-' \n");
  44 + String ip = InetAddress.getLocalHost().getHostAddress();
  45 + String port = env.getProperty("server.port");
  46 + String path = env.getProperty("server.servlet.context-path");
  47 + String redisPort = env.getProperty("spring.redis.port");
  48 + String redisHost = env.getProperty("spring.redis.host");
  49 + String sqlUrl = env.getProperty("spring.datasource.druid.master.url");
  50 + List<String> sqlInfo = getSqlInfo(sqlUrl);
  51 + log.info(
  52 + "\n Swagger访问地址:http://" + ip + ":" + port + path + "swagger-ui/index.html \n" +
  53 + " Redis服务器地址:" + redisHost + ":" + redisPort + "\n" +
  54 + " Mysql服务器地址:" + sqlInfo.get(0) + ":" + sqlInfo.get(1));
  55 + }
  56 +
  57 + private static List<String> getSqlInfo(String sqlInfo) {
  58 + List<String> str = new ArrayList<>(3);
  59 + Pattern pattern = Pattern.compile("jdbc:mysql://([a-zA-Z0-9.-]+):(\\d+)/");
  60 + Matcher matcher = pattern.matcher(sqlInfo);
  61 + if (matcher.find()) {
  62 + str.add(matcher.group(1));
  63 + str.add(matcher.group(2));
  64 + }
  65 + return str;
  66 + }
  67 +
  68 +}
ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java 0 → 100644
  1 +package com.ruoyi;
  2 +
  3 +import org.springframework.boot.builder.SpringApplicationBuilder;
  4 +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
  5 +
  6 +/**
  7 + * web容器中进行部署
  8 + *
  9 + * @author ruoyi
  10 + */
  11 +public class RuoYiServletInitializer extends SpringBootServletInitializer
  12 +{
  13 + @Override
  14 + protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
  15 + {
  16 + return application.sources(RuoYiApplication.class);
  17 + }
  18 +}
ruoyi-admin/src/main/java/com/ruoyi/controller/FeiAoController.java 0 → 100644
  1 +package com.ruoyi.controller;
  2 +
  3 +import org.springframework.web.bind.annotation.RequestMapping;
  4 +import org.springframework.web.bind.annotation.RequestMethod;
  5 +import org.springframework.web.bind.annotation.RestController;
  6 +
  7 +/**
  8 + * @author 20412
  9 + */
  10 +@RestController
  11 +@RequestMapping("/api")
  12 +public class FeiAoController {
  13 +
  14 + @RequestMapping(value = "/test",method = RequestMethod.GET)
  15 + public String test(){
  16 + return "测试";
  17 + }
  18 +}
ruoyi-admin/src/main/java/com/ruoyi/system/controller/TestHhhController.java 0 → 100644
  1 +package com.ruoyi.system.controller;
  2 +
  3 +import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +import org.springframework.security.access.prepost.PreAuthorize;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.GetMapping;
  8 +import org.springframework.web.bind.annotation.PostMapping;
  9 +import org.springframework.web.bind.annotation.PutMapping;
  10 +import org.springframework.web.bind.annotation.DeleteMapping;
  11 +import org.springframework.web.bind.annotation.PathVariable;
  12 +import org.springframework.web.bind.annotation.RequestBody;
  13 +import org.springframework.web.bind.annotation.RequestMapping;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +import com.ruoyi.common.annotation.Log;
  16 +import com.ruoyi.common.core.controller.BaseController;
  17 +import com.ruoyi.common.core.domain.AjaxResult;
  18 +import com.ruoyi.common.enums.BusinessType;
  19 +import com.ruoyi.system.domain.TestHhh;
  20 +import com.ruoyi.system.service.ITestHhhService;
  21 +import com.ruoyi.common.utils.poi.ExcelUtil;
  22 +import com.ruoyi.common.core.page.TableDataInfo;
  23 +
  24 +/**
  25 + * ceshiController
  26 + *
  27 + * @author ruoyi
  28 + * @date 2023-06-27
  29 + */
  30 +@RestController
  31 +@RequestMapping("/system/hhh")
  32 +public class TestHhhController extends BaseController
  33 +{
  34 + @Autowired
  35 + private ITestHhhService testHhhService;
  36 +
  37 + /**
  38 + * 查询ceshi列表
  39 + */
  40 + @PreAuthorize("@ss.hasPermi('system:hhh:list')")
  41 + @GetMapping("/list")
  42 + public TableDataInfo list(TestHhh testHhh)
  43 + {
  44 + startPage();
  45 + List<TestHhh> list = testHhhService.selectTestHhhList(testHhh);
  46 + return getDataTable(list);
  47 + }
  48 +
  49 + /**
  50 + * 导出ceshi列表
  51 + */
  52 + @PreAuthorize("@ss.hasPermi('system:hhh:export')")
  53 + @Log(title = "ceshi", businessType = BusinessType.EXPORT)
  54 + @PostMapping("/export")
  55 + public void export(HttpServletResponse response, TestHhh testHhh)
  56 + {
  57 + List<TestHhh> list = testHhhService.selectTestHhhList(testHhh);
  58 + ExcelUtil<TestHhh> util = new ExcelUtil<TestHhh>(TestHhh.class);
  59 + util.exportExcel(response, list, "ceshi数据");
  60 + }
  61 +
  62 + /**
  63 + * 获取ceshi详细信息
  64 + */
  65 + @PreAuthorize("@ss.hasPermi('system:hhh:query')")
  66 + @GetMapping(value = "/{id}")
  67 + public AjaxResult getInfo(@PathVariable("id") Long id)
  68 + {
  69 + return success(testHhhService.selectTestHhhById(id));
  70 + }
  71 +
  72 + /**
  73 + * 新增ceshi
  74 + */
  75 + @PreAuthorize("@ss.hasPermi('system:hhh:add')")
  76 + @Log(title = "ceshi", businessType = BusinessType.INSERT)
  77 + @PostMapping
  78 + public AjaxResult add(@RequestBody TestHhh testHhh)
  79 + {
  80 + return toAjax(testHhhService.insertTestHhh(testHhh));
  81 + }
  82 +
  83 + /**
  84 + * 修改ceshi
  85 + */
  86 + @PreAuthorize("@ss.hasPermi('system:hhh:edit')")
  87 + @Log(title = "ceshi", businessType = BusinessType.UPDATE)
  88 + @PutMapping
  89 + public AjaxResult edit(@RequestBody TestHhh testHhh)
  90 + {
  91 + return toAjax(testHhhService.updateTestHhh(testHhh));
  92 + }
  93 +
  94 + /**
  95 + * 删除ceshi
  96 + */
  97 + @PreAuthorize("@ss.hasPermi('system:hhh:remove')")
  98 + @Log(title = "ceshi", businessType = BusinessType.DELETE)
  99 + @DeleteMapping("/{ids}")
  100 + public AjaxResult remove(@PathVariable Long[] ids)
  101 + {
  102 + return toAjax(testHhhService.deleteTestHhhByIds(ids));
  103 + }
  104 +}
ruoyi-admin/src/main/java/com/ruoyi/system/domain/TestHhh.java 0 → 100644
  1 +package com.ruoyi.system.domain;
  2 +
  3 +import org.apache.commons.lang3.builder.ToStringBuilder;
  4 +import org.apache.commons.lang3.builder.ToStringStyle;
  5 +import com.ruoyi.common.annotation.Excel;
  6 +import com.ruoyi.common.core.domain.BaseEntity;
  7 +
  8 +/**
  9 + * ceshi对象 test_hhh
  10 + *
  11 + * @author ruoyi
  12 + * @date 2023-06-27
  13 + */
  14 +public class TestHhh extends BaseEntity
  15 +{
  16 + private static final long serialVersionUID = 1L;
  17 +
  18 + /** $column.columnComment */
  19 + private Long id;
  20 +
  21 + /** $column.columnComment */
  22 + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
  23 + private String name;
  24 +
  25 + /** $column.columnComment */
  26 + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
  27 + private Long age;
  28 +
  29 + public void setId(Long id)
  30 + {
  31 + this.id = id;
  32 + }
  33 +
  34 + public Long getId()
  35 + {
  36 + return id;
  37 + }
  38 + public void setName(String name)
  39 + {
  40 + this.name = name;
  41 + }
  42 +
  43 + public String getName()
  44 + {
  45 + return name;
  46 + }
  47 + public void setAge(Long age)
  48 + {
  49 + this.age = age;
  50 + }
  51 +
  52 + public Long getAge()
  53 + {
  54 + return age;
  55 + }
  56 +
  57 + @Override
  58 + public String toString() {
  59 + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
  60 + .append("id", getId())
  61 + .append("name", getName())
  62 + .append("age", getAge())
  63 + .toString();
  64 + }
  65 +}
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/TestHhhMapper.java 0 → 100644
  1 +package com.ruoyi.system.mapper;
  2 +
  3 +import java.util.List;
  4 +import com.ruoyi.system.domain.TestHhh;
  5 +
  6 +/**
  7 + * ceshiMapper接口
  8 + *
  9 + * @author ruoyi
  10 + * @date 2023-06-27
  11 + */
  12 +public interface TestHhhMapper
  13 +{
  14 + /**
  15 + * 查询ceshi
  16 + *
  17 + * @param id ceshi主键
  18 + * @return ceshi
  19 + */
  20 + public TestHhh selectTestHhhById(Long id);
  21 +
  22 + /**
  23 + * 查询ceshi列表
  24 + *
  25 + * @param testHhh ceshi
  26 + * @return ceshi集合
  27 + */
  28 + public List<TestHhh> selectTestHhhList(TestHhh testHhh);
  29 +
  30 + /**
  31 + * 新增ceshi
  32 + *
  33 + * @param testHhh ceshi
  34 + * @return 结果
  35 + */
  36 + public int insertTestHhh(TestHhh testHhh);
  37 +
  38 + /**
  39 + * 修改ceshi
  40 + *
  41 + * @param testHhh ceshi
  42 + * @return 结果
  43 + */
  44 + public int updateTestHhh(TestHhh testHhh);
  45 +
  46 + /**
  47 + * 删除ceshi
  48 + *
  49 + * @param id ceshi主键
  50 + * @return 结果
  51 + */
  52 + public int deleteTestHhhById(Long id);
  53 +
  54 + /**
  55 + * 批量删除ceshi
  56 + *
  57 + * @param ids 需要删除的数据主键集合
  58 + * @return 结果
  59 + */
  60 + public int deleteTestHhhByIds(Long[] ids);
  61 +}
ruoyi-admin/src/main/java/com/ruoyi/system/service/ITestHhhService.java 0 → 100644
  1 +package com.ruoyi.system.service;
  2 +
  3 +import java.util.List;
  4 +import com.ruoyi.system.domain.TestHhh;
  5 +
  6 +/**
  7 + * ceshiService接口
  8 + *
  9 + * @author ruoyi
  10 + * @date 2023-06-27
  11 + */
  12 +public interface ITestHhhService
  13 +{
  14 + /**
  15 + * 查询ceshi
  16 + *
  17 + * @param id ceshi主键
  18 + * @return ceshi
  19 + */
  20 + public TestHhh selectTestHhhById(Long id);
  21 +
  22 + /**
  23 + * 查询ceshi列表
  24 + *
  25 + * @param testHhh ceshi
  26 + * @return ceshi集合
  27 + */
  28 + public List<TestHhh> selectTestHhhList(TestHhh testHhh);
  29 +
  30 + /**
  31 + * 新增ceshi
  32 + *
  33 + * @param testHhh ceshi
  34 + * @return 结果
  35 + */
  36 + public int insertTestHhh(TestHhh testHhh);
  37 +
  38 + /**
  39 + * 修改ceshi
  40 + *
  41 + * @param testHhh ceshi
  42 + * @return 结果
  43 + */
  44 + public int updateTestHhh(TestHhh testHhh);
  45 +
  46 + /**
  47 + * 批量删除ceshi
  48 + *
  49 + * @param ids 需要删除的ceshi主键集合
  50 + * @return 结果
  51 + */
  52 + public int deleteTestHhhByIds(Long[] ids);
  53 +
  54 + /**
  55 + * 删除ceshi信息
  56 + *
  57 + * @param id ceshi主键
  58 + * @return 结果
  59 + */
  60 + public int deleteTestHhhById(Long id);
  61 +}
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/TestHhhServiceImpl.java 0 → 100644
  1 +package com.ruoyi.system.service.impl;
  2 +
  3 +import java.util.List;
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +import org.springframework.stereotype.Service;
  6 +import com.ruoyi.system.mapper.TestHhhMapper;
  7 +import com.ruoyi.system.domain.TestHhh;
  8 +import com.ruoyi.system.service.ITestHhhService;
  9 +
  10 +/**
  11 + * ceshiService业务层处理
  12 + *
  13 + * @author ruoyi
  14 + * @date 2023-06-27
  15 + */
  16 +@Service
  17 +public class TestHhhServiceImpl implements ITestHhhService
  18 +{
  19 + @Autowired
  20 + private TestHhhMapper testHhhMapper;
  21 +
  22 + /**
  23 + * 查询ceshi
  24 + *
  25 + * @param id ceshi主键
  26 + * @return ceshi
  27 + */
  28 + @Override
  29 + public TestHhh selectTestHhhById(Long id)
  30 + {
  31 + return testHhhMapper.selectTestHhhById(id);
  32 + }
  33 +
  34 + /**
  35 + * 查询ceshi列表
  36 + *
  37 + * @param testHhh ceshi
  38 + * @return ceshi
  39 + */
  40 + @Override
  41 + public List<TestHhh> selectTestHhhList(TestHhh testHhh)
  42 + {
  43 + return testHhhMapper.selectTestHhhList(testHhh);
  44 + }
  45 +
  46 + /**
  47 + * 新增ceshi
  48 + *
  49 + * @param testHhh ceshi
  50 + * @return 结果
  51 + */
  52 + @Override
  53 + public int insertTestHhh(TestHhh testHhh)
  54 + {
  55 + return testHhhMapper.insertTestHhh(testHhh);
  56 + }
  57 +
  58 + /**
  59 + * 修改ceshi
  60 + *
  61 + * @param testHhh ceshi
  62 + * @return 结果
  63 + */
  64 + @Override
  65 + public int updateTestHhh(TestHhh testHhh)
  66 + {
  67 + return testHhhMapper.updateTestHhh(testHhh);
  68 + }
  69 +
  70 + /**
  71 + * 批量删除ceshi
  72 + *
  73 + * @param ids 需要删除的ceshi主键
  74 + * @return 结果
  75 + */
  76 + @Override
  77 + public int deleteTestHhhByIds(Long[] ids)
  78 + {
  79 + return testHhhMapper.deleteTestHhhByIds(ids);
  80 + }
  81 +
  82 + /**
  83 + * 删除ceshi信息
  84 + *
  85 + * @param id ceshi主键
  86 + * @return 结果
  87 + */
  88 + @Override
  89 + public int deleteTestHhhById(Long id)
  90 + {
  91 + return testHhhMapper.deleteTestHhhById(id);
  92 + }
  93 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java 0 → 100644
  1 +package com.ruoyi.web.controller.common;
  2 +
  3 +import java.awt.image.BufferedImage;
  4 +import java.io.IOException;
  5 +import java.util.concurrent.TimeUnit;
  6 +import javax.annotation.Resource;
  7 +import javax.imageio.ImageIO;
  8 +import javax.servlet.http.HttpServletResponse;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.util.FastByteArrayOutputStream;
  11 +import org.springframework.web.bind.annotation.GetMapping;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +import com.google.code.kaptcha.Producer;
  14 +import com.ruoyi.common.config.RuoYiConfig;
  15 +import com.ruoyi.common.constant.CacheConstants;
  16 +import com.ruoyi.common.constant.Constants;
  17 +import com.ruoyi.common.core.domain.AjaxResult;
  18 +import com.ruoyi.common.core.redis.RedisCache;
  19 +import com.ruoyi.common.utils.sign.Base64;
  20 +import com.ruoyi.common.utils.uuid.IdUtils;
  21 +import com.ruoyi.system.service.ISysConfigService;
  22 +
  23 +/**
  24 + * 验证码操作处理
  25 + *
  26 + * @author ruoyi
  27 + */
  28 +@RestController
  29 +public class CaptchaController
  30 +{
  31 + @Resource(name = "captchaProducer")
  32 + private Producer captchaProducer;
  33 +
  34 + @Resource(name = "captchaProducerMath")
  35 + private Producer captchaProducerMath;
  36 +
  37 + @Autowired
  38 + private RedisCache redisCache;
  39 +
  40 + @Autowired
  41 + private ISysConfigService configService;
  42 + /**
  43 + * 生成验证码
  44 + */
  45 + @GetMapping("/captchaImage")
  46 + public AjaxResult getCode(HttpServletResponse response) throws IOException
  47 + {
  48 + AjaxResult ajax = AjaxResult.success();
  49 + boolean captchaEnabled = configService.selectCaptchaEnabled();
  50 + ajax.put("captchaEnabled", captchaEnabled);
  51 + if (!captchaEnabled)
  52 + {
  53 + return ajax;
  54 + }
  55 +
  56 + // 保存验证码信息
  57 + String uuid = IdUtils.simpleUUID();
  58 + String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
  59 +
  60 + String capStr = null, code = null;
  61 + BufferedImage image = null;
  62 +
  63 + // 生成验证码
  64 + String captchaType = RuoYiConfig.getCaptchaType();
  65 + if ("math".equals(captchaType))
  66 + {
  67 + String capText = captchaProducerMath.createText();
  68 + capStr = capText.substring(0, capText.lastIndexOf("@"));
  69 + code = capText.substring(capText.lastIndexOf("@") + 1);
  70 + image = captchaProducerMath.createImage(capStr);
  71 + }
  72 + else if ("char".equals(captchaType))
  73 + {
  74 + capStr = code = captchaProducer.createText();
  75 + image = captchaProducer.createImage(capStr);
  76 + }
  77 +
  78 + redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
  79 + // 转换流信息写出
  80 + FastByteArrayOutputStream os = new FastByteArrayOutputStream();
  81 + try
  82 + {
  83 + ImageIO.write(image, "jpg", os);
  84 + }
  85 + catch (IOException e)
  86 + {
  87 + return AjaxResult.error(e.getMessage());
  88 + }
  89 +
  90 + ajax.put("uuid", uuid);
  91 + ajax.put("img", Base64.encode(os.toByteArray()));
  92 + return ajax;
  93 + }
  94 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java 0 → 100644
  1 +package com.ruoyi.web.controller.common;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +import javax.servlet.http.HttpServletRequest;
  6 +import javax.servlet.http.HttpServletResponse;
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.http.MediaType;
  11 +import org.springframework.web.bind.annotation.GetMapping;
  12 +import org.springframework.web.bind.annotation.PostMapping;
  13 +import org.springframework.web.bind.annotation.RequestMapping;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +import org.springframework.web.multipart.MultipartFile;
  16 +import com.ruoyi.common.config.RuoYiConfig;
  17 +import com.ruoyi.common.constant.Constants;
  18 +import com.ruoyi.common.core.domain.AjaxResult;
  19 +import com.ruoyi.common.utils.StringUtils;
  20 +import com.ruoyi.common.utils.file.FileUploadUtils;
  21 +import com.ruoyi.common.utils.file.FileUtils;
  22 +import com.ruoyi.framework.config.ServerConfig;
  23 +
  24 +/**
  25 + * 通用请求处理
  26 + *
  27 + * @author ruoyi
  28 + */
  29 +@RestController
  30 +@RequestMapping("/common")
  31 +public class CommonController
  32 +{
  33 + private static final Logger log = LoggerFactory.getLogger(CommonController.class);
  34 +
  35 + @Autowired
  36 + private ServerConfig serverConfig;
  37 +
  38 + private static final String FILE_DELIMETER = ",";
  39 +
  40 + /**
  41 + * 通用下载请求
  42 + *
  43 + * @param fileName 文件名称
  44 + * @param delete 是否删除
  45 + */
  46 + @GetMapping("/download")
  47 + public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
  48 + {
  49 + try
  50 + {
  51 + if (!FileUtils.checkAllowDownload(fileName))
  52 + {
  53 + throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
  54 + }
  55 + String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
  56 + String filePath = RuoYiConfig.getDownloadPath() + fileName;
  57 +
  58 + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
  59 + FileUtils.setAttachmentResponseHeader(response, realFileName);
  60 + FileUtils.writeBytes(filePath, response.getOutputStream());
  61 + if (delete)
  62 + {
  63 + FileUtils.deleteFile(filePath);
  64 + }
  65 + }
  66 + catch (Exception e)
  67 + {
  68 + log.error("下载文件失败", e);
  69 + }
  70 + }
  71 +
  72 + /**
  73 + * 通用上传请求(单个)
  74 + */
  75 + @PostMapping("/upload")
  76 + public AjaxResult uploadFile(MultipartFile file) throws Exception
  77 + {
  78 + try
  79 + {
  80 + // 上传文件路径
  81 + String filePath = RuoYiConfig.getUploadPath();
  82 + // 上传并返回新文件名称
  83 + String fileName = FileUploadUtils.upload(filePath, file);
  84 + String url = serverConfig.getUrl() + fileName;
  85 + AjaxResult ajax = AjaxResult.success();
  86 + ajax.put("url", url);
  87 + ajax.put("fileName", fileName);
  88 + ajax.put("newFileName", FileUtils.getName(fileName));
  89 + ajax.put("originalFilename", file.getOriginalFilename());
  90 + return ajax;
  91 + }
  92 + catch (Exception e)
  93 + {
  94 + return AjaxResult.error(e.getMessage());
  95 + }
  96 + }
  97 +
  98 + /**
  99 + * 通用上传请求(多个)
  100 + */
  101 + @PostMapping("/uploads")
  102 + public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
  103 + {
  104 + try
  105 + {
  106 + // 上传文件路径
  107 + String filePath = RuoYiConfig.getUploadPath();
  108 + List<String> urls = new ArrayList<String>();
  109 + List<String> fileNames = new ArrayList<String>();
  110 + List<String> newFileNames = new ArrayList<String>();
  111 + List<String> originalFilenames = new ArrayList<String>();
  112 + for (MultipartFile file : files)
  113 + {
  114 + // 上传并返回新文件名称
  115 + String fileName = FileUploadUtils.upload(filePath, file);
  116 + String url = serverConfig.getUrl() + fileName;
  117 + urls.add(url);
  118 + fileNames.add(fileName);
  119 + newFileNames.add(FileUtils.getName(fileName));
  120 + originalFilenames.add(file.getOriginalFilename());
  121 + }
  122 + AjaxResult ajax = AjaxResult.success();
  123 + ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
  124 + ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
  125 + ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
  126 + ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
  127 + return ajax;
  128 + }
  129 + catch (Exception e)
  130 + {
  131 + return AjaxResult.error(e.getMessage());
  132 + }
  133 + }
  134 +
  135 + /**
  136 + * 本地资源通用下载
  137 + */
  138 + @GetMapping("/download/resource")
  139 + public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
  140 + throws Exception
  141 + {
  142 + try
  143 + {
  144 + if (!FileUtils.checkAllowDownload(resource))
  145 + {
  146 + throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
  147 + }
  148 + // 本地资源路径
  149 + String localPath = RuoYiConfig.getProfile();
  150 + // 数据库资源地址
  151 + String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
  152 + // 下载名称
  153 + String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
  154 + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
  155 + FileUtils.setAttachmentResponseHeader(response, downloadName);
  156 + FileUtils.writeBytes(downloadPath, response.getOutputStream());
  157 + }
  158 + catch (Exception e)
  159 + {
  160 + log.error("下载文件失败", e);
  161 + }
  162 + }
  163 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java 0 → 100644
  1 +package com.ruoyi.web.controller.monitor;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.Collection;
  5 +import java.util.HashMap;
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +import java.util.Properties;
  9 +import java.util.Set;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.data.redis.core.RedisCallback;
  12 +import org.springframework.data.redis.core.RedisTemplate;
  13 +import org.springframework.security.access.prepost.PreAuthorize;
  14 +import org.springframework.web.bind.annotation.DeleteMapping;
  15 +import org.springframework.web.bind.annotation.GetMapping;
  16 +import org.springframework.web.bind.annotation.PathVariable;
  17 +import org.springframework.web.bind.annotation.RequestMapping;
  18 +import org.springframework.web.bind.annotation.RestController;
  19 +import com.ruoyi.common.constant.CacheConstants;
  20 +import com.ruoyi.common.core.domain.AjaxResult;
  21 +import com.ruoyi.common.utils.StringUtils;
  22 +import com.ruoyi.system.domain.SysCache;
  23 +
  24 +/**
  25 + * 缓存监控
  26 + *
  27 + * @author ruoyi
  28 + */
  29 +@RestController
  30 +@RequestMapping("/monitor/cache")
  31 +public class CacheController
  32 +{
  33 + @Autowired
  34 + private RedisTemplate<String, String> redisTemplate;
  35 +
  36 + private final static List<SysCache> caches = new ArrayList<SysCache>();
  37 + {
  38 + caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
  39 + caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
  40 + caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
  41 + caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
  42 + caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
  43 + caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
  44 + caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
  45 + }
  46 +
  47 + @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
  48 + @GetMapping()
  49 + public AjaxResult getInfo() throws Exception
  50 + {
  51 + Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
  52 + Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
  53 + Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
  54 +
  55 + Map<String, Object> result = new HashMap<>(3);
  56 + result.put("info", info);
  57 + result.put("dbSize", dbSize);
  58 +
  59 + List<Map<String, String>> pieList = new ArrayList<>();
  60 + commandStats.stringPropertyNames().forEach(key -> {
  61 + Map<String, String> data = new HashMap<>(2);
  62 + String property = commandStats.getProperty(key);
  63 + data.put("name", StringUtils.removeStart(key, "cmdstat_"));
  64 + data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
  65 + pieList.add(data);
  66 + });
  67 + result.put("commandStats", pieList);
  68 + return AjaxResult.success(result);
  69 + }
  70 +
  71 + @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
  72 + @GetMapping("/getNames")
  73 + public AjaxResult cache()
  74 + {
  75 + return AjaxResult.success(caches);
  76 + }
  77 +
  78 + @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
  79 + @GetMapping("/getKeys/{cacheName}")
  80 + public AjaxResult getCacheKeys(@PathVariable String cacheName)
  81 + {
  82 + Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
  83 + return AjaxResult.success(cacheKeys);
  84 + }
  85 +
  86 + @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
  87 + @GetMapping("/getValue/{cacheName}/{cacheKey}")
  88 + public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
  89 + {
  90 + String cacheValue = redisTemplate.opsForValue().get(cacheKey);
  91 + SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
  92 + return AjaxResult.success(sysCache);
  93 + }
  94 +
  95 + @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
  96 + @DeleteMapping("/clearCacheName/{cacheName}")
  97 + public AjaxResult clearCacheName(@PathVariable String cacheName)
  98 + {
  99 + Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
  100 + redisTemplate.delete(cacheKeys);
  101 + return AjaxResult.success();
  102 + }
  103 +
  104 + @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
  105 + @DeleteMapping("/clearCacheKey/{cacheKey}")
  106 + public AjaxResult clearCacheKey(@PathVariable String cacheKey)
  107 + {
  108 + redisTemplate.delete(cacheKey);
  109 + return AjaxResult.success();
  110 + }
  111 +
  112 + @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
  113 + @DeleteMapping("/clearCacheAll")
  114 + public AjaxResult clearCacheAll()
  115 + {
  116 + Collection<String> cacheKeys = redisTemplate.keys("*");
  117 + redisTemplate.delete(cacheKeys);
  118 + return AjaxResult.success();
  119 + }
  120 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java 0 → 100644
  1 +package com.ruoyi.web.controller.monitor;
  2 +
  3 +import org.springframework.security.access.prepost.PreAuthorize;
  4 +import org.springframework.web.bind.annotation.GetMapping;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +import com.ruoyi.common.core.domain.AjaxResult;
  8 +import com.ruoyi.framework.web.domain.Server;
  9 +
  10 +/**
  11 + * 服务器监控
  12 + *
  13 + * @author ruoyi
  14 + */
  15 +@RestController
  16 +@RequestMapping("/monitor/server")
  17 +public class ServerController
  18 +{
  19 + @PreAuthorize("@ss.hasPermi('monitor:server:list')")
  20 + @GetMapping()
  21 + public AjaxResult getInfo() throws Exception
  22 + {
  23 + Server server = new Server();
  24 + server.copyTo();
  25 + return AjaxResult.success(server);
  26 + }
  27 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java 0 → 100644
  1 +package com.ruoyi.web.controller.monitor;
  2 +
  3 +import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.security.access.prepost.PreAuthorize;
  7 +import org.springframework.web.bind.annotation.DeleteMapping;
  8 +import org.springframework.web.bind.annotation.GetMapping;
  9 +import org.springframework.web.bind.annotation.PathVariable;
  10 +import org.springframework.web.bind.annotation.PostMapping;
  11 +import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +import com.ruoyi.common.annotation.Log;
  14 +import com.ruoyi.common.core.controller.BaseController;
  15 +import com.ruoyi.common.core.domain.AjaxResult;
  16 +import com.ruoyi.common.core.page.TableDataInfo;
  17 +import com.ruoyi.common.enums.BusinessType;
  18 +import com.ruoyi.common.utils.poi.ExcelUtil;
  19 +import com.ruoyi.framework.web.service.SysPasswordService;
  20 +import com.ruoyi.system.domain.SysLogininfor;
  21 +import com.ruoyi.system.service.ISysLogininforService;
  22 +
  23 +/**
  24 + * 系统访问记录
  25 + *
  26 + * @author ruoyi
  27 + */
  28 +@RestController
  29 +@RequestMapping("/monitor/logininfor")
  30 +public class SysLogininforController extends BaseController
  31 +{
  32 + @Autowired
  33 + private ISysLogininforService logininforService;
  34 +
  35 + @Autowired
  36 + private SysPasswordService passwordService;
  37 +
  38 + @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
  39 + @GetMapping("/list")
  40 + public TableDataInfo list(SysLogininfor logininfor)
  41 + {
  42 + startPage();
  43 + List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
  44 + return getDataTable(list);
  45 + }
  46 +
  47 + @Log(title = "登录日志", businessType = BusinessType.EXPORT)
  48 + @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
  49 + @PostMapping("/export")
  50 + public void export(HttpServletResponse response, SysLogininfor logininfor)
  51 + {
  52 + List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
  53 + ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
  54 + util.exportExcel(response, list, "登录日志");
  55 + }
  56 +
  57 + @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
  58 + @Log(title = "登录日志", businessType = BusinessType.DELETE)
  59 + @DeleteMapping("/{infoIds}")
  60 + public AjaxResult remove(@PathVariable Long[] infoIds)
  61 + {
  62 + return toAjax(logininforService.deleteLogininforByIds(infoIds));
  63 + }
  64 +
  65 + @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
  66 + @Log(title = "登录日志", businessType = BusinessType.CLEAN)
  67 + @DeleteMapping("/clean")
  68 + public AjaxResult clean()
  69 + {
  70 + logininforService.cleanLogininfor();
  71 + return success();
  72 + }
  73 +
  74 + @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
  75 + @Log(title = "账户解锁", businessType = BusinessType.OTHER)
  76 + @GetMapping("/unlock/{userName}")
  77 + public AjaxResult unlock(@PathVariable("userName") String userName)
  78 + {
  79 + passwordService.clearLoginRecordCache(userName);
  80 + return success();
  81 + }
  82 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java 0 → 100644
  1 +package com.ruoyi.web.controller.monitor;
  2 +
  3 +import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.security.access.prepost.PreAuthorize;
  7 +import org.springframework.web.bind.annotation.DeleteMapping;
  8 +import org.springframework.web.bind.annotation.GetMapping;
  9 +import org.springframework.web.bind.annotation.PathVariable;
  10 +import org.springframework.web.bind.annotation.PostMapping;
  11 +import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +import com.ruoyi.common.annotation.Log;
  14 +import com.ruoyi.common.core.controller.BaseController;
  15 +import com.ruoyi.common.core.domain.AjaxResult;
  16 +import com.ruoyi.common.core.page.TableDataInfo;
  17 +import com.ruoyi.common.enums.BusinessType;
  18 +import com.ruoyi.common.utils.poi.ExcelUtil;
  19 +import com.ruoyi.system.domain.SysOperLog;
  20 +import com.ruoyi.system.service.ISysOperLogService;
  21 +
  22 +/**
  23 + * 操作日志记录
  24 + *
  25 + * @author ruoyi
  26 + */
  27 +@RestController
  28 +@RequestMapping("/monitor/operlog")
  29 +public class SysOperlogController extends BaseController
  30 +{
  31 + @Autowired
  32 + private ISysOperLogService operLogService;
  33 +
  34 + @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
  35 + @GetMapping("/list")
  36 + public TableDataInfo list(SysOperLog operLog)
  37 + {
  38 + startPage();
  39 + List<SysOperLog> list = operLogService.selectOperLogList(operLog);
  40 + return getDataTable(list);
  41 + }
  42 +
  43 + @Log(title = "操作日志", businessType = BusinessType.EXPORT)
  44 + @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
  45 + @PostMapping("/export")
  46 + public void export(HttpServletResponse response, SysOperLog operLog)
  47 + {
  48 + List<SysOperLog> list = operLogService.selectOperLogList(operLog);
  49 + ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
  50 + util.exportExcel(response, list, "操作日志");
  51 + }
  52 +
  53 + @Log(title = "操作日志", businessType = BusinessType.DELETE)
  54 + @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
  55 + @DeleteMapping("/{operIds}")
  56 + public AjaxResult remove(@PathVariable Long[] operIds)
  57 + {
  58 + return toAjax(operLogService.deleteOperLogByIds(operIds));
  59 + }
  60 +
  61 + @Log(title = "操作日志", businessType = BusinessType.CLEAN)
  62 + @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
  63 + @DeleteMapping("/clean")
  64 + public AjaxResult clean()
  65 + {
  66 + operLogService.cleanOperLog();
  67 + return success();
  68 + }
  69 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java 0 → 100644
  1 +package com.ruoyi.web.controller.monitor;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.Collection;
  5 +import java.util.Collections;
  6 +import java.util.List;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.security.access.prepost.PreAuthorize;
  9 +import org.springframework.web.bind.annotation.DeleteMapping;
  10 +import org.springframework.web.bind.annotation.GetMapping;
  11 +import org.springframework.web.bind.annotation.PathVariable;
  12 +import org.springframework.web.bind.annotation.RequestMapping;
  13 +import org.springframework.web.bind.annotation.RestController;
  14 +import com.ruoyi.common.annotation.Log;
  15 +import com.ruoyi.common.constant.CacheConstants;
  16 +import com.ruoyi.common.core.controller.BaseController;
  17 +import com.ruoyi.common.core.domain.AjaxResult;
  18 +import com.ruoyi.common.core.domain.model.LoginUser;
  19 +import com.ruoyi.common.core.page.TableDataInfo;
  20 +import com.ruoyi.common.core.redis.RedisCache;
  21 +import com.ruoyi.common.enums.BusinessType;
  22 +import com.ruoyi.common.utils.StringUtils;
  23 +import com.ruoyi.system.domain.SysUserOnline;
  24 +import com.ruoyi.system.service.ISysUserOnlineService;
  25 +
  26 +/**
  27 + * 在线用户监控
  28 + *
  29 + * @author ruoyi
  30 + */
  31 +@RestController
  32 +@RequestMapping("/monitor/online")
  33 +public class SysUserOnlineController extends BaseController
  34 +{
  35 + @Autowired
  36 + private ISysUserOnlineService userOnlineService;
  37 +
  38 + @Autowired
  39 + private RedisCache redisCache;
  40 +
  41 + @PreAuthorize("@ss.hasPermi('monitor:online:list')")
  42 + @GetMapping("/list")
  43 + public TableDataInfo list(String ipaddr, String userName)
  44 + {
  45 + Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
  46 + List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
  47 + for (String key : keys)
  48 + {
  49 + LoginUser user = redisCache.getCacheObject(key);
  50 + if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
  51 + {
  52 + userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
  53 + }
  54 + else if (StringUtils.isNotEmpty(ipaddr))
  55 + {
  56 + userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
  57 + }
  58 + else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
  59 + {
  60 + userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
  61 + }
  62 + else
  63 + {
  64 + userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
  65 + }
  66 + }
  67 + Collections.reverse(userOnlineList);
  68 + userOnlineList.removeAll(Collections.singleton(null));
  69 + return getDataTable(userOnlineList);
  70 + }
  71 +
  72 + /**
  73 + * 强退用户
  74 + */
  75 + @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
  76 + @Log(title = "在线用户", businessType = BusinessType.FORCE)
  77 + @DeleteMapping("/{tokenId}")
  78 + public AjaxResult forceLogout(@PathVariable String tokenId)
  79 + {
  80 + redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
  81 + return success();
  82 + }
  83 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java 0 → 100644
  1 +package com.ruoyi.web.controller.system;
  2 +
  3 +import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.security.access.prepost.PreAuthorize;
  7 +import org.springframework.validation.annotation.Validated;
  8 +import org.springframework.web.bind.annotation.DeleteMapping;
  9 +import org.springframework.web.bind.annotation.GetMapping;
  10 +import org.springframework.web.bind.annotation.PathVariable;
  11 +import org.springframework.web.bind.annotation.PostMapping;
  12 +import org.springframework.web.bind.annotation.PutMapping;
  13 +import org.springframework.web.bind.annotation.RequestBody;
  14 +import org.springframework.web.bind.annotation.RequestMapping;
  15 +import org.springframework.web.bind.annotation.RestController;
  16 +import com.ruoyi.common.annotation.Log;
  17 +import com.ruoyi.common.core.controller.BaseController;
  18 +import com.ruoyi.common.core.domain.AjaxResult;
  19 +import com.ruoyi.common.core.page.TableDataInfo;
  20 +import com.ruoyi.common.enums.BusinessType;
  21 +import com.ruoyi.common.utils.poi.ExcelUtil;
  22 +import com.ruoyi.system.domain.SysConfig;
  23 +import com.ruoyi.system.service.ISysConfigService;
  24 +
  25 +/**
  26 + * 参数配置 信息操作处理
  27 + *
  28 + * @author ruoyi
  29 + */
  30 +@RestController
  31 +@RequestMapping("/system/config")
  32 +public class SysConfigController extends BaseController
  33 +{
  34 + @Autowired
  35 + private ISysConfigService configService;
  36 +
  37 + /**
  38 + * 获取参数配置列表
  39 + */
  40 + @PreAuthorize("@ss.hasPermi('system:config:list')")
  41 + @GetMapping("/list")
  42 + public TableDataInfo list(SysConfig config)
  43 + {
  44 + startPage();
  45 + List<SysConfig> list = configService.selectConfigList(config);
  46 + return getDataTable(list);
  47 + }
  48 +
  49 + @Log(title = "参数管理", businessType = BusinessType.EXPORT)
  50 + @PreAuthorize("@ss.hasPermi('system:config:export')")
  51 + @PostMapping("/export")
  52 + public void export(HttpServletResponse response, SysConfig config)
  53 + {
  54 + List<SysConfig> list = configService.selectConfigList(config);
  55 + ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
  56 + util.exportExcel(response, list, "参数数据");
  57 + }
  58 +
  59 + /**
  60 + * 根据参数编号获取详细信息
  61 + */
  62 + @PreAuthorize("@ss.hasPermi('system:config:query')")
  63 + @GetMapping(value = "/{configId}")
  64 + public AjaxResult getInfo(@PathVariable Long configId)
  65 + {
  66 + return success(configService.selectConfigById(configId));
  67 + }
  68 +
  69 + /**
  70 + * 根据参数键名查询参数值
  71 + */
  72 + @GetMapping(value = "/configKey/{configKey}")
  73 + public AjaxResult getConfigKey(@PathVariable String configKey)
  74 + {
  75 + return success(configService.selectConfigByKey(configKey));
  76 + }
  77 +
  78 + /**
  79 + * 新增参数配置
  80 + */
  81 + @PreAuthorize("@ss.hasPermi('system:config:add')")
  82 + @Log(title = "参数管理", businessType = BusinessType.INSERT)
  83 + @PostMapping
  84 + public AjaxResult add(@Validated @RequestBody SysConfig config)
  85 + {
  86 + if (!configService.checkConfigKeyUnique(config))
  87 + {
  88 + return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
  89 + }
  90 + config.setCreateBy(getUsername());
  91 + return toAjax(configService.insertConfig(config));
  92 + }
  93 +
  94 + /**
  95 + * 修改参数配置
  96 + */
  97 + @PreAuthorize("@ss.hasPermi('system:config:edit')")
  98 + @Log(title = "参数管理", businessType = BusinessType.UPDATE)
  99 + @PutMapping
  100 + public AjaxResult edit(@Validated @RequestBody SysConfig config)
  101 + {
  102 + if (!configService.checkConfigKeyUnique(config))
  103 + {
  104 + return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
  105 + }
  106 + config.setUpdateBy(getUsername());
  107 + return toAjax(configService.updateConfig(config));
  108 + }
  109 +
  110 + /**
  111 + * 删除参数配置
  112 + */
  113 + @PreAuthorize("@ss.hasPermi('system:config:remove')")
  114 + @Log(title = "参数管理", businessType = BusinessType.DELETE)
  115 + @DeleteMapping("/{configIds}")
  116 + public AjaxResult remove(@PathVariable Long[] configIds)
  117 + {
  118 + configService.deleteConfigByIds(configIds);
  119 + return success();
  120 + }
  121 +
  122 + /**
  123 + * 刷新参数缓存
  124 + */
  125 + @PreAuthorize("@ss.hasPermi('system:config:remove')")
  126 + @Log(title = "参数管理", businessType = BusinessType.CLEAN)
  127 + @DeleteMapping("/refreshCache")
  128 + public AjaxResult refreshCache()
  129 + {
  130 + configService.resetConfigCache();
  131 + return success();
  132 + }
  133 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java 0 → 100644
  1 +package com.ruoyi.web.controller.system;
  2 +
  3 +import java.util.List;
  4 +import org.apache.commons.lang3.ArrayUtils;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.security.access.prepost.PreAuthorize;
  7 +import org.springframework.validation.annotation.Validated;
  8 +import org.springframework.web.bind.annotation.DeleteMapping;
  9 +import org.springframework.web.bind.annotation.GetMapping;
  10 +import org.springframework.web.bind.annotation.PathVariable;
  11 +import org.springframework.web.bind.annotation.PostMapping;
  12 +import org.springframework.web.bind.annotation.PutMapping;
  13 +import org.springframework.web.bind.annotation.RequestBody;
  14 +import org.springframework.web.bind.annotation.RequestMapping;
  15 +import org.springframework.web.bind.annotation.RestController;
  16 +import com.ruoyi.common.annotation.Log;
  17 +import com.ruoyi.common.constant.UserConstants;
  18 +import com.ruoyi.common.core.controller.BaseController;
  19 +import com.ruoyi.common.core.domain.AjaxResult;
  20 +import com.ruoyi.common.core.domain.entity.SysDept;
  21 +import com.ruoyi.common.enums.BusinessType;
  22 +import com.ruoyi.common.utils.StringUtils;
  23 +import com.ruoyi.system.service.ISysDeptService;
  24 +
  25 +/**
  26 + * 部门信息
  27 + *
  28 + * @author ruoyi
  29 + */
  30 +@RestController
  31 +@RequestMapping("/system/dept")
  32 +public class SysDeptController extends BaseController
  33 +{
  34 + @Autowired
  35 + private ISysDeptService deptService;
  36 +
  37 + /**
  38 + * 获取部门列表
  39 + */
  40 + @PreAuthorize("@ss.hasPermi('system:dept:list')")
  41 + @GetMapping("/list")
  42 + public AjaxResult list(SysDept dept)
  43 + {
  44 + List<SysDept> depts = deptService.selectDeptList(dept);
  45 + return success(depts);
  46 + }
  47 +
  48 + /**
  49 + * 查询部门列表(排除节点)
  50 + */
  51 + @PreAuthorize("@ss.hasPermi('system:dept:list')")
  52 + @GetMapping("/list/exclude/{deptId}")
  53 + public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
  54 + {
  55 + List<SysDept> depts = deptService.selectDeptList(new SysDept());
  56 + depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
  57 + return success(depts);
  58 + }
  59 +
  60 + /**
  61 + * 根据部门编号获取详细信息
  62 + */
  63 + @PreAuthorize("@ss.hasPermi('system:dept:query')")
  64 + @GetMapping(value = "/{deptId}")
  65 + public AjaxResult getInfo(@PathVariable Long deptId)
  66 + {
  67 + deptService.checkDeptDataScope(deptId);
  68 + return success(deptService.selectDeptById(deptId));
  69 + }
  70 +
  71 + /**
  72 + * 新增部门
  73 + */
  74 + @PreAuthorize("@ss.hasPermi('system:dept:add')")
  75 + @Log(title = "部门管理", businessType = BusinessType.INSERT)
  76 + @PostMapping
  77 + public AjaxResult add(@Validated @RequestBody SysDept dept)
  78 + {
  79 + if (!deptService.checkDeptNameUnique(dept))
  80 + {
  81 + return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
  82 + }
  83 + dept.setCreateBy(getUsername());
  84 + return toAjax(deptService.insertDept(dept));
  85 + }
  86 +
  87 + /**
  88 + * 修改部门
  89 + */
  90 + @PreAuthorize("@ss.hasPermi('system:dept:edit')")
  91 + @Log(title = "部门管理", businessType = BusinessType.UPDATE)
  92 + @PutMapping
  93 + public AjaxResult edit(@Validated @RequestBody SysDept dept)
  94 + {
  95 + Long deptId = dept.getDeptId();
  96 + deptService.checkDeptDataScope(deptId);
  97 + if (!deptService.checkDeptNameUnique(dept))
  98 + {
  99 + return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
  100 + }
  101 + else if (dept.getParentId().equals(deptId))
  102 + {
  103 + return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
  104 + }
  105 + else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
  106 + {
  107 + return error("该部门包含未停用的子部门!");
  108 + }
  109 + dept.setUpdateBy(getUsername());
  110 + return toAjax(deptService.updateDept(dept));
  111 + }
  112 +
  113 + /**
  114 + * 删除部门
  115 + */
  116 + @PreAuthorize("@ss.hasPermi('system:dept:remove')")
  117 + @Log(title = "部门管理", businessType = BusinessType.DELETE)
  118 + @DeleteMapping("/{deptId}")
  119 + public AjaxResult remove(@PathVariable Long deptId)
  120 + {
  121 + if (deptService.hasChildByDeptId(deptId))
  122 + {
  123 + return warn("存在下级部门,不允许删除");
  124 + }
  125 + if (deptService.checkDeptExistUser(deptId))
  126 + {
  127 + return warn("部门存在用户,不允许删除");
  128 + }
  129 + deptService.checkDeptDataScope(deptId);
  130 + return toAjax(deptService.deleteDeptById(deptId));
  131 + }
  132 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java 0 → 100644
  1 +package com.ruoyi.web.controller.system;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +import javax.servlet.http.HttpServletResponse;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.security.access.prepost.PreAuthorize;
  8 +import org.springframework.validation.annotation.Validated;
  9 +import org.springframework.web.bind.annotation.DeleteMapping;
  10 +import org.springframework.web.bind.annotation.GetMapping;
  11 +import org.springframework.web.bind.annotation.PathVariable;
  12 +import org.springframework.web.bind.annotation.PostMapping;
  13 +import org.springframework.web.bind.annotation.PutMapping;
  14 +import org.springframework.web.bind.annotation.RequestBody;
  15 +import org.springframework.web.bind.annotation.RequestMapping;
  16 +import org.springframework.web.bind.annotation.RestController;
  17 +import com.ruoyi.common.annotation.Log;
  18 +import com.ruoyi.common.core.controller.BaseController;
  19 +import com.ruoyi.common.core.domain.AjaxResult;
  20 +import com.ruoyi.common.core.domain.entity.SysDictData;
  21 +import com.ruoyi.common.core.page.TableDataInfo;
  22 +import com.ruoyi.common.enums.BusinessType;
  23 +import com.ruoyi.common.utils.StringUtils;
  24 +import com.ruoyi.common.utils.poi.ExcelUtil;
  25 +import com.ruoyi.system.service.ISysDictDataService;
  26 +import com.ruoyi.system.service.ISysDictTypeService;
  27 +
  28 +/**
  29 + * 数据字典信息
  30 + *
  31 + * @author ruoyi
  32 + */
  33 +@RestController
  34 +@RequestMapping("/system/dict/data")
  35 +public class SysDictDataController extends BaseController
  36 +{
  37 + @Autowired
  38 + private ISysDictDataService dictDataService;
  39 +
  40 + @Autowired
  41 + private ISysDictTypeService dictTypeService;
  42 +
  43 + @PreAuthorize("@ss.hasPermi('system:dict:list')")
  44 + @GetMapping("/list")
  45 + public TableDataInfo list(SysDictData dictData)
  46 + {
  47 + startPage();
  48 + List<SysDictData> list = dictDataService.selectDictDataList(dictData);
  49 + return getDataTable(list);
  50 + }
  51 +
  52 + @Log(title = "字典数据", businessType = BusinessType.EXPORT)
  53 + @PreAuthorize("@ss.hasPermi('system:dict:export')")
  54 + @PostMapping("/export")
  55 + public void export(HttpServletResponse response, SysDictData dictData)
  56 + {
  57 + List<SysDictData> list = dictDataService.selectDictDataList(dictData);
  58 + ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
  59 + util.exportExcel(response, list, "字典数据");
  60 + }
  61 +
  62 + /**
  63 + * 查询字典数据详细
  64 + */
  65 + @PreAuthorize("@ss.hasPermi('system:dict:query')")
  66 + @GetMapping(value = "/{dictCode}")
  67 + public AjaxResult getInfo(@PathVariable Long dictCode)
  68 + {
  69 + return success(dictDataService.selectDictDataById(dictCode));
  70 + }
  71 +
  72 + /**
  73 + * 根据字典类型查询字典数据信息
  74 + */
  75 + @GetMapping(value = "/type/{dictType}")
  76 + public AjaxResult dictType(@PathVariable String dictType)
  77 + {
  78 + List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
  79 + if (StringUtils.isNull(data))
  80 + {
  81 + data = new ArrayList<SysDictData>();
  82 + }
  83 + return success(data);
  84 + }
  85 +
  86 + /**
  87 + * 新增字典类型
  88 + */
  89 + @PreAuthorize("@ss.hasPermi('system:dict:add')")
  90 + @Log(title = "字典数据", businessType = BusinessType.INSERT)
  91 + @PostMapping
  92 + public AjaxResult add(@Validated @RequestBody SysDictData dict)
  93 + {
  94 + dict.setCreateBy(getUsername());
  95 + return toAjax(dictDataService.insertDictData(dict));
  96 + }
  97 +
  98 + /**
  99 + * 修改保存字典类型
  100 + */
  101 + @PreAuthorize("@ss.hasPermi('system:dict:edit')")
  102 + @Log(title = "字典数据", businessType = BusinessType.UPDATE)
  103 + @PutMapping
  104 + public AjaxResult edit(@Validated @RequestBody SysDictData dict)
  105 + {
  106 + dict.setUpdateBy(getUsername());
  107 + return toAjax(dictDataService.updateDictData(dict));
  108 + }
  109 +
  110 + /**
  111 + * 删除字典类型
  112 + */
  113 + @PreAuthorize("@ss.hasPermi('system:dict:remove')")
  114 + @Log(title = "字典类型", businessType = BusinessType.DELETE)
  115 + @DeleteMapping("/{dictCodes}")
  116 + public AjaxResult remove(@PathVariable Long[] dictCodes)
  117 + {
  118 + dictDataService.deleteDictDataByIds(dictCodes);
  119 + return success();
  120 + }
  121 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java 0 → 100644
  1 +package com.ruoyi.web.controller.system;
  2 +
  3 +import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.security.access.prepost.PreAuthorize;
  7 +import org.springframework.validation.annotation.Validated;
  8 +import org.springframework.web.bind.annotation.DeleteMapping;
  9 +import org.springframework.web.bind.annotation.GetMapping;
  10 +import org.springframework.web.bind.annotation.PathVariable;
  11 +import org.springframework.web.bind.annotation.PostMapping;
  12 +import org.springframework.web.bind.annotation.PutMapping;
  13 +import org.springframework.web.bind.annotation.RequestBody;
  14 +import org.springframework.web.bind.annotation.RequestMapping;
  15 +import org.springframework.web.bind.annotation.RestController;
  16 +import com.ruoyi.common.annotation.Log;
  17 +import com.ruoyi.common.core.controller.BaseController;
  18 +import com.ruoyi.common.core.domain.AjaxResult;
  19 +import com.ruoyi.common.core.domain.entity.SysDictType;
  20 +import com.ruoyi.common.core.page.TableDataInfo;
  21 +import com.ruoyi.common.enums.BusinessType;
  22 +import com.ruoyi.common.utils.poi.ExcelUtil;
  23 +import com.ruoyi.system.service.ISysDictTypeService;
  24 +
  25 +/**
  26 + * 数据字典信息
  27 + *
  28 + * @author ruoyi
  29 + */
  30 +@RestController
  31 +@RequestMapping("/system/dict/type")
  32 +public class SysDictTypeController extends BaseController
  33 +{
  34 + @Autowired
  35 + private ISysDictTypeService dictTypeService;
  36 +
  37 + @PreAuthorize("@ss.hasPermi('system:dict:list')")
  38 + @GetMapping("/list")
  39 + public TableDataInfo list(SysDictType dictType)
  40 + {
  41 + startPage();
  42 + List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
  43 + return getDataTable(list);
  44 + }
  45 +
  46 + @Log(title = "字典类型", businessType = BusinessType.EXPORT)
  47 + @PreAuthorize("@ss.hasPermi('system:dict:export')")
  48 + @PostMapping("/export")
  49 + public void export(HttpServletResponse response, SysDictType dictType)
  50 + {
  51 + List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
  52 + ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
  53 + util.exportExcel(response, list, "字典类型");
  54 + }
  55 +
  56 + /**
  57 + * 查询字典类型详细
  58 + */
  59 + @PreAuthorize("@ss.hasPermi('system:dict:query')")
  60 + @GetMapping(value = "/{dictId}")
  61 + public AjaxResult getInfo(@PathVariable Long dictId)
  62 + {
  63 + return success(dictTypeService.selectDictTypeById(dictId));
  64 + }
  65 +
  66 + /**
  67 + * 新增字典类型
  68 + */
  69 + @PreAuthorize("@ss.hasPermi('system:dict:add')")
  70 + @Log(title = "字典类型", businessType = BusinessType.INSERT)
  71 + @PostMapping
  72 + public AjaxResult add(@Validated @RequestBody SysDictType dict)
  73 + {
  74 + if (!dictTypeService.checkDictTypeUnique(dict))
  75 + {
  76 + return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
  77 + }
  78 + dict.setCreateBy(getUsername());
  79 + return toAjax(dictTypeService.insertDictType(dict));
  80 + }
  81 +
  82 + /**
  83 + * 修改字典类型
  84 + */
  85 + @PreAuthorize("@ss.hasPermi('system:dict:edit')")
  86 + @Log(title = "字典类型", businessType = BusinessType.UPDATE)
  87 + @PutMapping
  88 + public AjaxResult edit(@Validated @RequestBody SysDictType dict)
  89 + {
  90 + if (!dictTypeService.checkDictTypeUnique(dict))
  91 + {
  92 + return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
  93 + }
  94 + dict.setUpdateBy(getUsername());
  95 + return toAjax(dictTypeService.updateDictType(dict));
  96 + }
  97 +
  98 + /**
  99 + * 删除字典类型
  100 + */
  101 + @PreAuthorize("@ss.hasPermi('system:dict:remove')")
  102 + @Log(title = "字典类型", businessType = BusinessType.DELETE)
  103 + @DeleteMapping("/{dictIds}")
  104 + public AjaxResult remove(@PathVariable Long[] dictIds)
  105 + {
  106 + dictTypeService.deleteDictTypeByIds(dictIds);
  107 + return success();
  108 + }
  109 +
  110 + /**
  111 + * 刷新字典缓存
  112 + */
  113 + @PreAuthorize("@ss.hasPermi('system:dict:remove')")
  114 + @Log(title = "字典类型", businessType = BusinessType.CLEAN)
  115 + @DeleteMapping("/refreshCache")
  116 + public AjaxResult refreshCache()
  117 + {
  118 + dictTypeService.resetDictCache();
  119 + return success();
  120 + }
  121 +
  122 + /**
  123 + * 获取字典选择框列表
  124 + */
  125 + @GetMapping("/optionselect")
  126 + public AjaxResult optionselect()
  127 + {
  128 + List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
  129 + return success(dictTypes);
  130 + }
  131 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java 0 → 100644
  1 +package com.ruoyi.web.controller.system;
  2 +
  3 +import org.springframework.beans.factory.annotation.Autowired;
  4 +import org.springframework.web.bind.annotation.RequestMapping;
  5 +import org.springframework.web.bind.annotation.RestController;
  6 +import com.ruoyi.common.config.RuoYiConfig;
  7 +import com.ruoyi.common.utils.StringUtils;
  8 +
  9 +/**
  10 + * 首页
  11 + *
  12 + * @author ruoyi
  13 + */
  14 +@RestController
  15 +public class SysIndexController
  16 +{
  17 + /** 系统基础配置 */
  18 + @Autowired
  19 + private RuoYiConfig ruoyiConfig;
  20 +
  21 + /**
  22 + * 访问首页,提示语
  23 + */
  24 + @RequestMapping("/")
  25 + public String index()
  26 + {
  27 + return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
  28 + }
  29 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java 0 → 100644
  1 +package com.ruoyi.web.controller.system;
  2 +
  3 +import java.util.List;
  4 +import java.util.Set;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.web.bind.annotation.GetMapping;
  7 +import org.springframework.web.bind.annotation.PostMapping;
  8 +import org.springframework.web.bind.annotation.RequestBody;
  9 +import org.springframework.web.bind.annotation.RestController;
  10 +import com.ruoyi.common.constant.Constants;
  11 +import com.ruoyi.common.core.domain.AjaxResult;
  12 +import com.ruoyi.common.core.domain.entity.SysMenu;
  13 +import com.ruoyi.common.core.domain.entity.SysUser;
  14 +import com.ruoyi.common.core.domain.model.LoginBody;
  15 +import com.ruoyi.common.utils.SecurityUtils;
  16 +import com.ruoyi.framework.web.service.SysLoginService;
  17 +import com.ruoyi.framework.web.service.SysPermissionService;
  18 +import com.ruoyi.system.service.ISysMenuService;
  19 +
  20 +/**
  21 + * 登录验证
  22 + *
  23 + * @author ruoyi
  24 + */
  25 +@RestController
  26 +public class SysLoginController
  27 +{
  28 + @Autowired
  29 + private SysLoginService loginService;
  30 +
  31 + @Autowired
  32 + private ISysMenuService menuService;
  33 +
  34 + @Autowired
  35 + private SysPermissionService permissionService;
  36 +
  37 + /**
  38 + * 登录方法
  39 + *
  40 + * @param loginBody 登录信息
  41 + * @return 结果
  42 + */
  43 + @PostMapping("/login")
  44 + public AjaxResult login(@RequestBody LoginBody loginBody)
  45 + {
  46 + AjaxResult ajax = AjaxResult.success();
  47 + // 生成令牌
  48 + String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
  49 + loginBody.getUuid());
  50 + ajax.put(Constants.TOKEN, token);
  51 + return ajax;
  52 + }
  53 +
  54 + /**
  55 + * 获取用户信息
  56 + *
  57 + * @return 用户信息
  58 + */
  59 + @GetMapping("getInfo")
  60 + public AjaxResult getInfo()
  61 + {
  62 + SysUser user = SecurityUtils.getLoginUser().getUser();
  63 + // 角色集合
  64 + Set<String> roles = permissionService.getRolePermission(user);
  65 + // 权限集合
  66 + Set<String> permissions = permissionService.getMenuPermission(user);
  67 + AjaxResult ajax = AjaxResult.success();
  68 + ajax.put("user", user);
  69 + ajax.put("roles", roles);
  70 + ajax.put("permissions", permissions);
  71 + return ajax;
  72 + }
  73 +
  74 + /**
  75 + * 获取路由信息
  76 + *
  77 + * @return 路由信息
  78 + */
  79 + @GetMapping("getRouters")
  80 + public AjaxResult getRouters()
  81 + {
  82 + Long userId = SecurityUtils.getUserId();
  83 + List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
  84 + return AjaxResult.success(menuService.buildMenus(menus));
  85 + }
  86 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java 0 → 100644
  1 +package com.ruoyi.web.controller.system;
  2 +
  3 +import java.util.List;
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +import org.springframework.security.access.prepost.PreAuthorize;
  6 +import org.springframework.validation.annotation.Validated;
  7 +import org.springframework.web.bind.annotation.DeleteMapping;
  8 +import org.springframework.web.bind.annotation.GetMapping;
  9 +import org.springframework.web.bind.annotation.PathVariable;
  10 +import org.springframework.web.bind.annotation.PostMapping;
  11 +import org.springframework.web.bind.annotation.PutMapping;
  12 +import org.springframework.web.bind.annotation.RequestBody;
  13 +import org.springframework.web.bind.annotation.RequestMapping;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +import com.ruoyi.common.annotation.Log;
  16 +import com.ruoyi.common.constant.UserConstants;
  17 +import com.ruoyi.common.core.controller.BaseController;
  18 +import com.ruoyi.common.core.domain.AjaxResult;
  19 +import com.ruoyi.common.core.domain.entity.SysMenu;
  20 +import com.ruoyi.common.enums.BusinessType;
  21 +import com.ruoyi.common.utils.StringUtils;
  22 +import com.ruoyi.system.service.ISysMenuService;
  23 +
  24 +/**
  25 + * 菜单信息
  26 + *
  27 + * @author ruoyi
  28 + */
  29 +@RestController
  30 +@RequestMapping("/system/menu")
  31 +public class SysMenuController extends BaseController
  32 +{
  33 + @Autowired
  34 + private ISysMenuService menuService;
  35 +
  36 + /**
  37 + * 获取菜单列表
  38 + */
  39 + @PreAuthorize("@ss.hasPermi('system:menu:list')")
  40 + @GetMapping("/list")
  41 + public AjaxResult list(SysMenu menu)
  42 + {
  43 + List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
  44 + return success(menus);
  45 + }
  46 +
  47 + /**
  48 + * 根据菜单编号获取详细信息
  49 + */
  50 + @PreAuthorize("@ss.hasPermi('system:menu:query')")
  51 + @GetMapping(value = "/{menuId}")
  52 + public AjaxResult getInfo(@PathVariable Long menuId)
  53 + {
  54 + return success(menuService.selectMenuById(menuId));
  55 + }
  56 +
  57 + /**
  58 + * 获取菜单下拉树列表
  59 + */
  60 + @GetMapping("/treeselect")
  61 + public AjaxResult treeselect(SysMenu menu)
  62 + {
  63 + List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
  64 + return success(menuService.buildMenuTreeSelect(menus));
  65 + }
  66 +
  67 + /**
  68 + * 加载对应角色菜单列表树
  69 + */
  70 + @GetMapping(value = "/roleMenuTreeselect/{roleId}")
  71 + public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
  72 + {
  73 + List<SysMenu> menus = menuService.selectMenuList(getUserId());
  74 + AjaxResult ajax = AjaxResult.success();
  75 + ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
  76 + ajax.put("menus", menuService.buildMenuTreeSelect(menus));
  77 + return ajax;
  78 + }
  79 +
  80 + /**
  81 + * 新增菜单
  82 + */
  83 + @PreAuthorize("@ss.hasPermi('system:menu:add')")
  84 + @Log(title = "菜单管理", businessType = BusinessType.INSERT)
  85 + @PostMapping
  86 + public AjaxResult add(@Validated @RequestBody SysMenu menu)
  87 + {
  88 + if (!menuService.checkMenuNameUnique(menu))
  89 + {
  90 + return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
  91 + }
  92 + else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
  93 + {
  94 + return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
  95 + }
  96 + menu.setCreateBy(getUsername());
  97 + return toAjax(menuService.insertMenu(menu));
  98 + }
  99 +
  100 + /**
  101 + * 修改菜单
  102 + */
  103 + @PreAuthorize("@ss.hasPermi('system:menu:edit')")
  104 + @Log(title = "菜单管理", businessType = BusinessType.UPDATE)
  105 + @PutMapping
  106 + public AjaxResult edit(@Validated @RequestBody SysMenu menu)
  107 + {
  108 + if (!menuService.checkMenuNameUnique(menu))
  109 + {
  110 + return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
  111 + }
  112 + else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
  113 + {
  114 + return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
  115 + }
  116 + else if (menu.getMenuId().equals(menu.getParentId()))
  117 + {
  118 + return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
  119 + }
  120 + menu.setUpdateBy(getUsername());
  121 + return toAjax(menuService.updateMenu(menu));
  122 + }
  123 +
  124 + /**
  125 + * 删除菜单
  126 + */
  127 + @PreAuthorize("@ss.hasPermi('system:menu:remove')")
  128 + @Log(title = "菜单管理", businessType = BusinessType.DELETE)
  129 + @DeleteMapping("/{menuId}")
  130 + public AjaxResult remove(@PathVariable("menuId") Long menuId)
  131 + {
  132 + if (menuService.hasChildByMenuId(menuId))
  133 + {
  134 + return warn("存在子菜单,不允许删除");
  135 + }
  136 + if (menuService.checkMenuExistRole(menuId))
  137 + {
  138 + return warn("菜单已分配,不允许删除");
  139 + }
  140 + return toAjax(menuService.deleteMenuById(menuId));
  141 + }
  142 +}
0 \ No newline at end of file 143 \ No newline at end of file
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java 0 → 100644
  1 +package com.ruoyi.web.controller.system;
  2 +
  3 +import java.util.List;
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +import org.springframework.security.access.prepost.PreAuthorize;
  6 +import org.springframework.validation.annotation.Validated;
  7 +import org.springframework.web.bind.annotation.DeleteMapping;
  8 +import org.springframework.web.bind.annotation.GetMapping;
  9 +import org.springframework.web.bind.annotation.PathVariable;
  10 +import org.springframework.web.bind.annotation.PostMapping;
  11 +import org.springframework.web.bind.annotation.PutMapping;
  12 +import org.springframework.web.bind.annotation.RequestBody;
  13 +import org.springframework.web.bind.annotation.RequestMapping;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +import com.ruoyi.common.annotation.Log;
  16 +import com.ruoyi.common.core.controller.BaseController;
  17 +import com.ruoyi.common.core.domain.AjaxResult;
  18 +import com.ruoyi.common.core.page.TableDataInfo;
  19 +import com.ruoyi.common.enums.BusinessType;
  20 +import com.ruoyi.system.domain.SysNotice;
  21 +import com.ruoyi.system.service.ISysNoticeService;
  22 +
  23 +/**
  24 + * 公告 信息操作处理
  25 + *
  26 + * @author ruoyi
  27 + */
  28 +@RestController
  29 +@RequestMapping("/system/notice")
  30 +public class SysNoticeController extends BaseController
  31 +{
  32 + @Autowired
  33 + private ISysNoticeService noticeService;
  34 +
  35 + /**
  36 + * 获取通知公告列表
  37 + */
  38 + @PreAuthorize("@ss.hasPermi('system:notice:list')")
  39 + @GetMapping("/list")
  40 + public TableDataInfo list(SysNotice notice)
  41 + {
  42 + startPage();
  43 + List<SysNotice> list = noticeService.selectNoticeList(notice);
  44 + return getDataTable(list);
  45 + }
  46 +
  47 + /**
  48 + * 根据通知公告编号获取详细信息
  49 + */
  50 + @PreAuthorize("@ss.hasPermi('system:notice:query')")
  51 + @GetMapping(value = "/{noticeId}")
  52 + public AjaxResult getInfo(@PathVariable Long noticeId)
  53 + {
  54 + return success(noticeService.selectNoticeById(noticeId));
  55 + }
  56 +
  57 + /**
  58 + * 新增通知公告
  59 + */
  60 + @PreAuthorize("@ss.hasPermi('system:notice:add')")
  61 + @Log(title = "通知公告", businessType = BusinessType.INSERT)
  62 + @PostMapping
  63 + public AjaxResult add(@Validated @RequestBody SysNotice notice)
  64 + {
  65 + notice.setCreateBy(getUsername());
  66 + return toAjax(noticeService.insertNotice(notice));
  67 + }
  68 +
  69 + /**
  70 + * 修改通知公告
  71 + */
  72 + @PreAuthorize("@ss.hasPermi('system:notice:edit')")
  73 + @Log(title = "通知公告", businessType = BusinessType.UPDATE)
  74 + @PutMapping
  75 + public AjaxResult edit(@Validated @RequestBody SysNotice notice)
  76 + {
  77 + notice.setUpdateBy(getUsername());
  78 + return toAjax(noticeService.updateNotice(notice));
  79 + }
  80 +
  81 + /**
  82 + * 删除通知公告
  83 + */
  84 + @PreAuthorize("@ss.hasPermi('system:notice:remove')")
  85 + @Log(title = "通知公告", businessType = BusinessType.DELETE)
  86 + @DeleteMapping("/{noticeIds}")
  87 + public AjaxResult remove(@PathVariable Long[] noticeIds)
  88 + {
  89 + return toAjax(noticeService.deleteNoticeByIds(noticeIds));
  90 + }
  91 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java 0 → 100644
  1 +package com.ruoyi.web.controller.system;
  2 +
  3 +import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.security.access.prepost.PreAuthorize;
  7 +import org.springframework.validation.annotation.Validated;
  8 +import org.springframework.web.bind.annotation.DeleteMapping;
  9 +import org.springframework.web.bind.annotation.GetMapping;
  10 +import org.springframework.web.bind.annotation.PathVariable;
  11 +import org.springframework.web.bind.annotation.PostMapping;
  12 +import org.springframework.web.bind.annotation.PutMapping;
  13 +import org.springframework.web.bind.annotation.RequestBody;
  14 +import org.springframework.web.bind.annotation.RequestMapping;
  15 +import org.springframework.web.bind.annotation.RestController;
  16 +import com.ruoyi.common.annotation.Log;
  17 +import com.ruoyi.common.core.controller.BaseController;
  18 +import com.ruoyi.common.core.domain.AjaxResult;
  19 +import com.ruoyi.common.core.page.TableDataInfo;
  20 +import com.ruoyi.common.enums.BusinessType;
  21 +import com.ruoyi.common.utils.poi.ExcelUtil;
  22 +import com.ruoyi.system.domain.SysPost;
  23 +import com.ruoyi.system.service.ISysPostService;
  24 +
  25 +/**
  26 + * 岗位信息操作处理
  27 + *
  28 + * @author ruoyi
  29 + */
  30 +@RestController
  31 +@RequestMapping("/system/post")
  32 +public class SysPostController extends BaseController
  33 +{
  34 + @Autowired
  35 + private ISysPostService postService;
  36 +
  37 + /**
  38 + * 获取岗位列表
  39 + */
  40 + @PreAuthorize("@ss.hasPermi('system:post:list')")
  41 + @GetMapping("/list")
  42 + public TableDataInfo list(SysPost post)
  43 + {
  44 + startPage();
  45 + List<SysPost> list = postService.selectPostList(post);
  46 + return getDataTable(list);
  47 + }
  48 +
  49 + @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
  50 + @PreAuthorize("@ss.hasPermi('system:post:export')")
  51 + @PostMapping("/export")
  52 + public void export(HttpServletResponse response, SysPost post)
  53 + {
  54 + List<SysPost> list = postService.selectPostList(post);
  55 + ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
  56 + util.exportExcel(response, list, "岗位数据");
  57 + }
  58 +
  59 + /**
  60 + * 根据岗位编号获取详细信息
  61 + */
  62 + @PreAuthorize("@ss.hasPermi('system:post:query')")
  63 + @GetMapping(value = "/{postId}")
  64 + public AjaxResult getInfo(@PathVariable Long postId)
  65 + {
  66 + return success(postService.selectPostById(postId));
  67 + }
  68 +
  69 + /**
  70 + * 新增岗位
  71 + */
  72 + @PreAuthorize("@ss.hasPermi('system:post:add')")
  73 + @Log(title = "岗位管理", businessType = BusinessType.INSERT)
  74 + @PostMapping
  75 + public AjaxResult add(@Validated @RequestBody SysPost post)
  76 + {
  77 + if (!postService.checkPostNameUnique(post))
  78 + {
  79 + return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
  80 + }
  81 + else if (!postService.checkPostCodeUnique(post))
  82 + {
  83 + return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
  84 + }
  85 + post.setCreateBy(getUsername());
  86 + return toAjax(postService.insertPost(post));
  87 + }
  88 +
  89 + /**
  90 + * 修改岗位
  91 + */
  92 + @PreAuthorize("@ss.hasPermi('system:post:edit')")
  93 + @Log(title = "岗位管理", businessType = BusinessType.UPDATE)
  94 + @PutMapping
  95 + public AjaxResult edit(@Validated @RequestBody SysPost post)
  96 + {
  97 + if (!postService.checkPostNameUnique(post))
  98 + {
  99 + return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
  100 + }
  101 + else if (!postService.checkPostCodeUnique(post))
  102 + {
  103 + return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
  104 + }
  105 + post.setUpdateBy(getUsername());
  106 + return toAjax(postService.updatePost(post));
  107 + }
  108 +
  109 + /**
  110 + * 删除岗位
  111 + */
  112 + @PreAuthorize("@ss.hasPermi('system:post:remove')")
  113 + @Log(title = "岗位管理", businessType = BusinessType.DELETE)
  114 + @DeleteMapping("/{postIds}")
  115 + public AjaxResult remove(@PathVariable Long[] postIds)
  116 + {
  117 + return toAjax(postService.deletePostByIds(postIds));
  118 + }
  119 +
  120 + /**
  121 + * 获取岗位选择框列表
  122 + */
  123 + @GetMapping("/optionselect")
  124 + public AjaxResult optionselect()
  125 + {
  126 + List<SysPost> posts = postService.selectPostAll();
  127 + return success(posts);
  128 + }
  129 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java 0 → 100644
  1 +package com.ruoyi.web.controller.system;
  2 +
  3 +import org.springframework.beans.factory.annotation.Autowired;
  4 +import org.springframework.web.bind.annotation.GetMapping;
  5 +import org.springframework.web.bind.annotation.PostMapping;
  6 +import org.springframework.web.bind.annotation.PutMapping;
  7 +import org.springframework.web.bind.annotation.RequestBody;
  8 +import org.springframework.web.bind.annotation.RequestMapping;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +import org.springframework.web.multipart.MultipartFile;
  12 +import com.ruoyi.common.annotation.Log;
  13 +import com.ruoyi.common.config.RuoYiConfig;
  14 +import com.ruoyi.common.core.controller.BaseController;
  15 +import com.ruoyi.common.core.domain.AjaxResult;
  16 +import com.ruoyi.common.core.domain.entity.SysUser;
  17 +import com.ruoyi.common.core.domain.model.LoginUser;
  18 +import com.ruoyi.common.enums.BusinessType;
  19 +import com.ruoyi.common.utils.SecurityUtils;
  20 +import com.ruoyi.common.utils.StringUtils;
  21 +import com.ruoyi.common.utils.file.FileUploadUtils;
  22 +import com.ruoyi.common.utils.file.MimeTypeUtils;
  23 +import com.ruoyi.framework.web.service.TokenService;
  24 +import com.ruoyi.system.service.ISysUserService;
  25 +
  26 +/**
  27 + * 个人信息 业务处理
  28 + *
  29 + * @author ruoyi
  30 + */
  31 +@RestController
  32 +@RequestMapping("/system/user/profile")
  33 +public class SysProfileController extends BaseController
  34 +{
  35 + @Autowired
  36 + private ISysUserService userService;
  37 +
  38 + @Autowired
  39 + private TokenService tokenService;
  40 +
  41 + /**
  42 + * 个人信息
  43 + */
  44 + @GetMapping
  45 + public AjaxResult profile()
  46 + {
  47 + LoginUser loginUser = getLoginUser();
  48 + SysUser user = loginUser.getUser();
  49 + AjaxResult ajax = AjaxResult.success(user);
  50 + ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
  51 + ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
  52 + return ajax;
  53 + }
  54 +
  55 + /**
  56 + * 修改用户
  57 + */
  58 + @Log(title = "个人信息", businessType = BusinessType.UPDATE)
  59 + @PutMapping
  60 + public AjaxResult updateProfile(@RequestBody SysUser user)
  61 + {
  62 + LoginUser loginUser = getLoginUser();
  63 + SysUser sysUser = loginUser.getUser();
  64 + user.setUserName(sysUser.getUserName());
  65 + if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
  66 + {
  67 + return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
  68 + }
  69 + if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
  70 + {
  71 + return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
  72 + }
  73 + user.setUserId(sysUser.getUserId());
  74 + user.setPassword(null);
  75 + user.setAvatar(null);
  76 + user.setDeptId(null);
  77 + if (userService.updateUserProfile(user) > 0)
  78 + {
  79 + // 更新缓存用户信息
  80 + sysUser.setNickName(user.getNickName());
  81 + sysUser.setPhonenumber(user.getPhonenumber());
  82 + sysUser.setEmail(user.getEmail());
  83 + sysUser.setSex(user.getSex());
  84 + tokenService.setLoginUser(loginUser);
  85 + return success();
  86 + }
  87 + return error("修改个人信息异常,请联系管理员");
  88 + }
  89 +
  90 + /**
  91 + * 重置密码
  92 + */
  93 + @Log(title = "个人信息", businessType = BusinessType.UPDATE)
  94 + @PutMapping("/updatePwd")
  95 + public AjaxResult updatePwd(String oldPassword, String newPassword)
  96 + {
  97 + LoginUser loginUser = getLoginUser();
  98 + String userName = loginUser.getUsername();
  99 + String password = loginUser.getPassword();
  100 + if (!SecurityUtils.matchesPassword(oldPassword, password))
  101 + {
  102 + return error("修改密码失败,旧密码错误");
  103 + }
  104 + if (SecurityUtils.matchesPassword(newPassword, password))
  105 + {
  106 + return error("新密码不能与旧密码相同");
  107 + }
  108 + if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
  109 + {
  110 + // 更新缓存用户密码
  111 + loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
  112 + tokenService.setLoginUser(loginUser);
  113 + return success();
  114 + }
  115 + return error("修改密码异常,请联系管理员");
  116 + }
  117 +
  118 + /**
  119 + * 头像上传
  120 + */
  121 + @Log(title = "用户头像", businessType = BusinessType.UPDATE)
  122 + @PostMapping("/avatar")
  123 + public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
  124 + {
  125 + if (!file.isEmpty())
  126 + {
  127 + LoginUser loginUser = getLoginUser();
  128 + String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
  129 + if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
  130 + {
  131 + AjaxResult ajax = AjaxResult.success();
  132 + ajax.put("imgUrl", avatar);
  133 + // 更新缓存用户头像
  134 + loginUser.getUser().setAvatar(avatar);
  135 + tokenService.setLoginUser(loginUser);
  136 + return ajax;
  137 + }
  138 + }
  139 + return error("上传图片异常,请联系管理员");
  140 + }
  141 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java 0 → 100644
  1 +package com.ruoyi.web.controller.system;
  2 +
  3 +import org.springframework.beans.factory.annotation.Autowired;
  4 +import org.springframework.web.bind.annotation.PostMapping;
  5 +import org.springframework.web.bind.annotation.RequestBody;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +import com.ruoyi.common.core.controller.BaseController;
  8 +import com.ruoyi.common.core.domain.AjaxResult;
  9 +import com.ruoyi.common.core.domain.model.RegisterBody;
  10 +import com.ruoyi.common.utils.StringUtils;
  11 +import com.ruoyi.framework.web.service.SysRegisterService;
  12 +import com.ruoyi.system.service.ISysConfigService;
  13 +
  14 +/**
  15 + * 注册验证
  16 + *
  17 + * @author ruoyi
  18 + */
  19 +@RestController
  20 +public class SysRegisterController extends BaseController
  21 +{
  22 + @Autowired
  23 + private SysRegisterService registerService;
  24 +
  25 + @Autowired
  26 + private ISysConfigService configService;
  27 +
  28 + @PostMapping("/register")
  29 + public AjaxResult register(@RequestBody RegisterBody user)
  30 + {
  31 + if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
  32 + {
  33 + return error("当前系统没有开启注册功能!");
  34 + }
  35 + String msg = registerService.register(user);
  36 + return StringUtils.isEmpty(msg) ? success() : error(msg);
  37 + }
  38 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java 0 → 100644
  1 +package com.ruoyi.web.controller.system;
  2 +
  3 +import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.security.access.prepost.PreAuthorize;
  7 +import org.springframework.validation.annotation.Validated;
  8 +import org.springframework.web.bind.annotation.DeleteMapping;
  9 +import org.springframework.web.bind.annotation.GetMapping;
  10 +import org.springframework.web.bind.annotation.PathVariable;
  11 +import org.springframework.web.bind.annotation.PostMapping;
  12 +import org.springframework.web.bind.annotation.PutMapping;
  13 +import org.springframework.web.bind.annotation.RequestBody;
  14 +import org.springframework.web.bind.annotation.RequestMapping;
  15 +import org.springframework.web.bind.annotation.RestController;
  16 +import com.ruoyi.common.annotation.Log;
  17 +import com.ruoyi.common.core.controller.BaseController;
  18 +import com.ruoyi.common.core.domain.AjaxResult;
  19 +import com.ruoyi.common.core.domain.entity.SysDept;
  20 +import com.ruoyi.common.core.domain.entity.SysRole;
  21 +import com.ruoyi.common.core.domain.entity.SysUser;
  22 +import com.ruoyi.common.core.domain.model.LoginUser;
  23 +import com.ruoyi.common.core.page.TableDataInfo;
  24 +import com.ruoyi.common.enums.BusinessType;
  25 +import com.ruoyi.common.utils.StringUtils;
  26 +import com.ruoyi.common.utils.poi.ExcelUtil;
  27 +import com.ruoyi.framework.web.service.SysPermissionService;
  28 +import com.ruoyi.framework.web.service.TokenService;
  29 +import com.ruoyi.system.domain.SysUserRole;
  30 +import com.ruoyi.system.service.ISysDeptService;
  31 +import com.ruoyi.system.service.ISysRoleService;
  32 +import com.ruoyi.system.service.ISysUserService;
  33 +
  34 +/**
  35 + * 角色信息
  36 + *
  37 + * @author ruoyi
  38 + */
  39 +@RestController
  40 +@RequestMapping("/system/role")
  41 +public class SysRoleController extends BaseController
  42 +{
  43 + @Autowired
  44 + private ISysRoleService roleService;
  45 +
  46 + @Autowired
  47 + private TokenService tokenService;
  48 +
  49 + @Autowired
  50 + private SysPermissionService permissionService;
  51 +
  52 + @Autowired
  53 + private ISysUserService userService;
  54 +
  55 + @Autowired
  56 + private ISysDeptService deptService;
  57 +
  58 + @PreAuthorize("@ss.hasPermi('system:role:list')")
  59 + @GetMapping("/list")
  60 + public TableDataInfo list(SysRole role)
  61 + {
  62 + startPage();
  63 + List<SysRole> list = roleService.selectRoleList(role);
  64 + return getDataTable(list);
  65 + }
  66 +
  67 + @Log(title = "角色管理", businessType = BusinessType.EXPORT)
  68 + @PreAuthorize("@ss.hasPermi('system:role:export')")
  69 + @PostMapping("/export")
  70 + public void export(HttpServletResponse response, SysRole role)
  71 + {
  72 + List<SysRole> list = roleService.selectRoleList(role);
  73 + ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
  74 + util.exportExcel(response, list, "角色数据");
  75 + }
  76 +
  77 + /**
  78 + * 根据角色编号获取详细信息
  79 + */
  80 + @PreAuthorize("@ss.hasPermi('system:role:query')")
  81 + @GetMapping(value = "/{roleId}")
  82 + public AjaxResult getInfo(@PathVariable Long roleId)
  83 + {
  84 + roleService.checkRoleDataScope(roleId);
  85 + return success(roleService.selectRoleById(roleId));
  86 + }
  87 +
  88 + /**
  89 + * 新增角色
  90 + */
  91 + @PreAuthorize("@ss.hasPermi('system:role:add')")
  92 + @Log(title = "角色管理", businessType = BusinessType.INSERT)
  93 + @PostMapping
  94 + public AjaxResult add(@Validated @RequestBody SysRole role)
  95 + {
  96 + if (!roleService.checkRoleNameUnique(role))
  97 + {
  98 + return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
  99 + }
  100 + else if (!roleService.checkRoleKeyUnique(role))
  101 + {
  102 + return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
  103 + }
  104 + role.setCreateBy(getUsername());
  105 + return toAjax(roleService.insertRole(role));
  106 +
  107 + }
  108 +
  109 + /**
  110 + * 修改保存角色
  111 + */
  112 + @PreAuthorize("@ss.hasPermi('system:role:edit')")
  113 + @Log(title = "角色管理", businessType = BusinessType.UPDATE)
  114 + @PutMapping
  115 + public AjaxResult edit(@Validated @RequestBody SysRole role)
  116 + {
  117 + roleService.checkRoleAllowed(role);
  118 + roleService.checkRoleDataScope(role.getRoleId());
  119 + if (!roleService.checkRoleNameUnique(role))
  120 + {
  121 + return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
  122 + }
  123 + else if (!roleService.checkRoleKeyUnique(role))
  124 + {
  125 + return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
  126 + }
  127 + role.setUpdateBy(getUsername());
  128 +
  129 + if (roleService.updateRole(role) > 0)
  130 + {
  131 + // 更新缓存用户权限
  132 + LoginUser loginUser = getLoginUser();
  133 + if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
  134 + {
  135 + loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
  136 + loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
  137 + tokenService.setLoginUser(loginUser);
  138 + }
  139 + return success();
  140 + }
  141 + return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
  142 + }
  143 +
  144 + /**
  145 + * 修改保存数据权限
  146 + */
  147 + @PreAuthorize("@ss.hasPermi('system:role:edit')")
  148 + @Log(title = "角色管理", businessType = BusinessType.UPDATE)
  149 + @PutMapping("/dataScope")
  150 + public AjaxResult dataScope(@RequestBody SysRole role)
  151 + {
  152 + roleService.checkRoleAllowed(role);
  153 + roleService.checkRoleDataScope(role.getRoleId());
  154 + return toAjax(roleService.authDataScope(role));
  155 + }
  156 +
  157 + /**
  158 + * 状态修改
  159 + */
  160 + @PreAuthorize("@ss.hasPermi('system:role:edit')")
  161 + @Log(title = "角色管理", businessType = BusinessType.UPDATE)
  162 + @PutMapping("/changeStatus")
  163 + public AjaxResult changeStatus(@RequestBody SysRole role)
  164 + {
  165 + roleService.checkRoleAllowed(role);
  166 + roleService.checkRoleDataScope(role.getRoleId());
  167 + role.setUpdateBy(getUsername());
  168 + return toAjax(roleService.updateRoleStatus(role));
  169 + }
  170 +
  171 + /**
  172 + * 删除角色
  173 + */
  174 + @PreAuthorize("@ss.hasPermi('system:role:remove')")
  175 + @Log(title = "角色管理", businessType = BusinessType.DELETE)
  176 + @DeleteMapping("/{roleIds}")
  177 + public AjaxResult remove(@PathVariable Long[] roleIds)
  178 + {
  179 + return toAjax(roleService.deleteRoleByIds(roleIds));
  180 + }
  181 +
  182 + /**
  183 + * 获取角色选择框列表
  184 + */
  185 + @PreAuthorize("@ss.hasPermi('system:role:query')")
  186 + @GetMapping("/optionselect")
  187 + public AjaxResult optionselect()
  188 + {
  189 + return success(roleService.selectRoleAll());
  190 + }
  191 +
  192 + /**
  193 + * 查询已分配用户角色列表
  194 + */
  195 + @PreAuthorize("@ss.hasPermi('system:role:list')")
  196 + @GetMapping("/authUser/allocatedList")
  197 + public TableDataInfo allocatedList(SysUser user)
  198 + {
  199 + startPage();
  200 + List<SysUser> list = userService.selectAllocatedList(user);
  201 + return getDataTable(list);
  202 + }
  203 +
  204 + /**
  205 + * 查询未分配用户角色列表
  206 + */
  207 + @PreAuthorize("@ss.hasPermi('system:role:list')")
  208 + @GetMapping("/authUser/unallocatedList")
  209 + public TableDataInfo unallocatedList(SysUser user)
  210 + {
  211 + startPage();
  212 + List<SysUser> list = userService.selectUnallocatedList(user);
  213 + return getDataTable(list);
  214 + }
  215 +
  216 + /**
  217 + * 取消授权用户
  218 + */
  219 + @PreAuthorize("@ss.hasPermi('system:role:edit')")
  220 + @Log(title = "角色管理", businessType = BusinessType.GRANT)
  221 + @PutMapping("/authUser/cancel")
  222 + public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
  223 + {
  224 + return toAjax(roleService.deleteAuthUser(userRole));
  225 + }
  226 +
  227 + /**
  228 + * 批量取消授权用户
  229 + */
  230 + @PreAuthorize("@ss.hasPermi('system:role:edit')")
  231 + @Log(title = "角色管理", businessType = BusinessType.GRANT)
  232 + @PutMapping("/authUser/cancelAll")
  233 + public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
  234 + {
  235 + return toAjax(roleService.deleteAuthUsers(roleId, userIds));
  236 + }
  237 +
  238 + /**
  239 + * 批量选择用户授权
  240 + */
  241 + @PreAuthorize("@ss.hasPermi('system:role:edit')")
  242 + @Log(title = "角色管理", businessType = BusinessType.GRANT)
  243 + @PutMapping("/authUser/selectAll")
  244 + public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
  245 + {
  246 + roleService.checkRoleDataScope(roleId);
  247 + return toAjax(roleService.insertAuthUsers(roleId, userIds));
  248 + }
  249 +
  250 + /**
  251 + * 获取对应角色部门树列表
  252 + */
  253 + @PreAuthorize("@ss.hasPermi('system:role:query')")
  254 + @GetMapping(value = "/deptTree/{roleId}")
  255 + public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
  256 + {
  257 + AjaxResult ajax = AjaxResult.success();
  258 + ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
  259 + ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
  260 + return ajax;
  261 + }
  262 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java 0 → 100644
  1 +package com.ruoyi.web.controller.system;
  2 +
  3 +import java.util.List;
  4 +import java.util.stream.Collectors;
  5 +import javax.servlet.http.HttpServletResponse;
  6 +import org.apache.commons.lang3.ArrayUtils;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.security.access.prepost.PreAuthorize;
  9 +import org.springframework.validation.annotation.Validated;
  10 +import org.springframework.web.bind.annotation.DeleteMapping;
  11 +import org.springframework.web.bind.annotation.GetMapping;
  12 +import org.springframework.web.bind.annotation.PathVariable;
  13 +import org.springframework.web.bind.annotation.PostMapping;
  14 +import org.springframework.web.bind.annotation.PutMapping;
  15 +import org.springframework.web.bind.annotation.RequestBody;
  16 +import org.springframework.web.bind.annotation.RequestMapping;
  17 +import org.springframework.web.bind.annotation.RestController;
  18 +import org.springframework.web.multipart.MultipartFile;
  19 +import com.ruoyi.common.annotation.Log;
  20 +import com.ruoyi.common.core.controller.BaseController;
  21 +import com.ruoyi.common.core.domain.AjaxResult;
  22 +import com.ruoyi.common.core.domain.entity.SysDept;
  23 +import com.ruoyi.common.core.domain.entity.SysRole;
  24 +import com.ruoyi.common.core.domain.entity.SysUser;
  25 +import com.ruoyi.common.core.page.TableDataInfo;
  26 +import com.ruoyi.common.enums.BusinessType;
  27 +import com.ruoyi.common.utils.SecurityUtils;
  28 +import com.ruoyi.common.utils.StringUtils;
  29 +import com.ruoyi.common.utils.poi.ExcelUtil;
  30 +import com.ruoyi.system.service.ISysDeptService;
  31 +import com.ruoyi.system.service.ISysPostService;
  32 +import com.ruoyi.system.service.ISysRoleService;
  33 +import com.ruoyi.system.service.ISysUserService;
  34 +
  35 +/**
  36 + * 用户信息
  37 + *
  38 + * @author ruoyi
  39 + */
  40 +@RestController
  41 +@RequestMapping("/system/user")
  42 +public class SysUserController extends BaseController
  43 +{
  44 + @Autowired
  45 + private ISysUserService userService;
  46 +
  47 + @Autowired
  48 + private ISysRoleService roleService;
  49 +
  50 + @Autowired
  51 + private ISysDeptService deptService;
  52 +
  53 + @Autowired
  54 + private ISysPostService postService;
  55 +
  56 + /**
  57 + * 获取用户列表
  58 + */
  59 + @PreAuthorize("@ss.hasPermi('system:user:list')")
  60 + @GetMapping("/list")
  61 + public TableDataInfo list(SysUser user)
  62 + {
  63 + startPage();
  64 + List<SysUser> list = userService.selectUserList(user);
  65 + return getDataTable(list);
  66 + }
  67 +
  68 + @Log(title = "用户管理", businessType = BusinessType.EXPORT)
  69 + @PreAuthorize("@ss.hasPermi('system:user:export')")
  70 + @PostMapping("/export")
  71 + public void export(HttpServletResponse response, SysUser user)
  72 + {
  73 + List<SysUser> list = userService.selectUserList(user);
  74 + ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
  75 + util.exportExcel(response, list, "用户数据");
  76 + }
  77 +
  78 + @Log(title = "用户管理", businessType = BusinessType.IMPORT)
  79 + @PreAuthorize("@ss.hasPermi('system:user:import')")
  80 + @PostMapping("/importData")
  81 + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
  82 + {
  83 + ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
  84 + List<SysUser> userList = util.importExcel(file.getInputStream());
  85 + String operName = getUsername();
  86 + String message = userService.importUser(userList, updateSupport, operName);
  87 + return success(message);
  88 + }
  89 +
  90 + @PostMapping("/importTemplate")
  91 + public void importTemplate(HttpServletResponse response)
  92 + {
  93 + ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
  94 + util.importTemplateExcel(response, "用户数据");
  95 + }
  96 +
  97 + /**
  98 + * 根据用户编号获取详细信息
  99 + */
  100 + @PreAuthorize("@ss.hasPermi('system:user:query')")
  101 + @GetMapping(value = { "/", "/{userId}" })
  102 + public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
  103 + {
  104 + userService.checkUserDataScope(userId);
  105 + AjaxResult ajax = AjaxResult.success();
  106 + List<SysRole> roles = roleService.selectRoleAll();
  107 + ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
  108 + ajax.put("posts", postService.selectPostAll());
  109 + if (StringUtils.isNotNull(userId))
  110 + {
  111 + SysUser sysUser = userService.selectUserById(userId);
  112 + ajax.put(AjaxResult.DATA_TAG, sysUser);
  113 + ajax.put("postIds", postService.selectPostListByUserId(userId));
  114 + ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
  115 + }
  116 + return ajax;
  117 + }
  118 +
  119 + /**
  120 + * 新增用户
  121 + */
  122 + @PreAuthorize("@ss.hasPermi('system:user:add')")
  123 + @Log(title = "用户管理", businessType = BusinessType.INSERT)
  124 + @PostMapping
  125 + public AjaxResult add(@Validated @RequestBody SysUser user)
  126 + {
  127 + if (!userService.checkUserNameUnique(user))
  128 + {
  129 + return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
  130 + }
  131 + else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
  132 + {
  133 + return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
  134 + }
  135 + else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
  136 + {
  137 + return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
  138 + }
  139 + user.setCreateBy(getUsername());
  140 + user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
  141 + return toAjax(userService.insertUser(user));
  142 + }
  143 +
  144 + /**
  145 + * 修改用户
  146 + */
  147 + @PreAuthorize("@ss.hasPermi('system:user:edit')")
  148 + @Log(title = "用户管理", businessType = BusinessType.UPDATE)
  149 + @PutMapping
  150 + public AjaxResult edit(@Validated @RequestBody SysUser user)
  151 + {
  152 + userService.checkUserAllowed(user);
  153 + userService.checkUserDataScope(user.getUserId());
  154 + if (!userService.checkUserNameUnique(user))
  155 + {
  156 + return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
  157 + }
  158 + else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
  159 + {
  160 + return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
  161 + }
  162 + else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
  163 + {
  164 + return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
  165 + }
  166 + user.setUpdateBy(getUsername());
  167 + return toAjax(userService.updateUser(user));
  168 + }
  169 +
  170 + /**
  171 + * 删除用户
  172 + */
  173 + @PreAuthorize("@ss.hasPermi('system:user:remove')")
  174 + @Log(title = "用户管理", businessType = BusinessType.DELETE)
  175 + @DeleteMapping("/{userIds}")
  176 + public AjaxResult remove(@PathVariable Long[] userIds)
  177 + {
  178 + if (ArrayUtils.contains(userIds, getUserId()))
  179 + {
  180 + return error("当前用户不能删除");
  181 + }
  182 + return toAjax(userService.deleteUserByIds(userIds));
  183 + }
  184 +
  185 + /**
  186 + * 重置密码
  187 + */
  188 + @PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
  189 + @Log(title = "用户管理", businessType = BusinessType.UPDATE)
  190 + @PutMapping("/resetPwd")
  191 + public AjaxResult resetPwd(@RequestBody SysUser user)
  192 + {
  193 + userService.checkUserAllowed(user);
  194 + userService.checkUserDataScope(user.getUserId());
  195 + user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
  196 + user.setUpdateBy(getUsername());
  197 + return toAjax(userService.resetPwd(user));
  198 + }
  199 +
  200 + /**
  201 + * 状态修改
  202 + */
  203 + @PreAuthorize("@ss.hasPermi('system:user:edit')")
  204 + @Log(title = "用户管理", businessType = BusinessType.UPDATE)
  205 + @PutMapping("/changeStatus")
  206 + public AjaxResult changeStatus(@RequestBody SysUser user)
  207 + {
  208 + userService.checkUserAllowed(user);
  209 + userService.checkUserDataScope(user.getUserId());
  210 + user.setUpdateBy(getUsername());
  211 + return toAjax(userService.updateUserStatus(user));
  212 + }
  213 +
  214 + /**
  215 + * 根据用户编号获取授权角色
  216 + */
  217 + @PreAuthorize("@ss.hasPermi('system:user:query')")
  218 + @GetMapping("/authRole/{userId}")
  219 + public AjaxResult authRole(@PathVariable("userId") Long userId)
  220 + {
  221 + AjaxResult ajax = AjaxResult.success();
  222 + SysUser user = userService.selectUserById(userId);
  223 + List<SysRole> roles = roleService.selectRolesByUserId(userId);
  224 + ajax.put("user", user);
  225 + ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
  226 + return ajax;
  227 + }
  228 +
  229 + /**
  230 + * 用户授权角色
  231 + */
  232 + @PreAuthorize("@ss.hasPermi('system:user:edit')")
  233 + @Log(title = "用户管理", businessType = BusinessType.GRANT)
  234 + @PutMapping("/authRole")
  235 + public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
  236 + {
  237 + userService.checkUserDataScope(userId);
  238 + userService.insertUserAuth(userId, roleIds);
  239 + return success();
  240 + }
  241 +
  242 + /**
  243 + * 获取部门树列表
  244 + */
  245 + @PreAuthorize("@ss.hasPermi('system:user:list')")
  246 + @GetMapping("/deptTree")
  247 + public AjaxResult deptTree(SysDept dept)
  248 + {
  249 + return success(deptService.selectDeptTreeList(dept));
  250 + }
  251 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java 0 → 100644
  1 +package com.ruoyi.web.controller.tool;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.LinkedHashMap;
  5 +import java.util.List;
  6 +import java.util.Map;
  7 +import org.springframework.web.bind.annotation.DeleteMapping;
  8 +import org.springframework.web.bind.annotation.GetMapping;
  9 +import org.springframework.web.bind.annotation.PathVariable;
  10 +import org.springframework.web.bind.annotation.PostMapping;
  11 +import org.springframework.web.bind.annotation.PutMapping;
  12 +import org.springframework.web.bind.annotation.RequestBody;
  13 +import org.springframework.web.bind.annotation.RequestMapping;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +import com.ruoyi.common.core.controller.BaseController;
  16 +import com.ruoyi.common.core.domain.R;
  17 +import com.ruoyi.common.utils.StringUtils;
  18 +import io.swagger.annotations.Api;
  19 +import io.swagger.annotations.ApiImplicitParam;
  20 +import io.swagger.annotations.ApiImplicitParams;
  21 +import io.swagger.annotations.ApiModel;
  22 +import io.swagger.annotations.ApiModelProperty;
  23 +import io.swagger.annotations.ApiOperation;
  24 +
  25 +/**
  26 + * swagger 用户测试方法
  27 + *
  28 + * @author ruoyi
  29 + */
  30 +@Api("用户信息管理")
  31 +@RestController
  32 +@RequestMapping("/test/user")
  33 +public class TestController extends BaseController
  34 +{
  35 + private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
  36 + {
  37 + users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
  38 + users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
  39 + }
  40 +
  41 + @ApiOperation("获取用户列表")
  42 + @GetMapping("/list")
  43 + public R<List<UserEntity>> userList()
  44 + {
  45 + List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
  46 + return R.ok(userList);
  47 + }
  48 +
  49 + @ApiOperation("获取用户详细")
  50 + @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
  51 + @GetMapping("/{userId}")
  52 + public R<UserEntity> getUser(@PathVariable Integer userId)
  53 + {
  54 + if (!users.isEmpty() && users.containsKey(userId))
  55 + {
  56 + return R.ok(users.get(userId));
  57 + }
  58 + else
  59 + {
  60 + return R.fail("用户不存在");
  61 + }
  62 + }
  63 +
  64 + @ApiOperation("新增用户")
  65 + @ApiImplicitParams({
  66 + @ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
  67 + @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
  68 + @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
  69 + @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
  70 + })
  71 + @PostMapping("/save")
  72 + public R<String> save(UserEntity user)
  73 + {
  74 + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
  75 + {
  76 + return R.fail("用户ID不能为空");
  77 + }
  78 + users.put(user.getUserId(), user);
  79 + return R.ok();
  80 + }
  81 +
  82 + @ApiOperation("更新用户")
  83 + @PutMapping("/update")
  84 + public R<String> update(@RequestBody UserEntity user)
  85 + {
  86 + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
  87 + {
  88 + return R.fail("用户ID不能为空");
  89 + }
  90 + if (users.isEmpty() || !users.containsKey(user.getUserId()))
  91 + {
  92 + return R.fail("用户不存在");
  93 + }
  94 + users.remove(user.getUserId());
  95 + users.put(user.getUserId(), user);
  96 + return R.ok();
  97 + }
  98 +
  99 + @ApiOperation("删除用户信息")
  100 + @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
  101 + @DeleteMapping("/{userId}")
  102 + public R<String> delete(@PathVariable Integer userId)
  103 + {
  104 + if (!users.isEmpty() && users.containsKey(userId))
  105 + {
  106 + users.remove(userId);
  107 + return R.ok();
  108 + }
  109 + else
  110 + {
  111 + return R.fail("用户不存在");
  112 + }
  113 + }
  114 +}
  115 +
  116 +@ApiModel(value = "UserEntity", description = "用户实体")
  117 +class UserEntity
  118 +{
  119 + @ApiModelProperty("用户ID")
  120 + private Integer userId;
  121 +
  122 + @ApiModelProperty("用户名称")
  123 + private String username;
  124 +
  125 + @ApiModelProperty("用户密码")
  126 + private String password;
  127 +
  128 + @ApiModelProperty("用户手机")
  129 + private String mobile;
  130 +
  131 + public UserEntity()
  132 + {
  133 +
  134 + }
  135 +
  136 + public UserEntity(Integer userId, String username, String password, String mobile)
  137 + {
  138 + this.userId = userId;
  139 + this.username = username;
  140 + this.password = password;
  141 + this.mobile = mobile;
  142 + }
  143 +
  144 + public Integer getUserId()
  145 + {
  146 + return userId;
  147 + }
  148 +
  149 + public void setUserId(Integer userId)
  150 + {
  151 + this.userId = userId;
  152 + }
  153 +
  154 + public String getUsername()
  155 + {
  156 + return username;
  157 + }
  158 +
  159 + public void setUsername(String username)
  160 + {
  161 + this.username = username;
  162 + }
  163 +
  164 + public String getPassword()
  165 + {
  166 + return password;
  167 + }
  168 +
  169 + public void setPassword(String password)
  170 + {
  171 + this.password = password;
  172 + }
  173 +
  174 + public String getMobile()
  175 + {
  176 + return mobile;
  177 + }
  178 +
  179 + public void setMobile(String mobile)
  180 + {
  181 + this.mobile = mobile;
  182 + }
  183 +}
ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java 0 → 100644
  1 +package com.ruoyi.web.core.config;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.beans.factory.annotation.Value;
  7 +import org.springframework.context.annotation.Bean;
  8 +import org.springframework.context.annotation.Configuration;
  9 +import com.ruoyi.common.config.RuoYiConfig;
  10 +import io.swagger.annotations.ApiOperation;
  11 +import io.swagger.models.auth.In;
  12 +import springfox.documentation.builders.ApiInfoBuilder;
  13 +import springfox.documentation.builders.PathSelectors;
  14 +import springfox.documentation.builders.RequestHandlerSelectors;
  15 +import springfox.documentation.service.ApiInfo;
  16 +import springfox.documentation.service.ApiKey;
  17 +import springfox.documentation.service.AuthorizationScope;
  18 +import springfox.documentation.service.Contact;
  19 +import springfox.documentation.service.SecurityReference;
  20 +import springfox.documentation.service.SecurityScheme;
  21 +import springfox.documentation.spi.DocumentationType;
  22 +import springfox.documentation.spi.service.contexts.SecurityContext;
  23 +import springfox.documentation.spring.web.plugins.Docket;
  24 +
  25 +/**
  26 + * Swagger2的接口配置
  27 + *
  28 + * @author ruoyi
  29 + */
  30 +@Configuration
  31 +public class SwaggerConfig
  32 +{
  33 + /** 系统基础配置 */
  34 + @Autowired
  35 + private RuoYiConfig ruoyiConfig;
  36 +
  37 + /** 是否开启swagger */
  38 + @Value("${swagger.enabled}")
  39 + private boolean enabled;
  40 +
  41 + /** 设置请求的统一前缀 */
  42 + @Value("${swagger.pathMapping}")
  43 + private String pathMapping;
  44 +
  45 + /**
  46 + * 创建API
  47 + */
  48 + @Bean
  49 + public Docket createRestApi()
  50 + {
  51 + return new Docket(DocumentationType.OAS_30)
  52 + // 是否启用Swagger
  53 + .enable(enabled)
  54 + // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
  55 + .apiInfo(apiInfo())
  56 + // 设置哪些接口暴露给Swagger展示
  57 + .select()
  58 + // 扫描所有有注解的api,用这种方式更灵活
  59 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
  60 + // 扫描指定包中的swagger注解
  61 + // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
  62 + // 扫描所有 .apis(RequestHandlerSelectors.any())
  63 + .paths(PathSelectors.any())
  64 + .build()
  65 + /* 设置安全模式,swagger可以设置访问token */
  66 + .securitySchemes(securitySchemes())
  67 + .securityContexts(securityContexts())
  68 + .pathMapping(pathMapping);
  69 + }
  70 +
  71 + /**
  72 + * 安全模式,这里指定token通过Authorization头请求头传递
  73 + */
  74 + private List<SecurityScheme> securitySchemes()
  75 + {
  76 + List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
  77 + apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
  78 + return apiKeyList;
  79 + }
  80 +
  81 + /**
  82 + * 安全上下文
  83 + */
  84 + private List<SecurityContext> securityContexts()
  85 + {
  86 + List<SecurityContext> securityContexts = new ArrayList<>();
  87 + securityContexts.add(
  88 + SecurityContext.builder()
  89 + .securityReferences(defaultAuth())
  90 + .operationSelector(o -> o.requestMappingPattern().matches("/.*"))
  91 + .build());
  92 + return securityContexts;
  93 + }
  94 +
  95 + /**
  96 + * 默认的安全上引用
  97 + */
  98 + private List<SecurityReference> defaultAuth()
  99 + {
  100 + AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
  101 + AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
  102 + authorizationScopes[0] = authorizationScope;
  103 + List<SecurityReference> securityReferences = new ArrayList<>();
  104 + securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
  105 + return securityReferences;
  106 + }
  107 +
  108 + /**
  109 + * 添加摘要信息
  110 + */
  111 + private ApiInfo apiInfo()
  112 + {
  113 + // 用ApiInfoBuilder进行定制
  114 + return new ApiInfoBuilder()
  115 + // 设置标题
  116 + .title("标题:飞奥一体机接口文档")
  117 + // 描述
  118 + .description("描述:用于开发人员调试")
  119 + // 作者信息
  120 + .contact(new Contact(ruoyiConfig.getName(), null, null))
  121 + // 版本
  122 + .version("版本号:" + ruoyiConfig.getVersion())
  123 + .build();
  124 + }
  125 +}
ruoyi-admin/src/main/resources/META-INF/spring-devtools.properties 0 → 100644
  1 +restart.include.json=/com.alibaba.fastjson.*.jar
0 \ No newline at end of file 2 \ No newline at end of file
ruoyi-admin/src/main/resources/application-druid-dev.yml 0 → 100644
  1 +# 数据源配置
  2 +spring:
  3 + datasource:
  4 + type: com.alibaba.druid.pool.DruidDataSource
  5 + driverClassName: com.mysql.cj.jdbc.Driver
  6 + druid:
  7 + # 主库数据源
  8 + master:
  9 + # 测试地址
  10 + url: jdbc:mysql://localhost:3306/all-in-one?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
  11 + username: root
  12 + password: guzijian
  13 + # 从库数据源
  14 + slave:
  15 + # 从数据源开关/默认关闭
  16 + enabled: false
  17 + url:
  18 + username:
  19 + password:
  20 + # 初始连接数
  21 + initialSize: 5
  22 + # 最小连接池数量
  23 + minIdle: 10
  24 + # 最大连接池数量
  25 + maxActive: 20
  26 + # 配置获取连接等待超时的时间
  27 + maxWait: 60000
  28 + # 配置连接超时时间
  29 + connectTimeout: 30000
  30 + # 配置网络超时时间
  31 + socketTimeout: 60000
  32 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
  33 + timeBetweenEvictionRunsMillis: 60000
  34 + # 配置一个连接在池中最小生存的时间,单位是毫秒
  35 + minEvictableIdleTimeMillis: 300000
  36 + # 配置一个连接在池中最大生存的时间,单位是毫秒
  37 + maxEvictableIdleTimeMillis: 900000
  38 + # 配置检测连接是否有效
  39 + validationQuery: SELECT 1 FROM DUAL
  40 + testWhileIdle: true
  41 + testOnBorrow: false
  42 + testOnReturn: false
  43 + webStatFilter:
  44 + enabled: true
  45 + statViewServlet:
  46 + enabled: true
  47 + # 设置白名单,不填则允许所有访问
  48 + allow:
  49 + url-pattern: /druid/*
  50 + # 控制台管理用户名和密码
  51 + login-username: ruoyi
  52 + login-password: 123456
  53 + filter:
  54 + stat:
  55 + enabled: true
  56 + # 慢SQL记录
  57 + log-slow-sql: true
  58 + slow-sql-millis: 1000
  59 + merge-sql: true
  60 + wall:
  61 + config:
  62 + multi-statement-allow: true
  63 +# 项目相关配置
  64 +ruoyi:
  65 + # 名称
  66 + name: RuoYi
  67 + # 版本
  68 + version: 3.8.5
  69 + # 版权年份
  70 + copyrightYear: 2023
  71 + # 实例演示开关
  72 + demoEnabled: true
  73 + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
  74 + profile: /home/ruoyi/uploadPath
  75 + # 获取ip地址开关
  76 + addressEnabled: false
  77 + # 验证码类型 math 数字计算 char 字符验证
  78 + captchaType: math
0 \ No newline at end of file 79 \ No newline at end of file
ruoyi-admin/src/main/resources/application-druid-prd.yml 0 → 100644
  1 +# 数据源配置
  2 +spring:
  3 + datasource:
  4 + type: com.alibaba.druid.pool.DruidDataSource
  5 + driverClassName: com.mysql.cj.jdbc.Driver
  6 + druid:
  7 + # 主库数据源
  8 + master:
  9 + # 开发地址
  10 +# url: jdbc:mysql://localhost:3306/all-in-one?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
  11 +# username: root
  12 +# password: guzijian
  13 + # 从库数据源
  14 + slave:
  15 + # 从数据源开关/默认关闭
  16 + enabled: false
  17 + url:
  18 + username:
  19 + password:
  20 + # 初始连接数
  21 + initialSize: 5
  22 + # 最小连接池数量
  23 + minIdle: 10
  24 + # 最大连接池数量
  25 + maxActive: 20
  26 + # 配置获取连接等待超时的时间
  27 + maxWait: 60000
  28 + # 配置连接超时时间
  29 + connectTimeout: 30000
  30 + # 配置网络超时时间
  31 + socketTimeout: 60000
  32 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
  33 + timeBetweenEvictionRunsMillis: 60000
  34 + # 配置一个连接在池中最小生存的时间,单位是毫秒
  35 + minEvictableIdleTimeMillis: 300000
  36 + # 配置一个连接在池中最大生存的时间,单位是毫秒
  37 + maxEvictableIdleTimeMillis: 900000
  38 + # 配置检测连接是否有效
  39 + validationQuery: SELECT 1 FROM DUAL
  40 + testWhileIdle: true
  41 + testOnBorrow: false
  42 + testOnReturn: false
  43 + webStatFilter:
  44 + enabled: true
  45 + statViewServlet:
  46 + enabled: true
  47 + # 设置白名单,不填则允许所有访问
  48 + allow:
  49 + url-pattern: /druid/*
  50 + # 控制台管理用户名和密码
  51 + login-username: ruoyi
  52 + login-password: 123456
  53 + filter:
  54 + stat:
  55 + enabled: true
  56 + # 慢SQL记录
  57 + log-slow-sql: true
  58 + slow-sql-millis: 1000
  59 + merge-sql: true
  60 + wall:
  61 + config:
  62 + multi-statement-allow: true
  63 +# 项目相关配置
  64 +ruoyi:
  65 + # 名称
  66 + name: RuoYi
  67 + # 版本
  68 + version: 3.8.5
  69 + # 版权年份
  70 + copyrightYear: 2023
  71 + # 实例演示开关
  72 + demoEnabled: true
  73 + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
  74 + profile: D:/ruoyi/uploadPath
  75 + # 获取ip地址开关
  76 + addressEnabled: false
  77 + # 验证码类型 math 数字计算 char 字符验证
  78 + captchaType: math
0 \ No newline at end of file 79 \ No newline at end of file
ruoyi-admin/src/main/resources/application-druid-uat.yml 0 → 100644
  1 +# 数据源配置
  2 +spring:
  3 + datasource:
  4 + type: com.alibaba.druid.pool.DruidDataSource
  5 + driverClassName: com.mysql.cj.jdbc.Driver
  6 + druid:
  7 + # 主库数据源
  8 + master:
  9 + # 测试地址
  10 + url: jdbc:mysql://localhost:3306/all-in-one?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
  11 + username: root
  12 + password: guzijian
  13 + # 从库数据源
  14 + slave:
  15 + # 从数据源开关/默认关闭
  16 + enabled: false
  17 + url:
  18 + username:
  19 + password:
  20 + # 初始连接数
  21 + initialSize: 5
  22 + # 最小连接池数量
  23 + minIdle: 10
  24 + # 最大连接池数量
  25 + maxActive: 20
  26 + # 配置获取连接等待超时的时间
  27 + maxWait: 60000
  28 + # 配置连接超时时间
  29 + connectTimeout: 30000
  30 + # 配置网络超时时间
  31 + socketTimeout: 60000
  32 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
  33 + timeBetweenEvictionRunsMillis: 60000
  34 + # 配置一个连接在池中最小生存的时间,单位是毫秒
  35 + minEvictableIdleTimeMillis: 300000
  36 + # 配置一个连接在池中最大生存的时间,单位是毫秒
  37 + maxEvictableIdleTimeMillis: 900000
  38 + # 配置检测连接是否有效
  39 + validationQuery: SELECT 1 FROM DUAL
  40 + testWhileIdle: true
  41 + testOnBorrow: false
  42 + testOnReturn: false
  43 + webStatFilter:
  44 + enabled: true
  45 + statViewServlet:
  46 + enabled: true
  47 + # 设置白名单,不填则允许所有访问
  48 + allow:
  49 + url-pattern: /druid/*
  50 + # 控制台管理用户名和密码
  51 + login-username: ruoyi
  52 + login-password: 123456
  53 + filter:
  54 + stat:
  55 + enabled: true
  56 + # 慢SQL记录
  57 + log-slow-sql: true
  58 + slow-sql-millis: 1000
  59 + merge-sql: true
  60 + wall:
  61 + config:
  62 + multi-statement-allow: true
  63 +# 项目相关配置
  64 +ruoyi:
  65 + # 名称
  66 + name: RuoYi
  67 + # 版本
  68 + version: 3.8.5
  69 + # 版权年份
  70 + copyrightYear: 2023
  71 + # 实例演示开关
  72 + demoEnabled: true
  73 + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
  74 + profile: /home/ruoyi/uploadPath
  75 + # 获取ip地址开关
  76 + addressEnabled: false
  77 + # 验证码类型 math 数字计算 char 字符验证
  78 + captchaType: math
0 \ No newline at end of file 79 \ No newline at end of file
ruoyi-admin/src/main/resources/application.yml 0 → 100644
  1 +# 项目相关配置
  2 +ruoyi:
  3 + # 名称
  4 + name: RuoYi
  5 + # 版本
  6 + version: 3.8.5
  7 + # 版权年份
  8 + copyrightYear: 2023
  9 + # 实例演示开关
  10 + demoEnabled: true
  11 + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
  12 + profile: D:/ruoyi/uploadPath
  13 + # 获取ip地址开关
  14 + addressEnabled: false
  15 + # 验证码类型 math 数字计算 char 字符验证
  16 + captchaType: math
  17 +
  18 +# 开发环境配置
  19 +server:
  20 + # 服务器的HTTP端口,默认为8080
  21 + port: 8080
  22 + servlet:
  23 + # 应用的访问路径
  24 + context-path: /
  25 + tomcat:
  26 + # tomcat的URI编码
  27 + uri-encoding: UTF-8
  28 + # 连接数满后的排队数,默认为100
  29 + accept-count: 1000
  30 + threads:
  31 + # tomcat最大线程数,默认为200
  32 + max: 800
  33 + # Tomcat启动初始化的线程数,默认值10
  34 + min-spare: 100
  35 +
  36 +# 日志配置
  37 +logging:
  38 + level:
  39 + com.ruoyi: debug
  40 + org.springframework: warn
  41 +
  42 +# 用户配置
  43 +user:
  44 + password:
  45 + # 密码最大错误次数
  46 + maxRetryCount: 5
  47 + # 密码锁定时间(默认10分钟)
  48 + lockTime: 10
  49 +
  50 +# Spring配置
  51 +spring:
  52 + # 资源信息
  53 + messages:
  54 + # 国际化资源文件路径
  55 + basename: i18n/messages
  56 + profiles:
  57 + active: druid-dev
  58 + # 文件上传
  59 + servlet:
  60 + multipart:
  61 + # 单个文件大小
  62 + max-file-size: 10MB
  63 + # 设置总上传的文件大小
  64 + max-request-size: 20MB
  65 + # 服务模块
  66 + devtools:
  67 + restart:
  68 + # 热部署开关
  69 + enabled: true
  70 + # redis 配置
  71 + redis:
  72 + # 地址
  73 + host: 121.41.83.61
  74 + database: 0
  75 + password: "guzijian"
  76 + port: 6379
  77 + # 连接超时时间
  78 + timeout: 10s
  79 + lettuce:
  80 + pool:
  81 + # 连接池中的最小空闲连接
  82 + min-idle: 0
  83 + # 连接池中的最大空闲连接
  84 + max-idle: 8
  85 + # 连接池的最大数据库连接数
  86 + max-active: 8
  87 + # #连接池最大阻塞等待时间(使用负值表示没有限制)
  88 + max-wait: -1ms
  89 +
  90 +# token配置
  91 +token:
  92 + # 令牌自定义标识
  93 + header: Authorization
  94 + # 令牌密钥
  95 + secret: abcdefghijklmnopqrstuvwxyz
  96 + # 令牌有效期(默认30分钟)
  97 + expireTime: 30
  98 +
  99 +# MyBatis配置
  100 +mybatis:
  101 + # 搜索指定包别名
  102 + typeAliasesPackage: com.ruoyi.**.domain
  103 + # 配置mapper的扫描,找到所有的mapper.xml映射文件
  104 + mapperLocations: classpath*:mapper/**/*Mapper.xml
  105 + # 加载全局的配置文件
  106 + configLocation: classpath:mybatis/mybatis-config.xml
  107 +
  108 +# PageHelper分页插件
  109 +pagehelper:
  110 + helperDialect: mysql
  111 + supportMethodsArguments: true
  112 + params: count=countSql
  113 +
  114 +# Swagger配置
  115 +swagger:
  116 + # 是否开启swagger
  117 + enabled: true
  118 + # 请求前缀
  119 +# pathMapping: /dev-api
  120 + pathMapping: /
  121 +
  122 +# 防止XSS攻击
  123 +xss:
  124 + # 过滤开关
  125 + enabled: true
  126 + # 排除链接(多个用逗号分隔)
  127 + excludes: /system/notice
  128 + # 匹配链接
  129 + urlPatterns: /system/*,/monitor/*,/tool/*
ruoyi-admin/src/main/resources/banner.txt 0 → 100644
  1 +Application Version: ${ruoyi.version}
  2 +Spring Boot Version: ${spring-boot.version}
  3 +////////////////////////////////////////////////////////////////////
  4 +// _ooOoo_ //
  5 +// o8888888o //
  6 +// 88" . "88 //
  7 +// (| ^_^ |) //
  8 +// O\ = /O //
  9 +// ____/`---'\____ //
  10 +// .' \\| |// `. //
  11 +// / \\||| : |||// \ //
  12 +// / _||||| -:- |||||- \ //
  13 +// | | \\\ - /// | | //
  14 +// | \_| ''\---/'' | | //
  15 +// \ .-\__ `-` ___/-. / //
  16 +// ___`. .' /--.--\ `. . ___ //
  17 +// ."" '< `.___\_<|>_/___.' >'"". //
  18 +// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
  19 +// \ \ `-. \_ __\ /__ _/ .-` / / //
  20 +// ========`-.____`-.___\_____/___.-`____.-'======== //
  21 +// `=---=' //
  22 +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
  23 +// 佛祖保佑 永不宕机 永无BUG //
  24 +////////////////////////////////////////////////////////////////////
0 \ No newline at end of file 25 \ No newline at end of file
ruoyi-admin/src/main/resources/i18n/messages.properties 0 → 100644
  1 +#错误消息
  2 +not.null=* 必须填写
  3 +user.jcaptcha.error=验证码错误
  4 +user.jcaptcha.expire=验证码已失效
  5 +user.not.exists=用户不存在/密码错误
  6 +user.password.not.match=用户不存在/密码错误
  7 +user.password.retry.limit.count=密码输入错误{0}次
  8 +user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
  9 +user.password.delete=对不起,您的账号已被删除
  10 +user.blocked=用户已封禁,请联系管理员
  11 +role.blocked=角色已封禁,请联系管理员
  12 +login.blocked=很遗憾,访问IP已被列入系统黑名单
  13 +user.logout.success=退出成功
  14 +
  15 +length.not.valid=长度必须在{min}到{max}个字符之间
  16 +
  17 +user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
  18 +user.password.not.valid=* 5-50个字符
  19 +
  20 +user.email.not.valid=邮箱格式错误
  21 +user.mobile.phone.number.not.valid=手机号格式错误
  22 +user.login.success=登录成功
  23 +user.register.success=注册成功
  24 +user.notfound=请重新登录
  25 +user.forcelogout=管理员强制退出,请重新登录
  26 +user.unknown.error=未知错误,请重新登录
  27 +
  28 +##文件上传消息
  29 +upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
  30 +upload.filename.exceed.length=上传的文件名最长{0}个字符
  31 +
  32 +##权限
  33 +no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
  34 +no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
  35 +no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
  36 +no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
  37 +no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
  38 +no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
ruoyi-admin/src/main/resources/logback.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<configuration>
  3 + <!-- 日志存放路径 -->
  4 +<!-- <property name="log.path" value="D:/ruoyi/logs" />-->
  5 + <property name="log.path" value="/home/ruoyi/logs" />
  6 + <!-- 日志输出格式 -->
  7 + <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
  8 +
  9 + <!-- 控制台输出 -->
  10 + <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
  11 + <encoder>
  12 + <pattern>${log.pattern}</pattern>
  13 + </encoder>
  14 + </appender>
  15 +
  16 + <!-- 系统日志输出 -->
  17 + <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
  18 + <file>${log.path}/sys-info.log</file>
  19 + <!-- 循环政策:基于时间创建日志文件 -->
  20 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  21 + <!-- 日志文件名格式 -->
  22 + <fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
  23 + <!-- 日志最大的历史 60天 -->
  24 + <maxHistory>60</maxHistory>
  25 + </rollingPolicy>
  26 + <encoder>
  27 + <pattern>${log.pattern}</pattern>
  28 + </encoder>
  29 + <filter class="ch.qos.logback.classic.filter.LevelFilter">
  30 + <!-- 过滤的级别 -->
  31 + <level>INFO</level>
  32 + <!-- 匹配时的操作:接收(记录) -->
  33 + <onMatch>ACCEPT</onMatch>
  34 + <!-- 不匹配时的操作:拒绝(不记录) -->
  35 + <onMismatch>DENY</onMismatch>
  36 + </filter>
  37 + </appender>
  38 +
  39 + <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
  40 + <file>${log.path}/sys-error.log</file>
  41 + <!-- 循环政策:基于时间创建日志文件 -->
  42 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  43 + <!-- 日志文件名格式 -->
  44 + <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
  45 + <!-- 日志最大的历史 60天 -->
  46 + <maxHistory>60</maxHistory>
  47 + </rollingPolicy>
  48 + <encoder>
  49 + <pattern>${log.pattern}</pattern>
  50 + </encoder>
  51 + <filter class="ch.qos.logback.classic.filter.LevelFilter">
  52 + <!-- 过滤的级别 -->
  53 + <level>ERROR</level>
  54 + <!-- 匹配时的操作:接收(记录) -->
  55 + <onMatch>ACCEPT</onMatch>
  56 + <!-- 不匹配时的操作:拒绝(不记录) -->
  57 + <onMismatch>DENY</onMismatch>
  58 + </filter>
  59 + </appender>
  60 +
  61 + <!-- 用户访问日志输出 -->
  62 + <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
  63 + <file>${log.path}/sys-user.log</file>
  64 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  65 + <!-- 按天回滚 daily -->
  66 + <fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
  67 + <!-- 日志最大的历史 30天 -->
  68 + <maxHistory>30</maxHistory>
  69 + </rollingPolicy>
  70 + <encoder>
  71 + <pattern>${log.pattern}</pattern>
  72 + </encoder>
  73 + </appender>
  74 +
  75 + <!-- 系统模块日志级别控制 -->
  76 + <logger name="com.ruoyi" level="info" />
  77 + <!-- Spring日志级别控制 -->
  78 + <logger name="org.springframework" level="warn" />
  79 +
  80 + <root level="info">
  81 + <appender-ref ref="console" />
  82 + </root>
  83 +
  84 + <!--系统操作日志-->
  85 + <root level="info">
  86 + <appender-ref ref="file_info" />
  87 + <appender-ref ref="file_error" />
  88 + </root>
  89 +
  90 + <!--系统用户操作日志-->
  91 + <logger name="sys-user" level="info">
  92 + <appender-ref ref="sys-user"/>
  93 + </logger>
  94 +</configuration>
0 \ No newline at end of file 95 \ No newline at end of file
ruoyi-admin/src/main/resources/mapper/TestHhhMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper
  3 +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4 +"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5 +<mapper namespace="com.ruoyi.system.mapper.TestHhhMapper">
  6 +
  7 + <resultMap type="TestHhh" id="TestHhhResult">
  8 + <result property="id" column="id" />
  9 + <result property="name" column="name" />
  10 + <result property="age" column="age" />
  11 + </resultMap>
  12 +
  13 + <sql id="selectTestHhhVo">
  14 + select id, name, age from test_hhh
  15 + </sql>
  16 +
  17 + <select id="selectTestHhhList" parameterType="TestHhh" resultMap="TestHhhResult">
  18 + <include refid="selectTestHhhVo"/>
  19 + <where>
  20 + <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  21 + <if test="age != null "> and age = #{age}</if>
  22 + </where>
  23 + </select>
  24 +
  25 + <select id="selectTestHhhById" parameterType="Long" resultMap="TestHhhResult">
  26 + <include refid="selectTestHhhVo"/>
  27 + where id = #{id}
  28 + </select>
  29 +
  30 + <insert id="insertTestHhh" parameterType="TestHhh" useGeneratedKeys="true" keyProperty="id">
  31 + insert into test_hhh
  32 + <trim prefix="(" suffix=")" suffixOverrides=",">
  33 + <if test="name != null">name,</if>
  34 + <if test="age != null">age,</if>
  35 + </trim>
  36 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  37 + <if test="name != null">#{name},</if>
  38 + <if test="age != null">#{age},</if>
  39 + </trim>
  40 + </insert>
  41 +
  42 + <update id="updateTestHhh" parameterType="TestHhh">
  43 + update test_hhh
  44 + <trim prefix="SET" suffixOverrides=",">
  45 + <if test="name != null">name = #{name},</if>
  46 + <if test="age != null">age = #{age},</if>
  47 + </trim>
  48 + where id = #{id}
  49 + </update>
  50 +
  51 + <delete id="deleteTestHhhById" parameterType="Long">
  52 + delete from test_hhh where id = #{id}
  53 + </delete>
  54 +
  55 + <delete id="deleteTestHhhByIds" parameterType="String">
  56 + delete from test_hhh where id in
  57 + <foreach item="id" collection="array" open="(" separator="," close=")">
  58 + #{id}
  59 + </foreach>
  60 + </delete>
  61 +</mapper>
0 \ No newline at end of file 62 \ No newline at end of file
ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE configuration
  3 +PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
  4 +"http://mybatis.org/dtd/mybatis-3-config.dtd">
  5 +<configuration>
  6 + <!-- 全局参数 -->
  7 + <settings>
  8 + <!-- 使全局的映射器启用或禁用缓存 -->
  9 + <setting name="cacheEnabled" value="true" />
  10 + <!-- 允许JDBC 支持自动生成主键 -->
  11 + <setting name="useGeneratedKeys" value="true" />
  12 + <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
  13 + <setting name="defaultExecutorType" value="SIMPLE" />
  14 + <!-- 指定 MyBatis 所用日志的具体实现 -->
  15 + <setting name="logImpl" value="SLF4J" />
  16 + <!-- 使用驼峰命名法转换字段 -->
  17 + <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
  18 + </settings>
  19 +
  20 +</configuration>
ruoyi-common/pom.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <parent>
  6 + <artifactId>ruoyi</artifactId>
  7 + <groupId>com.ruoyi</groupId>
  8 + <version>3.8.5</version>
  9 + </parent>
  10 + <modelVersion>4.0.0</modelVersion>
  11 +
  12 + <artifactId>ruoyi-common</artifactId>
  13 +
  14 + <description>
  15 + common通用工具
  16 + </description>
  17 +
  18 + <dependencies>
  19 +
  20 + <!-- Spring框架基本的核心工具 -->
  21 + <dependency>
  22 + <groupId>org.springframework</groupId>
  23 + <artifactId>spring-context-support</artifactId>
  24 + </dependency>
  25 +
  26 + <!-- SpringWeb模块 -->
  27 + <dependency>
  28 + <groupId>org.springframework</groupId>
  29 + <artifactId>spring-web</artifactId>
  30 + </dependency>
  31 +
  32 + <!-- spring security 安全认证 -->
  33 + <dependency>
  34 + <groupId>org.springframework.boot</groupId>
  35 + <artifactId>spring-boot-starter-security</artifactId>
  36 + </dependency>
  37 +
  38 + <!-- pagehelper 分页插件 -->
  39 + <dependency>
  40 + <groupId>com.github.pagehelper</groupId>
  41 + <artifactId>pagehelper-spring-boot-starter</artifactId>
  42 + </dependency>
  43 +
  44 + <!-- 自定义验证注解 -->
  45 + <dependency>
  46 + <groupId>org.springframework.boot</groupId>
  47 + <artifactId>spring-boot-starter-validation</artifactId>
  48 + </dependency>
  49 +
  50 + <!--常用工具类 -->
  51 + <dependency>
  52 + <groupId>org.apache.commons</groupId>
  53 + <artifactId>commons-lang3</artifactId>
  54 + </dependency>
  55 +
  56 + <!-- JSON工具类 -->
  57 + <dependency>
  58 + <groupId>com.fasterxml.jackson.core</groupId>
  59 + <artifactId>jackson-databind</artifactId>
  60 + </dependency>
  61 +
  62 + <!-- 动态数据源 -->
  63 + <dependency>
  64 + <groupId>com.baomidou</groupId>
  65 + <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
  66 + <version>3.5.2</version>
  67 + </dependency>
  68 +
  69 + <!-- 阿里JSON解析器 -->
  70 + <dependency>
  71 + <groupId>com.alibaba.fastjson2</groupId>
  72 + <artifactId>fastjson2</artifactId>
  73 + </dependency>
  74 +
  75 + <!-- io常用工具类 -->
  76 + <dependency>
  77 + <groupId>commons-io</groupId>
  78 + <artifactId>commons-io</artifactId>
  79 + </dependency>
  80 +
  81 + <!-- excel工具 -->
  82 + <dependency>
  83 + <groupId>org.apache.poi</groupId>
  84 + <artifactId>poi-ooxml</artifactId>
  85 + </dependency>
  86 +
  87 + <!-- yml解析器 -->
  88 + <dependency>
  89 + <groupId>org.yaml</groupId>
  90 + <artifactId>snakeyaml</artifactId>
  91 + </dependency>
  92 +
  93 + <!-- Token生成与解析-->
  94 + <dependency>
  95 + <groupId>io.jsonwebtoken</groupId>
  96 + <artifactId>jjwt</artifactId>
  97 + </dependency>
  98 +
  99 + <!-- Jaxb -->
  100 + <dependency>
  101 + <groupId>javax.xml.bind</groupId>
  102 + <artifactId>jaxb-api</artifactId>
  103 + </dependency>
  104 +
  105 + <!-- redis 缓存操作 -->
  106 + <dependency>
  107 + <groupId>org.springframework.boot</groupId>
  108 + <artifactId>spring-boot-starter-data-redis</artifactId>
  109 + </dependency>
  110 +
  111 + <!-- pool 对象池 -->
  112 + <dependency>
  113 + <groupId>org.apache.commons</groupId>
  114 + <artifactId>commons-pool2</artifactId>
  115 + </dependency>
  116 +
  117 + <!-- 解析客户端操作系统、浏览器等 -->
  118 + <dependency>
  119 + <groupId>eu.bitwalker</groupId>
  120 + <artifactId>UserAgentUtils</artifactId>
  121 + </dependency>
  122 +
  123 + <!-- servlet包 -->
  124 + <dependency>
  125 + <groupId>javax.servlet</groupId>
  126 + <artifactId>javax.servlet-api</artifactId>
  127 + </dependency>
  128 +
  129 + </dependencies>
  130 +
  131 +</project>
0 \ No newline at end of file 132 \ No newline at end of file
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Anonymous.java 0 → 100644
  1 +package com.ruoyi.common.annotation;
  2 +
  3 +import java.lang.annotation.Documented;
  4 +import java.lang.annotation.ElementType;
  5 +import java.lang.annotation.Retention;
  6 +import java.lang.annotation.RetentionPolicy;
  7 +import java.lang.annotation.Target;
  8 +
  9 +/**
  10 + * 匿名访问不鉴权注解
  11 + *
  12 + * @author ruoyi
  13 + */
  14 +@Target({ ElementType.METHOD, ElementType.TYPE })
  15 +@Retention(RetentionPolicy.RUNTIME)
  16 +@Documented
  17 +public @interface Anonymous
  18 +{
  19 +}
ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java 0 → 100644
  1 +package com.ruoyi.common.annotation;
  2 +
  3 +import java.lang.annotation.Documented;
  4 +import java.lang.annotation.ElementType;
  5 +import java.lang.annotation.Retention;
  6 +import java.lang.annotation.RetentionPolicy;
  7 +import java.lang.annotation.Target;
  8 +
  9 +/**
  10 + * 数据权限过滤注解
  11 + *
  12 + * @author ruoyi
  13 + */
  14 +@Target(ElementType.METHOD)
  15 +@Retention(RetentionPolicy.RUNTIME)
  16 +@Documented
  17 +public @interface DataScope
  18 +{
  19 + /**
  20 + * 部门表的别名
  21 + */
  22 + public String deptAlias() default "";
  23 +
  24 + /**
  25 + * 用户表的别名
  26 + */
  27 + public String userAlias() default "";
  28 +
  29 + /**
  30 + * 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来
  31 + */
  32 + public String permission() default "";
  33 +}
ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java 0 → 100644
  1 +package com.ruoyi.common.annotation;
  2 +
  3 +import java.lang.annotation.Documented;
  4 +import java.lang.annotation.ElementType;
  5 +import java.lang.annotation.Inherited;
  6 +import java.lang.annotation.Retention;
  7 +import java.lang.annotation.RetentionPolicy;
  8 +import java.lang.annotation.Target;
  9 +import com.ruoyi.common.enums.DataSourceType;
  10 +
  11 +/**
  12 + * 自定义多数据源切换注解
  13 + *
  14 + * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
  15 + *
  16 + * @author ruoyi
  17 + */
  18 +@Target({ ElementType.METHOD, ElementType.TYPE })
  19 +@Retention(RetentionPolicy.RUNTIME)
  20 +@Documented
  21 +@Inherited
  22 +public @interface DataSource
  23 +{
  24 + /**
  25 + * 切换数据源名称
  26 + */
  27 + public DataSourceType value() default DataSourceType.MASTER;
  28 +}
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java 0 → 100644
  1 +package com.ruoyi.common.annotation;
  2 +
  3 +import java.lang.annotation.ElementType;
  4 +import java.lang.annotation.Retention;
  5 +import java.lang.annotation.RetentionPolicy;
  6 +import java.lang.annotation.Target;
  7 +import java.math.BigDecimal;
  8 +import org.apache.poi.ss.usermodel.HorizontalAlignment;
  9 +import org.apache.poi.ss.usermodel.IndexedColors;
  10 +import com.ruoyi.common.utils.poi.ExcelHandlerAdapter;
  11 +
  12 +/**
  13 + * 自定义导出Excel数据注解
  14 + *
  15 + * @author ruoyi
  16 + */
  17 +@Retention(RetentionPolicy.RUNTIME)
  18 +@Target(ElementType.FIELD)
  19 +public @interface Excel
  20 +{
  21 + /**
  22 + * 导出时在excel中排序
  23 + */
  24 + public int sort() default Integer.MAX_VALUE;
  25 +
  26 + /**
  27 + * 导出到Excel中的名字.
  28 + */
  29 + public String name() default "";
  30 +
  31 + /**
  32 + * 日期格式, 如: yyyy-MM-dd
  33 + */
  34 + public String dateFormat() default "";
  35 +
  36 + /**
  37 + * 如果是字典类型,请设置字典的type值 (如: sys_user_sex)
  38 + */
  39 + public String dictType() default "";
  40 +
  41 + /**
  42 + * 读取内容转表达式 (如: 0=男,1=女,2=未知)
  43 + */
  44 + public String readConverterExp() default "";
  45 +
  46 + /**
  47 + * 分隔符,读取字符串组内容
  48 + */
  49 + public String separator() default ",";
  50 +
  51 + /**
  52 + * BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
  53 + */
  54 + public int scale() default -1;
  55 +
  56 + /**
  57 + * BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
  58 + */
  59 + public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
  60 +
  61 + /**
  62 + * 导出时在excel中每个列的高度 单位为字符
  63 + */
  64 + public double height() default 14;
  65 +
  66 + /**
  67 + * 导出时在excel中每个列的宽 单位为字符
  68 + */
  69 + public double width() default 16;
  70 +
  71 + /**
  72 + * 文字后缀,如% 90 变成90%
  73 + */
  74 + public String suffix() default "";
  75 +
  76 + /**
  77 + * 当值为空时,字段的默认值
  78 + */
  79 + public String defaultValue() default "";
  80 +
  81 + /**
  82 + * 提示信息
  83 + */
  84 + public String prompt() default "";
  85 +
  86 + /**
  87 + * 设置只能选择不能输入的列内容.
  88 + */
  89 + public String[] combo() default {};
  90 +
  91 + /**
  92 + * 是否需要纵向合并单元格,应对需求:含有list集合单元格)
  93 + */
  94 + public boolean needMerge() default false;
  95 +
  96 + /**
  97 + * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
  98 + */
  99 + public boolean isExport() default true;
  100 +
  101 + /**
  102 + * 另一个类中的属性名称,支持多级获取,以小数点隔开
  103 + */
  104 + public String targetAttr() default "";
  105 +
  106 + /**
  107 + * 是否自动统计数据,在最后追加一行统计数据总和
  108 + */
  109 + public boolean isStatistics() default false;
  110 +
  111 + /**
  112 + * 导出类型(0数字 1字符串 2图片)
  113 + */
  114 + public ColumnType cellType() default ColumnType.STRING;
  115 +
  116 + /**
  117 + * 导出列头背景色
  118 + */
  119 + public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
  120 +
  121 + /**
  122 + * 导出列头字体颜色
  123 + */
  124 + public IndexedColors headerColor() default IndexedColors.WHITE;
  125 +
  126 + /**
  127 + * 导出单元格背景色
  128 + */
  129 + public IndexedColors backgroundColor() default IndexedColors.WHITE;
  130 +
  131 + /**
  132 + * 导出单元格字体颜色
  133 + */
  134 + public IndexedColors color() default IndexedColors.BLACK;
  135 +
  136 + /**
  137 + * 导出字段对齐方式
  138 + */
  139 + public HorizontalAlignment align() default HorizontalAlignment.CENTER;
  140 +
  141 + /**
  142 + * 自定义数据处理器
  143 + */
  144 + public Class<?> handler() default ExcelHandlerAdapter.class;
  145 +
  146 + /**
  147 + * 自定义数据处理器参数
  148 + */
  149 + public String[] args() default {};
  150 +
  151 + /**
  152 + * 字段类型(0:导出导入;1:仅导出;2:仅导入)
  153 + */
  154 + Type type() default Type.ALL;
  155 +
  156 + public enum Type
  157 + {
  158 + ALL(0), EXPORT(1), IMPORT(2);
  159 + private final int value;
  160 +
  161 + Type(int value)
  162 + {
  163 + this.value = value;
  164 + }
  165 +
  166 + public int value()
  167 + {
  168 + return this.value;
  169 + }
  170 + }
  171 +
  172 + public enum ColumnType
  173 + {
  174 + NUMERIC(0), STRING(1), IMAGE(2);
  175 + private final int value;
  176 +
  177 + ColumnType(int value)
  178 + {
  179 + this.value = value;
  180 + }
  181 +
  182 + public int value()
  183 + {
  184 + return this.value;
  185 + }
  186 + }
  187 +}
0 \ No newline at end of file 188 \ No newline at end of file
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java 0 → 100644
  1 +package com.ruoyi.common.annotation;
  2 +
  3 +import java.lang.annotation.ElementType;
  4 +import java.lang.annotation.Retention;
  5 +import java.lang.annotation.RetentionPolicy;
  6 +import java.lang.annotation.Target;
  7 +
  8 +/**
  9 + * Excel注解集
  10 + *
  11 + * @author ruoyi
  12 + */
  13 +@Target(ElementType.FIELD)
  14 +@Retention(RetentionPolicy.RUNTIME)
  15 +public @interface Excels
  16 +{
  17 + public Excel[] value();
  18 +}
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java 0 → 100644
  1 +package com.ruoyi.common.annotation;
  2 +
  3 +import java.lang.annotation.Documented;
  4 +import java.lang.annotation.ElementType;
  5 +import java.lang.annotation.Retention;
  6 +import java.lang.annotation.RetentionPolicy;
  7 +import java.lang.annotation.Target;
  8 +import com.ruoyi.common.enums.BusinessType;
  9 +import com.ruoyi.common.enums.OperatorType;
  10 +
  11 +/**
  12 + * 自定义操作日志记录注解
  13 + *
  14 + * @author ruoyi
  15 + *
  16 + */
  17 +@Target({ ElementType.PARAMETER, ElementType.METHOD })
  18 +@Retention(RetentionPolicy.RUNTIME)
  19 +@Documented
  20 +public @interface Log
  21 +{
  22 + /**
  23 + * 模块
  24 + */
  25 + public String title() default "";
  26 +
  27 + /**
  28 + * 功能
  29 + */
  30 + public BusinessType businessType() default BusinessType.OTHER;
  31 +
  32 + /**
  33 + * 操作人类别
  34 + */
  35 + public OperatorType operatorType() default OperatorType.MANAGE;
  36 +
  37 + /**
  38 + * 是否保存请求的参数
  39 + */
  40 + public boolean isSaveRequestData() default true;
  41 +
  42 + /**
  43 + * 是否保存响应的参数
  44 + */
  45 + public boolean isSaveResponseData() default true;
  46 +
  47 + /**
  48 + * 排除指定的请求参数
  49 + */
  50 + public String[] excludeParamNames() default {};
  51 +}
ruoyi-common/src/main/java/com/ruoyi/common/annotation/RateLimiter.java 0 → 100644
  1 +package com.ruoyi.common.annotation;
  2 +
  3 +import java.lang.annotation.Documented;
  4 +import java.lang.annotation.ElementType;
  5 +import java.lang.annotation.Retention;
  6 +import java.lang.annotation.RetentionPolicy;
  7 +import java.lang.annotation.Target;
  8 +import com.ruoyi.common.constant.CacheConstants;
  9 +import com.ruoyi.common.enums.LimitType;
  10 +
  11 +/**
  12 + * 限流注解
  13 + *
  14 + * @author ruoyi
  15 + */
  16 +@Target(ElementType.METHOD)
  17 +@Retention(RetentionPolicy.RUNTIME)
  18 +@Documented
  19 +public @interface RateLimiter
  20 +{
  21 + /**
  22 + * 限流key
  23 + */
  24 + public String key() default CacheConstants.RATE_LIMIT_KEY;
  25 +
  26 + /**
  27 + * 限流时间,单位秒
  28 + */
  29 + public int time() default 60;
  30 +
  31 + /**
  32 + * 限流次数
  33 + */
  34 + public int count() default 100;
  35 +
  36 + /**
  37 + * 限流类型
  38 + */
  39 + public LimitType limitType() default LimitType.DEFAULT;
  40 +}