Commit fa99501bbce3d083a8f076bc24f2de7bcab98143

Authored by ljq
0 parents

初始化

Showing 57 changed files with 4829 additions and 0 deletions

Too many changes to show.

To preserve performance only 57 of 596 files are displayed.

.gitignore 0 → 100644
  1 +++ a/.gitignore
  1 +######################################################################
  2 +# Build Tools
  3 +
  4 +.gradle
  5 +/build/
  6 +!gradle/wrapper/gradle-wrapper.jar
  7 +
  8 +target/
  9 +!.mvn/wrapper/maven-wrapper.jar
  10 +
  11 +######################################################################
  12 +# IDE
  13 +
  14 +### STS ###
  15 +.apt_generated
  16 +.classpath
  17 +.factorypath
  18 +.project
  19 +.settings
  20 +.springBeans
  21 +
  22 +### IntelliJ IDEA ###
  23 +.idea
  24 +*.iws
  25 +*.iml
  26 +*.ipr
  27 +
  28 +### JRebel ###
  29 +rebel.xml
  30 +
  31 +### NetBeans ###
  32 +nbproject/private/
  33 +build/*
  34 +nbbuild/
  35 +dist/
  36 +nbdist/
  37 +.nb-gradle/
  38 +
  39 +######################################################################
  40 +# Others
  41 +*.log
  42 +*.xml.versionsBackup
  43 +*.swp
  44 +
  45 +!*/build/*.java
  46 +!*/build/*.html
  47 +!*/build/*.xml
LICENSE 0 → 100644
  1 +++ a/LICENSE
  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 +++ a/README.md
  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.3</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.3-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/139821253-blue.svg)](https://jq.qq.com/?_wv=1027&k=njiWDmkj) 点击按钮入群。
0 \ No newline at end of file 98 \ No newline at end of file
bin/clean.bat 0 → 100644
  1 +++ a/bin/clean.bat
  1 +@echo off
  2 +echo.
  3 +echo [信息] 清理工程target生成路径。
  4 +echo.
  5 +
  6 +%~d0
  7 +cd %~dp0
  8 +
  9 +cd ..
  10 +call mvn clean
  11 +
  12 +pause
0 \ No newline at end of file 13 \ No newline at end of file
bin/package.bat 0 → 100644
  1 +++ a/bin/package.bat
  1 +@echo off
  2 +echo.
  3 +echo [信息] 打包Web工程,生成war/jar包文件。
  4 +echo.
  5 +
  6 +%~d0
  7 +cd %~dp0
  8 +
  9 +cd ..
  10 +call mvn clean package -Dmaven.test.skip=true
  11 +
  12 +pause
0 \ No newline at end of file 13 \ No newline at end of file
bin/run.bat 0 → 100644
  1 +++ a/bin/run.bat
  1 +@echo off
  2 +echo.
  3 +echo [信息] 使用Jar命令运行Web工程。
  4 +echo.
  5 +
  6 +cd %~dp0
  7 +cd ../ruoyi-admin/target
  8 +
  9 +set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
  10 +
  11 +java -jar %JAVA_OPTS% ruoyi-admin.jar
  12 +
  13 +cd bin
  14 +pause
0 \ No newline at end of file 15 \ No newline at end of file
doc/若依环境使用手册.docx 0 → 100644
No preview for this file type
pom.xml 0 → 100644
  1 +++ a/pom.xml
  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.3</version>
  10 +
  11 + <name>ruoyi</name>
  12 + <url>http://www.ruoyi.vip</url>
  13 + <description>若依管理系统</description>
  14 +
  15 + <properties>
  16 + <ruoyi.version>3.8.3</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.11</druid.version>
  22 + <bitwalker.version>1.21</bitwalker.version>
  23 + <swagger.version>3.0.0</swagger.version>
  24 + <kaptcha.version>2.3.2</kaptcha.version>
  25 + <mybatis-spring-boot.version>2.2.2</mybatis-spring-boot.version>
  26 + <pagehelper.boot.version>1.4.1</pagehelper.boot.version>
  27 + <fastjson.version>2.0.9</fastjson.version>
  28 + <oshi.version>6.2.1</oshi.version>
  29 + <commons.io.version>2.11.0</commons.io.version>
  30 + <commons.fileupload.version>1.4</commons.fileupload.version>
  31 + <commons.collections.version>3.2.2</commons.collections.version>
  32 + <poi.version>4.1.2</poi.version>
  33 + <velocity.version>2.3</velocity.version>
  34 + <jwt.version>0.9.1</jwt.version>
  35 + </properties>
  36 +
  37 + <!-- 依赖声明 -->
  38 + <dependencyManagement>
  39 + <dependencies>
  40 +
  41 + <!-- SpringBoot的依赖配置-->
  42 + <dependency>
  43 + <groupId>org.springframework.boot</groupId>
  44 + <artifactId>spring-boot-dependencies</artifactId>
  45 + <version>2.5.14</version>
  46 + <type>pom</type>
  47 + <scope>import</scope>
  48 + </dependency>
  49 +
  50 + <!-- 阿里数据库连接池 -->
  51 + <dependency>
  52 + <groupId>com.alibaba</groupId>
  53 + <artifactId>druid-spring-boot-starter</artifactId>
  54 + <version>${druid.version}</version>
  55 + </dependency>
  56 +
  57 + <!-- 解析客户端操作系统、浏览器等 -->
  58 + <dependency>
  59 + <groupId>eu.bitwalker</groupId>
  60 + <artifactId>UserAgentUtils</artifactId>
  61 + <version>${bitwalker.version}</version>
  62 + </dependency>
  63 +
  64 + <!-- SpringBoot集成mybatis框架 -->
  65 + <dependency>
  66 + <groupId>org.mybatis.spring.boot</groupId>
  67 + <artifactId>mybatis-spring-boot-starter</artifactId>
  68 + <version>${mybatis-spring-boot.version}</version>
  69 + </dependency>
  70 +
  71 + <!-- pagehelper 分页插件 -->
  72 + <dependency>
  73 + <groupId>com.github.pagehelper</groupId>
  74 + <artifactId>pagehelper-spring-boot-starter</artifactId>
  75 + <version>${pagehelper.boot.version}</version>
  76 + </dependency>
  77 +
  78 + <!-- 获取系统信息 -->
  79 + <dependency>
  80 + <groupId>com.github.oshi</groupId>
  81 + <artifactId>oshi-core</artifactId>
  82 + <version>${oshi.version}</version>
  83 + </dependency>
  84 +
  85 + <!-- Swagger3依赖 -->
  86 + <dependency>
  87 + <groupId>io.springfox</groupId>
  88 + <artifactId>springfox-boot-starter</artifactId>
  89 + <version>${swagger.version}</version>
  90 + <exclusions>
  91 + <exclusion>
  92 + <groupId>io.swagger</groupId>
  93 + <artifactId>swagger-models</artifactId>
  94 + </exclusion>
  95 + </exclusions>
  96 + </dependency>
  97 +
  98 + <!-- io常用工具类 -->
  99 + <dependency>
  100 + <groupId>commons-io</groupId>
  101 + <artifactId>commons-io</artifactId>
  102 + <version>${commons.io.version}</version>
  103 + </dependency>
  104 +
  105 + <!-- 文件上传工具类 -->
  106 + <dependency>
  107 + <groupId>commons-fileupload</groupId>
  108 + <artifactId>commons-fileupload</artifactId>
  109 + <version>${commons.fileupload.version}</version>
  110 + </dependency>
  111 +
  112 + <!-- excel工具 -->
  113 + <dependency>
  114 + <groupId>org.apache.poi</groupId>
  115 + <artifactId>poi-ooxml</artifactId>
  116 + <version>${poi.version}</version>
  117 + </dependency>
  118 +
  119 + <!-- velocity代码生成使用模板 -->
  120 + <dependency>
  121 + <groupId>org.apache.velocity</groupId>
  122 + <artifactId>velocity-engine-core</artifactId>
  123 + <version>${velocity.version}</version>
  124 + </dependency>
  125 +
  126 + <!-- collections工具类 -->
  127 + <dependency>
  128 + <groupId>commons-collections</groupId>
  129 + <artifactId>commons-collections</artifactId>
  130 + <version>${commons.collections.version}</version>
  131 + </dependency>
  132 +
  133 + <!-- 阿里JSON解析器 -->
  134 + <dependency>
  135 + <groupId>com.alibaba.fastjson2</groupId>
  136 + <artifactId>fastjson2</artifactId>
  137 + <version>${fastjson.version}</version>
  138 + </dependency>
  139 +
  140 + <!-- Token生成与解析-->
  141 + <dependency>
  142 + <groupId>io.jsonwebtoken</groupId>
  143 + <artifactId>jjwt</artifactId>
  144 + <version>${jwt.version}</version>
  145 + </dependency>
  146 +
  147 + <!-- 验证码 -->
  148 + <dependency>
  149 + <groupId>com.github.penggle</groupId>
  150 + <artifactId>kaptcha</artifactId>
  151 + <version>${kaptcha.version}</version>
  152 + </dependency>
  153 +
  154 + <!-- 定时任务-->
  155 + <dependency>
  156 + <groupId>com.ruoyi</groupId>
  157 + <artifactId>ruoyi-quartz</artifactId>
  158 + <version>${ruoyi.version}</version>
  159 + </dependency>
  160 +
  161 + <!-- 代码生成-->
  162 + <dependency>
  163 + <groupId>com.ruoyi</groupId>
  164 + <artifactId>ruoyi-generator</artifactId>
  165 + <version>${ruoyi.version}</version>
  166 + </dependency>
  167 +
  168 + <!-- 核心模块-->
  169 + <dependency>
  170 + <groupId>com.ruoyi</groupId>
  171 + <artifactId>ruoyi-framework</artifactId>
  172 + <version>${ruoyi.version}</version>
  173 + </dependency>
  174 +
  175 + <!-- 系统模块-->
  176 + <dependency>
  177 + <groupId>com.ruoyi</groupId>
  178 + <artifactId>ruoyi-system</artifactId>
  179 + <version>${ruoyi.version}</version>
  180 + </dependency>
  181 +
  182 + <!-- 通用工具-->
  183 + <dependency>
  184 + <groupId>com.ruoyi</groupId>
  185 + <artifactId>ruoyi-common</artifactId>
  186 + <version>${ruoyi.version}</version>
  187 + </dependency>
  188 +
  189 + </dependencies>
  190 + </dependencyManagement>
  191 +
  192 + <modules>
  193 + <module>ruoyi-admin</module>
  194 + <module>ruoyi-framework</module>
  195 + <module>ruoyi-system</module>
  196 + <module>ruoyi-quartz</module>
  197 + <module>ruoyi-generator</module>
  198 + <module>ruoyi-common</module>
  199 + </modules>
  200 + <packaging>pom</packaging>
  201 +
  202 +
  203 + <dependencies>
  204 +
  205 + </dependencies>
  206 +
  207 + <build>
  208 + <plugins>
  209 + <plugin>
  210 + <groupId>org.apache.maven.plugins</groupId>
  211 + <artifactId>maven-compiler-plugin</artifactId>
  212 + <version>3.1</version>
  213 + <configuration>
  214 + <source>${java.version}</source>
  215 + <target>${java.version}</target>
  216 + <encoding>${project.build.sourceEncoding}</encoding>
  217 + </configuration>
  218 + </plugin>
  219 + </plugins>
  220 + </build>
  221 +
  222 + <repositories>
  223 + <repository>
  224 + <id>public</id>
  225 + <name>aliyun nexus</name>
  226 + <url>https://maven.aliyun.com/repository/public</url>
  227 + <releases>
  228 + <enabled>true</enabled>
  229 + </releases>
  230 + </repository>
  231 + </repositories>
  232 +
  233 + <pluginRepositories>
  234 + <pluginRepository>
  235 + <id>public</id>
  236 + <name>aliyun nexus</name>
  237 + <url>https://maven.aliyun.com/repository/public</url>
  238 + <releases>
  239 + <enabled>true</enabled>
  240 + </releases>
  241 + <snapshots>
  242 + <enabled>false</enabled>
  243 + </snapshots>
  244 + </pluginRepository>
  245 + </pluginRepositories>
  246 +
  247 +</project>
0 \ No newline at end of file 248 \ No newline at end of file
ruoyi-admin/pom.xml 0 → 100644
  1 +++ a/ruoyi-admin/pom.xml
  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.3</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 +++ a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
  1 +package com.ruoyi;
  2 +
  3 +import org.springframework.boot.SpringApplication;
  4 +import org.springframework.boot.autoconfigure.SpringBootApplication;
  5 +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  6 +
  7 +/**
  8 + * 启动程序
  9 + *
  10 + * @author ruoyi
  11 + */
  12 +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
  13 +public class RuoYiApplication
  14 +{
  15 + public static void main(String[] args)
  16 + {
  17 + // System.setProperty("spring.devtools.restart.enabled", "false");
  18 + SpringApplication.run(RuoYiApplication.class, args);
  19 + System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)11゙ \n" +
  20 + " .-------. ____ __ \n" +
  21 + " | _ _ \\ \\ \\ / / \n" +
  22 + " | ( ' ) | \\ _. / ' \n" +
  23 + " |(_ o _) / _( )_ .' \n" +
  24 + " | (_,_).' __ ___(_ o _)' \n" +
  25 + " | |\\ \\ | || |(_,_)' \n" +
  26 + " | | \\ `' /| `-' / \n" +
  27 + " | | \\ / \\ / \n" +
  28 + " ''-' `'-' `-..-' ");
  29 + }
  30 +}
ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java 0 → 100644
  1 +++ a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java
  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/web/controller/common/CaptchaController.java 0 → 100644
  1 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java
  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 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
  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 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java
  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 + }
  45 +
  46 + @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
  47 + @GetMapping()
  48 + public AjaxResult getInfo() throws Exception
  49 + {
  50 + Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
  51 + Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
  52 + Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
  53 +
  54 + Map<String, Object> result = new HashMap<>(3);
  55 + result.put("info", info);
  56 + result.put("dbSize", dbSize);
  57 +
  58 + List<Map<String, String>> pieList = new ArrayList<>();
  59 + commandStats.stringPropertyNames().forEach(key -> {
  60 + Map<String, String> data = new HashMap<>(2);
  61 + String property = commandStats.getProperty(key);
  62 + data.put("name", StringUtils.removeStart(key, "cmdstat_"));
  63 + data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
  64 + pieList.add(data);
  65 + });
  66 + result.put("commandStats", pieList);
  67 + return AjaxResult.success(result);
  68 + }
  69 +
  70 + @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
  71 + @GetMapping("/getNames")
  72 + public AjaxResult cache()
  73 + {
  74 + return AjaxResult.success(caches);
  75 + }
  76 +
  77 + @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
  78 + @GetMapping("/getKeys/{cacheName}")
  79 + public AjaxResult getCacheKeys(@PathVariable String cacheName)
  80 + {
  81 + Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
  82 + return AjaxResult.success(cacheKeys);
  83 + }
  84 +
  85 + @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
  86 + @GetMapping("/getValue/{cacheName}/{cacheKey}")
  87 + public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
  88 + {
  89 + String cacheValue = redisTemplate.opsForValue().get(cacheKey);
  90 + SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
  91 + return AjaxResult.success(sysCache);
  92 + }
  93 +
  94 + @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
  95 + @DeleteMapping("/clearCacheName/{cacheName}")
  96 + public AjaxResult clearCacheName(@PathVariable String cacheName)
  97 + {
  98 + Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
  99 + redisTemplate.delete(cacheKeys);
  100 + return AjaxResult.success();
  101 + }
  102 +
  103 + @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
  104 + @DeleteMapping("/clearCacheKey/{cacheKey}")
  105 + public AjaxResult clearCacheKey(@PathVariable String cacheKey)
  106 + {
  107 + redisTemplate.delete(cacheKey);
  108 + return AjaxResult.success();
  109 + }
  110 +
  111 + @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
  112 + @DeleteMapping("/clearCacheAll")
  113 + public AjaxResult clearCacheAll()
  114 + {
  115 + Collection<String> cacheKeys = redisTemplate.keys("*");
  116 + redisTemplate.delete(cacheKeys);
  117 + return AjaxResult.success();
  118 + }
  119 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java 0 → 100644
  1 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java
  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 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java
  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.SysLogininfor;
  20 +import com.ruoyi.system.service.ISysLogininforService;
  21 +
  22 +/**
  23 + * 系统访问记录
  24 + *
  25 + * @author ruoyi
  26 + */
  27 +@RestController
  28 +@RequestMapping("/monitor/logininfor")
  29 +public class SysLogininforController extends BaseController
  30 +{
  31 + @Autowired
  32 + private ISysLogininforService logininforService;
  33 +
  34 + @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
  35 + @GetMapping("/list")
  36 + public TableDataInfo list(SysLogininfor logininfor)
  37 + {
  38 + startPage();
  39 + List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
  40 + return getDataTable(list);
  41 + }
  42 +
  43 + @Log(title = "登录日志", businessType = BusinessType.EXPORT)
  44 + @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
  45 + @PostMapping("/export")
  46 + public void export(HttpServletResponse response, SysLogininfor logininfor)
  47 + {
  48 + List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
  49 + ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
  50 + util.exportExcel(response, list, "登录日志");
  51 + }
  52 +
  53 + @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
  54 + @Log(title = "登录日志", businessType = BusinessType.DELETE)
  55 + @DeleteMapping("/{infoIds}")
  56 + public AjaxResult remove(@PathVariable Long[] infoIds)
  57 + {
  58 + return toAjax(logininforService.deleteLogininforByIds(infoIds));
  59 + }
  60 +
  61 + @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
  62 + @Log(title = "登录日志", businessType = BusinessType.CLEAN)
  63 + @DeleteMapping("/clean")
  64 + public AjaxResult clean()
  65 + {
  66 + logininforService.cleanLogininfor();
  67 + return AjaxResult.success();
  68 + }
  69 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java 0 → 100644
  1 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java
  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 AjaxResult.success();
  68 + }
  69 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java 0 → 100644
  1 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java
  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 + if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
  53 + {
  54 + userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
  55 + }
  56 + }
  57 + else if (StringUtils.isNotEmpty(ipaddr))
  58 + {
  59 + if (StringUtils.equals(ipaddr, user.getIpaddr()))
  60 + {
  61 + userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
  62 + }
  63 + }
  64 + else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
  65 + {
  66 + if (StringUtils.equals(userName, user.getUsername()))
  67 + {
  68 + userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
  69 + }
  70 + }
  71 + else
  72 + {
  73 + userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
  74 + }
  75 + }
  76 + Collections.reverse(userOnlineList);
  77 + userOnlineList.removeAll(Collections.singleton(null));
  78 + return getDataTable(userOnlineList);
  79 + }
  80 +
  81 + /**
  82 + * 强退用户
  83 + */
  84 + @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
  85 + @Log(title = "在线用户", businessType = BusinessType.FORCE)
  86 + @DeleteMapping("/{tokenId}")
  87 + public AjaxResult forceLogout(@PathVariable String tokenId)
  88 + {
  89 + redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
  90 + return AjaxResult.success();
  91 + }
  92 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java 0 → 100644
  1 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
  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.constant.UserConstants;
  18 +import com.ruoyi.common.core.controller.BaseController;
  19 +import com.ruoyi.common.core.domain.AjaxResult;
  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.domain.SysConfig;
  24 +import com.ruoyi.system.service.ISysConfigService;
  25 +
  26 +/**
  27 + * 参数配置 信息操作处理
  28 + *
  29 + * @author ruoyi
  30 + */
  31 +@RestController
  32 +@RequestMapping("/system/config")
  33 +public class SysConfigController extends BaseController
  34 +{
  35 + @Autowired
  36 + private ISysConfigService configService;
  37 +
  38 + /**
  39 + * 获取参数配置列表
  40 + */
  41 + @PreAuthorize("@ss.hasPermi('system:config:list')")
  42 + @GetMapping("/list")
  43 + public TableDataInfo list(SysConfig config)
  44 + {
  45 + startPage();
  46 + List<SysConfig> list = configService.selectConfigList(config);
  47 + return getDataTable(list);
  48 + }
  49 +
  50 + @Log(title = "参数管理", businessType = BusinessType.EXPORT)
  51 + @PreAuthorize("@ss.hasPermi('system:config:export')")
  52 + @PostMapping("/export")
  53 + public void export(HttpServletResponse response, SysConfig config)
  54 + {
  55 + List<SysConfig> list = configService.selectConfigList(config);
  56 + ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
  57 + util.exportExcel(response, list, "参数数据");
  58 + }
  59 +
  60 + /**
  61 + * 根据参数编号获取详细信息
  62 + */
  63 + @PreAuthorize("@ss.hasPermi('system:config:query')")
  64 + @GetMapping(value = "/{configId}")
  65 + public AjaxResult getInfo(@PathVariable Long configId)
  66 + {
  67 + return AjaxResult.success(configService.selectConfigById(configId));
  68 + }
  69 +
  70 + /**
  71 + * 根据参数键名查询参数值
  72 + */
  73 + @GetMapping(value = "/configKey/{configKey}")
  74 + public AjaxResult getConfigKey(@PathVariable String configKey)
  75 + {
  76 + return AjaxResult.success(configService.selectConfigByKey(configKey));
  77 + }
  78 +
  79 + /**
  80 + * 新增参数配置
  81 + */
  82 + @PreAuthorize("@ss.hasPermi('system:config:add')")
  83 + @Log(title = "参数管理", businessType = BusinessType.INSERT)
  84 + @PostMapping
  85 + public AjaxResult add(@Validated @RequestBody SysConfig config)
  86 + {
  87 + if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
  88 + {
  89 + return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
  90 + }
  91 + config.setCreateBy(getUsername());
  92 + return toAjax(configService.insertConfig(config));
  93 + }
  94 +
  95 + /**
  96 + * 修改参数配置
  97 + */
  98 + @PreAuthorize("@ss.hasPermi('system:config:edit')")
  99 + @Log(title = "参数管理", businessType = BusinessType.UPDATE)
  100 + @PutMapping
  101 + public AjaxResult edit(@Validated @RequestBody SysConfig config)
  102 + {
  103 + if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
  104 + {
  105 + return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
  106 + }
  107 + config.setUpdateBy(getUsername());
  108 + return toAjax(configService.updateConfig(config));
  109 + }
  110 +
  111 + /**
  112 + * 删除参数配置
  113 + */
  114 + @PreAuthorize("@ss.hasPermi('system:config:remove')")
  115 + @Log(title = "参数管理", businessType = BusinessType.DELETE)
  116 + @DeleteMapping("/{configIds}")
  117 + public AjaxResult remove(@PathVariable Long[] configIds)
  118 + {
  119 + configService.deleteConfigByIds(configIds);
  120 + return success();
  121 + }
  122 +
  123 + /**
  124 + * 刷新参数缓存
  125 + */
  126 + @PreAuthorize("@ss.hasPermi('system:config:remove')")
  127 + @Log(title = "参数管理", businessType = BusinessType.CLEAN)
  128 + @DeleteMapping("/refreshCache")
  129 + public AjaxResult refreshCache()
  130 + {
  131 + configService.resetConfigCache();
  132 + return AjaxResult.success();
  133 + }
  134 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java 0 → 100644
  1 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
  1 +package com.ruoyi.web.controller.system;
  2 +
  3 +import java.util.Iterator;
  4 +import java.util.List;
  5 +import org.apache.commons.lang3.ArrayUtils;
  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.constant.UserConstants;
  19 +import com.ruoyi.common.core.controller.BaseController;
  20 +import com.ruoyi.common.core.domain.AjaxResult;
  21 +import com.ruoyi.common.core.domain.entity.SysDept;
  22 +import com.ruoyi.common.enums.BusinessType;
  23 +import com.ruoyi.common.utils.StringUtils;
  24 +import com.ruoyi.system.service.ISysDeptService;
  25 +
  26 +/**
  27 + * 部门信息
  28 + *
  29 + * @author ruoyi
  30 + */
  31 +@RestController
  32 +@RequestMapping("/system/dept")
  33 +public class SysDeptController extends BaseController
  34 +{
  35 + @Autowired
  36 + private ISysDeptService deptService;
  37 +
  38 + /**
  39 + * 获取部门列表
  40 + */
  41 + @PreAuthorize("@ss.hasPermi('system:dept:list')")
  42 + @GetMapping("/list")
  43 + public AjaxResult list(SysDept dept)
  44 + {
  45 + List<SysDept> depts = deptService.selectDeptList(dept);
  46 + return AjaxResult.success(depts);
  47 + }
  48 +
  49 + /**
  50 + * 查询部门列表(排除节点)
  51 + */
  52 + @PreAuthorize("@ss.hasPermi('system:dept:list')")
  53 + @GetMapping("/list/exclude/{deptId}")
  54 + public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
  55 + {
  56 + List<SysDept> depts = deptService.selectDeptList(new SysDept());
  57 + Iterator<SysDept> it = depts.iterator();
  58 + while (it.hasNext())
  59 + {
  60 + SysDept d = (SysDept) it.next();
  61 + if (d.getDeptId().intValue() == deptId
  62 + || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
  63 + {
  64 + it.remove();
  65 + }
  66 + }
  67 + return AjaxResult.success(depts);
  68 + }
  69 +
  70 + /**
  71 + * 根据部门编号获取详细信息
  72 + */
  73 + @PreAuthorize("@ss.hasPermi('system:dept:query')")
  74 + @GetMapping(value = "/{deptId}")
  75 + public AjaxResult getInfo(@PathVariable Long deptId)
  76 + {
  77 + deptService.checkDeptDataScope(deptId);
  78 + return AjaxResult.success(deptService.selectDeptById(deptId));
  79 + }
  80 +
  81 + /**
  82 + * 获取部门下拉树列表
  83 + */
  84 + @GetMapping("/treeselect")
  85 + public AjaxResult treeselect(SysDept dept)
  86 + {
  87 + List<SysDept> depts = deptService.selectDeptList(dept);
  88 + return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
  89 + }
  90 +
  91 + /**
  92 + * 加载对应角色部门列表树
  93 + */
  94 + @GetMapping(value = "/roleDeptTreeselect/{roleId}")
  95 + public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
  96 + {
  97 + List<SysDept> depts = deptService.selectDeptList(new SysDept());
  98 + AjaxResult ajax = AjaxResult.success();
  99 + ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
  100 + ajax.put("depts", deptService.buildDeptTreeSelect(depts));
  101 + return ajax;
  102 + }
  103 +
  104 + /**
  105 + * 新增部门
  106 + */
  107 + @PreAuthorize("@ss.hasPermi('system:dept:add')")
  108 + @Log(title = "部门管理", businessType = BusinessType.INSERT)
  109 + @PostMapping
  110 + public AjaxResult add(@Validated @RequestBody SysDept dept)
  111 + {
  112 + if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
  113 + {
  114 + return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
  115 + }
  116 + dept.setCreateBy(getUsername());
  117 + return toAjax(deptService.insertDept(dept));
  118 + }
  119 +
  120 + /**
  121 + * 修改部门
  122 + */
  123 + @PreAuthorize("@ss.hasPermi('system:dept:edit')")
  124 + @Log(title = "部门管理", businessType = BusinessType.UPDATE)
  125 + @PutMapping
  126 + public AjaxResult edit(@Validated @RequestBody SysDept dept)
  127 + {
  128 + Long deptId = dept.getDeptId();
  129 + deptService.checkDeptDataScope(deptId);
  130 + if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
  131 + {
  132 + return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
  133 + }
  134 + else if (dept.getParentId().equals(deptId))
  135 + {
  136 + return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
  137 + }
  138 + else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
  139 + {
  140 + return AjaxResult.error("该部门包含未停用的子部门!");
  141 + }
  142 + dept.setUpdateBy(getUsername());
  143 + return toAjax(deptService.updateDept(dept));
  144 + }
  145 +
  146 + /**
  147 + * 删除部门
  148 + */
  149 + @PreAuthorize("@ss.hasPermi('system:dept:remove')")
  150 + @Log(title = "部门管理", businessType = BusinessType.DELETE)
  151 + @DeleteMapping("/{deptId}")
  152 + public AjaxResult remove(@PathVariable Long deptId)
  153 + {
  154 + if (deptService.hasChildByDeptId(deptId))
  155 + {
  156 + return AjaxResult.error("存在下级部门,不允许删除");
  157 + }
  158 + if (deptService.checkDeptExistUser(deptId))
  159 + {
  160 + return AjaxResult.error("部门存在用户,不允许删除");
  161 + }
  162 + deptService.checkDeptDataScope(deptId);
  163 + return toAjax(deptService.deleteDeptById(deptId));
  164 + }
  165 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java 0 → 100644
  1 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
  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 AjaxResult.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 AjaxResult.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 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
  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.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.SysDictType;
  21 +import com.ruoyi.common.core.page.TableDataInfo;
  22 +import com.ruoyi.common.enums.BusinessType;
  23 +import com.ruoyi.common.utils.poi.ExcelUtil;
  24 +import com.ruoyi.system.service.ISysDictTypeService;
  25 +
  26 +/**
  27 + * 数据字典信息
  28 + *
  29 + * @author ruoyi
  30 + */
  31 +@RestController
  32 +@RequestMapping("/system/dict/type")
  33 +public class SysDictTypeController extends BaseController
  34 +{
  35 + @Autowired
  36 + private ISysDictTypeService dictTypeService;
  37 +
  38 + @PreAuthorize("@ss.hasPermi('system:dict:list')")
  39 + @GetMapping("/list")
  40 + public TableDataInfo list(SysDictType dictType)
  41 + {
  42 + startPage();
  43 + List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
  44 + return getDataTable(list);
  45 + }
  46 +
  47 + @Log(title = "字典类型", businessType = BusinessType.EXPORT)
  48 + @PreAuthorize("@ss.hasPermi('system:dict:export')")
  49 + @PostMapping("/export")
  50 + public void export(HttpServletResponse response, SysDictType dictType)
  51 + {
  52 + List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
  53 + ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
  54 + util.exportExcel(response, list, "字典类型");
  55 + }
  56 +
  57 + /**
  58 + * 查询字典类型详细
  59 + */
  60 + @PreAuthorize("@ss.hasPermi('system:dict:query')")
  61 + @GetMapping(value = "/{dictId}")
  62 + public AjaxResult getInfo(@PathVariable Long dictId)
  63 + {
  64 + return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
  65 + }
  66 +
  67 + /**
  68 + * 新增字典类型
  69 + */
  70 + @PreAuthorize("@ss.hasPermi('system:dict:add')")
  71 + @Log(title = "字典类型", businessType = BusinessType.INSERT)
  72 + @PostMapping
  73 + public AjaxResult add(@Validated @RequestBody SysDictType dict)
  74 + {
  75 + if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
  76 + {
  77 + return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
  78 + }
  79 + dict.setCreateBy(getUsername());
  80 + return toAjax(dictTypeService.insertDictType(dict));
  81 + }
  82 +
  83 + /**
  84 + * 修改字典类型
  85 + */
  86 + @PreAuthorize("@ss.hasPermi('system:dict:edit')")
  87 + @Log(title = "字典类型", businessType = BusinessType.UPDATE)
  88 + @PutMapping
  89 + public AjaxResult edit(@Validated @RequestBody SysDictType dict)
  90 + {
  91 + if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
  92 + {
  93 + return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
  94 + }
  95 + dict.setUpdateBy(getUsername());
  96 + return toAjax(dictTypeService.updateDictType(dict));
  97 + }
  98 +
  99 + /**
  100 + * 删除字典类型
  101 + */
  102 + @PreAuthorize("@ss.hasPermi('system:dict:remove')")
  103 + @Log(title = "字典类型", businessType = BusinessType.DELETE)
  104 + @DeleteMapping("/{dictIds}")
  105 + public AjaxResult remove(@PathVariable Long[] dictIds)
  106 + {
  107 + dictTypeService.deleteDictTypeByIds(dictIds);
  108 + return success();
  109 + }
  110 +
  111 + /**
  112 + * 刷新字典缓存
  113 + */
  114 + @PreAuthorize("@ss.hasPermi('system:dict:remove')")
  115 + @Log(title = "字典类型", businessType = BusinessType.CLEAN)
  116 + @DeleteMapping("/refreshCache")
  117 + public AjaxResult refreshCache()
  118 + {
  119 + dictTypeService.resetDictCache();
  120 + return AjaxResult.success();
  121 + }
  122 +
  123 + /**
  124 + * 获取字典选择框列表
  125 + */
  126 + @GetMapping("/optionselect")
  127 + public AjaxResult optionselect()
  128 + {
  129 + List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
  130 + return AjaxResult.success(dictTypes);
  131 + }
  132 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java 0 → 100644
  1 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java
  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 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
  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 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
  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 AjaxResult.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 AjaxResult.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 AjaxResult.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 (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
  89 + {
  90 + return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
  91 + }
  92 + else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
  93 + {
  94 + return AjaxResult.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 (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
  109 + {
  110 + return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
  111 + }
  112 + else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
  113 + {
  114 + return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
  115 + }
  116 + else if (menu.getMenuId().equals(menu.getParentId()))
  117 + {
  118 + return AjaxResult.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 AjaxResult.error("存在子菜单,不允许删除");
  135 + }
  136 + if (menuService.checkMenuExistRole(menuId))
  137 + {
  138 + return AjaxResult.error("菜单已分配,不允许删除");
  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 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java
  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 AjaxResult.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 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
  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.constant.UserConstants;
  18 +import com.ruoyi.common.core.controller.BaseController;
  19 +import com.ruoyi.common.core.domain.AjaxResult;
  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.domain.SysPost;
  24 +import com.ruoyi.system.service.ISysPostService;
  25 +
  26 +/**
  27 + * 岗位信息操作处理
  28 + *
  29 + * @author ruoyi
  30 + */
  31 +@RestController
  32 +@RequestMapping("/system/post")
  33 +public class SysPostController extends BaseController
  34 +{
  35 + @Autowired
  36 + private ISysPostService postService;
  37 +
  38 + /**
  39 + * 获取岗位列表
  40 + */
  41 + @PreAuthorize("@ss.hasPermi('system:post:list')")
  42 + @GetMapping("/list")
  43 + public TableDataInfo list(SysPost post)
  44 + {
  45 + startPage();
  46 + List<SysPost> list = postService.selectPostList(post);
  47 + return getDataTable(list);
  48 + }
  49 +
  50 + @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
  51 + @PreAuthorize("@ss.hasPermi('system:post:export')")
  52 + @PostMapping("/export")
  53 + public void export(HttpServletResponse response, SysPost post)
  54 + {
  55 + List<SysPost> list = postService.selectPostList(post);
  56 + ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
  57 + util.exportExcel(response, list, "岗位数据");
  58 + }
  59 +
  60 + /**
  61 + * 根据岗位编号获取详细信息
  62 + */
  63 + @PreAuthorize("@ss.hasPermi('system:post:query')")
  64 + @GetMapping(value = "/{postId}")
  65 + public AjaxResult getInfo(@PathVariable Long postId)
  66 + {
  67 + return AjaxResult.success(postService.selectPostById(postId));
  68 + }
  69 +
  70 + /**
  71 + * 新增岗位
  72 + */
  73 + @PreAuthorize("@ss.hasPermi('system:post:add')")
  74 + @Log(title = "岗位管理", businessType = BusinessType.INSERT)
  75 + @PostMapping
  76 + public AjaxResult add(@Validated @RequestBody SysPost post)
  77 + {
  78 + if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
  79 + {
  80 + return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
  81 + }
  82 + else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
  83 + {
  84 + return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
  85 + }
  86 + post.setCreateBy(getUsername());
  87 + return toAjax(postService.insertPost(post));
  88 + }
  89 +
  90 + /**
  91 + * 修改岗位
  92 + */
  93 + @PreAuthorize("@ss.hasPermi('system:post:edit')")
  94 + @Log(title = "岗位管理", businessType = BusinessType.UPDATE)
  95 + @PutMapping
  96 + public AjaxResult edit(@Validated @RequestBody SysPost post)
  97 + {
  98 + if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
  99 + {
  100 + return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
  101 + }
  102 + else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
  103 + {
  104 + return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
  105 + }
  106 + post.setUpdateBy(getUsername());
  107 + return toAjax(postService.updatePost(post));
  108 + }
  109 +
  110 + /**
  111 + * 删除岗位
  112 + */
  113 + @PreAuthorize("@ss.hasPermi('system:post:remove')")
  114 + @Log(title = "岗位管理", businessType = BusinessType.DELETE)
  115 + @DeleteMapping("/{postIds}")
  116 + public AjaxResult remove(@PathVariable Long[] postIds)
  117 + {
  118 + return toAjax(postService.deletePostByIds(postIds));
  119 + }
  120 +
  121 + /**
  122 + * 获取岗位选择框列表
  123 + */
  124 + @GetMapping("/optionselect")
  125 + public AjaxResult optionselect()
  126 + {
  127 + List<SysPost> posts = postService.selectPostAll();
  128 + return AjaxResult.success(posts);
  129 + }
  130 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java 0 → 100644
  1 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java
  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.constant.UserConstants;
  15 +import com.ruoyi.common.core.controller.BaseController;
  16 +import com.ruoyi.common.core.domain.AjaxResult;
  17 +import com.ruoyi.common.core.domain.entity.SysUser;
  18 +import com.ruoyi.common.core.domain.model.LoginUser;
  19 +import com.ruoyi.common.enums.BusinessType;
  20 +import com.ruoyi.common.utils.SecurityUtils;
  21 +import com.ruoyi.common.utils.StringUtils;
  22 +import com.ruoyi.common.utils.file.FileUploadUtils;
  23 +import com.ruoyi.common.utils.file.MimeTypeUtils;
  24 +import com.ruoyi.framework.web.service.TokenService;
  25 +import com.ruoyi.system.service.ISysUserService;
  26 +
  27 +/**
  28 + * 个人信息 业务处理
  29 + *
  30 + * @author ruoyi
  31 + */
  32 +@RestController
  33 +@RequestMapping("/system/user/profile")
  34 +public class SysProfileController extends BaseController
  35 +{
  36 + @Autowired
  37 + private ISysUserService userService;
  38 +
  39 + @Autowired
  40 + private TokenService tokenService;
  41 +
  42 + /**
  43 + * 个人信息
  44 + */
  45 + @GetMapping
  46 + public AjaxResult profile()
  47 + {
  48 + LoginUser loginUser = getLoginUser();
  49 + SysUser user = loginUser.getUser();
  50 + AjaxResult ajax = AjaxResult.success(user);
  51 + ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
  52 + ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
  53 + return ajax;
  54 + }
  55 +
  56 + /**
  57 + * 修改用户
  58 + */
  59 + @Log(title = "个人信息", businessType = BusinessType.UPDATE)
  60 + @PutMapping
  61 + public AjaxResult updateProfile(@RequestBody SysUser user)
  62 + {
  63 + LoginUser loginUser = getLoginUser();
  64 + SysUser sysUser = loginUser.getUser();
  65 + user.setUserName(sysUser.getUserName());
  66 + if (StringUtils.isNotEmpty(user.getPhonenumber())
  67 + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
  68 + {
  69 + return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
  70 + }
  71 + if (StringUtils.isNotEmpty(user.getEmail())
  72 + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
  73 + {
  74 + return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
  75 + }
  76 + user.setUserId(sysUser.getUserId());
  77 + user.setPassword(null);
  78 + if (userService.updateUserProfile(user) > 0)
  79 + {
  80 + // 更新缓存用户信息
  81 + sysUser.setNickName(user.getNickName());
  82 + sysUser.setPhonenumber(user.getPhonenumber());
  83 + sysUser.setEmail(user.getEmail());
  84 + sysUser.setSex(user.getSex());
  85 + tokenService.setLoginUser(loginUser);
  86 + return AjaxResult.success();
  87 + }
  88 + return AjaxResult.error("修改个人信息异常,请联系管理员");
  89 + }
  90 +
  91 + /**
  92 + * 重置密码
  93 + */
  94 + @Log(title = "个人信息", businessType = BusinessType.UPDATE)
  95 + @PutMapping("/updatePwd")
  96 + public AjaxResult updatePwd(String oldPassword, String newPassword)
  97 + {
  98 + LoginUser loginUser = getLoginUser();
  99 + String userName = loginUser.getUsername();
  100 + String password = loginUser.getPassword();
  101 + if (!SecurityUtils.matchesPassword(oldPassword, password))
  102 + {
  103 + return AjaxResult.error("修改密码失败,旧密码错误");
  104 + }
  105 + if (SecurityUtils.matchesPassword(newPassword, password))
  106 + {
  107 + return AjaxResult.error("新密码不能与旧密码相同");
  108 + }
  109 + if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
  110 + {
  111 + // 更新缓存用户密码
  112 + loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
  113 + tokenService.setLoginUser(loginUser);
  114 + return AjaxResult.success();
  115 + }
  116 + return AjaxResult.error("修改密码异常,请联系管理员");
  117 + }
  118 +
  119 + /**
  120 + * 头像上传
  121 + */
  122 + @Log(title = "用户头像", businessType = BusinessType.UPDATE)
  123 + @PostMapping("/avatar")
  124 + public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
  125 + {
  126 + if (!file.isEmpty())
  127 + {
  128 + LoginUser loginUser = getLoginUser();
  129 + String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
  130 + if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
  131 + {
  132 + AjaxResult ajax = AjaxResult.success();
  133 + ajax.put("imgUrl", avatar);
  134 + // 更新缓存用户头像
  135 + loginUser.getUser().setAvatar(avatar);
  136 + tokenService.setLoginUser(loginUser);
  137 + return ajax;
  138 + }
  139 + }
  140 + return AjaxResult.error("上传图片异常,请联系管理员");
  141 + }
  142 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java 0 → 100644
  1 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java
  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 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
  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.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.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.ISysRoleService;
  31 +import com.ruoyi.system.service.ISysUserService;
  32 +
  33 +/**
  34 + * 角色信息
  35 + *
  36 + * @author ruoyi
  37 + */
  38 +@RestController
  39 +@RequestMapping("/system/role")
  40 +public class SysRoleController extends BaseController
  41 +{
  42 + @Autowired
  43 + private ISysRoleService roleService;
  44 +
  45 + @Autowired
  46 + private TokenService tokenService;
  47 +
  48 + @Autowired
  49 + private SysPermissionService permissionService;
  50 +
  51 + @Autowired
  52 + private ISysUserService userService;
  53 +
  54 + @PreAuthorize("@ss.hasPermi('system:role:list')")
  55 + @GetMapping("/list")
  56 + public TableDataInfo list(SysRole role)
  57 + {
  58 + startPage();
  59 + List<SysRole> list = roleService.selectRoleList(role);
  60 + return getDataTable(list);
  61 + }
  62 +
  63 + @Log(title = "角色管理", businessType = BusinessType.EXPORT)
  64 + @PreAuthorize("@ss.hasPermi('system:role:export')")
  65 + @PostMapping("/export")
  66 + public void export(HttpServletResponse response, SysRole role)
  67 + {
  68 + List<SysRole> list = roleService.selectRoleList(role);
  69 + ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
  70 + util.exportExcel(response, list, "角色数据");
  71 + }
  72 +
  73 + /**
  74 + * 根据角色编号获取详细信息
  75 + */
  76 + @PreAuthorize("@ss.hasPermi('system:role:query')")
  77 + @GetMapping(value = "/{roleId}")
  78 + public AjaxResult getInfo(@PathVariable Long roleId)
  79 + {
  80 + roleService.checkRoleDataScope(roleId);
  81 + return AjaxResult.success(roleService.selectRoleById(roleId));
  82 + }
  83 +
  84 + /**
  85 + * 新增角色
  86 + */
  87 + @PreAuthorize("@ss.hasPermi('system:role:add')")
  88 + @Log(title = "角色管理", businessType = BusinessType.INSERT)
  89 + @PostMapping
  90 + public AjaxResult add(@Validated @RequestBody SysRole role)
  91 + {
  92 + if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
  93 + {
  94 + return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
  95 + }
  96 + else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
  97 + {
  98 + return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
  99 + }
  100 + role.setCreateBy(getUsername());
  101 + return toAjax(roleService.insertRole(role));
  102 +
  103 + }
  104 +
  105 + /**
  106 + * 修改保存角色
  107 + */
  108 + @PreAuthorize("@ss.hasPermi('system:role:edit')")
  109 + @Log(title = "角色管理", businessType = BusinessType.UPDATE)
  110 + @PutMapping
  111 + public AjaxResult edit(@Validated @RequestBody SysRole role)
  112 + {
  113 + roleService.checkRoleAllowed(role);
  114 + roleService.checkRoleDataScope(role.getRoleId());
  115 + if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
  116 + {
  117 + return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
  118 + }
  119 + else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
  120 + {
  121 + return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
  122 + }
  123 + role.setUpdateBy(getUsername());
  124 +
  125 + if (roleService.updateRole(role) > 0)
  126 + {
  127 + // 更新缓存用户权限
  128 + LoginUser loginUser = getLoginUser();
  129 + if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
  130 + {
  131 + loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
  132 + loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
  133 + tokenService.setLoginUser(loginUser);
  134 + }
  135 + return AjaxResult.success();
  136 + }
  137 + return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
  138 + }
  139 +
  140 + /**
  141 + * 修改保存数据权限
  142 + */
  143 + @PreAuthorize("@ss.hasPermi('system:role:edit')")
  144 + @Log(title = "角色管理", businessType = BusinessType.UPDATE)
  145 + @PutMapping("/dataScope")
  146 + public AjaxResult dataScope(@RequestBody SysRole role)
  147 + {
  148 + roleService.checkRoleAllowed(role);
  149 + roleService.checkRoleDataScope(role.getRoleId());
  150 + return toAjax(roleService.authDataScope(role));
  151 + }
  152 +
  153 + /**
  154 + * 状态修改
  155 + */
  156 + @PreAuthorize("@ss.hasPermi('system:role:edit')")
  157 + @Log(title = "角色管理", businessType = BusinessType.UPDATE)
  158 + @PutMapping("/changeStatus")
  159 + public AjaxResult changeStatus(@RequestBody SysRole role)
  160 + {
  161 + roleService.checkRoleAllowed(role);
  162 + roleService.checkRoleDataScope(role.getRoleId());
  163 + role.setUpdateBy(getUsername());
  164 + return toAjax(roleService.updateRoleStatus(role));
  165 + }
  166 +
  167 + /**
  168 + * 删除角色
  169 + */
  170 + @PreAuthorize("@ss.hasPermi('system:role:remove')")
  171 + @Log(title = "角色管理", businessType = BusinessType.DELETE)
  172 + @DeleteMapping("/{roleIds}")
  173 + public AjaxResult remove(@PathVariable Long[] roleIds)
  174 + {
  175 + return toAjax(roleService.deleteRoleByIds(roleIds));
  176 + }
  177 +
  178 + /**
  179 + * 获取角色选择框列表
  180 + */
  181 + @PreAuthorize("@ss.hasPermi('system:role:query')")
  182 + @GetMapping("/optionselect")
  183 + public AjaxResult optionselect()
  184 + {
  185 + return AjaxResult.success(roleService.selectRoleAll());
  186 + }
  187 +
  188 + /**
  189 + * 查询已分配用户角色列表
  190 + */
  191 + @PreAuthorize("@ss.hasPermi('system:role:list')")
  192 + @GetMapping("/authUser/allocatedList")
  193 + public TableDataInfo allocatedList(SysUser user)
  194 + {
  195 + startPage();
  196 + List<SysUser> list = userService.selectAllocatedList(user);
  197 + return getDataTable(list);
  198 + }
  199 +
  200 + /**
  201 + * 查询未分配用户角色列表
  202 + */
  203 + @PreAuthorize("@ss.hasPermi('system:role:list')")
  204 + @GetMapping("/authUser/unallocatedList")
  205 + public TableDataInfo unallocatedList(SysUser user)
  206 + {
  207 + startPage();
  208 + List<SysUser> list = userService.selectUnallocatedList(user);
  209 + return getDataTable(list);
  210 + }
  211 +
  212 + /**
  213 + * 取消授权用户
  214 + */
  215 + @PreAuthorize("@ss.hasPermi('system:role:edit')")
  216 + @Log(title = "角色管理", businessType = BusinessType.GRANT)
  217 + @PutMapping("/authUser/cancel")
  218 + public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
  219 + {
  220 + return toAjax(roleService.deleteAuthUser(userRole));
  221 + }
  222 +
  223 + /**
  224 + * 批量取消授权用户
  225 + */
  226 + @PreAuthorize("@ss.hasPermi('system:role:edit')")
  227 + @Log(title = "角色管理", businessType = BusinessType.GRANT)
  228 + @PutMapping("/authUser/cancelAll")
  229 + public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
  230 + {
  231 + return toAjax(roleService.deleteAuthUsers(roleId, userIds));
  232 + }
  233 +
  234 + /**
  235 + * 批量选择用户授权
  236 + */
  237 + @PreAuthorize("@ss.hasPermi('system:role:edit')")
  238 + @Log(title = "角色管理", businessType = BusinessType.GRANT)
  239 + @PutMapping("/authUser/selectAll")
  240 + public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
  241 + {
  242 + roleService.checkRoleDataScope(roleId);
  243 + return toAjax(roleService.insertAuthUsers(roleId, userIds));
  244 + }
  245 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java 0 → 100644
  1 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  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.constant.UserConstants;
  21 +import com.ruoyi.common.core.controller.BaseController;
  22 +import com.ruoyi.common.core.domain.AjaxResult;
  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.ISysPostService;
  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/user")
  41 +public class SysUserController extends BaseController
  42 +{
  43 + @Autowired
  44 + private ISysUserService userService;
  45 +
  46 + @Autowired
  47 + private ISysRoleService roleService;
  48 +
  49 + @Autowired
  50 + private ISysPostService postService;
  51 +
  52 + /**
  53 + * 获取用户列表
  54 + */
  55 + @PreAuthorize("@ss.hasPermi('system:user:list')")
  56 + @GetMapping("/list")
  57 + public TableDataInfo list(SysUser user)
  58 + {
  59 + startPage();
  60 + List<SysUser> list = userService.selectUserList(user);
  61 + return getDataTable(list);
  62 + }
  63 +
  64 + @Log(title = "用户管理", businessType = BusinessType.EXPORT)
  65 + @PreAuthorize("@ss.hasPermi('system:user:export')")
  66 + @PostMapping("/export")
  67 + public void export(HttpServletResponse response, SysUser user)
  68 + {
  69 + List<SysUser> list = userService.selectUserList(user);
  70 + ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
  71 + util.exportExcel(response, list, "用户数据");
  72 + }
  73 +
  74 + @Log(title = "用户管理", businessType = BusinessType.IMPORT)
  75 + @PreAuthorize("@ss.hasPermi('system:user:import')")
  76 + @PostMapping("/importData")
  77 + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
  78 + {
  79 + ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
  80 + List<SysUser> userList = util.importExcel(file.getInputStream());
  81 + String operName = getUsername();
  82 + String message = userService.importUser(userList, updateSupport, operName);
  83 + return AjaxResult.success(message);
  84 + }
  85 +
  86 + @PostMapping("/importTemplate")
  87 + public void importTemplate(HttpServletResponse response)
  88 + {
  89 + ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
  90 + util.importTemplateExcel(response, "用户数据");
  91 + }
  92 +
  93 + /**
  94 + * 根据用户编号获取详细信息
  95 + */
  96 + @PreAuthorize("@ss.hasPermi('system:user:query')")
  97 + @GetMapping(value = { "/", "/{userId}" })
  98 + public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
  99 + {
  100 + userService.checkUserDataScope(userId);
  101 + AjaxResult ajax = AjaxResult.success();
  102 + List<SysRole> roles = roleService.selectRoleAll();
  103 + ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
  104 + ajax.put("posts", postService.selectPostAll());
  105 + if (StringUtils.isNotNull(userId))
  106 + {
  107 + SysUser sysUser = userService.selectUserById(userId);
  108 + ajax.put(AjaxResult.DATA_TAG, sysUser);
  109 + ajax.put("postIds", postService.selectPostListByUserId(userId));
  110 + ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
  111 + }
  112 + return ajax;
  113 + }
  114 +
  115 + /**
  116 + * 新增用户
  117 + */
  118 + @PreAuthorize("@ss.hasPermi('system:user:add')")
  119 + @Log(title = "用户管理", businessType = BusinessType.INSERT)
  120 + @PostMapping
  121 + public AjaxResult add(@Validated @RequestBody SysUser user)
  122 + {
  123 + if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName())))
  124 + {
  125 + return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
  126 + }
  127 + else if (StringUtils.isNotEmpty(user.getPhonenumber())
  128 + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
  129 + {
  130 + return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
  131 + }
  132 + else if (StringUtils.isNotEmpty(user.getEmail())
  133 + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
  134 + {
  135 + return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
  136 + }
  137 + user.setCreateBy(getUsername());
  138 + user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
  139 + return toAjax(userService.insertUser(user));
  140 + }
  141 +
  142 + /**
  143 + * 修改用户
  144 + */
  145 + @PreAuthorize("@ss.hasPermi('system:user:edit')")
  146 + @Log(title = "用户管理", businessType = BusinessType.UPDATE)
  147 + @PutMapping
  148 + public AjaxResult edit(@Validated @RequestBody SysUser user)
  149 + {
  150 + userService.checkUserAllowed(user);
  151 + userService.checkUserDataScope(user.getUserId());
  152 + if (StringUtils.isNotEmpty(user.getPhonenumber())
  153 + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
  154 + {
  155 + return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
  156 + }
  157 + else if (StringUtils.isNotEmpty(user.getEmail())
  158 + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
  159 + {
  160 + return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
  161 + }
  162 + user.setUpdateBy(getUsername());
  163 + return toAjax(userService.updateUser(user));
  164 + }
  165 +
  166 + /**
  167 + * 删除用户
  168 + */
  169 + @PreAuthorize("@ss.hasPermi('system:user:remove')")
  170 + @Log(title = "用户管理", businessType = BusinessType.DELETE)
  171 + @DeleteMapping("/{userIds}")
  172 + public AjaxResult remove(@PathVariable Long[] userIds)
  173 + {
  174 + if (ArrayUtils.contains(userIds, getUserId()))
  175 + {
  176 + return error("当前用户不能删除");
  177 + }
  178 + return toAjax(userService.deleteUserByIds(userIds));
  179 + }
  180 +
  181 + /**
  182 + * 重置密码
  183 + */
  184 + @PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
  185 + @Log(title = "用户管理", businessType = BusinessType.UPDATE)
  186 + @PutMapping("/resetPwd")
  187 + public AjaxResult resetPwd(@RequestBody SysUser user)
  188 + {
  189 + userService.checkUserAllowed(user);
  190 + userService.checkUserDataScope(user.getUserId());
  191 + user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
  192 + user.setUpdateBy(getUsername());
  193 + return toAjax(userService.resetPwd(user));
  194 + }
  195 +
  196 + /**
  197 + * 状态修改
  198 + */
  199 + @PreAuthorize("@ss.hasPermi('system:user:edit')")
  200 + @Log(title = "用户管理", businessType = BusinessType.UPDATE)
  201 + @PutMapping("/changeStatus")
  202 + public AjaxResult changeStatus(@RequestBody SysUser user)
  203 + {
  204 + userService.checkUserAllowed(user);
  205 + userService.checkUserDataScope(user.getUserId());
  206 + user.setUpdateBy(getUsername());
  207 + return toAjax(userService.updateUserStatus(user));
  208 + }
  209 +
  210 + /**
  211 + * 根据用户编号获取授权角色
  212 + */
  213 + @PreAuthorize("@ss.hasPermi('system:user:query')")
  214 + @GetMapping("/authRole/{userId}")
  215 + public AjaxResult authRole(@PathVariable("userId") Long userId)
  216 + {
  217 + AjaxResult ajax = AjaxResult.success();
  218 + SysUser user = userService.selectUserById(userId);
  219 + List<SysRole> roles = roleService.selectRolesByUserId(userId);
  220 + ajax.put("user", user);
  221 + ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
  222 + return ajax;
  223 + }
  224 +
  225 + /**
  226 + * 用户授权角色
  227 + */
  228 + @PreAuthorize("@ss.hasPermi('system:user:edit')")
  229 + @Log(title = "用户管理", businessType = BusinessType.GRANT)
  230 + @PutMapping("/authRole")
  231 + public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
  232 + {
  233 + userService.checkUserDataScope(userId);
  234 + userService.insertUserAuth(userId, roleIds);
  235 + return success();
  236 + }
  237 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java 0 → 100644
  1 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java
  1 +package com.ruoyi.web.controller.tool;
  2 +
  3 +import org.springframework.security.access.prepost.PreAuthorize;
  4 +import org.springframework.stereotype.Controller;
  5 +import org.springframework.web.bind.annotation.GetMapping;
  6 +import org.springframework.web.bind.annotation.RequestMapping;
  7 +import com.ruoyi.common.core.controller.BaseController;
  8 +
  9 +/**
  10 + * swagger 接口
  11 + *
  12 + * @author ruoyi
  13 + */
  14 +@Controller
  15 +@RequestMapping("/tool/swagger")
  16 +public class SwaggerController extends BaseController
  17 +{
  18 + @PreAuthorize("@ss.hasPermi('tool:swagger:view')")
  19 + @GetMapping()
  20 + public String index()
  21 + {
  22 + return redirect("/swagger-ui.html");
  23 + }
  24 +}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java 0 → 100644
  1 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java
  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 +++ a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java
  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("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
  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 +++ a/ruoyi-admin/src/main/resources/META-INF/spring-devtools.properties
  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.yml 0 → 100644
  1 +++ a/ruoyi-admin/src/main/resources/application-druid.yml
  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 + url: jdbc:mysql://localhost:3306/archives?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
  10 + username: root
  11 + password: root
  12 + # 从库数据源
  13 + slave:
  14 + # 从数据源开关/默认关闭
  15 + enabled: false
  16 + url:
  17 + username:
  18 + password:
  19 + # 初始连接数
  20 + initialSize: 5
  21 + # 最小连接池数量
  22 + minIdle: 10
  23 + # 最大连接池数量
  24 + maxActive: 20
  25 + # 配置获取连接等待超时的时间
  26 + maxWait: 60000
  27 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
  28 + timeBetweenEvictionRunsMillis: 60000
  29 + # 配置一个连接在池中最小生存的时间,单位是毫秒
  30 + minEvictableIdleTimeMillis: 300000
  31 + # 配置一个连接在池中最大生存的时间,单位是毫秒
  32 + maxEvictableIdleTimeMillis: 900000
  33 + # 配置检测连接是否有效
  34 + validationQuery: SELECT 1 FROM DUAL
  35 + testWhileIdle: true
  36 + testOnBorrow: false
  37 + testOnReturn: false
  38 + webStatFilter:
  39 + enabled: true
  40 + statViewServlet:
  41 + enabled: true
  42 + # 设置白名单,不填则允许所有访问
  43 + allow:
  44 + url-pattern: /druid/*
  45 + # 控制台管理用户名和密码
  46 + login-username: ruoyi
  47 + login-password: 123456
  48 + filter:
  49 + stat:
  50 + enabled: true
  51 + # 慢SQL记录
  52 + log-slow-sql: true
  53 + slow-sql-millis: 1000
  54 + merge-sql: true
  55 + wall:
  56 + config:
  57 + multi-statement-allow: true
0 \ No newline at end of file 58 \ No newline at end of file
ruoyi-admin/src/main/resources/application.yml 0 → 100644
  1 +++ a/ruoyi-admin/src/main/resources/application.yml
  1 +# 项目相关配置
  2 +ruoyi:
  3 + # 名称
  4 + name: RuoYi
  5 + # 版本
  6 + version: 3.8.3
  7 + # 版权年份
  8 + copyrightYear: 2022
  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 +# Spring配置
  43 +spring:
  44 + # 资源信息
  45 + messages:
  46 + # 国际化资源文件路径
  47 + basename: i18n/messages
  48 + profiles:
  49 + active: druid
  50 + # 文件上传
  51 + servlet:
  52 + multipart:
  53 + # 单个文件大小
  54 + max-file-size: 10MB
  55 + # 设置总上传的文件大小
  56 + max-request-size: 20MB
  57 + # 服务模块
  58 + devtools:
  59 + restart:
  60 + # 热部署开关
  61 + enabled: true
  62 + # redis 配置
  63 + redis:
  64 + # 地址
  65 + host: localhost
  66 + # 端口,默认为6379
  67 + port: 6379
  68 + # 数据库索引
  69 + database: 0
  70 + # 密码
  71 + password:
  72 + # 连接超时时间
  73 + timeout: 10s
  74 + lettuce:
  75 + pool:
  76 + # 连接池中的最小空闲连接
  77 + min-idle: 0
  78 + # 连接池中的最大空闲连接
  79 + max-idle: 8
  80 + # 连接池的最大数据库连接数
  81 + max-active: 8
  82 + # #连接池最大阻塞等待时间(使用负值表示没有限制)
  83 + max-wait: -1ms
  84 +
  85 +# token配置
  86 +token:
  87 + # 令牌自定义标识
  88 + header: Authorization
  89 + # 令牌密钥
  90 + secret: abcdefghijklmnopqrstuvwxyz
  91 + # 令牌有效期(默认30分钟)
  92 + expireTime: 30
  93 +
  94 +# MyBatis配置
  95 +mybatis:
  96 + # 搜索指定包别名
  97 + typeAliasesPackage: com.ruoyi.**.domain
  98 + # 配置mapper的扫描,找到所有的mapper.xml映射文件
  99 + mapperLocations: classpath*:mapper/**/*Mapper.xml
  100 + # 加载全局的配置文件
  101 + configLocation: classpath:mybatis/mybatis-config.xml
  102 +
  103 +# PageHelper分页插件
  104 +pagehelper:
  105 + helperDialect: mysql
  106 + supportMethodsArguments: true
  107 + params: count=countSql
  108 +
  109 +# Swagger配置
  110 +swagger:
  111 + # 是否开启swagger
  112 + enabled: true
  113 + # 请求前缀
  114 + pathMapping: /dev-api
  115 +
  116 +# 防止XSS攻击
  117 +xss:
  118 + # 过滤开关
  119 + enabled: true
  120 + # 排除链接(多个用逗号分隔)
  121 + excludes: /system/notice
  122 + # 匹配链接
  123 + urlPatterns: /system/*,/monitor/*,/tool/*
ruoyi-admin/src/main/resources/banner.txt 0 → 100644
  1 +++ a/ruoyi-admin/src/main/resources/banner.txt
  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 +++ a/ruoyi-admin/src/main/resources/i18n/messages.properties
  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}次,帐户锁定10分钟
  9 +user.password.delete=对不起,您的账号已被删除
  10 +user.blocked=用户已封禁,请联系管理员
  11 +role.blocked=角色已封禁,请联系管理员
  12 +user.logout.success=退出成功
  13 +
  14 +length.not.valid=长度必须在{min}到{max}个字符之间
  15 +
  16 +user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
  17 +user.password.not.valid=* 5-50个字符
  18 +
  19 +user.email.not.valid=邮箱格式错误
  20 +user.mobile.phone.number.not.valid=手机号格式错误
  21 +user.login.success=登录成功
  22 +user.register.success=注册成功
  23 +user.notfound=请重新登录
  24 +user.forcelogout=管理员强制退出,请重新登录
  25 +user.unknown.error=未知错误,请重新登录
  26 +
  27 +##文件上传消息
  28 +upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
  29 +upload.filename.exceed.length=上传的文件名最长{0}个字符
  30 +
  31 +##权限
  32 +no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
  33 +no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
  34 +no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
  35 +no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
  36 +no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
  37 +no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
ruoyi-admin/src/main/resources/logback.xml 0 → 100644
  1 +++ a/ruoyi-admin/src/main/resources/logback.xml
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<configuration>
  3 + <!-- 日志存放路径 -->
  4 + <property name="log.path" value="/home/ruoyi/logs" />
  5 + <!-- 日志输出格式 -->
  6 + <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
  7 +
  8 + <!-- 控制台输出 -->
  9 + <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
  10 + <encoder>
  11 + <pattern>${log.pattern}</pattern>
  12 + </encoder>
  13 + </appender>
  14 +
  15 + <!-- 系统日志输出 -->
  16 + <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
  17 + <file>${log.path}/sys-info.log</file>
  18 + <!-- 循环政策:基于时间创建日志文件 -->
  19 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  20 + <!-- 日志文件名格式 -->
  21 + <fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
  22 + <!-- 日志最大的历史 60天 -->
  23 + <maxHistory>60</maxHistory>
  24 + </rollingPolicy>
  25 + <encoder>
  26 + <pattern>${log.pattern}</pattern>
  27 + </encoder>
  28 + <filter class="ch.qos.logback.classic.filter.LevelFilter">
  29 + <!-- 过滤的级别 -->
  30 + <level>INFO</level>
  31 + <!-- 匹配时的操作:接收(记录) -->
  32 + <onMatch>ACCEPT</onMatch>
  33 + <!-- 不匹配时的操作:拒绝(不记录) -->
  34 + <onMismatch>DENY</onMismatch>
  35 + </filter>
  36 + </appender>
  37 +
  38 + <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
  39 + <file>${log.path}/sys-error.log</file>
  40 + <!-- 循环政策:基于时间创建日志文件 -->
  41 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  42 + <!-- 日志文件名格式 -->
  43 + <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
  44 + <!-- 日志最大的历史 60天 -->
  45 + <maxHistory>60</maxHistory>
  46 + </rollingPolicy>
  47 + <encoder>
  48 + <pattern>${log.pattern}</pattern>
  49 + </encoder>
  50 + <filter class="ch.qos.logback.classic.filter.LevelFilter">
  51 + <!-- 过滤的级别 -->
  52 + <level>ERROR</level>
  53 + <!-- 匹配时的操作:接收(记录) -->
  54 + <onMatch>ACCEPT</onMatch>
  55 + <!-- 不匹配时的操作:拒绝(不记录) -->
  56 + <onMismatch>DENY</onMismatch>
  57 + </filter>
  58 + </appender>
  59 +
  60 + <!-- 用户访问日志输出 -->
  61 + <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
  62 + <file>${log.path}/sys-user.log</file>
  63 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  64 + <!-- 按天回滚 daily -->
  65 + <fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
  66 + <!-- 日志最大的历史 60天 -->
  67 + <maxHistory>60</maxHistory>
  68 + </rollingPolicy>
  69 + <encoder>
  70 + <pattern>${log.pattern}</pattern>
  71 + </encoder>
  72 + </appender>
  73 +
  74 + <!-- 系统模块日志级别控制 -->
  75 + <logger name="com.ruoyi" level="info" />
  76 + <!-- Spring日志级别控制 -->
  77 + <logger name="org.springframework" level="warn" />
  78 +
  79 + <root level="info">
  80 + <appender-ref ref="console" />
  81 + </root>
  82 +
  83 + <!--系统操作日志-->
  84 + <root level="info">
  85 + <appender-ref ref="file_info" />
  86 + <appender-ref ref="file_error" />
  87 + </root>
  88 +
  89 + <!--系统用户操作日志-->
  90 + <logger name="sys-user" level="info">
  91 + <appender-ref ref="sys-user"/>
  92 + </logger>
  93 +</configuration>
0 \ No newline at end of file 94 \ No newline at end of file
ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml 0 → 100644
  1 +++ a/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
  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 +++ a/ruoyi-common/pom.xml
  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.3</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 + <!-- 阿里JSON解析器 -->
  63 + <dependency>
  64 + <groupId>com.alibaba.fastjson2</groupId>
  65 + <artifactId>fastjson2</artifactId>
  66 + </dependency>
  67 +
  68 + <!-- io常用工具类 -->
  69 + <dependency>
  70 + <groupId>commons-io</groupId>
  71 + <artifactId>commons-io</artifactId>
  72 + </dependency>
  73 +
  74 + <!-- 文件上传工具类 -->
  75 + <dependency>
  76 + <groupId>commons-fileupload</groupId>
  77 + <artifactId>commons-fileupload</artifactId>
  78 + </dependency>
  79 +
  80 + <!-- excel工具 -->
  81 + <dependency>
  82 + <groupId>org.apache.poi</groupId>
  83 + <artifactId>poi-ooxml</artifactId>
  84 + </dependency>
  85 +
  86 + <!-- yml解析器 -->
  87 + <dependency>
  88 + <groupId>org.yaml</groupId>
  89 + <artifactId>snakeyaml</artifactId>
  90 + </dependency>
  91 +
  92 + <!-- Token生成与解析-->
  93 + <dependency>
  94 + <groupId>io.jsonwebtoken</groupId>
  95 + <artifactId>jjwt</artifactId>
  96 + </dependency>
  97 +
  98 + <!-- Jaxb -->
  99 + <dependency>
  100 + <groupId>javax.xml.bind</groupId>
  101 + <artifactId>jaxb-api</artifactId>
  102 + </dependency>
  103 +
  104 + <!-- redis 缓存操作 -->
  105 + <dependency>
  106 + <groupId>org.springframework.boot</groupId>
  107 + <artifactId>spring-boot-starter-data-redis</artifactId>
  108 + </dependency>
  109 +
  110 + <!-- pool 对象池 -->
  111 + <dependency>
  112 + <groupId>org.apache.commons</groupId>
  113 + <artifactId>commons-pool2</artifactId>
  114 + </dependency>
  115 +
  116 + <!-- 解析客户端操作系统、浏览器等 -->
  117 + <dependency>
  118 + <groupId>eu.bitwalker</groupId>
  119 + <artifactId>UserAgentUtils</artifactId>
  120 + </dependency>
  121 +
  122 + <!-- servlet包 -->
  123 + <dependency>
  124 + <groupId>javax.servlet</groupId>
  125 + <artifactId>javax.servlet-api</artifactId>
  126 + </dependency>
  127 +
  128 + </dependencies>
  129 +
  130 +</project>
0 \ No newline at end of file 131 \ No newline at end of file
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Anonymous.java 0 → 100644
  1 +++ a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Anonymous.java
  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 +++ a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java
  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 +}
ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java 0 → 100644
  1 +++ a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java
  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 +++ a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java
  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 + * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
  93 + */
  94 + public boolean isExport() default true;
  95 +
  96 + /**
  97 + * 另一个类中的属性名称,支持多级获取,以小数点隔开
  98 + */
  99 + public String targetAttr() default "";
  100 +
  101 + /**
  102 + * 是否自动统计数据,在最后追加一行统计数据总和
  103 + */
  104 + public boolean isStatistics() default false;
  105 +
  106 + /**
  107 + * 导出类型(0数字 1字符串)
  108 + */
  109 + public ColumnType cellType() default ColumnType.STRING;
  110 +
  111 + /**
  112 + * 导出字体颜色
  113 + */
  114 + public IndexedColors color() default IndexedColors.BLACK;
  115 +
  116 + /**
  117 + * 导出字段对齐方式
  118 + */
  119 + public HorizontalAlignment align() default HorizontalAlignment.CENTER;
  120 +
  121 + /**
  122 + * 自定义数据处理器
  123 + */
  124 + public Class<?> handler() default ExcelHandlerAdapter.class;
  125 +
  126 + /**
  127 + * 自定义数据处理器参数
  128 + */
  129 + public String[] args() default {};
  130 +
  131 + public enum Align
  132 + {
  133 + AUTO(0), LEFT(1), CENTER(2), RIGHT(3);
  134 + private final int value;
  135 +
  136 + Align(int value)
  137 + {
  138 + this.value = value;
  139 + }
  140 +
  141 + public int value()
  142 + {
  143 + return this.value;
  144 + }
  145 + }
  146 +
  147 + /**
  148 + * 字段类型(0:导出导入;1:仅导出;2:仅导入)
  149 + */
  150 + Type type() default Type.ALL;
  151 +
  152 + public enum Type
  153 + {
  154 + ALL(0), EXPORT(1), IMPORT(2);
  155 + private final int value;
  156 +
  157 + Type(int value)
  158 + {
  159 + this.value = value;
  160 + }
  161 +
  162 + public int value()
  163 + {
  164 + return this.value;
  165 + }
  166 + }
  167 +
  168 + public enum ColumnType
  169 + {
  170 + NUMERIC(0), STRING(1), IMAGE(2);
  171 + private final int value;
  172 +
  173 + ColumnType(int value)
  174 + {
  175 + this.value = value;
  176 + }
  177 +
  178 + public int value()
  179 + {
  180 + return this.value;
  181 + }
  182 + }
  183 +}
0 \ No newline at end of file 184 \ No newline at end of file
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java 0 → 100644
  1 +++ a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java
  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 +++ a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java
  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 +}
ruoyi-common/src/main/java/com/ruoyi/common/annotation/RateLimiter.java 0 → 100644
  1 +++ a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RateLimiter.java
  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 +}
ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java 0 → 100644
  1 +++ a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java
  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 +
  10 +/**
  11 + * 自定义注解防止表单重复提交
  12 + *
  13 + * @author ruoyi
  14 + *
  15 + */
  16 +@Inherited
  17 +@Target(ElementType.METHOD)
  18 +@Retention(RetentionPolicy.RUNTIME)
  19 +@Documented
  20 +public @interface RepeatSubmit
  21 +{
  22 + /**
  23 + * 间隔时间(ms),小于此时间视为重复提交
  24 + */
  25 + public int interval() default 5000;
  26 +
  27 + /**
  28 + * 提示消息
  29 + */
  30 + public String message() default "不允许重复提交,请稍候再试";
  31 +}
ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java 0 → 100644
  1 +++ a/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java
  1 +package com.ruoyi.common.config;
  2 +
  3 +import org.springframework.boot.context.properties.ConfigurationProperties;
  4 +import org.springframework.stereotype.Component;
  5 +
  6 +/**
  7 + * 读取项目相关配置
  8 + *
  9 + * @author ruoyi
  10 + */
  11 +@Component
  12 +@ConfigurationProperties(prefix = "ruoyi")
  13 +public class RuoYiConfig
  14 +{
  15 + /** 项目名称 */
  16 + private String name;
  17 +
  18 + /** 版本 */
  19 + private String version;
  20 +
  21 + /** 版权年份 */
  22 + private String copyrightYear;
  23 +
  24 + /** 实例演示开关 */
  25 + private boolean demoEnabled;
  26 +
  27 + /** 上传路径 */
  28 + private static String profile;
  29 +
  30 + /** 获取地址开关 */
  31 + private static boolean addressEnabled;
  32 +
  33 + /** 验证码类型 */
  34 + private static String captchaType;
  35 +
  36 + public String getName()
  37 + {
  38 + return name;
  39 + }
  40 +
  41 + public void setName(String name)
  42 + {
  43 + this.name = name;
  44 + }
  45 +
  46 + public String getVersion()
  47 + {
  48 + return version;
  49 + }
  50 +
  51 + public void setVersion(String version)
  52 + {
  53 + this.version = version;
  54 + }
  55 +
  56 + public String getCopyrightYear()
  57 + {
  58 + return copyrightYear;
  59 + }
  60 +
  61 + public void setCopyrightYear(String copyrightYear)
  62 + {
  63 + this.copyrightYear = copyrightYear;
  64 + }
  65 +
  66 + public boolean isDemoEnabled()
  67 + {
  68 + return demoEnabled;
  69 + }
  70 +
  71 + public void setDemoEnabled(boolean demoEnabled)
  72 + {
  73 + this.demoEnabled = demoEnabled;
  74 + }
  75 +
  76 + public static String getProfile()
  77 + {
  78 + return profile;
  79 + }
  80 +
  81 + public void setProfile(String profile)
  82 + {
  83 + RuoYiConfig.profile = profile;
  84 + }
  85 +
  86 + public static boolean isAddressEnabled()
  87 + {
  88 + return addressEnabled;
  89 + }
  90 +
  91 + public void setAddressEnabled(boolean addressEnabled)
  92 + {
  93 + RuoYiConfig.addressEnabled = addressEnabled;
  94 + }
  95 +
  96 + public static String getCaptchaType() {
  97 + return captchaType;
  98 + }
  99 +
  100 + public void setCaptchaType(String captchaType) {
  101 + RuoYiConfig.captchaType = captchaType;
  102 + }
  103 +
  104 + /**
  105 + * 获取导入上传路径
  106 + */
  107 + public static String getImportPath()
  108 + {
  109 + return getProfile() + "/import";
  110 + }
  111 +
  112 + /**
  113 + * 获取头像上传路径
  114 + */
  115 + public static String getAvatarPath()
  116 + {
  117 + return getProfile() + "/avatar";
  118 + }
  119 +
  120 + /**
  121 + * 获取下载路径
  122 + */
  123 + public static String getDownloadPath()
  124 + {
  125 + return getProfile() + "/download/";
  126 + }
  127 +
  128 + /**
  129 + * 获取上传路径
  130 + */
  131 + public static String getUploadPath()
  132 + {
  133 + return getProfile() + "/upload";
  134 + }
  135 +}
ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java 0 → 100644
  1 +++ a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java
  1 +package com.ruoyi.common.constant;
  2 +
  3 +/**
  4 + * 缓存的key 常量
  5 + *
  6 + * @author ruoyi
  7 + */
  8 +public class CacheConstants
  9 +{
  10 + /**
  11 + * 登录用户 redis key
  12 + */
  13 + public static final String LOGIN_TOKEN_KEY = "login_tokens:";
  14 +
  15 + /**
  16 + * 验证码 redis key
  17 + */
  18 + public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
  19 +
  20 + /**
  21 + * 参数管理 cache key
  22 + */
  23 + public static final String SYS_CONFIG_KEY = "sys_config:";
  24 +
  25 + /**
  26 + * 字典管理 cache key
  27 + */
  28 + public static final String SYS_DICT_KEY = "sys_dict:";
  29 +
  30 + /**
  31 + * 防重提交 redis key
  32 + */
  33 + public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";
  34 +
  35 + /**
  36 + * 限流 redis key
  37 + */
  38 + public static final String RATE_LIMIT_KEY = "rate_limit:";
  39 +}
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java 0 → 100644
  1 +++ a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
  1 +package com.ruoyi.common.constant;
  2 +
  3 +import io.jsonwebtoken.Claims;
  4 +
  5 +/**
  6 + * 通用常量信息
  7 + *
  8 + * @author ruoyi
  9 + */
  10 +public class Constants
  11 +{
  12 + /**
  13 + * UTF-8 字符集
  14 + */
  15 + public static final String UTF8 = "UTF-8";
  16 +
  17 + /**
  18 + * GBK 字符集
  19 + */
  20 + public static final String GBK = "GBK";
  21 +
  22 + /**
  23 + * http请求
  24 + */
  25 + public static final String HTTP = "http://";
  26 +
  27 + /**
  28 + * https请求
  29 + */
  30 + public static final String HTTPS = "https://";
  31 +
  32 + /**
  33 + * 通用成功标识
  34 + */
  35 + public static final String SUCCESS = "0";
  36 +
  37 + /**
  38 + * 通用失败标识
  39 + */
  40 + public static final String FAIL = "1";
  41 +
  42 + /**
  43 + * 登录成功
  44 + */
  45 + public static final String LOGIN_SUCCESS = "Success";
  46 +
  47 + /**
  48 + * 注销
  49 + */
  50 + public static final String LOGOUT = "Logout";
  51 +
  52 + /**
  53 + * 注册
  54 + */
  55 + public static final String REGISTER = "Register";
  56 +
  57 + /**
  58 + * 登录失败
  59 + */
  60 + public static final String LOGIN_FAIL = "Error";
  61 +
  62 + /**
  63 + * 验证码有效期(分钟)
  64 + */
  65 + public static final Integer CAPTCHA_EXPIRATION = 2;
  66 +
  67 + /**
  68 + * 令牌
  69 + */
  70 + public static final String TOKEN = "token";
  71 +
  72 + /**
  73 + * 令牌前缀
  74 + */
  75 + public static final String TOKEN_PREFIX = "Bearer ";
  76 +
  77 + /**
  78 + * 令牌前缀
  79 + */
  80 + public static final String LOGIN_USER_KEY = "login_user_key";
  81 +
  82 + /**
  83 + * 用户ID
  84 + */
  85 + public static final String JWT_USERID = "userid";
  86 +
  87 + /**
  88 + * 用户名称
  89 + */
  90 + public static final String JWT_USERNAME = Claims.SUBJECT;
  91 +
  92 + /**
  93 + * 用户头像
  94 + */
  95 + public static final String JWT_AVATAR = "avatar";
  96 +
  97 + /**
  98 + * 创建时间
  99 + */
  100 + public static final String JWT_CREATED = "created";
  101 +
  102 + /**
  103 + * 用户权限
  104 + */
  105 + public static final String JWT_AUTHORITIES = "authorities";
  106 +
  107 + /**
  108 + * 资源映射路径 前缀
  109 + */
  110 + public static final String RESOURCE_PREFIX = "/profile";
  111 +
  112 + /**
  113 + * RMI 远程方法调用
  114 + */
  115 + public static final String LOOKUP_RMI = "rmi:";
  116 +
  117 + /**
  118 + * LDAP 远程方法调用
  119 + */
  120 + public static final String LOOKUP_LDAP = "ldap:";
  121 +
  122 + /**
  123 + * LDAPS 远程方法调用
  124 + */
  125 + public static final String LOOKUP_LDAPS = "ldaps:";
  126 +
  127 + /**
  128 + * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
  129 + */
  130 + public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" };
  131 +
  132 + /**
  133 + * 定时任务违规的字符
  134 + */
  135 + public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
  136 + "org.springframework", "org.apache", "com.ruoyi.common.utils.file" };
  137 +}
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java 0 → 100644
  1 +++ a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
  1 +package com.ruoyi.common.constant;
  2 +
  3 +/**
  4 + * 代码生成通用常量
  5 + *
  6 + * @author ruoyi
  7 + */
  8 +public class GenConstants
  9 +{
  10 + /** 单表(增删改查) */
  11 + public static final String TPL_CRUD = "crud";
  12 +
  13 + /** 树表(增删改查) */
  14 + public static final String TPL_TREE = "tree";
  15 +
  16 + /** 主子表(增删改查) */
  17 + public static final String TPL_SUB = "sub";
  18 +
  19 + /** 树编码字段 */
  20 + public static final String TREE_CODE = "treeCode";
  21 +
  22 + /** 树父编码字段 */
  23 + public static final String TREE_PARENT_CODE = "treeParentCode";
  24 +
  25 + /** 树名称字段 */
  26 + public static final String TREE_NAME = "treeName";
  27 +
  28 + /** 上级菜单ID字段 */
  29 + public static final String PARENT_MENU_ID = "parentMenuId";
  30 +
  31 + /** 上级菜单名称字段 */
  32 + public static final String PARENT_MENU_NAME = "parentMenuName";
  33 +
  34 + /** 数据库字符串类型 */
  35 + public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" };
  36 +
  37 + /** 数据库文本类型 */
  38 + public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" };
  39 +
  40 + /** 数据库时间类型 */
  41 + public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" };
  42 +
  43 + /** 数据库数字类型 */
  44 + public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
  45 + "bit", "bigint", "float", "double", "decimal" };
  46 +
  47 + /** 页面不需要编辑字段 */
  48 + public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
  49 +
  50 + /** 页面不需要显示的列表字段 */
  51 + public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
  52 + "update_time" };
  53 +
  54 + /** 页面不需要查询字段 */
  55 + public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
  56 + "update_time", "remark" };
  57 +
  58 + /** Entity基类字段 */
  59 + public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
  60 +
  61 + /** Tree基类字段 */
  62 + public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" };
  63 +
  64 + /** 文本框 */
  65 + public static final String HTML_INPUT = "input";
  66 +
  67 + /** 文本域 */
  68 + public static final String HTML_TEXTAREA = "textarea";
  69 +
  70 + /** 下拉框 */
  71 + public static final String HTML_SELECT = "select";
  72 +
  73 + /** 单选框 */
  74 + public static final String HTML_RADIO = "radio";
  75 +
  76 + /** 复选框 */
  77 + public static final String HTML_CHECKBOX = "checkbox";
  78 +
  79 + /** 日期控件 */
  80 + public static final String HTML_DATETIME = "datetime";
  81 +
  82 + /** 图片上传控件 */
  83 + public static final String HTML_IMAGE_UPLOAD = "imageUpload";
  84 +
  85 + /** 文件上传控件 */
  86 + public static final String HTML_FILE_UPLOAD = "fileUpload";
  87 +
  88 + /** 富文本控件 */
  89 + public static final String HTML_EDITOR = "editor";
  90 +
  91 + /** 字符串类型 */
  92 + public static final String TYPE_STRING = "String";
  93 +
  94 + /** 整型 */
  95 + public static final String TYPE_INTEGER = "Integer";
  96 +
  97 + /** 长整型 */
  98 + public static final String TYPE_LONG = "Long";
  99 +
  100 + /** 浮点型 */
  101 + public static final String TYPE_DOUBLE = "Double";
  102 +
  103 + /** 高精度计算类型 */
  104 + public static final String TYPE_BIGDECIMAL = "BigDecimal";
  105 +
  106 + /** 时间类型 */
  107 + public static final String TYPE_DATE = "Date";
  108 +
  109 + /** 模糊查询 */
  110 + public static final String QUERY_LIKE = "LIKE";
  111 +
  112 + /** 相等查询 */
  113 + public static final String QUERY_EQ = "EQ";
  114 +
  115 + /** 需要 */
  116 + public static final String REQUIRE = "1";
  117 +}
ruoyi-common/src/main/java/com/ruoyi/common/constant/HttpStatus.java 0 → 100644
  1 +++ a/ruoyi-common/src/main/java/com/ruoyi/common/constant/HttpStatus.java
  1 +package com.ruoyi.common.constant;
  2 +
  3 +/**
  4 + * 返回状态码
  5 + *
  6 + * @author ruoyi
  7 + */
  8 +public class HttpStatus
  9 +{
  10 + /**
  11 + * 操作成功
  12 + */
  13 + public static final int SUCCESS = 200;
  14 +
  15 + /**
  16 + * 对象创建成功
  17 + */
  18 + public static final int CREATED = 201;
  19 +
  20 + /**
  21 + * 请求已经被接受
  22 + */
  23 + public static final int ACCEPTED = 202;
  24 +
  25 + /**
  26 + * 操作已经执行成功,但是没有返回数据
  27 + */
  28 + public static final int NO_CONTENT = 204;
  29 +
  30 + /**
  31 + * 资源已被移除
  32 + */
  33 + public static final int MOVED_PERM = 301;
  34 +
  35 + /**
  36 + * 重定向
  37 + */
  38 + public static final int SEE_OTHER = 303;
  39 +
  40 + /**
  41 + * 资源没有被修改
  42 + */
  43 + public static final int NOT_MODIFIED = 304;
  44 +
  45 + /**
  46 + * 参数列表错误(缺少,格式不匹配)
  47 + */
  48 + public static final int BAD_REQUEST = 400;
  49 +
  50 + /**
  51 + * 未授权
  52 + */
  53 + public static final int UNAUTHORIZED = 401;
  54 +
  55 + /**
  56 + * 访问受限,授权过期
  57 + */
  58 + public static final int FORBIDDEN = 403;
  59 +
  60 + /**
  61 + * 资源,服务未找到
  62 + */
  63 + public static final int NOT_FOUND = 404;
  64 +
  65 + /**
  66 + * 不允许的http方法
  67 + */
  68 + public static final int BAD_METHOD = 405;
  69 +
  70 + /**
  71 + * 资源冲突,或者资源被锁
  72 + */
  73 + public static final int CONFLICT = 409;
  74 +
  75 + /**
  76 + * 不支持的数据,媒体类型
  77 + */
  78 + public static final int UNSUPPORTED_TYPE = 415;
  79 +
  80 + /**
  81 + * 系统内部错误
  82 + */
  83 + public static final int ERROR = 500;
  84 +
  85 + /**
  86 + * 接口未实现
  87 + */
  88 + public static final int NOT_IMPLEMENTED = 501;
  89 +}
ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java 0 → 100644
  1 +++ a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java
  1 +package com.ruoyi.common.constant;
  2 +
  3 +/**
  4 + * 任务调度通用常量
  5 + *
  6 + * @author ruoyi
  7 + */
  8 +public class ScheduleConstants
  9 +{
  10 + public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
  11 +
  12 + /** 执行目标key */
  13 + public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
  14 +
  15 + /** 默认 */
  16 + public static final String MISFIRE_DEFAULT = "0";
  17 +
  18 + /** 立即触发执行 */
  19 + public static final String MISFIRE_IGNORE_MISFIRES = "1";
  20 +
  21 + /** 触发一次执行 */
  22 + public static final String MISFIRE_FIRE_AND_PROCEED = "2";
  23 +
  24 + /** 不触发立即执行 */
  25 + public static final String MISFIRE_DO_NOTHING = "3";
  26 +
  27 + public enum Status
  28 + {
  29 + /**
  30 + * 正常
  31 + */
  32 + NORMAL("0"),
  33 + /**
  34 + * 暂停
  35 + */
  36 + PAUSE("1");
  37 +
  38 + private String value;
  39 +
  40 + private Status(String value)
  41 + {
  42 + this.value = value;
  43 + }
  44 +
  45 + public String getValue()
  46 + {
  47 + return value;
  48 + }
  49 + }
  50 +}
ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java 0 → 100644
  1 +++ a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java
  1 +package com.ruoyi.common.constant;
  2 +
  3 +/**
  4 + * 用户常量信息
  5 + *
  6 + * @author ruoyi
  7 + */
  8 +public class UserConstants
  9 +{
  10 + /**
  11 + * 平台内系统用户的唯一标志
  12 + */
  13 + public static final String SYS_USER = "SYS_USER";
  14 +
  15 + /** 正常状态 */
  16 + public static final String NORMAL = "0";
  17 +
  18 + /** 异常状态 */
  19 + public static final String EXCEPTION = "1";
  20 +
  21 + /** 用户封禁状态 */
  22 + public static final String USER_DISABLE = "1";
  23 +
  24 + /** 角色封禁状态 */
  25 + public static final String ROLE_DISABLE = "1";
  26 +
  27 + /** 部门正常状态 */
  28 + public static final String DEPT_NORMAL = "0";
  29 +
  30 + /** 部门停用状态 */
  31 + public static final String DEPT_DISABLE = "1";
  32 +
  33 + /** 字典正常状态 */
  34 + public static final String DICT_NORMAL = "0";
  35 +
  36 + /** 是否为系统默认(是) */
  37 + public static final String YES = "Y";
  38 +
  39 + /** 是否菜单外链(是) */
  40 + public static final String YES_FRAME = "0";
  41 +
  42 + /** 是否菜单外链(否) */
  43 + public static final String NO_FRAME = "1";
  44 +
  45 + /** 菜单类型(目录) */
  46 + public static final String TYPE_DIR = "M";
  47 +
  48 + /** 菜单类型(菜单) */
  49 + public static final String TYPE_MENU = "C";
  50 +
  51 + /** 菜单类型(按钮) */
  52 + public static final String TYPE_BUTTON = "F";
  53 +
  54 + /** Layout组件标识 */
  55 + public final static String LAYOUT = "Layout";
  56 +
  57 + /** ParentView组件标识 */
  58 + public final static String PARENT_VIEW = "ParentView";
  59 +
  60 + /** InnerLink组件标识 */
  61 + public final static String INNER_LINK = "InnerLink";
  62 +
  63 + /** 校验返回结果码 */
  64 + public final static String UNIQUE = "0";
  65 + public final static String NOT_UNIQUE = "1";
  66 +
  67 + /**
  68 + * 用户名长度限制
  69 + */
  70 + public static final int USERNAME_MIN_LENGTH = 2;
  71 + public static final int USERNAME_MAX_LENGTH = 20;
  72 +
  73 + /**
  74 + * 密码长度限制
  75 + */
  76 + public static final int PASSWORD_MIN_LENGTH = 5;
  77 + public static final int PASSWORD_MAX_LENGTH = 20;
  78 +}