Showing
49 changed files
with
4771 additions
and
0 deletions
Too many changes to show.
To preserve performance only 49 of 49+ files are displayed.
.gitignore
0 → 100644
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 | +README-SPECIAL.md | ||
45 | + | ||
46 | +!*/build/*.java | ||
47 | +!*/build/*.html | ||
48 | +!*/build/*.xml | ||
49 | + | ||
50 | + | ||
51 | +.env.development |
.vscode/extensions.json
0 → 100644
.vscode/settings.json
0 → 100644
LICENSE
0 → 100644
1 | +The MIT License (MIT) | ||
2 | + | ||
3 | +Copyright (c) 2018 RuoYi | ||
4 | + | ||
5 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
6 | +this software and associated documentation files (the "Software"), to deal in | ||
7 | +the Software without restriction, including without limitation the rights to | ||
8 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
9 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
10 | +subject to the following conditions: | ||
11 | + | ||
12 | +The above copyright notice and this permission notice shall be included in all | ||
13 | +copies or substantial portions of the Software. | ||
14 | + | ||
15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
17 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
18 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
19 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
20 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
README-SPECIAL-GL.md
0 → 100644
1 | +考勤机管理增加一个功能,前端传入这个考勤机的ip地址,后端根据这个IP地址进行ping操作,如果ping通,则返回在线,否则返回不在线。需要给前端返回的是在线状态和在线状态测试时间。 |
README.md
0 → 100644
1 | +<p align="center"> | ||
2 | + <img alt="logo" src="https://oscimg.oschina.net/oscnet/up-d3d0a9303e11d522a06cd263f3079027715.png"> | ||
3 | +</p> | ||
4 | +<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.8.8</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.8-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 | +* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip) | ||
25 | +* 阿里云优惠券:[点我领取](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) | ||
26 | + | ||
27 | +## 内置功能 | ||
28 | + | ||
29 | +1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。 | ||
30 | +2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。 | ||
31 | +3. 岗位管理:配置系统用户所属担任职务。 | ||
32 | +4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。 | ||
33 | +5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。 | ||
34 | +6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。 | ||
35 | +7. 参数管理:对系统动态配置常用参数。 | ||
36 | +8. 通知公告:系统通知公告信息发布维护。 | ||
37 | +9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。 | ||
38 | +10. 登录日志:系统登录日志记录查询包含登录异常。 | ||
39 | +11. 在线用户:当前系统中活跃用户状态监控。 | ||
40 | +12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。 | ||
41 | +13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。 | ||
42 | +14. 系统接口:根据业务代码自动生成相关的api接口文档。 | ||
43 | +15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。 | ||
44 | +16. 缓存监控:对系统的缓存信息查询,命令统计等。 | ||
45 | +17. 在线构建器:拖动表单元素生成相应的HTML代码。 | ||
46 | +18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。 | ||
47 | + | ||
48 | +## 在线体验 | ||
49 | + | ||
50 | +- admin/admin123 | ||
51 | +- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。 | ||
52 | + | ||
53 | +演示地址:http://vue.ruoyi.vip | ||
54 | +文档地址:http://doc.ruoyi.vip | ||
55 | + | ||
56 | +## 演示图 | ||
57 | + | ||
58 | +<table> | ||
59 | + <tr> | ||
60 | + <td><img src="https://oscimg.oschina.net/oscnet/cd1f90be5f2684f4560c9519c0f2a232ee8.jpg"/></td> | ||
61 | + <td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td> | ||
62 | + </tr> | ||
63 | + <tr> | ||
64 | + <td><img src="https://oscimg.oschina.net/oscnet/up-8074972883b5ba0622e13246738ebba237a.png"/></td> | ||
65 | + <td><img src="https://oscimg.oschina.net/oscnet/up-9f88719cdfca9af2e58b352a20e23d43b12.png"/></td> | ||
66 | + </tr> | ||
67 | + <tr> | ||
68 | + <td><img src="https://oscimg.oschina.net/oscnet/up-39bf2584ec3a529b0d5a3b70d15c9b37646.png"/></td> | ||
69 | + <td><img src="https://oscimg.oschina.net/oscnet/up-936ec82d1f4872e1bc980927654b6007307.png"/></td> | ||
70 | + </tr> | ||
71 | + <tr> | ||
72 | + <td><img src="https://oscimg.oschina.net/oscnet/up-b2d62ceb95d2dd9b3fbe157bb70d26001e9.png"/></td> | ||
73 | + <td><img src="https://oscimg.oschina.net/oscnet/up-d67451d308b7a79ad6819723396f7c3d77a.png"/></td> | ||
74 | + </tr> | ||
75 | + <tr> | ||
76 | + <td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td> | ||
77 | + <td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td> | ||
78 | + </tr> | ||
79 | + <tr> | ||
80 | + <td><img src="https://oscimg.oschina.net/oscnet/up-8370a0d02977eebf6dbf854c8450293c937.png"/></td> | ||
81 | + <td><img src="https://oscimg.oschina.net/oscnet/up-49003ed83f60f633e7153609a53a2b644f7.png"/></td> | ||
82 | + </tr> | ||
83 | + <tr> | ||
84 | + <td><img src="https://oscimg.oschina.net/oscnet/up-d4fe726319ece268d4746602c39cffc0621.png"/></td> | ||
85 | + <td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td> | ||
86 | + </tr> | ||
87 | + <tr> | ||
88 | + <td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td> | ||
89 | + <td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td> | ||
90 | + </tr> | ||
91 | +</table> | ||
92 | + | ||
93 | + | ||
94 | +## 鸿果前后端分离交流群 | ||
95 | + | ||
96 | +QQ群: [](https://jq.qq.com/?_wv=1027&k=5bVB1og) [](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [](https://jq.qq.com/?_wv=1027&k=51G72yr) [](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) [](https://jq.qq.com/?_wv=1027&k=eCx8eyoJ) [](https://jq.qq.com/?_wv=1027&k=SpyH2875) [](https://jq.qq.com/?_wv=1027&k=tKEt51dz) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=0vBbSb0ztbBgVtn3kJS-Q4HUNYwip89G&authKey=8irq5PhutrZmWIvsUsklBxhj57l%2F1nOZqjzigkXZVoZE451GG4JHPOqW7AW6cf0T&noverify=0&group_code=143961921) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=ZFAPAbp09S2ltvwrJzp7wGlbopsc0rwi&authKey=HB2cxpxP2yspk%2Bo3WKTBfktRCccVkU26cgi5B16u0KcAYrVu7sBaE7XSEqmMdFQp&noverify=0&group_code=174951577) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Fn2aF5IHpwsy8j6VlalNJK6qbwFLFHat&authKey=uyIT%2B97x2AXj3odyXpsSpVaPMC%2Bidw0LxG5MAtEqlrcBcWJUA%2FeS43rsF1Tg7IRJ&noverify=0&group_code=161281055) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=XIzkm_mV2xTsUtFxo63bmicYoDBA6Ifm&authKey=dDW%2F4qsmw3x9govoZY9w%2FoWAoC4wbHqGal%2BbqLzoS6VBarU8EBptIgPKN%2FviyC8j&noverify=0&group_code=138988063) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=DkugnCg68PevlycJSKSwjhFqfIgrWWwR&authKey=pR1Pa5lPIeGF%2FFtIk6d%2FGB5qFi0EdvyErtpQXULzo03zbhopBHLWcuqdpwY241R%2F&noverify=0&group_code=151450850) 点击按钮入群。 | ||
97 | + | ||
98 | +# 第三方人员管理模块 | ||
99 | + | ||
100 | +## 功能说明 | ||
101 | +本模块提供第三方运维人员的管理功能,包括: | ||
102 | +- 人员基本信息管理 | ||
103 | +- 公司信息关联 | ||
104 | +- 终端借用管理 | ||
105 | +- 堡垒机使用记录 | ||
106 | +- 办公室信息管理 | ||
107 | +- 家庭成员信息 | ||
108 | +- 工作经历记录 | ||
109 | +- 合同信息关联 | ||
110 | + | ||
111 | +## 安装部署 | ||
112 | +1. 执行数据库脚本 | ||
113 | + - sql/menu.sql | ||
114 | + - sql/dict.sql | ||
115 | + - sql/role.sql | ||
116 | + | ||
117 | +2. 配置文件 | ||
118 | + - 确保application.yml中数据库配置正确 | ||
119 | + - 确保application.yml中文件上传路径配置正确 | ||
120 | + | ||
121 | +3. 权限配置 | ||
122 | + - 为需要使用此功能的角色分配相应权限 | ||
123 | + - 基本权限包括:查询、导出 | ||
124 | + | ||
125 | +## 使用说明 | ||
126 | +1. 列表查询 | ||
127 | + - 支持按用户名、姓名、手机号、党员状态等条件查询 | ||
128 | + - 支持分页显示 | ||
129 | + | ||
130 | +2. 详情查看 | ||
131 | + - 点击查看详情可以查看人员的所有相关信息 | ||
132 | + - 详情信息分多个标签页展示 | ||
133 | + - 支持查看图片和文件 | ||
134 | + | ||
135 | +## 注意事项 | ||
136 | +1. 文件上传 | ||
137 | + - 支持的图片格式:jpg、png、gif | ||
138 | + - 支持的文件格式:pdf、doc、docx | ||
139 | + - 单个文件大小限制:10MB | ||
140 | + | ||
141 | +2. 数据安全 | ||
142 | + - 敏感信息已进行加密处理 | ||
143 | + - 按照权限控制数据访问范围 |
bin/clean.bat
0 → 100644
bin/package.bat
0 → 100644
bin/run.bat
0 → 100644
doc/若依环境使用手册.docx
0 → 100644
No preview for this file type
package-lock.json
0 → 100644
pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
5 | + <modelVersion>4.0.0</modelVersion> | ||
6 | + | ||
7 | + <groupId>com.ruoyi</groupId> | ||
8 | + <artifactId>ruoyi</artifactId> | ||
9 | + <version>3.8.8</version> | ||
10 | + | ||
11 | + <name>ruoyi</name> | ||
12 | + <url>http://www.ruoyi.vip</url> | ||
13 | + <description>第三方运维管理系统</description> | ||
14 | + | ||
15 | + <properties> | ||
16 | + <ruoyi.version>3.8.8</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 | + <spring-boot.version>2.5.15</spring-boot.version> | ||
22 | + <druid.version>1.2.23</druid.version> | ||
23 | + <bitwalker.version>1.21</bitwalker.version> | ||
24 | + <swagger.version>3.0.0</swagger.version> | ||
25 | + <kaptcha.version>2.3.3</kaptcha.version> | ||
26 | + <pagehelper.boot.version>1.4.7</pagehelper.boot.version> | ||
27 | + <fastjson.version>2.0.53</fastjson.version> | ||
28 | + <oshi.version>6.6.5</oshi.version> | ||
29 | + <commons.io.version>2.13.0</commons.io.version> | ||
30 | + <poi.version>4.1.2</poi.version> | ||
31 | + <velocity.version>2.3</velocity.version> | ||
32 | + <jwt.version>0.9.1</jwt.version> | ||
33 | + <!-- override dependency version --> | ||
34 | + <tomcat.version>9.0.96</tomcat.version> | ||
35 | + <logback.version>1.2.13</logback.version> | ||
36 | + <spring-security.version>5.7.12</spring-security.version> | ||
37 | + <spring-framework.version>5.3.39</spring-framework.version> | ||
38 | + </properties> | ||
39 | + | ||
40 | + <!-- 依赖声明 --> | ||
41 | + <dependencyManagement> | ||
42 | + <dependencies> | ||
43 | + | ||
44 | + <!-- 覆盖SpringFramework的依赖配置--> | ||
45 | + <dependency> | ||
46 | + <groupId>org.springframework</groupId> | ||
47 | + <artifactId>spring-framework-bom</artifactId> | ||
48 | + <version>${spring-framework.version}</version> | ||
49 | + <type>pom</type> | ||
50 | + <scope>import</scope> | ||
51 | + </dependency> | ||
52 | + | ||
53 | + <!-- 覆盖SpringSecurity的依赖配置--> | ||
54 | + <dependency> | ||
55 | + <groupId>org.springframework.security</groupId> | ||
56 | + <artifactId>spring-security-bom</artifactId> | ||
57 | + <version>${spring-security.version}</version> | ||
58 | + <type>pom</type> | ||
59 | + <scope>import</scope> | ||
60 | + </dependency> | ||
61 | + | ||
62 | + <!-- SpringBoot的依赖配置--> | ||
63 | + <dependency> | ||
64 | + <groupId>org.springframework.boot</groupId> | ||
65 | + <artifactId>spring-boot-dependencies</artifactId> | ||
66 | + <version>${spring-boot.version}</version> | ||
67 | + <type>pom</type> | ||
68 | + <scope>import</scope> | ||
69 | + </dependency> | ||
70 | + | ||
71 | + <!-- 覆盖logback的依赖配置--> | ||
72 | + <dependency> | ||
73 | + <groupId>ch.qos.logback</groupId> | ||
74 | + <artifactId>logback-core</artifactId> | ||
75 | + <version>${logback.version}</version> | ||
76 | + </dependency> | ||
77 | + | ||
78 | + <dependency> | ||
79 | + <groupId>ch.qos.logback</groupId> | ||
80 | + <artifactId>logback-classic</artifactId> | ||
81 | + <version>${logback.version}</version> | ||
82 | + </dependency> | ||
83 | + | ||
84 | + <!-- 覆盖tomcat的依赖配置--> | ||
85 | + <dependency> | ||
86 | + <groupId>org.apache.tomcat.embed</groupId> | ||
87 | + <artifactId>tomcat-embed-core</artifactId> | ||
88 | + <version>${tomcat.version}</version> | ||
89 | + </dependency> | ||
90 | + | ||
91 | + <dependency> | ||
92 | + <groupId>org.apache.tomcat.embed</groupId> | ||
93 | + <artifactId>tomcat-embed-el</artifactId> | ||
94 | + <version>${tomcat.version}</version> | ||
95 | + </dependency> | ||
96 | + | ||
97 | + <dependency> | ||
98 | + <groupId>org.apache.tomcat.embed</groupId> | ||
99 | + <artifactId>tomcat-embed-websocket</artifactId> | ||
100 | + <version>${tomcat.version}</version> | ||
101 | + </dependency> | ||
102 | + | ||
103 | + <!-- 阿里数据库连接池 --> | ||
104 | + <dependency> | ||
105 | + <groupId>com.alibaba</groupId> | ||
106 | + <artifactId>druid-spring-boot-starter</artifactId> | ||
107 | + <version>${druid.version}</version> | ||
108 | + </dependency> | ||
109 | + | ||
110 | + <!-- 解析客户端操作系统、浏览器等 --> | ||
111 | + <dependency> | ||
112 | + <groupId>eu.bitwalker</groupId> | ||
113 | + <artifactId>UserAgentUtils</artifactId> | ||
114 | + <version>${bitwalker.version}</version> | ||
115 | + </dependency> | ||
116 | + | ||
117 | + <!-- pagehelper 分页插件 --> | ||
118 | + <dependency> | ||
119 | + <groupId>com.github.pagehelper</groupId> | ||
120 | + <artifactId>pagehelper-spring-boot-starter</artifactId> | ||
121 | + <version>${pagehelper.boot.version}</version> | ||
122 | + </dependency> | ||
123 | + | ||
124 | + <!-- 获取系统信息 --> | ||
125 | + <dependency> | ||
126 | + <groupId>com.github.oshi</groupId> | ||
127 | + <artifactId>oshi-core</artifactId> | ||
128 | + <version>${oshi.version}</version> | ||
129 | + </dependency> | ||
130 | + | ||
131 | + <!-- Swagger3依赖 --> | ||
132 | + <dependency> | ||
133 | + <groupId>io.springfox</groupId> | ||
134 | + <artifactId>springfox-boot-starter</artifactId> | ||
135 | + <version>${swagger.version}</version> | ||
136 | + <exclusions> | ||
137 | + <exclusion> | ||
138 | + <groupId>io.swagger</groupId> | ||
139 | + <artifactId>swagger-models</artifactId> | ||
140 | + </exclusion> | ||
141 | + </exclusions> | ||
142 | + </dependency> | ||
143 | + | ||
144 | + <!-- io常用工具类 --> | ||
145 | + <dependency> | ||
146 | + <groupId>commons-io</groupId> | ||
147 | + <artifactId>commons-io</artifactId> | ||
148 | + <version>${commons.io.version}</version> | ||
149 | + </dependency> | ||
150 | + | ||
151 | + <!-- excel工具 --> | ||
152 | + <dependency> | ||
153 | + <groupId>org.apache.poi</groupId> | ||
154 | + <artifactId>poi-ooxml</artifactId> | ||
155 | + <version>${poi.version}</version> | ||
156 | + </dependency> | ||
157 | + | ||
158 | + <!-- velocity代码生成使用模板 --> | ||
159 | + <dependency> | ||
160 | + <groupId>org.apache.velocity</groupId> | ||
161 | + <artifactId>velocity-engine-core</artifactId> | ||
162 | + <version>${velocity.version}</version> | ||
163 | + </dependency> | ||
164 | + | ||
165 | + <!-- 阿里JSON解析器 --> | ||
166 | + <dependency> | ||
167 | + <groupId>com.alibaba.fastjson2</groupId> | ||
168 | + <artifactId>fastjson2</artifactId> | ||
169 | + <version>${fastjson.version}</version> | ||
170 | + </dependency> | ||
171 | + | ||
172 | + <!-- Token生成与解析--> | ||
173 | + <dependency> | ||
174 | + <groupId>io.jsonwebtoken</groupId> | ||
175 | + <artifactId>jjwt</artifactId> | ||
176 | + <version>${jwt.version}</version> | ||
177 | + </dependency> | ||
178 | + | ||
179 | + <!-- 验证码 --> | ||
180 | + <dependency> | ||
181 | + <groupId>pro.fessional</groupId> | ||
182 | + <artifactId>kaptcha</artifactId> | ||
183 | + <version>${kaptcha.version}</version> | ||
184 | + </dependency> | ||
185 | + | ||
186 | + <!-- 定时任务--> | ||
187 | + <dependency> | ||
188 | + <groupId>com.ruoyi</groupId> | ||
189 | + <artifactId>ruoyi-quartz</artifactId> | ||
190 | + <version>${ruoyi.version}</version> | ||
191 | + </dependency> | ||
192 | + | ||
193 | + <!-- 代码生成--> | ||
194 | + <dependency> | ||
195 | + <groupId>com.ruoyi</groupId> | ||
196 | + <artifactId>ruoyi-generator</artifactId> | ||
197 | + <version>${ruoyi.version}</version> | ||
198 | + </dependency> | ||
199 | + | ||
200 | + <!-- 核心模块--> | ||
201 | + <dependency> | ||
202 | + <groupId>com.ruoyi</groupId> | ||
203 | + <artifactId>ruoyi-framework</artifactId> | ||
204 | + <version>${ruoyi.version}</version> | ||
205 | + </dependency> | ||
206 | + | ||
207 | + <!-- 系统模块--> | ||
208 | + <dependency> | ||
209 | + <groupId>com.ruoyi</groupId> | ||
210 | + <artifactId>ruoyi-system</artifactId> | ||
211 | + <version>${ruoyi.version}</version> | ||
212 | + </dependency> | ||
213 | + | ||
214 | + <!-- 通用工具--> | ||
215 | + <dependency> | ||
216 | + <groupId>com.ruoyi</groupId> | ||
217 | + <artifactId>ruoyi-common</artifactId> | ||
218 | + <version>${ruoyi.version}</version> | ||
219 | + </dependency> | ||
220 | + | ||
221 | + <!-- lombok --> | ||
222 | + <dependency> | ||
223 | + <groupId>org.projectlombok</groupId> | ||
224 | + <artifactId>lombok</artifactId> | ||
225 | + <version>1.18.30</version> | ||
226 | + </dependency> | ||
227 | + | ||
228 | + </dependencies> | ||
229 | + </dependencyManagement> | ||
230 | + | ||
231 | + <modules> | ||
232 | + <module>ruoyi-framework</module> | ||
233 | + <module>ruoyi-system</module> | ||
234 | + <module>ruoyi-quartz</module> | ||
235 | + <module>ruoyi-generator</module> | ||
236 | + <module>ruoyi-common</module> | ||
237 | + <module>schedule-message</module> | ||
238 | + </modules> | ||
239 | + <packaging>pom</packaging> | ||
240 | + | ||
241 | + <build> | ||
242 | + <plugins> | ||
243 | + <plugin> | ||
244 | + <groupId>org.apache.maven.plugins</groupId> | ||
245 | + <artifactId>maven-compiler-plugin</artifactId> | ||
246 | + <version>3.1</version> | ||
247 | + <configuration> | ||
248 | + <source>${java.version}</source> | ||
249 | + <target>${java.version}</target> | ||
250 | + <encoding>${project.build.sourceEncoding}</encoding> | ||
251 | + </configuration> | ||
252 | + </plugin> | ||
253 | + <plugin> | ||
254 | + <groupId>org.apache.maven.plugins</groupId> | ||
255 | + <artifactId>maven-resources-plugin</artifactId> | ||
256 | + <configuration> | ||
257 | + <encoding>UTF-8</encoding> | ||
258 | + <nonFilteredFileExtensions> | ||
259 | + <nonFilteredFileExtension>xlsx</nonFilteredFileExtension> | ||
260 | + <nonFilteredFileExtension>xls</nonFilteredFileExtension> | ||
261 | + </nonFilteredFileExtensions> | ||
262 | + </configuration> | ||
263 | + </plugin> | ||
264 | + | ||
265 | + </plugins> | ||
266 | + </build> | ||
267 | + | ||
268 | + <repositories> | ||
269 | + <repository> | ||
270 | + <id>public</id> | ||
271 | + <name>aliyun nexus</name> | ||
272 | + <url>https://maven.aliyun.com/repository/public</url> | ||
273 | + <releases> | ||
274 | + <enabled>true</enabled> | ||
275 | + </releases> | ||
276 | + </repository> | ||
277 | + </repositories> | ||
278 | + | ||
279 | + <pluginRepositories> | ||
280 | + <pluginRepository> | ||
281 | + <id>public</id> | ||
282 | + <name>aliyun nexus</name> | ||
283 | + <url>https://maven.aliyun.com/repository/public</url> | ||
284 | + <releases> | ||
285 | + <enabled>true</enabled> | ||
286 | + </releases> | ||
287 | + <snapshots> | ||
288 | + <enabled>false</enabled> | ||
289 | + </snapshots> | ||
290 | + </pluginRepository> | ||
291 | + </pluginRepositories> | ||
292 | + | ||
293 | +</project> |
ruoyi-common/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
5 | + <parent> | ||
6 | + <artifactId>ruoyi</artifactId> | ||
7 | + <groupId>com.ruoyi</groupId> | ||
8 | + <version>3.8.8</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 | + <!-- excel工具 --> | ||
75 | + <dependency> | ||
76 | + <groupId>org.apache.poi</groupId> | ||
77 | + <artifactId>poi-ooxml</artifactId> | ||
78 | + </dependency> | ||
79 | + | ||
80 | + <!-- yml解析器 --> | ||
81 | + <dependency> | ||
82 | + <groupId>org.yaml</groupId> | ||
83 | + <artifactId>snakeyaml</artifactId> | ||
84 | + </dependency> | ||
85 | + | ||
86 | + <!-- Token生成与解析--> | ||
87 | + <dependency> | ||
88 | + <groupId>io.jsonwebtoken</groupId> | ||
89 | + <artifactId>jjwt</artifactId> | ||
90 | + </dependency> | ||
91 | + | ||
92 | + <!-- Jaxb --> | ||
93 | + <dependency> | ||
94 | + <groupId>javax.xml.bind</groupId> | ||
95 | + <artifactId>jaxb-api</artifactId> | ||
96 | + </dependency> | ||
97 | + | ||
98 | + <!-- redis 缓存操作 --> | ||
99 | + <dependency> | ||
100 | + <groupId>org.springframework.boot</groupId> | ||
101 | + <artifactId>spring-boot-starter-data-redis</artifactId> | ||
102 | + </dependency> | ||
103 | + | ||
104 | + <!-- pool 对象池 --> | ||
105 | + <dependency> | ||
106 | + <groupId>org.apache.commons</groupId> | ||
107 | + <artifactId>commons-pool2</artifactId> | ||
108 | + </dependency> | ||
109 | + | ||
110 | + <!-- 解析客户端操作系统、浏览器等 --> | ||
111 | + <dependency> | ||
112 | + <groupId>eu.bitwalker</groupId> | ||
113 | + <artifactId>UserAgentUtils</artifactId> | ||
114 | + </dependency> | ||
115 | + | ||
116 | + <!-- servlet包 --> | ||
117 | + <dependency> | ||
118 | + <groupId>javax.servlet</groupId> | ||
119 | + <artifactId>javax.servlet-api</artifactId> | ||
120 | + </dependency> | ||
121 | + | ||
122 | + <dependency> | ||
123 | + <groupId>com.alibaba</groupId> | ||
124 | + <artifactId>easyexcel</artifactId> | ||
125 | + <version>3.2.1</version> | ||
126 | + </dependency> | ||
127 | + | ||
128 | + </dependencies> | ||
129 | + | ||
130 | +</project> |
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 | +} |
1 | +package com.ruoyi.common.annotation; | ||
2 | + | ||
3 | +import java.lang.annotation.Documented; | ||
4 | +import java.lang.annotation.ElementType; | ||
5 | +import java.lang.annotation.Retention; | ||
6 | +import java.lang.annotation.RetentionPolicy; | ||
7 | +import java.lang.annotation.Target; | ||
8 | + | ||
9 | +/** | ||
10 | + * 数据权限过滤注解 | ||
11 | + * | ||
12 | + * @author ruoyi | ||
13 | + */ | ||
14 | +@Target(ElementType.METHOD) | ||
15 | +@Retention(RetentionPolicy.RUNTIME) | ||
16 | +@Documented | ||
17 | +public @interface DataScope | ||
18 | +{ | ||
19 | + /** | ||
20 | + * 部门表的别名 | ||
21 | + */ | ||
22 | + public String deptAlias() default ""; | ||
23 | + | ||
24 | + /** | ||
25 | + * 用户表的别名 | ||
26 | + */ | ||
27 | + public String userAlias() default ""; | ||
28 | + | ||
29 | + /** | ||
30 | + * 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来 | ||
31 | + */ | ||
32 | + public String permission() default ""; | ||
33 | +} |
1 | +package com.ruoyi.common.annotation; | ||
2 | + | ||
3 | + | ||
4 | +import java.lang.annotation.*; | ||
5 | + | ||
6 | +@Target(ElementType.METHOD) | ||
7 | +@Retention(RetentionPolicy.RUNTIME) | ||
8 | +@Documented | ||
9 | +public @interface DataScopeExt { | ||
10 | + | ||
11 | + /** | ||
12 | + * 部门表的别名 | ||
13 | + */ | ||
14 | + public String deptAlias() default ""; | ||
15 | + | ||
16 | + /** | ||
17 | + * 用户表的别名 | ||
18 | + */ | ||
19 | + public String userAlias() default ""; | ||
20 | + | ||
21 | + /** | ||
22 | + * 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来 | ||
23 | + */ | ||
24 | + public String permission() default ""; | ||
25 | +} |
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 | +} |
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 | + * 是否从字典读数据到combo,默认不读取,如读取需要设置dictType注解. | ||
93 | + */ | ||
94 | + public boolean comboReadDict() default false; | ||
95 | + | ||
96 | + /** | ||
97 | + * 是否需要纵向合并单元格,应对需求:含有list集合单元格) | ||
98 | + */ | ||
99 | + public boolean needMerge() default false; | ||
100 | + | ||
101 | + /** | ||
102 | + * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写. | ||
103 | + */ | ||
104 | + public boolean isExport() default true; | ||
105 | + | ||
106 | + /** | ||
107 | + * 另一个类中的属性名称,支持多级获取,以小数点隔开 | ||
108 | + */ | ||
109 | + public String targetAttr() default ""; | ||
110 | + | ||
111 | + /** | ||
112 | + * 是否自动统计数据,在最后追加一行统计数据总和 | ||
113 | + */ | ||
114 | + public boolean isStatistics() default false; | ||
115 | + | ||
116 | + /** | ||
117 | + * 导出类型(0数字 1字符串 2图片) | ||
118 | + */ | ||
119 | + public ColumnType cellType() default ColumnType.STRING; | ||
120 | + | ||
121 | + /** | ||
122 | + * 导出列头背景颜色 | ||
123 | + */ | ||
124 | + public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT; | ||
125 | + | ||
126 | + /** | ||
127 | + * 导出列头字体颜色 | ||
128 | + */ | ||
129 | + public IndexedColors headerColor() default IndexedColors.WHITE; | ||
130 | + | ||
131 | + /** | ||
132 | + * 导出单元格背景颜色 | ||
133 | + */ | ||
134 | + public IndexedColors backgroundColor() default IndexedColors.WHITE; | ||
135 | + | ||
136 | + /** | ||
137 | + * 导出单元格字体颜色 | ||
138 | + */ | ||
139 | + public IndexedColors color() default IndexedColors.BLACK; | ||
140 | + | ||
141 | + /** | ||
142 | + * 导出字段对齐方式 | ||
143 | + */ | ||
144 | + public HorizontalAlignment align() default HorizontalAlignment.CENTER; | ||
145 | + | ||
146 | + /** | ||
147 | + * 自定义数据处理器 | ||
148 | + */ | ||
149 | + public Class<?> handler() default ExcelHandlerAdapter.class; | ||
150 | + | ||
151 | + /** | ||
152 | + * 自定义数据处理器参数 | ||
153 | + */ | ||
154 | + public String[] args() default {}; | ||
155 | + | ||
156 | + /** | ||
157 | + * 字段类型(0:导出导入;1:仅导出;2:仅导入) | ||
158 | + */ | ||
159 | + Type type() default Type.ALL; | ||
160 | + | ||
161 | + public enum Type | ||
162 | + { | ||
163 | + ALL(0), EXPORT(1), IMPORT(2); | ||
164 | + private final int value; | ||
165 | + | ||
166 | + Type(int value) | ||
167 | + { | ||
168 | + this.value = value; | ||
169 | + } | ||
170 | + | ||
171 | + public int value() | ||
172 | + { | ||
173 | + return this.value; | ||
174 | + } | ||
175 | + } | ||
176 | + | ||
177 | + public enum ColumnType | ||
178 | + { | ||
179 | + NUMERIC(0), STRING(1), IMAGE(2), TEXT(3); | ||
180 | + private final int value; | ||
181 | + | ||
182 | + ColumnType(int value) | ||
183 | + { | ||
184 | + this.value = value; | ||
185 | + } | ||
186 | + | ||
187 | + public int value() | ||
188 | + { | ||
189 | + return this.value; | ||
190 | + } | ||
191 | + } | ||
192 | +} |
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 | +} |
1 | +package com.ruoyi.common.annotation; | ||
2 | + | ||
3 | +import java.lang.annotation.Documented; | ||
4 | +import java.lang.annotation.ElementType; | ||
5 | +import java.lang.annotation.Retention; | ||
6 | +import java.lang.annotation.RetentionPolicy; | ||
7 | +import java.lang.annotation.Target; | ||
8 | +import com.ruoyi.common.enums.BusinessType; | ||
9 | +import com.ruoyi.common.enums.OperatorType; | ||
10 | + | ||
11 | +/** | ||
12 | + * 自定义操作日志记录注解 | ||
13 | + * | ||
14 | + * @author ruoyi | ||
15 | + * | ||
16 | + */ | ||
17 | +@Target({ ElementType.PARAMETER, ElementType.METHOD }) | ||
18 | +@Retention(RetentionPolicy.RUNTIME) | ||
19 | +@Documented | ||
20 | +public @interface Log | ||
21 | +{ | ||
22 | + /** | ||
23 | + * 模块 | ||
24 | + */ | ||
25 | + public String title() default ""; | ||
26 | + | ||
27 | + /** | ||
28 | + * 功能 | ||
29 | + */ | ||
30 | + public BusinessType businessType() default BusinessType.OTHER; | ||
31 | + | ||
32 | + /** | ||
33 | + * 操作人类别 | ||
34 | + */ | ||
35 | + public OperatorType operatorType() default OperatorType.MANAGE; | ||
36 | + | ||
37 | + /** | ||
38 | + * 是否保存请求的参数 | ||
39 | + */ | ||
40 | + public boolean isSaveRequestData() default true; | ||
41 | + | ||
42 | + /** | ||
43 | + * 是否保存响应的参数 | ||
44 | + */ | ||
45 | + public boolean isSaveResponseData() default true; | ||
46 | + | ||
47 | + /** | ||
48 | + * 排除指定的请求参数 | ||
49 | + */ | ||
50 | + public String[] excludeParamNames() default {}; | ||
51 | +} |
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 | +} |
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 | +} |
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 com.fasterxml.jackson.annotation.JacksonAnnotationsInside; | ||
8 | +import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
9 | +import com.ruoyi.common.config.serializer.SensitiveJsonSerializer; | ||
10 | +import com.ruoyi.common.enums.DesensitizedType; | ||
11 | + | ||
12 | +/** | ||
13 | + * 数据脱敏注解 | ||
14 | + * | ||
15 | + * @author ruoyi | ||
16 | + */ | ||
17 | +@Retention(RetentionPolicy.RUNTIME) | ||
18 | +@Target(ElementType.FIELD) | ||
19 | +@JacksonAnnotationsInside | ||
20 | +@JsonSerialize(using = SensitiveJsonSerializer.class) | ||
21 | +public @interface Sensitive | ||
22 | +{ | ||
23 | + DesensitizedType desensitizedType(); | ||
24 | +} |
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 static String profile; | ||
26 | + | ||
27 | + /** 获取地址开关 */ | ||
28 | + private static boolean addressEnabled; | ||
29 | + | ||
30 | + /** 验证码类型 */ | ||
31 | + private static String captchaType; | ||
32 | + | ||
33 | + public String getName() | ||
34 | + { | ||
35 | + return name; | ||
36 | + } | ||
37 | + | ||
38 | + public void setName(String name) | ||
39 | + { | ||
40 | + this.name = name; | ||
41 | + } | ||
42 | + | ||
43 | + public String getVersion() | ||
44 | + { | ||
45 | + return version; | ||
46 | + } | ||
47 | + | ||
48 | + public void setVersion(String version) | ||
49 | + { | ||
50 | + this.version = version; | ||
51 | + } | ||
52 | + | ||
53 | + public String getCopyrightYear() | ||
54 | + { | ||
55 | + return copyrightYear; | ||
56 | + } | ||
57 | + | ||
58 | + public void setCopyrightYear(String copyrightYear) | ||
59 | + { | ||
60 | + this.copyrightYear = copyrightYear; | ||
61 | + } | ||
62 | + | ||
63 | + public static String getProfile() | ||
64 | + { | ||
65 | + return profile; | ||
66 | + } | ||
67 | + | ||
68 | + public void setProfile(String profile) | ||
69 | + { | ||
70 | + RuoYiConfig.profile = profile; | ||
71 | + } | ||
72 | + | ||
73 | + public static boolean isAddressEnabled() | ||
74 | + { | ||
75 | + return addressEnabled; | ||
76 | + } | ||
77 | + | ||
78 | + public void setAddressEnabled(boolean addressEnabled) | ||
79 | + { | ||
80 | + RuoYiConfig.addressEnabled = addressEnabled; | ||
81 | + } | ||
82 | + | ||
83 | + public static String getCaptchaType() { | ||
84 | + return captchaType; | ||
85 | + } | ||
86 | + | ||
87 | + public void setCaptchaType(String captchaType) { | ||
88 | + RuoYiConfig.captchaType = captchaType; | ||
89 | + } | ||
90 | + | ||
91 | + /** | ||
92 | + * 获取导入上传路径 | ||
93 | + */ | ||
94 | + public static String getImportPath() | ||
95 | + { | ||
96 | + return getProfile() + "/import"; | ||
97 | + } | ||
98 | + | ||
99 | + /** | ||
100 | + * 获取头像上传路径 | ||
101 | + */ | ||
102 | + public static String getAvatarPath() | ||
103 | + { | ||
104 | + return getProfile() + "/avatar"; | ||
105 | + } | ||
106 | + | ||
107 | + /** | ||
108 | + * 获取下载路径 | ||
109 | + */ | ||
110 | + public static String getDownloadPath() | ||
111 | + { | ||
112 | + return getProfile() + "/download/"; | ||
113 | + } | ||
114 | + | ||
115 | + /** | ||
116 | + * 获取上传路径 | ||
117 | + */ | ||
118 | + public static String getUploadPath() | ||
119 | + { | ||
120 | + return getProfile() + "/upload"; | ||
121 | + } | ||
122 | +} |
ruoyi-common/src/main/java/com/ruoyi/common/config/serializer/SensitiveJsonSerializer.java
0 → 100644
1 | +package com.ruoyi.common.config.serializer; | ||
2 | + | ||
3 | +import java.io.IOException; | ||
4 | +import java.util.Objects; | ||
5 | +import com.fasterxml.jackson.core.JsonGenerator; | ||
6 | +import com.fasterxml.jackson.databind.BeanProperty; | ||
7 | +import com.fasterxml.jackson.databind.JsonMappingException; | ||
8 | +import com.fasterxml.jackson.databind.JsonSerializer; | ||
9 | +import com.fasterxml.jackson.databind.SerializerProvider; | ||
10 | +import com.fasterxml.jackson.databind.ser.ContextualSerializer; | ||
11 | +import com.ruoyi.common.annotation.Sensitive; | ||
12 | +import com.ruoyi.common.core.domain.model.LoginUser; | ||
13 | +import com.ruoyi.common.enums.DesensitizedType; | ||
14 | +import com.ruoyi.common.utils.SecurityUtils; | ||
15 | + | ||
16 | +/** | ||
17 | + * 数据脱敏序列化过滤 | ||
18 | + * | ||
19 | + * @author ruoyi | ||
20 | + */ | ||
21 | +public class SensitiveJsonSerializer extends JsonSerializer<String> implements ContextualSerializer | ||
22 | +{ | ||
23 | + private DesensitizedType desensitizedType; | ||
24 | + | ||
25 | + @Override | ||
26 | + public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) throws IOException | ||
27 | + { | ||
28 | + if (desensitization()) | ||
29 | + { | ||
30 | + gen.writeString(desensitizedType.desensitizer().apply(value)); | ||
31 | + } | ||
32 | + else | ||
33 | + { | ||
34 | + gen.writeString(value); | ||
35 | + } | ||
36 | + } | ||
37 | + | ||
38 | + @Override | ||
39 | + public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property) | ||
40 | + throws JsonMappingException | ||
41 | + { | ||
42 | + Sensitive annotation = property.getAnnotation(Sensitive.class); | ||
43 | + if (Objects.nonNull(annotation) && Objects.equals(String.class, property.getType().getRawClass())) | ||
44 | + { | ||
45 | + this.desensitizedType = annotation.desensitizedType(); | ||
46 | + return this; | ||
47 | + } | ||
48 | + return prov.findValueSerializer(property.getType(), property); | ||
49 | + } | ||
50 | + | ||
51 | + /** | ||
52 | + * 是否需要脱敏处理 | ||
53 | + */ | ||
54 | + private boolean desensitization() | ||
55 | + { | ||
56 | + try | ||
57 | + { | ||
58 | + LoginUser securityUser = SecurityUtils.getLoginUser(); | ||
59 | + // 管理员不脱敏 | ||
60 | + return !securityUser.getUser().isAdmin(); | ||
61 | + } | ||
62 | + catch (Exception e) | ||
63 | + { | ||
64 | + return true; | ||
65 | + } | ||
66 | + } | ||
67 | +} |
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 | + | ||
40 | + /** | ||
41 | + * 登录账户密码错误次数 redis key | ||
42 | + */ | ||
43 | + public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; | ||
44 | +} |
1 | +package com.ruoyi.common.constant; | ||
2 | + | ||
3 | +import java.util.Locale; | ||
4 | +import io.jsonwebtoken.Claims; | ||
5 | + | ||
6 | +/** | ||
7 | + * 通用常量信息 | ||
8 | + * | ||
9 | + * @author ruoyi | ||
10 | + */ | ||
11 | +public class Constants | ||
12 | +{ | ||
13 | + /** | ||
14 | + * UTF-8 字符集 | ||
15 | + */ | ||
16 | + public static final String UTF8 = "UTF-8"; | ||
17 | + | ||
18 | + /** | ||
19 | + * GBK 字符集 | ||
20 | + */ | ||
21 | + public static final String GBK = "GBK"; | ||
22 | + | ||
23 | + /** | ||
24 | + * 系统语言 | ||
25 | + */ | ||
26 | + public static final Locale DEFAULT_LOCALE = Locale.SIMPLIFIED_CHINESE; | ||
27 | + | ||
28 | + /** | ||
29 | + * www主域 | ||
30 | + */ | ||
31 | + public static final String WWW = "www."; | ||
32 | + | ||
33 | + /** | ||
34 | + * http请求 | ||
35 | + */ | ||
36 | + public static final String HTTP = "http://"; | ||
37 | + | ||
38 | + /** | ||
39 | + * https请求 | ||
40 | + */ | ||
41 | + public static final String HTTPS = "https://"; | ||
42 | + | ||
43 | + /** | ||
44 | + * 通用成功标识 | ||
45 | + */ | ||
46 | + public static final String SUCCESS = "0"; | ||
47 | + | ||
48 | + /** | ||
49 | + * 通用失败标识 | ||
50 | + */ | ||
51 | + public static final String FAIL = "1"; | ||
52 | + | ||
53 | + /** | ||
54 | + * 登录成功 | ||
55 | + */ | ||
56 | + public static final String LOGIN_SUCCESS = "Success"; | ||
57 | + | ||
58 | + /** | ||
59 | + * 注销 | ||
60 | + */ | ||
61 | + public static final String LOGOUT = "Logout"; | ||
62 | + | ||
63 | + /** | ||
64 | + * 注册 | ||
65 | + */ | ||
66 | + public static final String REGISTER = "Register"; | ||
67 | + | ||
68 | + /** | ||
69 | + * 登录失败 | ||
70 | + */ | ||
71 | + public static final String LOGIN_FAIL = "Error"; | ||
72 | + | ||
73 | + /** | ||
74 | + * 所有权限标识 | ||
75 | + */ | ||
76 | + public static final String ALL_PERMISSION = "*:*:*"; | ||
77 | + | ||
78 | + /** | ||
79 | + * 管理员角色权限标识 | ||
80 | + */ | ||
81 | + public static final String SUPER_ADMIN = "admin"; | ||
82 | + | ||
83 | + /** | ||
84 | + * 角色权限分隔符 | ||
85 | + */ | ||
86 | + public static final String ROLE_DELIMETER = ","; | ||
87 | + | ||
88 | + /** | ||
89 | + * 权限标识分隔符 | ||
90 | + */ | ||
91 | + public static final String PERMISSION_DELIMETER = ","; | ||
92 | + | ||
93 | + /** | ||
94 | + * 验证码有效期(分钟) | ||
95 | + */ | ||
96 | + public static final Integer CAPTCHA_EXPIRATION = 2; | ||
97 | + | ||
98 | + /** | ||
99 | + * 令牌 | ||
100 | + */ | ||
101 | + public static final String TOKEN = "token"; | ||
102 | + | ||
103 | + /** | ||
104 | + * 令牌前缀 | ||
105 | + */ | ||
106 | + public static final String TOKEN_PREFIX = "Bearer "; | ||
107 | + | ||
108 | + /** | ||
109 | + * 令牌前缀 | ||
110 | + */ | ||
111 | + public static final String LOGIN_USER_KEY = "login_user_key"; | ||
112 | + | ||
113 | + /** | ||
114 | + * 用户ID | ||
115 | + */ | ||
116 | + public static final String JWT_USERID = "userid"; | ||
117 | + | ||
118 | + /** | ||
119 | + * 用户名称 | ||
120 | + */ | ||
121 | + public static final String JWT_USERNAME = Claims.SUBJECT; | ||
122 | + | ||
123 | + /** | ||
124 | + * 用户头像 | ||
125 | + */ | ||
126 | + public static final String JWT_AVATAR = "avatar"; | ||
127 | + | ||
128 | + /** | ||
129 | + * 创建时间 | ||
130 | + */ | ||
131 | + public static final String JWT_CREATED = "created"; | ||
132 | + | ||
133 | + /** | ||
134 | + * 用户权限 | ||
135 | + */ | ||
136 | + public static final String JWT_AUTHORITIES = "authorities"; | ||
137 | + | ||
138 | + /** | ||
139 | + * 资源映射路径 前缀 | ||
140 | + */ | ||
141 | + public static final String RESOURCE_PREFIX = "/profile"; | ||
142 | + | ||
143 | + /** | ||
144 | + * RMI 远程方法调用 | ||
145 | + */ | ||
146 | + public static final String LOOKUP_RMI = "rmi:"; | ||
147 | + | ||
148 | + /** | ||
149 | + * LDAP 远程方法调用 | ||
150 | + */ | ||
151 | + public static final String LOOKUP_LDAP = "ldap:"; | ||
152 | + | ||
153 | + /** | ||
154 | + * LDAPS 远程方法调用 | ||
155 | + */ | ||
156 | + public static final String LOOKUP_LDAPS = "ldaps:"; | ||
157 | + | ||
158 | + /** | ||
159 | + * 自动识别json对象白名单配置(仅允许解析的包名,范围越小越安全) | ||
160 | + */ | ||
161 | + public static final String[] JSON_WHITELIST_STR = { "org.springframework", "com.ruoyi" }; | ||
162 | + | ||
163 | + /** | ||
164 | + * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加) | ||
165 | + */ | ||
166 | + public static final String[] JOB_WHITELIST_STR = { "com.ruoyi.quartz.task" }; | ||
167 | + | ||
168 | + /** | ||
169 | + * 定时任务违规的字符 | ||
170 | + */ | ||
171 | + public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", | ||
172 | + "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config", "com.ruoyi.generator" }; | ||
173 | +} |
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 | +} |
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 | + | ||
90 | + /** | ||
91 | + * 系统警告消息 | ||
92 | + */ | ||
93 | + public static final int WARN = 601; | ||
94 | +} |
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 | +} |
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_NORMAL = "0"; | ||
26 | + | ||
27 | + /** 角色封禁状态 */ | ||
28 | + public static final String ROLE_DISABLE = "1"; | ||
29 | + | ||
30 | + /** 部门正常状态 */ | ||
31 | + public static final String DEPT_NORMAL = "0"; | ||
32 | + | ||
33 | + /** 部门停用状态 */ | ||
34 | + public static final String DEPT_DISABLE = "1"; | ||
35 | + | ||
36 | + /** 字典正常状态 */ | ||
37 | + public static final String DICT_NORMAL = "0"; | ||
38 | + | ||
39 | + /** 是否为系统默认(是) */ | ||
40 | + public static final String YES = "Y"; | ||
41 | + | ||
42 | + /** 是否菜单外链(是) */ | ||
43 | + public static final String YES_FRAME = "0"; | ||
44 | + | ||
45 | + /** 是否菜单外链(否) */ | ||
46 | + public static final String NO_FRAME = "1"; | ||
47 | + | ||
48 | + /** 菜单类型(目录) */ | ||
49 | + public static final String TYPE_DIR = "M"; | ||
50 | + | ||
51 | + /** 菜单类型(菜单) */ | ||
52 | + public static final String TYPE_MENU = "C"; | ||
53 | + | ||
54 | + /** 菜单类型(按钮) */ | ||
55 | + public static final String TYPE_BUTTON = "F"; | ||
56 | + | ||
57 | + /** Layout组件标识 */ | ||
58 | + public final static String LAYOUT = "Layout"; | ||
59 | + | ||
60 | + /** ParentView组件标识 */ | ||
61 | + public final static String PARENT_VIEW = "ParentView"; | ||
62 | + | ||
63 | + /** InnerLink组件标识 */ | ||
64 | + public final static String INNER_LINK = "InnerLink"; | ||
65 | + | ||
66 | + /** 校验是否唯一的返回标识 */ | ||
67 | + public final static boolean UNIQUE = true; | ||
68 | + public final static boolean NOT_UNIQUE = false; | ||
69 | + | ||
70 | + /** | ||
71 | + * 用户名长度限制 | ||
72 | + */ | ||
73 | + public static final int USERNAME_MIN_LENGTH = 2; | ||
74 | + public static final int USERNAME_MAX_LENGTH = 20; | ||
75 | + | ||
76 | + /** | ||
77 | + * 密码长度限制 | ||
78 | + */ | ||
79 | + public static final int PASSWORD_MIN_LENGTH = 5; | ||
80 | + public static final int PASSWORD_MAX_LENGTH = 20; | ||
81 | +} |
1 | +package com.ruoyi.common.core.controller; | ||
2 | + | ||
3 | +import java.beans.PropertyEditorSupport; | ||
4 | +import java.util.Date; | ||
5 | +import java.util.List; | ||
6 | +import org.slf4j.Logger; | ||
7 | +import org.slf4j.LoggerFactory; | ||
8 | +import org.springframework.web.bind.WebDataBinder; | ||
9 | +import org.springframework.web.bind.annotation.InitBinder; | ||
10 | +import com.github.pagehelper.PageHelper; | ||
11 | +import com.github.pagehelper.PageInfo; | ||
12 | +import com.ruoyi.common.constant.HttpStatus; | ||
13 | +import com.ruoyi.common.core.domain.AjaxResult; | ||
14 | +import com.ruoyi.common.core.domain.model.LoginUser; | ||
15 | +import com.ruoyi.common.core.page.PageDomain; | ||
16 | +import com.ruoyi.common.core.page.TableDataInfo; | ||
17 | +import com.ruoyi.common.core.page.TableSupport; | ||
18 | +import com.ruoyi.common.utils.DateUtils; | ||
19 | +import com.ruoyi.common.utils.PageUtils; | ||
20 | +import com.ruoyi.common.utils.SecurityUtils; | ||
21 | +import com.ruoyi.common.utils.StringUtils; | ||
22 | +import com.ruoyi.common.utils.sql.SqlUtil; | ||
23 | + | ||
24 | +/** | ||
25 | + * web层通用数据处理 | ||
26 | + * | ||
27 | + * @author ruoyi | ||
28 | + */ | ||
29 | +public class BaseController | ||
30 | +{ | ||
31 | + protected final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
32 | + | ||
33 | + /** | ||
34 | + * 将前台传递过来的日期格式的字符串,自动转化为Date类型 | ||
35 | + */ | ||
36 | + @InitBinder | ||
37 | + public void initBinder(WebDataBinder binder) | ||
38 | + { | ||
39 | + // Date 类型转换 | ||
40 | + binder.registerCustomEditor(Date.class, new PropertyEditorSupport() | ||
41 | + { | ||
42 | + @Override | ||
43 | + public void setAsText(String text) | ||
44 | + { | ||
45 | + setValue(DateUtils.parseDate(text)); | ||
46 | + } | ||
47 | + }); | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * 设置请求分页数据 | ||
52 | + */ | ||
53 | + protected void startPage() | ||
54 | + { | ||
55 | + PageUtils.startPage(); | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * 设置请求排序数据 | ||
60 | + */ | ||
61 | + protected void startOrderBy() | ||
62 | + { | ||
63 | + PageDomain pageDomain = TableSupport.buildPageRequest(); | ||
64 | + if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) | ||
65 | + { | ||
66 | + String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); | ||
67 | + PageHelper.orderBy(orderBy); | ||
68 | + } | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * 清理分页的线程变量 | ||
73 | + */ | ||
74 | + protected void clearPage() | ||
75 | + { | ||
76 | + PageUtils.clearPage(); | ||
77 | + } | ||
78 | + | ||
79 | + /** | ||
80 | + * 响应请求分页数据 | ||
81 | + */ | ||
82 | + @SuppressWarnings({ "rawtypes", "unchecked" }) | ||
83 | + protected TableDataInfo getDataTable(List<?> list) | ||
84 | + { | ||
85 | + TableDataInfo rspData = new TableDataInfo(); | ||
86 | + rspData.setCode(HttpStatus.SUCCESS); | ||
87 | + rspData.setMsg("查询成功"); | ||
88 | + rspData.setRows(list); | ||
89 | + rspData.setTotal(new PageInfo(list).getTotal()); | ||
90 | + return rspData; | ||
91 | + } | ||
92 | + | ||
93 | + /** | ||
94 | + * 返回成功 | ||
95 | + */ | ||
96 | + public AjaxResult success() | ||
97 | + { | ||
98 | + return AjaxResult.success(); | ||
99 | + } | ||
100 | + | ||
101 | + /** | ||
102 | + * 返回失败消息 | ||
103 | + */ | ||
104 | + public AjaxResult error() | ||
105 | + { | ||
106 | + return AjaxResult.error(); | ||
107 | + } | ||
108 | + | ||
109 | + /** | ||
110 | + * 返回成功消息 | ||
111 | + */ | ||
112 | + public AjaxResult success(String message) | ||
113 | + { | ||
114 | + return AjaxResult.success(message); | ||
115 | + } | ||
116 | + | ||
117 | + /** | ||
118 | + * 返回成功消息 | ||
119 | + */ | ||
120 | + public AjaxResult success(Object data) | ||
121 | + { | ||
122 | + return AjaxResult.success(data); | ||
123 | + } | ||
124 | + | ||
125 | + /** | ||
126 | + * 返回失败消息 | ||
127 | + */ | ||
128 | + public AjaxResult error(String message) | ||
129 | + { | ||
130 | + return AjaxResult.error(message); | ||
131 | + } | ||
132 | + | ||
133 | + /** | ||
134 | + * 返回警告消息 | ||
135 | + */ | ||
136 | + public AjaxResult warn(String message) | ||
137 | + { | ||
138 | + return AjaxResult.warn(message); | ||
139 | + } | ||
140 | + | ||
141 | + /** | ||
142 | + * 响应返回结果 | ||
143 | + * | ||
144 | + * @param rows 影响行数 | ||
145 | + * @return 操作结果 | ||
146 | + */ | ||
147 | + protected AjaxResult toAjax(int rows) | ||
148 | + { | ||
149 | + return rows > 0 ? AjaxResult.success() : AjaxResult.error(); | ||
150 | + } | ||
151 | + | ||
152 | + /** | ||
153 | + * 响应返回结果 | ||
154 | + * | ||
155 | + * @param result 结果 | ||
156 | + * @return 操作结果 | ||
157 | + */ | ||
158 | + protected AjaxResult toAjax(boolean result) | ||
159 | + { | ||
160 | + return result ? success() : error(); | ||
161 | + } | ||
162 | + | ||
163 | + /** | ||
164 | + * 页面跳转 | ||
165 | + */ | ||
166 | + public String redirect(String url) | ||
167 | + { | ||
168 | + return StringUtils.format("redirect:{}", url); | ||
169 | + } | ||
170 | + | ||
171 | + /** | ||
172 | + * 获取用户缓存信息 | ||
173 | + */ | ||
174 | + public LoginUser getLoginUser() | ||
175 | + { | ||
176 | + return SecurityUtils.getLoginUser(); | ||
177 | + } | ||
178 | + | ||
179 | + /** | ||
180 | + * 获取登录用户id | ||
181 | + */ | ||
182 | + public Long getUserId() | ||
183 | + { | ||
184 | + return getLoginUser().getUserId(); | ||
185 | + } | ||
186 | + | ||
187 | + /** | ||
188 | + * 获取登录部门id | ||
189 | + */ | ||
190 | + public Long getDeptId() | ||
191 | + { | ||
192 | + return getLoginUser().getDeptId(); | ||
193 | + } | ||
194 | + | ||
195 | + /** | ||
196 | + * 获取登录用户名 | ||
197 | + */ | ||
198 | + public String getUsername() | ||
199 | + { | ||
200 | + return getLoginUser().getUsername(); | ||
201 | + } | ||
202 | +} |
1 | +package com.ruoyi.common.core.domain; | ||
2 | + | ||
3 | +import java.util.HashMap; | ||
4 | +import java.util.Objects; | ||
5 | +import com.ruoyi.common.constant.HttpStatus; | ||
6 | +import com.ruoyi.common.utils.StringUtils; | ||
7 | + | ||
8 | +/** | ||
9 | + * 操作消息提醒 | ||
10 | + * | ||
11 | + * @author ruoyi | ||
12 | + */ | ||
13 | +public class AjaxResult extends HashMap<String, Object> | ||
14 | +{ | ||
15 | + private static final long serialVersionUID = 1L; | ||
16 | + | ||
17 | + /** 状态码 */ | ||
18 | + public static final String CODE_TAG = "code"; | ||
19 | + | ||
20 | + /** 返回内容 */ | ||
21 | + public static final String MSG_TAG = "msg"; | ||
22 | + | ||
23 | + /** 数据对象 */ | ||
24 | + public static final String DATA_TAG = "data"; | ||
25 | + | ||
26 | + /** | ||
27 | + * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。 | ||
28 | + */ | ||
29 | + public AjaxResult() | ||
30 | + { | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * 初始化一个新创建的 AjaxResult 对象 | ||
35 | + * | ||
36 | + * @param code 状态码 | ||
37 | + * @param msg 返回内容 | ||
38 | + */ | ||
39 | + public AjaxResult(int code, String msg) | ||
40 | + { | ||
41 | + super.put(CODE_TAG, code); | ||
42 | + super.put(MSG_TAG, msg); | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * 初始化一个新创建的 AjaxResult 对象 | ||
47 | + * | ||
48 | + * @param code 状态码 | ||
49 | + * @param msg 返回内容 | ||
50 | + * @param data 数据对象 | ||
51 | + */ | ||
52 | + public AjaxResult(int code, String msg, Object data) | ||
53 | + { | ||
54 | + super.put(CODE_TAG, code); | ||
55 | + super.put(MSG_TAG, msg); | ||
56 | + if (StringUtils.isNotNull(data)) | ||
57 | + { | ||
58 | + super.put(DATA_TAG, data); | ||
59 | + } | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * 返回成功消息 | ||
64 | + * | ||
65 | + * @return 成功消息 | ||
66 | + */ | ||
67 | + public static AjaxResult success() | ||
68 | + { | ||
69 | + return AjaxResult.success("操作成功"); | ||
70 | + } | ||
71 | + | ||
72 | + /** | ||
73 | + * 返回成功数据 | ||
74 | + * | ||
75 | + * @return 成功消息 | ||
76 | + */ | ||
77 | + public static AjaxResult success(Object data) | ||
78 | + { | ||
79 | + return AjaxResult.success("操作成功", data); | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * 返回成功消息 | ||
84 | + * | ||
85 | + * @param msg 返回内容 | ||
86 | + * @return 成功消息 | ||
87 | + */ | ||
88 | + public static AjaxResult success(String msg) | ||
89 | + { | ||
90 | + return AjaxResult.success(msg, null); | ||
91 | + } | ||
92 | + | ||
93 | + /** | ||
94 | + * 返回成功消息 | ||
95 | + * | ||
96 | + * @param msg 返回内容 | ||
97 | + * @param data 数据对象 | ||
98 | + * @return 成功消息 | ||
99 | + */ | ||
100 | + public static AjaxResult success(String msg, Object data) | ||
101 | + { | ||
102 | + return new AjaxResult(HttpStatus.SUCCESS, msg, data); | ||
103 | + } | ||
104 | + | ||
105 | + /** | ||
106 | + * 返回警告消息 | ||
107 | + * | ||
108 | + * @param msg 返回内容 | ||
109 | + * @return 警告消息 | ||
110 | + */ | ||
111 | + public static AjaxResult warn(String msg) | ||
112 | + { | ||
113 | + return AjaxResult.warn(msg, null); | ||
114 | + } | ||
115 | + | ||
116 | + /** | ||
117 | + * 返回警告消息 | ||
118 | + * | ||
119 | + * @param msg 返回内容 | ||
120 | + * @param data 数据对象 | ||
121 | + * @return 警告消息 | ||
122 | + */ | ||
123 | + public static AjaxResult warn(String msg, Object data) | ||
124 | + { | ||
125 | + return new AjaxResult(HttpStatus.WARN, msg, data); | ||
126 | + } | ||
127 | + | ||
128 | + /** | ||
129 | + * 返回错误消息 | ||
130 | + * | ||
131 | + * @return 错误消息 | ||
132 | + */ | ||
133 | + public static AjaxResult error() | ||
134 | + { | ||
135 | + return AjaxResult.error("操作失败"); | ||
136 | + } | ||
137 | + | ||
138 | + /** | ||
139 | + * 返回错误消息 | ||
140 | + * | ||
141 | + * @param msg 返回内容 | ||
142 | + * @return 错误消息 | ||
143 | + */ | ||
144 | + public static AjaxResult error(String msg) | ||
145 | + { | ||
146 | + return AjaxResult.error(msg, null); | ||
147 | + } | ||
148 | + | ||
149 | + /** | ||
150 | + * 返回错误消息 | ||
151 | + * | ||
152 | + * @param msg 返回内容 | ||
153 | + * @param data 数据对象 | ||
154 | + * @return 错误消息 | ||
155 | + */ | ||
156 | + public static AjaxResult error(String msg, Object data) | ||
157 | + { | ||
158 | + return new AjaxResult(HttpStatus.ERROR, msg, data); | ||
159 | + } | ||
160 | + | ||
161 | + /** | ||
162 | + * 返回错误消息 | ||
163 | + * | ||
164 | + * @param code 状态码 | ||
165 | + * @param msg 返回内容 | ||
166 | + * @return 错误消息 | ||
167 | + */ | ||
168 | + public static AjaxResult error(int code, String msg) | ||
169 | + { | ||
170 | + return new AjaxResult(code, msg, null); | ||
171 | + } | ||
172 | + | ||
173 | + /** | ||
174 | + * 是否为成功消息 | ||
175 | + * | ||
176 | + * @return 结果 | ||
177 | + */ | ||
178 | + public boolean isSuccess() | ||
179 | + { | ||
180 | + return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG)); | ||
181 | + } | ||
182 | + | ||
183 | + /** | ||
184 | + * 是否为警告消息 | ||
185 | + * | ||
186 | + * @return 结果 | ||
187 | + */ | ||
188 | + public boolean isWarn() | ||
189 | + { | ||
190 | + return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG)); | ||
191 | + } | ||
192 | + | ||
193 | + /** | ||
194 | + * 是否为错误消息 | ||
195 | + * | ||
196 | + * @return 结果 | ||
197 | + */ | ||
198 | + public boolean isError() | ||
199 | + { | ||
200 | + return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG)); | ||
201 | + } | ||
202 | + | ||
203 | + /** | ||
204 | + * 方便链式调用 | ||
205 | + * | ||
206 | + * @param key 键 | ||
207 | + * @param value 值 | ||
208 | + * @return 数据对象 | ||
209 | + */ | ||
210 | + @Override | ||
211 | + public AjaxResult put(String key, Object value) | ||
212 | + { | ||
213 | + super.put(key, value); | ||
214 | + return this; | ||
215 | + } | ||
216 | +} |
1 | +package com.ruoyi.common.core.domain; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | +import java.util.Date; | ||
5 | +import java.util.HashMap; | ||
6 | +import java.util.Map; | ||
7 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
8 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
9 | +import com.fasterxml.jackson.annotation.JsonInclude; | ||
10 | + | ||
11 | +/** | ||
12 | + * Entity基类 | ||
13 | + * | ||
14 | + * @author ruoyi | ||
15 | + */ | ||
16 | +public class BaseEntity implements Serializable | ||
17 | +{ | ||
18 | + private static final long serialVersionUID = 1L; | ||
19 | + | ||
20 | + /** 搜索值 */ | ||
21 | + @JsonIgnore | ||
22 | + private String searchValue; | ||
23 | + | ||
24 | + /** 创建者 */ | ||
25 | + private String createBy; | ||
26 | + | ||
27 | + /** 创建时间 */ | ||
28 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||
29 | + private Date createTime; | ||
30 | + | ||
31 | + /** 更新者 */ | ||
32 | + private String updateBy; | ||
33 | + | ||
34 | + /** 更新时间 */ | ||
35 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||
36 | + private Date updateTime; | ||
37 | + | ||
38 | + /** 备注 */ | ||
39 | + private String remark; | ||
40 | + | ||
41 | + /** 请求参数 */ | ||
42 | + @JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
43 | + private Map<String, Object> params; | ||
44 | + | ||
45 | + private boolean permissionExclude;//不考虑数据权限控制,true不控制数据权限,false控制数据权限 | ||
46 | + private String roleA;//数据权限控制参数:甲方所有用户 | ||
47 | + private String roleA0;//数据权限控制参数:甲方领导用户 | ||
48 | + private String roleA1;//数据权限控制参数:甲方组长用户 | ||
49 | + private String roleA2;//数据权限控制参数:甲方组员用户 | ||
50 | + private String roleB;//数据权限控制参数:乙方所有用户 | ||
51 | + private String roleB1;//数据权限控制参数:乙方项目经理用户 | ||
52 | + private String roleB2;//数据权限控制参数:乙方运维人员用户 | ||
53 | + | ||
54 | + public String getSearchValue() | ||
55 | + { | ||
56 | + return searchValue; | ||
57 | + } | ||
58 | + | ||
59 | + public void setSearchValue(String searchValue) | ||
60 | + { | ||
61 | + this.searchValue = searchValue; | ||
62 | + } | ||
63 | + | ||
64 | + public String getCreateBy() | ||
65 | + { | ||
66 | + return createBy; | ||
67 | + } | ||
68 | + | ||
69 | + public void setCreateBy(String createBy) | ||
70 | + { | ||
71 | + this.createBy = createBy; | ||
72 | + } | ||
73 | + | ||
74 | + public Date getCreateTime() | ||
75 | + { | ||
76 | + return createTime; | ||
77 | + } | ||
78 | + | ||
79 | + public void setCreateTime(Date createTime) | ||
80 | + { | ||
81 | + this.createTime = createTime; | ||
82 | + } | ||
83 | + | ||
84 | + public String getUpdateBy() | ||
85 | + { | ||
86 | + return updateBy; | ||
87 | + } | ||
88 | + | ||
89 | + public void setUpdateBy(String updateBy) | ||
90 | + { | ||
91 | + this.updateBy = updateBy; | ||
92 | + } | ||
93 | + | ||
94 | + public Date getUpdateTime() | ||
95 | + { | ||
96 | + return updateTime; | ||
97 | + } | ||
98 | + | ||
99 | + public void setUpdateTime(Date updateTime) | ||
100 | + { | ||
101 | + this.updateTime = updateTime; | ||
102 | + } | ||
103 | + | ||
104 | + public String getRemark() | ||
105 | + { | ||
106 | + return remark; | ||
107 | + } | ||
108 | + | ||
109 | + public void setRemark(String remark) | ||
110 | + { | ||
111 | + this.remark = remark; | ||
112 | + } | ||
113 | + | ||
114 | + public Map<String, Object> getParams() | ||
115 | + { | ||
116 | + if (params == null) | ||
117 | + { | ||
118 | + params = new HashMap<>(); | ||
119 | + } | ||
120 | + return params; | ||
121 | + } | ||
122 | + | ||
123 | + public void setParams(Map<String, Object> params) | ||
124 | + { | ||
125 | + this.params = params; | ||
126 | + } | ||
127 | + | ||
128 | + public boolean isPermissionExclude() { | ||
129 | + return permissionExclude; | ||
130 | + } | ||
131 | + | ||
132 | + public void setPermissionExclude(boolean permissionExclude) { | ||
133 | + this.permissionExclude = permissionExclude; | ||
134 | + } | ||
135 | + | ||
136 | + public String getRoleA() { | ||
137 | + return roleA; | ||
138 | + } | ||
139 | + | ||
140 | + public void setRoleA(String roleA) { | ||
141 | + this.roleA = roleA; | ||
142 | + } | ||
143 | + | ||
144 | + public String getRoleA0() { | ||
145 | + return roleA0; | ||
146 | + } | ||
147 | + | ||
148 | + public void setRoleA0(String roleA0) { | ||
149 | + this.roleA0 = roleA0; | ||
150 | + } | ||
151 | + | ||
152 | + public String getRoleA1() { | ||
153 | + return roleA1; | ||
154 | + } | ||
155 | + | ||
156 | + public void setRoleA1(String roleA1) { | ||
157 | + this.roleA1 = roleA1; | ||
158 | + } | ||
159 | + | ||
160 | + public String getRoleA2() { | ||
161 | + return roleA2; | ||
162 | + } | ||
163 | + | ||
164 | + public void setRoleA2(String roleA2) { | ||
165 | + this.roleA2 = roleA2; | ||
166 | + } | ||
167 | + | ||
168 | + public String getRoleB() { | ||
169 | + return roleB; | ||
170 | + } | ||
171 | + | ||
172 | + public void setRoleB(String roleB) { | ||
173 | + this.roleB = roleB; | ||
174 | + } | ||
175 | + | ||
176 | + public String getRoleB1() { | ||
177 | + return roleB1; | ||
178 | + } | ||
179 | + | ||
180 | + public void setRoleB1(String roleB1) { | ||
181 | + this.roleB1 = roleB1; | ||
182 | + } | ||
183 | + | ||
184 | + public String getRoleB2() { | ||
185 | + return roleB2; | ||
186 | + } | ||
187 | + | ||
188 | + public void setRoleB2(String roleB2) { | ||
189 | + this.roleB2 = roleB2; | ||
190 | + } | ||
191 | + | ||
192 | +} |
1 | +package com.ruoyi.common.core.domain; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | +import com.ruoyi.common.constant.HttpStatus; | ||
5 | + | ||
6 | +/** | ||
7 | + * 响应信息主体 | ||
8 | + * | ||
9 | + * @author ruoyi | ||
10 | + */ | ||
11 | +public class R<T> implements Serializable | ||
12 | +{ | ||
13 | + private static final long serialVersionUID = 1L; | ||
14 | + | ||
15 | + /** 成功 */ | ||
16 | + public static final int SUCCESS = HttpStatus.SUCCESS; | ||
17 | + | ||
18 | + /** 失败 */ | ||
19 | + public static final int FAIL = HttpStatus.ERROR; | ||
20 | + | ||
21 | + private int code; | ||
22 | + | ||
23 | + private String msg; | ||
24 | + | ||
25 | + private T data; | ||
26 | + | ||
27 | + public static <T> R<T> ok() | ||
28 | + { | ||
29 | + return restResult(null, SUCCESS, "操作成功"); | ||
30 | + } | ||
31 | + | ||
32 | + public static <T> R<T> ok(T data) | ||
33 | + { | ||
34 | + return restResult(data, SUCCESS, "操作成功"); | ||
35 | + } | ||
36 | + | ||
37 | + public static <T> R<T> ok(T data, String msg) | ||
38 | + { | ||
39 | + return restResult(data, SUCCESS, msg); | ||
40 | + } | ||
41 | + | ||
42 | + public static <T> R<T> fail() | ||
43 | + { | ||
44 | + return restResult(null, FAIL, "操作失败"); | ||
45 | + } | ||
46 | + | ||
47 | + public static <T> R<T> fail(String msg) | ||
48 | + { | ||
49 | + return restResult(null, FAIL, msg); | ||
50 | + } | ||
51 | + | ||
52 | + public static <T> R<T> fail(T data) | ||
53 | + { | ||
54 | + return restResult(data, FAIL, "操作失败"); | ||
55 | + } | ||
56 | + | ||
57 | + public static <T> R<T> fail(T data, String msg) | ||
58 | + { | ||
59 | + return restResult(data, FAIL, msg); | ||
60 | + } | ||
61 | + | ||
62 | + public static <T> R<T> fail(int code, String msg) | ||
63 | + { | ||
64 | + return restResult(null, code, msg); | ||
65 | + } | ||
66 | + | ||
67 | + private static <T> R<T> restResult(T data, int code, String msg) | ||
68 | + { | ||
69 | + R<T> apiResult = new R<>(); | ||
70 | + apiResult.setCode(code); | ||
71 | + apiResult.setData(data); | ||
72 | + apiResult.setMsg(msg); | ||
73 | + return apiResult; | ||
74 | + } | ||
75 | + | ||
76 | + public int getCode() | ||
77 | + { | ||
78 | + return code; | ||
79 | + } | ||
80 | + | ||
81 | + public void setCode(int code) | ||
82 | + { | ||
83 | + this.code = code; | ||
84 | + } | ||
85 | + | ||
86 | + public String getMsg() | ||
87 | + { | ||
88 | + return msg; | ||
89 | + } | ||
90 | + | ||
91 | + public void setMsg(String msg) | ||
92 | + { | ||
93 | + this.msg = msg; | ||
94 | + } | ||
95 | + | ||
96 | + public T getData() | ||
97 | + { | ||
98 | + return data; | ||
99 | + } | ||
100 | + | ||
101 | + public void setData(T data) | ||
102 | + { | ||
103 | + this.data = data; | ||
104 | + } | ||
105 | + | ||
106 | + public static <T> Boolean isError(R<T> ret) | ||
107 | + { | ||
108 | + return !isSuccess(ret); | ||
109 | + } | ||
110 | + | ||
111 | + public static <T> Boolean isSuccess(R<T> ret) | ||
112 | + { | ||
113 | + return R.SUCCESS == ret.getCode(); | ||
114 | + } | ||
115 | +} |
1 | +package com.ruoyi.common.core.domain; | ||
2 | + | ||
3 | +import java.util.ArrayList; | ||
4 | +import java.util.List; | ||
5 | + | ||
6 | +/** | ||
7 | + * Tree基类 | ||
8 | + * | ||
9 | + * @author ruoyi | ||
10 | + */ | ||
11 | +public class TreeEntity extends BaseEntity | ||
12 | +{ | ||
13 | + private static final long serialVersionUID = 1L; | ||
14 | + | ||
15 | + /** 父菜单名称 */ | ||
16 | + private String parentName; | ||
17 | + | ||
18 | + /** 父菜单ID */ | ||
19 | + private Long parentId; | ||
20 | + | ||
21 | + /** 显示顺序 */ | ||
22 | + private Integer orderNum; | ||
23 | + | ||
24 | + /** 祖级列表 */ | ||
25 | + private String ancestors; | ||
26 | + | ||
27 | + /** 子部门 */ | ||
28 | + private List<?> children = new ArrayList<>(); | ||
29 | + | ||
30 | + public String getParentName() | ||
31 | + { | ||
32 | + return parentName; | ||
33 | + } | ||
34 | + | ||
35 | + public void setParentName(String parentName) | ||
36 | + { | ||
37 | + this.parentName = parentName; | ||
38 | + } | ||
39 | + | ||
40 | + public Long getParentId() | ||
41 | + { | ||
42 | + return parentId; | ||
43 | + } | ||
44 | + | ||
45 | + public void setParentId(Long parentId) | ||
46 | + { | ||
47 | + this.parentId = parentId; | ||
48 | + } | ||
49 | + | ||
50 | + public Integer getOrderNum() | ||
51 | + { | ||
52 | + return orderNum; | ||
53 | + } | ||
54 | + | ||
55 | + public void setOrderNum(Integer orderNum) | ||
56 | + { | ||
57 | + this.orderNum = orderNum; | ||
58 | + } | ||
59 | + | ||
60 | + public String getAncestors() | ||
61 | + { | ||
62 | + return ancestors; | ||
63 | + } | ||
64 | + | ||
65 | + public void setAncestors(String ancestors) | ||
66 | + { | ||
67 | + this.ancestors = ancestors; | ||
68 | + } | ||
69 | + | ||
70 | + public List<?> getChildren() | ||
71 | + { | ||
72 | + return children; | ||
73 | + } | ||
74 | + | ||
75 | + public void setChildren(List<?> children) | ||
76 | + { | ||
77 | + this.children = children; | ||
78 | + } | ||
79 | +} |
1 | +package com.ruoyi.common.core.domain; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | +import java.util.List; | ||
5 | +import java.util.stream.Collectors; | ||
6 | +import com.fasterxml.jackson.annotation.JsonInclude; | ||
7 | +import com.ruoyi.common.core.domain.entity.SysDept; | ||
8 | +import com.ruoyi.common.core.domain.entity.SysMenu; | ||
9 | + | ||
10 | +/** | ||
11 | + * Treeselect树结构实体类 | ||
12 | + * | ||
13 | + * @author ruoyi | ||
14 | + */ | ||
15 | +public class TreeSelect implements Serializable | ||
16 | +{ | ||
17 | + private static final long serialVersionUID = 1L; | ||
18 | + | ||
19 | + /** 节点ID */ | ||
20 | + private Long id; | ||
21 | + | ||
22 | + /** 节点名称 */ | ||
23 | + private String label; | ||
24 | + | ||
25 | + /** 子节点 */ | ||
26 | + @JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
27 | + private List<TreeSelect> children; | ||
28 | + | ||
29 | + public TreeSelect() | ||
30 | + { | ||
31 | + | ||
32 | + } | ||
33 | + | ||
34 | + public TreeSelect(SysDept dept) | ||
35 | + { | ||
36 | + this.id = dept.getDeptId(); | ||
37 | + this.label = dept.getDeptName(); | ||
38 | + this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); | ||
39 | + } | ||
40 | + | ||
41 | + public TreeSelect(SysMenu menu) | ||
42 | + { | ||
43 | + this.id = menu.getMenuId(); | ||
44 | + this.label = menu.getMenuName(); | ||
45 | + this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); | ||
46 | + } | ||
47 | + | ||
48 | + public Long getId() | ||
49 | + { | ||
50 | + return id; | ||
51 | + } | ||
52 | + | ||
53 | + public void setId(Long id) | ||
54 | + { | ||
55 | + this.id = id; | ||
56 | + } | ||
57 | + | ||
58 | + public String getLabel() | ||
59 | + { | ||
60 | + return label; | ||
61 | + } | ||
62 | + | ||
63 | + public void setLabel(String label) | ||
64 | + { | ||
65 | + this.label = label; | ||
66 | + } | ||
67 | + | ||
68 | + public List<TreeSelect> getChildren() | ||
69 | + { | ||
70 | + return children; | ||
71 | + } | ||
72 | + | ||
73 | + public void setChildren(List<TreeSelect> children) | ||
74 | + { | ||
75 | + this.children = children; | ||
76 | + } | ||
77 | +} |
1 | +package com.ruoyi.common.core.domain.entity; | ||
2 | + | ||
3 | +import java.util.ArrayList; | ||
4 | +import java.util.List; | ||
5 | +import javax.validation.constraints.Email; | ||
6 | +import javax.validation.constraints.NotBlank; | ||
7 | +import javax.validation.constraints.NotNull; | ||
8 | +import javax.validation.constraints.Size; | ||
9 | +import org.apache.commons.lang3.builder.ToStringBuilder; | ||
10 | +import org.apache.commons.lang3.builder.ToStringStyle; | ||
11 | +import com.ruoyi.common.core.domain.BaseEntity; | ||
12 | + | ||
13 | +/** | ||
14 | + * 部门表 sys_dept | ||
15 | + * | ||
16 | + * @author ruoyi | ||
17 | + */ | ||
18 | +public class SysDept extends BaseEntity | ||
19 | +{ | ||
20 | + private static final long serialVersionUID = 1L; | ||
21 | + | ||
22 | + /** 部门ID */ | ||
23 | + private Long deptId; | ||
24 | + | ||
25 | + /** 父部门ID */ | ||
26 | + private Long parentId; | ||
27 | + | ||
28 | + /** 祖级列表 */ | ||
29 | + private String ancestors; | ||
30 | + | ||
31 | + /** 部门名称 */ | ||
32 | + private String deptName; | ||
33 | + | ||
34 | + /** 显示顺序 */ | ||
35 | + private Integer orderNum; | ||
36 | + | ||
37 | + /** 负责人 */ | ||
38 | + private String leader; | ||
39 | + | ||
40 | + /** 联系电话 */ | ||
41 | + private String phone; | ||
42 | + | ||
43 | + /** 邮箱 */ | ||
44 | + private String email; | ||
45 | + | ||
46 | + /** 部门状态:0正常,1停用 */ | ||
47 | + private String status; | ||
48 | + | ||
49 | + /** 删除标志(0代表存在 2代表删除) */ | ||
50 | + private String delFlag; | ||
51 | + | ||
52 | + /** 父部门名称 */ | ||
53 | + private String parentName; | ||
54 | + | ||
55 | + /** 子部门 */ | ||
56 | + private List<SysDept> children = new ArrayList<SysDept>(); | ||
57 | + | ||
58 | + public Long getDeptId() | ||
59 | + { | ||
60 | + return deptId; | ||
61 | + } | ||
62 | + | ||
63 | + public void setDeptId(Long deptId) | ||
64 | + { | ||
65 | + this.deptId = deptId; | ||
66 | + } | ||
67 | + | ||
68 | + public Long getParentId() | ||
69 | + { | ||
70 | + return parentId; | ||
71 | + } | ||
72 | + | ||
73 | + public void setParentId(Long parentId) | ||
74 | + { | ||
75 | + this.parentId = parentId; | ||
76 | + } | ||
77 | + | ||
78 | + public String getAncestors() | ||
79 | + { | ||
80 | + return ancestors; | ||
81 | + } | ||
82 | + | ||
83 | + public void setAncestors(String ancestors) | ||
84 | + { | ||
85 | + this.ancestors = ancestors; | ||
86 | + } | ||
87 | + | ||
88 | + @NotBlank(message = "部门名称不能为空") | ||
89 | + @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") | ||
90 | + public String getDeptName() | ||
91 | + { | ||
92 | + return deptName; | ||
93 | + } | ||
94 | + | ||
95 | + public void setDeptName(String deptName) | ||
96 | + { | ||
97 | + this.deptName = deptName; | ||
98 | + } | ||
99 | + | ||
100 | + @NotNull(message = "显示顺序不能为空") | ||
101 | + public Integer getOrderNum() | ||
102 | + { | ||
103 | + return orderNum; | ||
104 | + } | ||
105 | + | ||
106 | + public void setOrderNum(Integer orderNum) | ||
107 | + { | ||
108 | + this.orderNum = orderNum; | ||
109 | + } | ||
110 | + | ||
111 | + public String getLeader() | ||
112 | + { | ||
113 | + return leader; | ||
114 | + } | ||
115 | + | ||
116 | + public void setLeader(String leader) | ||
117 | + { | ||
118 | + this.leader = leader; | ||
119 | + } | ||
120 | + | ||
121 | + @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") | ||
122 | + public String getPhone() | ||
123 | + { | ||
124 | + return phone; | ||
125 | + } | ||
126 | + | ||
127 | + public void setPhone(String phone) | ||
128 | + { | ||
129 | + this.phone = phone; | ||
130 | + } | ||
131 | + | ||
132 | + @Email(message = "邮箱格式不正确") | ||
133 | + @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") | ||
134 | + public String getEmail() | ||
135 | + { | ||
136 | + return email; | ||
137 | + } | ||
138 | + | ||
139 | + public void setEmail(String email) | ||
140 | + { | ||
141 | + this.email = email; | ||
142 | + } | ||
143 | + | ||
144 | + public String getStatus() | ||
145 | + { | ||
146 | + return status; | ||
147 | + } | ||
148 | + | ||
149 | + public void setStatus(String status) | ||
150 | + { | ||
151 | + this.status = status; | ||
152 | + } | ||
153 | + | ||
154 | + public String getDelFlag() | ||
155 | + { | ||
156 | + return delFlag; | ||
157 | + } | ||
158 | + | ||
159 | + public void setDelFlag(String delFlag) | ||
160 | + { | ||
161 | + this.delFlag = delFlag; | ||
162 | + } | ||
163 | + | ||
164 | + public String getParentName() | ||
165 | + { | ||
166 | + return parentName; | ||
167 | + } | ||
168 | + | ||
169 | + public void setParentName(String parentName) | ||
170 | + { | ||
171 | + this.parentName = parentName; | ||
172 | + } | ||
173 | + | ||
174 | + public List<SysDept> getChildren() | ||
175 | + { | ||
176 | + return children; | ||
177 | + } | ||
178 | + | ||
179 | + public void setChildren(List<SysDept> children) | ||
180 | + { | ||
181 | + this.children = children; | ||
182 | + } | ||
183 | + | ||
184 | + @Override | ||
185 | + public String toString() { | ||
186 | + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | ||
187 | + .append("deptId", getDeptId()) | ||
188 | + .append("parentId", getParentId()) | ||
189 | + .append("ancestors", getAncestors()) | ||
190 | + .append("deptName", getDeptName()) | ||
191 | + .append("orderNum", getOrderNum()) | ||
192 | + .append("leader", getLeader()) | ||
193 | + .append("phone", getPhone()) | ||
194 | + .append("email", getEmail()) | ||
195 | + .append("status", getStatus()) | ||
196 | + .append("delFlag", getDelFlag()) | ||
197 | + .append("createBy", getCreateBy()) | ||
198 | + .append("createTime", getCreateTime()) | ||
199 | + .append("updateBy", getUpdateBy()) | ||
200 | + .append("updateTime", getUpdateTime()) | ||
201 | + .toString(); | ||
202 | + } | ||
203 | +} |
1 | +package com.ruoyi.common.core.domain.entity; | ||
2 | + | ||
3 | +import javax.validation.constraints.NotBlank; | ||
4 | +import javax.validation.constraints.Size; | ||
5 | +import org.apache.commons.lang3.builder.ToStringBuilder; | ||
6 | +import org.apache.commons.lang3.builder.ToStringStyle; | ||
7 | +import com.ruoyi.common.annotation.Excel; | ||
8 | +import com.ruoyi.common.annotation.Excel.ColumnType; | ||
9 | +import com.ruoyi.common.constant.UserConstants; | ||
10 | +import com.ruoyi.common.core.domain.BaseEntity; | ||
11 | + | ||
12 | +/** | ||
13 | + * 字典数据表 sys_dict_data | ||
14 | + * | ||
15 | + * @author ruoyi | ||
16 | + */ | ||
17 | +public class SysDictData extends BaseEntity | ||
18 | +{ | ||
19 | + private static final long serialVersionUID = 1L; | ||
20 | + | ||
21 | + /** 字典编码 */ | ||
22 | + @Excel(name = "字典编码", cellType = ColumnType.NUMERIC) | ||
23 | + private Long dictCode; | ||
24 | + | ||
25 | + /** 字典排序 */ | ||
26 | + @Excel(name = "字典排序", cellType = ColumnType.NUMERIC) | ||
27 | + private Long dictSort; | ||
28 | + | ||
29 | + /** 字典标签 */ | ||
30 | + @Excel(name = "字典标签") | ||
31 | + private String dictLabel; | ||
32 | + | ||
33 | + /** 字典键值 */ | ||
34 | + @Excel(name = "字典键值") | ||
35 | + private String dictValue; | ||
36 | + | ||
37 | + /** 字典类型 */ | ||
38 | + @Excel(name = "字典类型") | ||
39 | + private String dictType; | ||
40 | + | ||
41 | + /** 样式属性(其他样式扩展) */ | ||
42 | + private String cssClass; | ||
43 | + | ||
44 | + /** 表格字典样式 */ | ||
45 | + private String listClass; | ||
46 | + | ||
47 | + /** 是否默认(Y是 N否) */ | ||
48 | + @Excel(name = "是否默认", readConverterExp = "Y=是,N=否") | ||
49 | + private String isDefault; | ||
50 | + | ||
51 | + /** 状态(0正常 1停用) */ | ||
52 | + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") | ||
53 | + private String status; | ||
54 | + | ||
55 | + public Long getDictCode() | ||
56 | + { | ||
57 | + return dictCode; | ||
58 | + } | ||
59 | + | ||
60 | + public void setDictCode(Long dictCode) | ||
61 | + { | ||
62 | + this.dictCode = dictCode; | ||
63 | + } | ||
64 | + | ||
65 | + public Long getDictSort() | ||
66 | + { | ||
67 | + return dictSort; | ||
68 | + } | ||
69 | + | ||
70 | + public void setDictSort(Long dictSort) | ||
71 | + { | ||
72 | + this.dictSort = dictSort; | ||
73 | + } | ||
74 | + | ||
75 | + @NotBlank(message = "字典标签不能为空") | ||
76 | + @Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符") | ||
77 | + public String getDictLabel() | ||
78 | + { | ||
79 | + return dictLabel; | ||
80 | + } | ||
81 | + | ||
82 | + public void setDictLabel(String dictLabel) | ||
83 | + { | ||
84 | + this.dictLabel = dictLabel; | ||
85 | + } | ||
86 | + | ||
87 | + @NotBlank(message = "字典键值不能为空") | ||
88 | + @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") | ||
89 | + public String getDictValue() | ||
90 | + { | ||
91 | + return dictValue; | ||
92 | + } | ||
93 | + | ||
94 | + public void setDictValue(String dictValue) | ||
95 | + { | ||
96 | + this.dictValue = dictValue; | ||
97 | + } | ||
98 | + | ||
99 | + @NotBlank(message = "字典类型不能为空") | ||
100 | + @Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符") | ||
101 | + public String getDictType() | ||
102 | + { | ||
103 | + return dictType; | ||
104 | + } | ||
105 | + | ||
106 | + public void setDictType(String dictType) | ||
107 | + { | ||
108 | + this.dictType = dictType; | ||
109 | + } | ||
110 | + | ||
111 | + @Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符") | ||
112 | + public String getCssClass() | ||
113 | + { | ||
114 | + return cssClass; | ||
115 | + } | ||
116 | + | ||
117 | + public void setCssClass(String cssClass) | ||
118 | + { | ||
119 | + this.cssClass = cssClass; | ||
120 | + } | ||
121 | + | ||
122 | + public String getListClass() | ||
123 | + { | ||
124 | + return listClass; | ||
125 | + } | ||
126 | + | ||
127 | + public void setListClass(String listClass) | ||
128 | + { | ||
129 | + this.listClass = listClass; | ||
130 | + } | ||
131 | + | ||
132 | + public boolean getDefault() | ||
133 | + { | ||
134 | + return UserConstants.YES.equals(this.isDefault); | ||
135 | + } | ||
136 | + | ||
137 | + public String getIsDefault() | ||
138 | + { | ||
139 | + return isDefault; | ||
140 | + } | ||
141 | + | ||
142 | + public void setIsDefault(String isDefault) | ||
143 | + { | ||
144 | + this.isDefault = isDefault; | ||
145 | + } | ||
146 | + | ||
147 | + public String getStatus() | ||
148 | + { | ||
149 | + return status; | ||
150 | + } | ||
151 | + | ||
152 | + public void setStatus(String status) | ||
153 | + { | ||
154 | + this.status = status; | ||
155 | + } | ||
156 | + | ||
157 | + @Override | ||
158 | + public String toString() { | ||
159 | + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | ||
160 | + .append("dictCode", getDictCode()) | ||
161 | + .append("dictSort", getDictSort()) | ||
162 | + .append("dictLabel", getDictLabel()) | ||
163 | + .append("dictValue", getDictValue()) | ||
164 | + .append("dictType", getDictType()) | ||
165 | + .append("cssClass", getCssClass()) | ||
166 | + .append("listClass", getListClass()) | ||
167 | + .append("isDefault", getIsDefault()) | ||
168 | + .append("status", getStatus()) | ||
169 | + .append("createBy", getCreateBy()) | ||
170 | + .append("createTime", getCreateTime()) | ||
171 | + .append("updateBy", getUpdateBy()) | ||
172 | + .append("updateTime", getUpdateTime()) | ||
173 | + .append("remark", getRemark()) | ||
174 | + .toString(); | ||
175 | + } | ||
176 | +} |
1 | +package com.ruoyi.common.core.domain.entity; | ||
2 | + | ||
3 | +import javax.validation.constraints.NotBlank; | ||
4 | +import javax.validation.constraints.Pattern; | ||
5 | +import javax.validation.constraints.Size; | ||
6 | +import org.apache.commons.lang3.builder.ToStringBuilder; | ||
7 | +import org.apache.commons.lang3.builder.ToStringStyle; | ||
8 | +import com.ruoyi.common.annotation.Excel; | ||
9 | +import com.ruoyi.common.annotation.Excel.ColumnType; | ||
10 | +import com.ruoyi.common.core.domain.BaseEntity; | ||
11 | + | ||
12 | +/** | ||
13 | + * 字典类型表 sys_dict_type | ||
14 | + * | ||
15 | + * @author ruoyi | ||
16 | + */ | ||
17 | +public class SysDictType extends BaseEntity | ||
18 | +{ | ||
19 | + private static final long serialVersionUID = 1L; | ||
20 | + | ||
21 | + /** 字典主键 */ | ||
22 | + @Excel(name = "字典主键", cellType = ColumnType.NUMERIC) | ||
23 | + private Long dictId; | ||
24 | + | ||
25 | + /** 字典名称 */ | ||
26 | + @Excel(name = "字典名称") | ||
27 | + private String dictName; | ||
28 | + | ||
29 | + /** 字典类型 */ | ||
30 | + @Excel(name = "字典类型") | ||
31 | + private String dictType; | ||
32 | + | ||
33 | + /** 状态(0正常 1停用) */ | ||
34 | + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") | ||
35 | + private String status; | ||
36 | + | ||
37 | + public Long getDictId() | ||
38 | + { | ||
39 | + return dictId; | ||
40 | + } | ||
41 | + | ||
42 | + public void setDictId(Long dictId) | ||
43 | + { | ||
44 | + this.dictId = dictId; | ||
45 | + } | ||
46 | + | ||
47 | + @NotBlank(message = "字典名称不能为空") | ||
48 | + @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符") | ||
49 | + public String getDictName() | ||
50 | + { | ||
51 | + return dictName; | ||
52 | + } | ||
53 | + | ||
54 | + public void setDictName(String dictName) | ||
55 | + { | ||
56 | + this.dictName = dictName; | ||
57 | + } | ||
58 | + | ||
59 | + @NotBlank(message = "字典类型不能为空") | ||
60 | + @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") | ||
61 | + @Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)") | ||
62 | + public String getDictType() | ||
63 | + { | ||
64 | + return dictType; | ||
65 | + } | ||
66 | + | ||
67 | + public void setDictType(String dictType) | ||
68 | + { | ||
69 | + this.dictType = dictType; | ||
70 | + } | ||
71 | + | ||
72 | + public String getStatus() | ||
73 | + { | ||
74 | + return status; | ||
75 | + } | ||
76 | + | ||
77 | + public void setStatus(String status) | ||
78 | + { | ||
79 | + this.status = status; | ||
80 | + } | ||
81 | + | ||
82 | + @Override | ||
83 | + public String toString() { | ||
84 | + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | ||
85 | + .append("dictId", getDictId()) | ||
86 | + .append("dictName", getDictName()) | ||
87 | + .append("dictType", getDictType()) | ||
88 | + .append("status", getStatus()) | ||
89 | + .append("createBy", getCreateBy()) | ||
90 | + .append("createTime", getCreateTime()) | ||
91 | + .append("updateBy", getUpdateBy()) | ||
92 | + .append("updateTime", getUpdateTime()) | ||
93 | + .append("remark", getRemark()) | ||
94 | + .toString(); | ||
95 | + } | ||
96 | +} |
1 | +package com.ruoyi.common.core.domain.entity; | ||
2 | + | ||
3 | +import java.util.ArrayList; | ||
4 | +import java.util.List; | ||
5 | +import javax.validation.constraints.NotBlank; | ||
6 | +import javax.validation.constraints.NotNull; | ||
7 | +import javax.validation.constraints.Size; | ||
8 | +import org.apache.commons.lang3.builder.ToStringBuilder; | ||
9 | +import org.apache.commons.lang3.builder.ToStringStyle; | ||
10 | +import com.ruoyi.common.core.domain.BaseEntity; | ||
11 | + | ||
12 | +/** | ||
13 | + * 菜单权限表 sys_menu | ||
14 | + * | ||
15 | + * @author ruoyi | ||
16 | + */ | ||
17 | +public class SysMenu extends BaseEntity | ||
18 | +{ | ||
19 | + private static final long serialVersionUID = 1L; | ||
20 | + | ||
21 | + /** 菜单ID */ | ||
22 | + private Long menuId; | ||
23 | + | ||
24 | + /** 菜单名称 */ | ||
25 | + private String menuName; | ||
26 | + | ||
27 | + /** 父菜单名称 */ | ||
28 | + private String parentName; | ||
29 | + | ||
30 | + /** 父菜单ID */ | ||
31 | + private Long parentId; | ||
32 | + | ||
33 | + /** 显示顺序 */ | ||
34 | + private Integer orderNum; | ||
35 | + | ||
36 | + /** 路由地址 */ | ||
37 | + private String path; | ||
38 | + | ||
39 | + /** 组件路径 */ | ||
40 | + private String component; | ||
41 | + | ||
42 | + /** 路由参数 */ | ||
43 | + private String query; | ||
44 | + | ||
45 | + /** 路由名称,默认和路由地址相同的驼峰格式(注意:因为vue3版本的router会删除名称相同路由,为避免名字的冲突,特殊情况可以自定义) */ | ||
46 | + private String routeName; | ||
47 | + | ||
48 | + /** 是否为外链(0是 1否) */ | ||
49 | + private String isFrame; | ||
50 | + | ||
51 | + /** 是否缓存(0缓存 1不缓存) */ | ||
52 | + private String isCache; | ||
53 | + | ||
54 | + /** 类型(M目录 C菜单 F按钮) */ | ||
55 | + private String menuType; | ||
56 | + | ||
57 | + /** 显示状态(0显示 1隐藏) */ | ||
58 | + private String visible; | ||
59 | + | ||
60 | + /** 菜单状态(0正常 1停用) */ | ||
61 | + private String status; | ||
62 | + | ||
63 | + /** 权限字符串 */ | ||
64 | + private String perms; | ||
65 | + | ||
66 | + /** 菜单图标 */ | ||
67 | + private String icon; | ||
68 | + | ||
69 | + /** 子菜单 */ | ||
70 | + private List<SysMenu> children = new ArrayList<SysMenu>(); | ||
71 | + | ||
72 | + public Long getMenuId() | ||
73 | + { | ||
74 | + return menuId; | ||
75 | + } | ||
76 | + | ||
77 | + public void setMenuId(Long menuId) | ||
78 | + { | ||
79 | + this.menuId = menuId; | ||
80 | + } | ||
81 | + | ||
82 | + @NotBlank(message = "菜单名称不能为空") | ||
83 | + @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") | ||
84 | + public String getMenuName() | ||
85 | + { | ||
86 | + return menuName; | ||
87 | + } | ||
88 | + | ||
89 | + public void setMenuName(String menuName) | ||
90 | + { | ||
91 | + this.menuName = menuName; | ||
92 | + } | ||
93 | + | ||
94 | + public String getParentName() | ||
95 | + { | ||
96 | + return parentName; | ||
97 | + } | ||
98 | + | ||
99 | + public void setParentName(String parentName) | ||
100 | + { | ||
101 | + this.parentName = parentName; | ||
102 | + } | ||
103 | + | ||
104 | + public Long getParentId() | ||
105 | + { | ||
106 | + return parentId; | ||
107 | + } | ||
108 | + | ||
109 | + public void setParentId(Long parentId) | ||
110 | + { | ||
111 | + this.parentId = parentId; | ||
112 | + } | ||
113 | + | ||
114 | + @NotNull(message = "显示顺序不能为空") | ||
115 | + public Integer getOrderNum() | ||
116 | + { | ||
117 | + return orderNum; | ||
118 | + } | ||
119 | + | ||
120 | + public void setOrderNum(Integer orderNum) | ||
121 | + { | ||
122 | + this.orderNum = orderNum; | ||
123 | + } | ||
124 | + | ||
125 | + @Size(min = 0, max = 200, message = "路由地址不能超过200个字符") | ||
126 | + public String getPath() | ||
127 | + { | ||
128 | + return path; | ||
129 | + } | ||
130 | + | ||
131 | + public void setPath(String path) | ||
132 | + { | ||
133 | + this.path = path; | ||
134 | + } | ||
135 | + | ||
136 | + @Size(min = 0, max = 200, message = "组件路径不能超过255个字符") | ||
137 | + public String getComponent() | ||
138 | + { | ||
139 | + return component; | ||
140 | + } | ||
141 | + | ||
142 | + public void setComponent(String component) | ||
143 | + { | ||
144 | + this.component = component; | ||
145 | + } | ||
146 | + | ||
147 | + public String getQuery() | ||
148 | + { | ||
149 | + return query; | ||
150 | + } | ||
151 | + | ||
152 | + public void setQuery(String query) | ||
153 | + { | ||
154 | + this.query = query; | ||
155 | + } | ||
156 | + | ||
157 | + public String getRouteName() | ||
158 | + { | ||
159 | + return routeName; | ||
160 | + } | ||
161 | + | ||
162 | + public void setRouteName(String routeName) | ||
163 | + { | ||
164 | + this.routeName = routeName; | ||
165 | + } | ||
166 | + | ||
167 | + public String getIsFrame() | ||
168 | + { | ||
169 | + return isFrame; | ||
170 | + } | ||
171 | + | ||
172 | + public void setIsFrame(String isFrame) | ||
173 | + { | ||
174 | + this.isFrame = isFrame; | ||
175 | + } | ||
176 | + | ||
177 | + public String getIsCache() | ||
178 | + { | ||
179 | + return isCache; | ||
180 | + } | ||
181 | + | ||
182 | + public void setIsCache(String isCache) | ||
183 | + { | ||
184 | + this.isCache = isCache; | ||
185 | + } | ||
186 | + | ||
187 | + @NotBlank(message = "菜单类型不能为空") | ||
188 | + public String getMenuType() | ||
189 | + { | ||
190 | + return menuType; | ||
191 | + } | ||
192 | + | ||
193 | + public void setMenuType(String menuType) | ||
194 | + { | ||
195 | + this.menuType = menuType; | ||
196 | + } | ||
197 | + | ||
198 | + public String getVisible() | ||
199 | + { | ||
200 | + return visible; | ||
201 | + } | ||
202 | + | ||
203 | + public void setVisible(String visible) | ||
204 | + { | ||
205 | + this.visible = visible; | ||
206 | + } | ||
207 | + | ||
208 | + public String getStatus() | ||
209 | + { | ||
210 | + return status; | ||
211 | + } | ||
212 | + | ||
213 | + public void setStatus(String status) | ||
214 | + { | ||
215 | + this.status = status; | ||
216 | + } | ||
217 | + | ||
218 | + @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") | ||
219 | + public String getPerms() | ||
220 | + { | ||
221 | + return perms; | ||
222 | + } | ||
223 | + | ||
224 | + public void setPerms(String perms) | ||
225 | + { | ||
226 | + this.perms = perms; | ||
227 | + } | ||
228 | + | ||
229 | + public String getIcon() | ||
230 | + { | ||
231 | + return icon; | ||
232 | + } | ||
233 | + | ||
234 | + public void setIcon(String icon) | ||
235 | + { | ||
236 | + this.icon = icon; | ||
237 | + } | ||
238 | + | ||
239 | + public List<SysMenu> getChildren() | ||
240 | + { | ||
241 | + return children; | ||
242 | + } | ||
243 | + | ||
244 | + public void setChildren(List<SysMenu> children) | ||
245 | + { | ||
246 | + this.children = children; | ||
247 | + } | ||
248 | + | ||
249 | + @Override | ||
250 | + public String toString() { | ||
251 | + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | ||
252 | + .append("menuId", getMenuId()) | ||
253 | + .append("menuName", getMenuName()) | ||
254 | + .append("parentId", getParentId()) | ||
255 | + .append("orderNum", getOrderNum()) | ||
256 | + .append("path", getPath()) | ||
257 | + .append("component", getComponent()) | ||
258 | + .append("query", getQuery()) | ||
259 | + .append("routeName", getRouteName()) | ||
260 | + .append("isFrame", getIsFrame()) | ||
261 | + .append("IsCache", getIsCache()) | ||
262 | + .append("menuType", getMenuType()) | ||
263 | + .append("visible", getVisible()) | ||
264 | + .append("status ", getStatus()) | ||
265 | + .append("perms", getPerms()) | ||
266 | + .append("icon", getIcon()) | ||
267 | + .append("createBy", getCreateBy()) | ||
268 | + .append("createTime", getCreateTime()) | ||
269 | + .append("updateBy", getUpdateBy()) | ||
270 | + .append("updateTime", getUpdateTime()) | ||
271 | + .append("remark", getRemark()) | ||
272 | + .toString(); | ||
273 | + } | ||
274 | +} |
1 | +package com.ruoyi.common.core.domain.entity; | ||
2 | + | ||
3 | +import java.util.Set; | ||
4 | +import javax.validation.constraints.NotBlank; | ||
5 | +import javax.validation.constraints.NotNull; | ||
6 | +import javax.validation.constraints.Size; | ||
7 | +import org.apache.commons.lang3.builder.ToStringBuilder; | ||
8 | +import org.apache.commons.lang3.builder.ToStringStyle; | ||
9 | +import com.ruoyi.common.annotation.Excel; | ||
10 | +import com.ruoyi.common.annotation.Excel.ColumnType; | ||
11 | +import com.ruoyi.common.core.domain.BaseEntity; | ||
12 | + | ||
13 | +/** | ||
14 | + * 角色表 sys_role | ||
15 | + * | ||
16 | + * @author ruoyi | ||
17 | + */ | ||
18 | +public class SysRole extends BaseEntity | ||
19 | +{ | ||
20 | + private static final long serialVersionUID = 1L; | ||
21 | + | ||
22 | + /** 角色ID */ | ||
23 | + @Excel(name = "角色序号", cellType = ColumnType.NUMERIC) | ||
24 | + private Long roleId; | ||
25 | + | ||
26 | + /** 角色名称 */ | ||
27 | + @Excel(name = "角色名称") | ||
28 | + private String roleName; | ||
29 | + | ||
30 | + /** 角色权限 */ | ||
31 | + @Excel(name = "角色权限") | ||
32 | + private String roleKey; | ||
33 | + | ||
34 | + /** 角色排序 */ | ||
35 | + @Excel(name = "角色排序") | ||
36 | + private Integer roleSort; | ||
37 | + | ||
38 | + /** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */ | ||
39 | + @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") | ||
40 | + private String dataScope; | ||
41 | + | ||
42 | + /** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */ | ||
43 | + private boolean menuCheckStrictly; | ||
44 | + | ||
45 | + /** 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) */ | ||
46 | + private boolean deptCheckStrictly; | ||
47 | + | ||
48 | + /** 角色状态(0正常 1停用) */ | ||
49 | + @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") | ||
50 | + private String status; | ||
51 | + | ||
52 | + /** 删除标志(0代表存在 2代表删除) */ | ||
53 | + private String delFlag; | ||
54 | + | ||
55 | + /** 用户是否存在此角色标识 默认不存在 */ | ||
56 | + private boolean flag = false; | ||
57 | + | ||
58 | + /** 菜单组 */ | ||
59 | + private Long[] menuIds; | ||
60 | + | ||
61 | + /** 部门组(数据权限) */ | ||
62 | + private Long[] deptIds; | ||
63 | + | ||
64 | + /** 角色菜单权限 */ | ||
65 | + private Set<String> permissions; | ||
66 | + | ||
67 | + /** 角色默认首页 */ | ||
68 | + private String homepage; | ||
69 | + | ||
70 | + public SysRole() | ||
71 | + { | ||
72 | + | ||
73 | + } | ||
74 | + | ||
75 | + public SysRole(Long roleId) | ||
76 | + { | ||
77 | + this.roleId = roleId; | ||
78 | + } | ||
79 | + | ||
80 | + public Long getRoleId() | ||
81 | + { | ||
82 | + return roleId; | ||
83 | + } | ||
84 | + | ||
85 | + public void setRoleId(Long roleId) | ||
86 | + { | ||
87 | + this.roleId = roleId; | ||
88 | + } | ||
89 | + | ||
90 | + public boolean isAdmin() | ||
91 | + { | ||
92 | + return isAdmin(this.roleId); | ||
93 | + } | ||
94 | + | ||
95 | + public static boolean isAdmin(Long roleId) | ||
96 | + { | ||
97 | + return roleId != null && 1L == roleId; | ||
98 | + } | ||
99 | + | ||
100 | + @NotBlank(message = "角色名称不能为空") | ||
101 | + @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") | ||
102 | + public String getRoleName() | ||
103 | + { | ||
104 | + return roleName; | ||
105 | + } | ||
106 | + | ||
107 | + public void setRoleName(String roleName) | ||
108 | + { | ||
109 | + this.roleName = roleName; | ||
110 | + } | ||
111 | + | ||
112 | + @NotBlank(message = "权限字符不能为空") | ||
113 | + @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") | ||
114 | + public String getRoleKey() | ||
115 | + { | ||
116 | + return roleKey; | ||
117 | + } | ||
118 | + | ||
119 | + public void setRoleKey(String roleKey) | ||
120 | + { | ||
121 | + this.roleKey = roleKey; | ||
122 | + } | ||
123 | + | ||
124 | + @NotNull(message = "显示顺序不能为空") | ||
125 | + public Integer getRoleSort() | ||
126 | + { | ||
127 | + return roleSort; | ||
128 | + } | ||
129 | + | ||
130 | + public void setRoleSort(Integer roleSort) | ||
131 | + { | ||
132 | + this.roleSort = roleSort; | ||
133 | + } | ||
134 | + | ||
135 | + public String getDataScope() | ||
136 | + { | ||
137 | + return dataScope; | ||
138 | + } | ||
139 | + | ||
140 | + public void setDataScope(String dataScope) | ||
141 | + { | ||
142 | + this.dataScope = dataScope; | ||
143 | + } | ||
144 | + | ||
145 | + public boolean isMenuCheckStrictly() | ||
146 | + { | ||
147 | + return menuCheckStrictly; | ||
148 | + } | ||
149 | + | ||
150 | + public void setMenuCheckStrictly(boolean menuCheckStrictly) | ||
151 | + { | ||
152 | + this.menuCheckStrictly = menuCheckStrictly; | ||
153 | + } | ||
154 | + | ||
155 | + public boolean isDeptCheckStrictly() | ||
156 | + { | ||
157 | + return deptCheckStrictly; | ||
158 | + } | ||
159 | + | ||
160 | + public void setDeptCheckStrictly(boolean deptCheckStrictly) | ||
161 | + { | ||
162 | + this.deptCheckStrictly = deptCheckStrictly; | ||
163 | + } | ||
164 | + | ||
165 | + public String getStatus() | ||
166 | + { | ||
167 | + return status; | ||
168 | + } | ||
169 | + | ||
170 | + public void setStatus(String status) | ||
171 | + { | ||
172 | + this.status = status; | ||
173 | + } | ||
174 | + | ||
175 | + public String getDelFlag() | ||
176 | + { | ||
177 | + return delFlag; | ||
178 | + } | ||
179 | + | ||
180 | + public void setDelFlag(String delFlag) | ||
181 | + { | ||
182 | + this.delFlag = delFlag; | ||
183 | + } | ||
184 | + | ||
185 | + public boolean isFlag() | ||
186 | + { | ||
187 | + return flag; | ||
188 | + } | ||
189 | + | ||
190 | + public void setFlag(boolean flag) | ||
191 | + { | ||
192 | + this.flag = flag; | ||
193 | + } | ||
194 | + | ||
195 | + public Long[] getMenuIds() | ||
196 | + { | ||
197 | + return menuIds; | ||
198 | + } | ||
199 | + | ||
200 | + public void setMenuIds(Long[] menuIds) | ||
201 | + { | ||
202 | + this.menuIds = menuIds; | ||
203 | + } | ||
204 | + | ||
205 | + public Long[] getDeptIds() | ||
206 | + { | ||
207 | + return deptIds; | ||
208 | + } | ||
209 | + | ||
210 | + public void setDeptIds(Long[] deptIds) | ||
211 | + { | ||
212 | + this.deptIds = deptIds; | ||
213 | + } | ||
214 | + | ||
215 | + public Set<String> getPermissions() | ||
216 | + { | ||
217 | + return permissions; | ||
218 | + } | ||
219 | + | ||
220 | + public void setPermissions(Set<String> permissions) | ||
221 | + { | ||
222 | + this.permissions = permissions; | ||
223 | + } | ||
224 | + | ||
225 | + public String getHomepage() | ||
226 | + { | ||
227 | + return homepage; | ||
228 | + } | ||
229 | + | ||
230 | + public void setHomepage(String homepage) | ||
231 | + { | ||
232 | + this.homepage = homepage; | ||
233 | + } | ||
234 | + | ||
235 | + @Override | ||
236 | + public String toString() { | ||
237 | + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | ||
238 | + .append("roleId", getRoleId()) | ||
239 | + .append("roleName", getRoleName()) | ||
240 | + .append("roleKey", getRoleKey()) | ||
241 | + .append("roleSort", getRoleSort()) | ||
242 | + .append("dataScope", getDataScope()) | ||
243 | + .append("menuCheckStrictly", isMenuCheckStrictly()) | ||
244 | + .append("deptCheckStrictly", isDeptCheckStrictly()) | ||
245 | + .append("status", getStatus()) | ||
246 | + .append("delFlag", getDelFlag()) | ||
247 | + .append("createBy", getCreateBy()) | ||
248 | + .append("createTime", getCreateTime()) | ||
249 | + .append("updateBy", getUpdateBy()) | ||
250 | + .append("updateTime", getUpdateTime()) | ||
251 | + .append("remark", getRemark()) | ||
252 | + .append("homepage", getHomepage()) | ||
253 | + .toString(); | ||
254 | + } | ||
255 | +} |
1 | +package com.ruoyi.common.core.domain.entity; | ||
2 | + | ||
3 | +import java.util.Date; | ||
4 | +import java.util.List; | ||
5 | +import javax.validation.constraints.*; | ||
6 | +import org.apache.commons.lang3.builder.ToStringBuilder; | ||
7 | +import org.apache.commons.lang3.builder.ToStringStyle; | ||
8 | +import com.ruoyi.common.annotation.Excel; | ||
9 | +import com.ruoyi.common.annotation.Excel.ColumnType; | ||
10 | +import com.ruoyi.common.annotation.Excel.Type; | ||
11 | +import com.ruoyi.common.annotation.Excels; | ||
12 | +import com.ruoyi.common.core.domain.BaseEntity; | ||
13 | +import com.ruoyi.common.xss.Xss; | ||
14 | + | ||
15 | +/** | ||
16 | + * 用户对象 sys_user | ||
17 | + * | ||
18 | + * @author ruoyi | ||
19 | + */ | ||
20 | +public class SysUser extends BaseEntity | ||
21 | +{ | ||
22 | + private static final long serialVersionUID = 1L; | ||
23 | + | ||
24 | + /** 用户ID */ | ||
25 | + @Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号") | ||
26 | + private Long userId; | ||
27 | + | ||
28 | + /** 部门ID */ | ||
29 | + @Excel(name = "部门编号", type = Type.IMPORT) | ||
30 | + private Long deptId; | ||
31 | + | ||
32 | + /** 用户账号 */ | ||
33 | + @Excel(name = "登录名称") | ||
34 | + private String userName; | ||
35 | + | ||
36 | + /** 用户昵称 */ | ||
37 | + @Excel(name = "用户名称") | ||
38 | + private String nickName; | ||
39 | + | ||
40 | + /** 用户类型 */ | ||
41 | + @Excel(name = "用户类型", readConverterExp = "0=系统用户,1=甲方用户,2=乙方用户") | ||
42 | + private String userType; | ||
43 | + | ||
44 | + /** 用户邮箱 */ | ||
45 | + @Excel(name = "用户邮箱") | ||
46 | + private String email; | ||
47 | + | ||
48 | + /** 手机号码 */ | ||
49 | + @Excel(name = "手机号码", cellType = ColumnType.TEXT) | ||
50 | + private String phonenumber; | ||
51 | + | ||
52 | + /** 用户性别 */ | ||
53 | + @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") | ||
54 | + private String sex; | ||
55 | + | ||
56 | + /** 用户头像 */ | ||
57 | + private String avatar; | ||
58 | + | ||
59 | + /** 密码 */ | ||
60 | + private String password; | ||
61 | + | ||
62 | + /** 帐号状态(0正常 1停用) */ | ||
63 | + @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") | ||
64 | + private String status; | ||
65 | + | ||
66 | + /** 删除标志(0代表存在 2代表删除) */ | ||
67 | + private String delFlag; | ||
68 | + | ||
69 | + /** 最后登录IP */ | ||
70 | + @Excel(name = "最后登录IP", type = Type.EXPORT) | ||
71 | + private String loginIp; | ||
72 | + | ||
73 | + /** 最后登录时间 */ | ||
74 | + @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) | ||
75 | + private Date loginDate; | ||
76 | + | ||
77 | + /** 部门对象 */ | ||
78 | + @Excels({ | ||
79 | + @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), | ||
80 | + @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT) | ||
81 | + }) | ||
82 | + private SysDept dept; | ||
83 | + | ||
84 | + /** 角色对象 */ | ||
85 | + private List<SysRole> roles; | ||
86 | + | ||
87 | + /** 角色组 */ | ||
88 | + private Long[] roleIds; | ||
89 | + | ||
90 | + /** 岗位组 */ | ||
91 | + private Long[] postIds; | ||
92 | + | ||
93 | + /** 角色ID */ | ||
94 | + private Long roleId; | ||
95 | + | ||
96 | + private String companyId; | ||
97 | + | ||
98 | + private String companyName; | ||
99 | + | ||
100 | + /** 默认首页 */ | ||
101 | + private String homepage; | ||
102 | + private boolean showRules; | ||
103 | + private String cardId; | ||
104 | + | ||
105 | + public SysUser() | ||
106 | + { | ||
107 | + | ||
108 | + } | ||
109 | + | ||
110 | + public SysUser(Long userId) | ||
111 | + { | ||
112 | + this.userId = userId; | ||
113 | + } | ||
114 | + | ||
115 | + public Long getUserId() | ||
116 | + { | ||
117 | + return userId; | ||
118 | + } | ||
119 | + | ||
120 | + public void setUserId(Long userId) | ||
121 | + { | ||
122 | + this.userId = userId; | ||
123 | + } | ||
124 | + | ||
125 | + public boolean isAdmin() | ||
126 | + { | ||
127 | + return isAdmin(this.userId); | ||
128 | + } | ||
129 | + | ||
130 | + public static boolean isAdmin(Long userId) | ||
131 | + { | ||
132 | + return userId != null && 1L == userId; | ||
133 | + } | ||
134 | + | ||
135 | + public Long getDeptId() | ||
136 | + { | ||
137 | + return deptId; | ||
138 | + } | ||
139 | + | ||
140 | + public void setDeptId(Long deptId) | ||
141 | + { | ||
142 | + this.deptId = deptId; | ||
143 | + } | ||
144 | + | ||
145 | + @Xss(message = "用户昵称不能包含脚本字符") | ||
146 | + @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") | ||
147 | + public String getNickName() | ||
148 | + { | ||
149 | + return nickName; | ||
150 | + } | ||
151 | + | ||
152 | + public void setNickName(String nickName) | ||
153 | + { | ||
154 | + this.nickName = nickName; | ||
155 | + } | ||
156 | + | ||
157 | + @Xss(message = "用户账号不能包含脚本字符") | ||
158 | + @NotBlank(message = "用户账号不能为空") | ||
159 | + @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") | ||
160 | + public String getUserName() | ||
161 | + { | ||
162 | + return userName; | ||
163 | + } | ||
164 | + | ||
165 | + public void setUserName(String userName) | ||
166 | + { | ||
167 | + this.userName = userName; | ||
168 | + } | ||
169 | + | ||
170 | + public String getUserType() | ||
171 | + { | ||
172 | + return userType; | ||
173 | + } | ||
174 | + | ||
175 | + public void setUserType(String userType) | ||
176 | + { | ||
177 | + this.userType = userType; | ||
178 | + } | ||
179 | + | ||
180 | + @Email(message = "邮箱格式不正确") | ||
181 | + @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") | ||
182 | + public String getEmail() | ||
183 | + { | ||
184 | + return email; | ||
185 | + } | ||
186 | + | ||
187 | + public void setEmail(String email) | ||
188 | + { | ||
189 | + this.email = email; | ||
190 | + } | ||
191 | + | ||
192 | + @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") | ||
193 | + public String getPhonenumber() | ||
194 | + { | ||
195 | + return phonenumber; | ||
196 | + } | ||
197 | + | ||
198 | + public void setPhonenumber(String phonenumber) | ||
199 | + { | ||
200 | + this.phonenumber = phonenumber; | ||
201 | + } | ||
202 | + | ||
203 | + public String getSex() | ||
204 | + { | ||
205 | + return sex; | ||
206 | + } | ||
207 | + | ||
208 | + public void setSex(String sex) | ||
209 | + { | ||
210 | + this.sex = sex; | ||
211 | + } | ||
212 | + | ||
213 | + public String getAvatar() | ||
214 | + { | ||
215 | + return avatar; | ||
216 | + } | ||
217 | + | ||
218 | + public void setAvatar(String avatar) | ||
219 | + { | ||
220 | + this.avatar = avatar; | ||
221 | + } | ||
222 | + | ||
223 | + public String getPassword() | ||
224 | + { | ||
225 | + return password; | ||
226 | + } | ||
227 | + | ||
228 | + public void setPassword(String password) | ||
229 | + { | ||
230 | + this.password = password; | ||
231 | + } | ||
232 | + | ||
233 | + public String getStatus() | ||
234 | + { | ||
235 | + return status; | ||
236 | + } | ||
237 | + | ||
238 | + public void setStatus(String status) | ||
239 | + { | ||
240 | + this.status = status; | ||
241 | + } | ||
242 | + | ||
243 | + public String getDelFlag() | ||
244 | + { | ||
245 | + return delFlag; | ||
246 | + } | ||
247 | + | ||
248 | + public void setDelFlag(String delFlag) | ||
249 | + { | ||
250 | + this.delFlag = delFlag; | ||
251 | + } | ||
252 | + | ||
253 | + public String getLoginIp() | ||
254 | + { | ||
255 | + return loginIp; | ||
256 | + } | ||
257 | + | ||
258 | + public void setLoginIp(String loginIp) | ||
259 | + { | ||
260 | + this.loginIp = loginIp; | ||
261 | + } | ||
262 | + | ||
263 | + public Date getLoginDate() | ||
264 | + { | ||
265 | + return loginDate; | ||
266 | + } | ||
267 | + | ||
268 | + public void setLoginDate(Date loginDate) | ||
269 | + { | ||
270 | + this.loginDate = loginDate; | ||
271 | + } | ||
272 | + | ||
273 | + public SysDept getDept() | ||
274 | + { | ||
275 | + return dept; | ||
276 | + } | ||
277 | + | ||
278 | + public void setDept(SysDept dept) | ||
279 | + { | ||
280 | + this.dept = dept; | ||
281 | + } | ||
282 | + | ||
283 | + public List<SysRole> getRoles() | ||
284 | + { | ||
285 | + return roles; | ||
286 | + } | ||
287 | + | ||
288 | + public void setRoles(List<SysRole> roles) | ||
289 | + { | ||
290 | + this.roles = roles; | ||
291 | + } | ||
292 | + | ||
293 | + public Long[] getRoleIds() | ||
294 | + { | ||
295 | + return roleIds; | ||
296 | + } | ||
297 | + | ||
298 | + public void setRoleIds(Long[] roleIds) | ||
299 | + { | ||
300 | + this.roleIds = roleIds; | ||
301 | + } | ||
302 | + | ||
303 | + public Long[] getPostIds() | ||
304 | + { | ||
305 | + return postIds; | ||
306 | + } | ||
307 | + | ||
308 | + public void setPostIds(Long[] postIds) | ||
309 | + { | ||
310 | + this.postIds = postIds; | ||
311 | + } | ||
312 | + | ||
313 | + public Long getRoleId() | ||
314 | + { | ||
315 | + return roleId; | ||
316 | + } | ||
317 | + | ||
318 | + public void setRoleId(Long roleId) | ||
319 | + { | ||
320 | + this.roleId = roleId; | ||
321 | + } | ||
322 | + | ||
323 | + public String getCompanyId() | ||
324 | + { | ||
325 | + return companyId; | ||
326 | + } | ||
327 | + | ||
328 | + public void setCompanyId(String companyId) | ||
329 | + { | ||
330 | + this.companyId = companyId; | ||
331 | + } | ||
332 | + | ||
333 | + public String getHomepage() | ||
334 | + { | ||
335 | + return homepage; | ||
336 | + } | ||
337 | + | ||
338 | + public void setHomepage(String homepage) | ||
339 | + { | ||
340 | + this.homepage = homepage; | ||
341 | + } | ||
342 | + | ||
343 | + public boolean isShowRules() { | ||
344 | + return showRules; | ||
345 | + } | ||
346 | + | ||
347 | + public void setShowRules(boolean showRules) { | ||
348 | + this.showRules = showRules; | ||
349 | + } | ||
350 | + | ||
351 | + public String getCardId() { | ||
352 | + return cardId; | ||
353 | + } | ||
354 | + public void setCardId(String cardId) { | ||
355 | + this.cardId = cardId; | ||
356 | + } | ||
357 | + | ||
358 | + @Override | ||
359 | + public String toString() { | ||
360 | + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | ||
361 | + .append("userId", getUserId()) | ||
362 | + .append("deptId", getDeptId()) | ||
363 | + .append("userName", getUserName()) | ||
364 | + .append("nickName", getNickName()) | ||
365 | + .append("userType", getUserType()) | ||
366 | + .append("email", getEmail()) | ||
367 | + .append("phonenumber", getPhonenumber()) | ||
368 | + .append("sex", getSex()) | ||
369 | + .append("avatar", getAvatar()) | ||
370 | + .append("password", getPassword()) | ||
371 | + .append("status", getStatus()) | ||
372 | + .append("delFlag", getDelFlag()) | ||
373 | + .append("loginIp", getLoginIp()) | ||
374 | + .append("loginDate", getLoginDate()) | ||
375 | + .append("createBy", getCreateBy()) | ||
376 | + .append("createTime", getCreateTime()) | ||
377 | + .append("updateBy", getUpdateBy()) | ||
378 | + .append("updateTime", getUpdateTime()) | ||
379 | + .append("remark", getRemark()) | ||
380 | + .append("homepage", getHomepage()) | ||
381 | + .append("dept", getDept()) | ||
382 | + .append("cardId", getCardId()) | ||
383 | + .toString(); | ||
384 | + } | ||
385 | + | ||
386 | + public String getCompanyName() { | ||
387 | + return companyName; | ||
388 | + } | ||
389 | + | ||
390 | + public void setCompanyName(String companyName) { | ||
391 | + this.companyName = companyName; | ||
392 | + } | ||
393 | +} |
1 | +package com.ruoyi.common.core.domain.model; | ||
2 | + | ||
3 | +/** | ||
4 | + * 用户登录对象 | ||
5 | + * | ||
6 | + * @author ruoyi | ||
7 | + */ | ||
8 | +public class LoginBody | ||
9 | +{ | ||
10 | + /** | ||
11 | + * 用户名 | ||
12 | + */ | ||
13 | + private String username; | ||
14 | + | ||
15 | + /** | ||
16 | + * 用户密码 | ||
17 | + */ | ||
18 | + private String password; | ||
19 | + | ||
20 | + /** | ||
21 | + * 验证码 | ||
22 | + */ | ||
23 | + private String code; | ||
24 | + | ||
25 | + /** | ||
26 | + * 唯一标识 | ||
27 | + */ | ||
28 | + private String uuid; | ||
29 | + | ||
30 | + public String getUsername() | ||
31 | + { | ||
32 | + return username; | ||
33 | + } | ||
34 | + | ||
35 | + public void setUsername(String username) | ||
36 | + { | ||
37 | + this.username = username; | ||
38 | + } | ||
39 | + | ||
40 | + public String getPassword() | ||
41 | + { | ||
42 | + return password; | ||
43 | + } | ||
44 | + | ||
45 | + public void setPassword(String password) | ||
46 | + { | ||
47 | + this.password = password; | ||
48 | + } | ||
49 | + | ||
50 | + public String getCode() | ||
51 | + { | ||
52 | + return code; | ||
53 | + } | ||
54 | + | ||
55 | + public void setCode(String code) | ||
56 | + { | ||
57 | + this.code = code; | ||
58 | + } | ||
59 | + | ||
60 | + public String getUuid() | ||
61 | + { | ||
62 | + return uuid; | ||
63 | + } | ||
64 | + | ||
65 | + public void setUuid(String uuid) | ||
66 | + { | ||
67 | + this.uuid = uuid; | ||
68 | + } | ||
69 | +} |
1 | +package com.ruoyi.common.core.domain.model; | ||
2 | + | ||
3 | +import com.alibaba.fastjson2.annotation.JSONField; | ||
4 | +import com.ruoyi.common.core.domain.entity.SysUser; | ||
5 | +import org.springframework.security.core.GrantedAuthority; | ||
6 | +import org.springframework.security.core.userdetails.UserDetails; | ||
7 | +import java.util.Collection; | ||
8 | +import java.util.Set; | ||
9 | + | ||
10 | +/** | ||
11 | + * 登录用户身份权限 | ||
12 | + * | ||
13 | + * @author ruoyi | ||
14 | + */ | ||
15 | +public class LoginUser implements UserDetails | ||
16 | +{ | ||
17 | + private static final long serialVersionUID = 1L; | ||
18 | + | ||
19 | + /** | ||
20 | + * 用户ID | ||
21 | + */ | ||
22 | + private Long userId; | ||
23 | + | ||
24 | + /** | ||
25 | + * 部门ID | ||
26 | + */ | ||
27 | + private Long deptId; | ||
28 | + | ||
29 | + /** | ||
30 | + * 用户唯一标识 | ||
31 | + */ | ||
32 | + private String token; | ||
33 | + | ||
34 | + /** | ||
35 | + * 登录时间 | ||
36 | + */ | ||
37 | + private Long loginTime; | ||
38 | + | ||
39 | + /** | ||
40 | + * 过期时间 | ||
41 | + */ | ||
42 | + private Long expireTime; | ||
43 | + | ||
44 | + /** | ||
45 | + * 登录IP地址 | ||
46 | + */ | ||
47 | + private String ipaddr; | ||
48 | + | ||
49 | + /** | ||
50 | + * 登录地点 | ||
51 | + */ | ||
52 | + private String loginLocation; | ||
53 | + | ||
54 | + /** | ||
55 | + * 浏览器类型 | ||
56 | + */ | ||
57 | + private String browser; | ||
58 | + | ||
59 | + /** | ||
60 | + * 操作系统 | ||
61 | + */ | ||
62 | + private String os; | ||
63 | + | ||
64 | + /** | ||
65 | + * 权限列表 | ||
66 | + */ | ||
67 | + private Set<String> permissions; | ||
68 | + | ||
69 | + /** | ||
70 | + * 用户信息 | ||
71 | + */ | ||
72 | + private SysUser user; | ||
73 | + | ||
74 | + public LoginUser() | ||
75 | + { | ||
76 | + } | ||
77 | + | ||
78 | + public LoginUser(SysUser user, Set<String> permissions) | ||
79 | + { | ||
80 | + this.user = user; | ||
81 | + this.permissions = permissions; | ||
82 | + } | ||
83 | + | ||
84 | + public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions) | ||
85 | + { | ||
86 | + this.userId = userId; | ||
87 | + this.deptId = deptId; | ||
88 | + this.user = user; | ||
89 | + this.permissions = permissions; | ||
90 | + } | ||
91 | + | ||
92 | + public Long getUserId() | ||
93 | + { | ||
94 | + return userId; | ||
95 | + } | ||
96 | + | ||
97 | + public void setUserId(Long userId) | ||
98 | + { | ||
99 | + this.userId = userId; | ||
100 | + } | ||
101 | + | ||
102 | + public Long getDeptId() | ||
103 | + { | ||
104 | + return deptId; | ||
105 | + } | ||
106 | + | ||
107 | + public void setDeptId(Long deptId) | ||
108 | + { | ||
109 | + this.deptId = deptId; | ||
110 | + } | ||
111 | + | ||
112 | + public String getToken() | ||
113 | + { | ||
114 | + return token; | ||
115 | + } | ||
116 | + | ||
117 | + public void setToken(String token) | ||
118 | + { | ||
119 | + this.token = token; | ||
120 | + } | ||
121 | + | ||
122 | + @JSONField(serialize = false) | ||
123 | + @Override | ||
124 | + public String getPassword() | ||
125 | + { | ||
126 | + return user.getPassword(); | ||
127 | + } | ||
128 | + | ||
129 | + @Override | ||
130 | + public String getUsername() | ||
131 | + { | ||
132 | + return user.getUserName(); | ||
133 | + } | ||
134 | + | ||
135 | + /** | ||
136 | + * 账户是否未过期,过期无法验证 | ||
137 | + */ | ||
138 | + @JSONField(serialize = false) | ||
139 | + @Override | ||
140 | + public boolean isAccountNonExpired() | ||
141 | + { | ||
142 | + return true; | ||
143 | + } | ||
144 | + | ||
145 | + /** | ||
146 | + * 指定用户是否解锁,锁定的用户无法进行身份验证 | ||
147 | + * | ||
148 | + * @return | ||
149 | + */ | ||
150 | + @JSONField(serialize = false) | ||
151 | + @Override | ||
152 | + public boolean isAccountNonLocked() | ||
153 | + { | ||
154 | + return true; | ||
155 | + } | ||
156 | + | ||
157 | + /** | ||
158 | + * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证 | ||
159 | + * | ||
160 | + * @return | ||
161 | + */ | ||
162 | + @JSONField(serialize = false) | ||
163 | + @Override | ||
164 | + public boolean isCredentialsNonExpired() | ||
165 | + { | ||
166 | + return true; | ||
167 | + } | ||
168 | + | ||
169 | + /** | ||
170 | + * 是否可用 ,禁用的用户不能身份验证 | ||
171 | + * | ||
172 | + * @return | ||
173 | + */ | ||
174 | + @JSONField(serialize = false) | ||
175 | + @Override | ||
176 | + public boolean isEnabled() | ||
177 | + { | ||
178 | + return true; | ||
179 | + } | ||
180 | + | ||
181 | + public Long getLoginTime() | ||
182 | + { | ||
183 | + return loginTime; | ||
184 | + } | ||
185 | + | ||
186 | + public void setLoginTime(Long loginTime) | ||
187 | + { | ||
188 | + this.loginTime = loginTime; | ||
189 | + } | ||
190 | + | ||
191 | + public String getIpaddr() | ||
192 | + { | ||
193 | + return ipaddr; | ||
194 | + } | ||
195 | + | ||
196 | + public void setIpaddr(String ipaddr) | ||
197 | + { | ||
198 | + this.ipaddr = ipaddr; | ||
199 | + } | ||
200 | + | ||
201 | + public String getLoginLocation() | ||
202 | + { | ||
203 | + return loginLocation; | ||
204 | + } | ||
205 | + | ||
206 | + public void setLoginLocation(String loginLocation) | ||
207 | + { | ||
208 | + this.loginLocation = loginLocation; | ||
209 | + } | ||
210 | + | ||
211 | + public String getBrowser() | ||
212 | + { | ||
213 | + return browser; | ||
214 | + } | ||
215 | + | ||
216 | + public void setBrowser(String browser) | ||
217 | + { | ||
218 | + this.browser = browser; | ||
219 | + } | ||
220 | + | ||
221 | + public String getOs() | ||
222 | + { | ||
223 | + return os; | ||
224 | + } | ||
225 | + | ||
226 | + public void setOs(String os) | ||
227 | + { | ||
228 | + this.os = os; | ||
229 | + } | ||
230 | + | ||
231 | + public Long getExpireTime() | ||
232 | + { | ||
233 | + return expireTime; | ||
234 | + } | ||
235 | + | ||
236 | + public void setExpireTime(Long expireTime) | ||
237 | + { | ||
238 | + this.expireTime = expireTime; | ||
239 | + } | ||
240 | + | ||
241 | + public Set<String> getPermissions() | ||
242 | + { | ||
243 | + return permissions; | ||
244 | + } | ||
245 | + | ||
246 | + public void setPermissions(Set<String> permissions) | ||
247 | + { | ||
248 | + this.permissions = permissions; | ||
249 | + } | ||
250 | + | ||
251 | + public SysUser getUser() | ||
252 | + { | ||
253 | + return user; | ||
254 | + } | ||
255 | + | ||
256 | + public void setUser(SysUser user) | ||
257 | + { | ||
258 | + this.user = user; | ||
259 | + } | ||
260 | + | ||
261 | + @Override | ||
262 | + public Collection<? extends GrantedAuthority> getAuthorities() | ||
263 | + { | ||
264 | + return null; | ||
265 | + } | ||
266 | +} |
1 | +package com.ruoyi.common.core.page; | ||
2 | + | ||
3 | +import com.ruoyi.common.utils.StringUtils; | ||
4 | + | ||
5 | +/** | ||
6 | + * 分页数据 | ||
7 | + * | ||
8 | + * @author ruoyi | ||
9 | + */ | ||
10 | +public class PageDomain | ||
11 | +{ | ||
12 | + /** 当前记录起始索引 */ | ||
13 | + private Integer pageNum; | ||
14 | + | ||
15 | + /** 每页显示记录数 */ | ||
16 | + private Integer pageSize; | ||
17 | + | ||
18 | + /** 排序列 */ | ||
19 | + private String orderByColumn; | ||
20 | + | ||
21 | + /** 排序的方向desc或者asc */ | ||
22 | + private String isAsc = "asc"; | ||
23 | + | ||
24 | + /** 分页参数合理化 */ | ||
25 | + private Boolean reasonable = true; | ||
26 | + | ||
27 | + public String getOrderBy() | ||
28 | + { | ||
29 | + if (StringUtils.isEmpty(orderByColumn)) | ||
30 | + { | ||
31 | + return ""; | ||
32 | + } | ||
33 | + return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc; | ||
34 | + } | ||
35 | + | ||
36 | + public Integer getPageNum() | ||
37 | + { | ||
38 | + return pageNum; | ||
39 | + } | ||
40 | + | ||
41 | + public void setPageNum(Integer pageNum) | ||
42 | + { | ||
43 | + this.pageNum = pageNum; | ||
44 | + } | ||
45 | + | ||
46 | + public Integer getPageSize() | ||
47 | + { | ||
48 | + return pageSize; | ||
49 | + } | ||
50 | + | ||
51 | + public void setPageSize(Integer pageSize) | ||
52 | + { | ||
53 | + this.pageSize = pageSize; | ||
54 | + } | ||
55 | + | ||
56 | + public String getOrderByColumn() | ||
57 | + { | ||
58 | + return orderByColumn; | ||
59 | + } | ||
60 | + | ||
61 | + public void setOrderByColumn(String orderByColumn) | ||
62 | + { | ||
63 | + this.orderByColumn = orderByColumn; | ||
64 | + } | ||
65 | + | ||
66 | + public String getIsAsc() | ||
67 | + { | ||
68 | + return isAsc; | ||
69 | + } | ||
70 | + | ||
71 | + public void setIsAsc(String isAsc) | ||
72 | + { | ||
73 | + if (StringUtils.isNotEmpty(isAsc)) | ||
74 | + { | ||
75 | + // 兼容前端排序类型 | ||
76 | + if ("ascending".equals(isAsc)) | ||
77 | + { | ||
78 | + isAsc = "asc"; | ||
79 | + } | ||
80 | + else if ("descending".equals(isAsc)) | ||
81 | + { | ||
82 | + isAsc = "desc"; | ||
83 | + } | ||
84 | + this.isAsc = isAsc; | ||
85 | + } | ||
86 | + } | ||
87 | + | ||
88 | + public Boolean getReasonable() | ||
89 | + { | ||
90 | + if (StringUtils.isNull(reasonable)) | ||
91 | + { | ||
92 | + return Boolean.TRUE; | ||
93 | + } | ||
94 | + return reasonable; | ||
95 | + } | ||
96 | + | ||
97 | + public void setReasonable(Boolean reasonable) | ||
98 | + { | ||
99 | + this.reasonable = reasonable; | ||
100 | + } | ||
101 | +} |
1 | +package com.ruoyi.common.core.page; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | +import java.util.List; | ||
5 | + | ||
6 | +/** | ||
7 | + * 表格分页数据对象 | ||
8 | + * | ||
9 | + * @author ruoyi | ||
10 | + */ | ||
11 | +public class TableDataInfo implements Serializable | ||
12 | +{ | ||
13 | + private static final long serialVersionUID = 1L; | ||
14 | + | ||
15 | + /** 总记录数 */ | ||
16 | + private long total; | ||
17 | + | ||
18 | + /** 列表数据 */ | ||
19 | + private List<?> rows; | ||
20 | + | ||
21 | + /** 消息状态码 */ | ||
22 | + private int code; | ||
23 | + | ||
24 | + /** 消息内容 */ | ||
25 | + private String msg; | ||
26 | + | ||
27 | + /** | ||
28 | + * 表格数据对象 | ||
29 | + */ | ||
30 | + public TableDataInfo() | ||
31 | + { | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * 分页 | ||
36 | + * | ||
37 | + * @param list 列表数据 | ||
38 | + * @param total 总记录数 | ||
39 | + */ | ||
40 | + public TableDataInfo(List<?> list, int total) | ||
41 | + { | ||
42 | + this.rows = list; | ||
43 | + this.total = total; | ||
44 | + } | ||
45 | + | ||
46 | + public long getTotal() | ||
47 | + { | ||
48 | + return total; | ||
49 | + } | ||
50 | + | ||
51 | + public void setTotal(long total) | ||
52 | + { | ||
53 | + this.total = total; | ||
54 | + } | ||
55 | + | ||
56 | + public List<?> getRows() | ||
57 | + { | ||
58 | + return rows; | ||
59 | + } | ||
60 | + | ||
61 | + public void setRows(List<?> rows) | ||
62 | + { | ||
63 | + this.rows = rows; | ||
64 | + } | ||
65 | + | ||
66 | + public int getCode() | ||
67 | + { | ||
68 | + return code; | ||
69 | + } | ||
70 | + | ||
71 | + public void setCode(int code) | ||
72 | + { | ||
73 | + this.code = code; | ||
74 | + } | ||
75 | + | ||
76 | + public String getMsg() | ||
77 | + { | ||
78 | + return msg; | ||
79 | + } | ||
80 | + | ||
81 | + public void setMsg(String msg) | ||
82 | + { | ||
83 | + this.msg = msg; | ||
84 | + } | ||
85 | +} |
1 | +package com.ruoyi.common.core.page; | ||
2 | + | ||
3 | +import com.ruoyi.common.core.text.Convert; | ||
4 | +import com.ruoyi.common.utils.ServletUtils; | ||
5 | + | ||
6 | +/** | ||
7 | + * 表格数据处理 | ||
8 | + * | ||
9 | + * @author ruoyi | ||
10 | + */ | ||
11 | +public class TableSupport | ||
12 | +{ | ||
13 | + /** | ||
14 | + * 当前记录起始索引 | ||
15 | + */ | ||
16 | + public static final String PAGE_NUM = "pageNum"; | ||
17 | + | ||
18 | + /** | ||
19 | + * 每页显示记录数 | ||
20 | + */ | ||
21 | + public static final String PAGE_SIZE = "pageSize"; | ||
22 | + | ||
23 | + /** | ||
24 | + * 排序列 | ||
25 | + */ | ||
26 | + public static final String ORDER_BY_COLUMN = "orderByColumn"; | ||
27 | + | ||
28 | + /** | ||
29 | + * 排序的方向 "desc" 或者 "asc". | ||
30 | + */ | ||
31 | + public static final String IS_ASC = "isAsc"; | ||
32 | + | ||
33 | + /** | ||
34 | + * 分页参数合理化 | ||
35 | + */ | ||
36 | + public static final String REASONABLE = "reasonable"; | ||
37 | + | ||
38 | + /** | ||
39 | + * 封装分页对象 | ||
40 | + */ | ||
41 | + public static PageDomain getPageDomain() | ||
42 | + { | ||
43 | + PageDomain pageDomain = new PageDomain(); | ||
44 | + pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1)); | ||
45 | + pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10)); | ||
46 | + pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN)); | ||
47 | + pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC)); | ||
48 | + pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE)); | ||
49 | + return pageDomain; | ||
50 | + } | ||
51 | + | ||
52 | + public static PageDomain buildPageRequest() | ||
53 | + { | ||
54 | + return getPageDomain(); | ||
55 | + } | ||
56 | +} |
-
Please register or login to post a comment