Compare commits
161 Commits
Author | SHA1 | Date | |
---|---|---|---|
d872c66d19 | |||
1042b40cfc | |||
070f7bc6bd | |||
4f1c99293f | |||
57fa243747 | |||
04f2607398 | |||
01caa02f5e | |||
e37ec9f8fa | |||
122e8b61a0 | |||
2345dfdf42 | |||
77550e2f11 | |||
ca5b4bc852 | |||
5fc9a63231 | |||
958be505c9 | |||
ec8c7f1d79 | |||
030b61bc37 | |||
619e1d241a | |||
dc07b97cdb | |||
dd37524b04 | |||
8c0ebd008e | |||
0c76d45349 | |||
6237ddb3dc | |||
8643dde074 | |||
d22fa29b65 | |||
b66097c004 | |||
d30dc35e59 | |||
87c38706cd | |||
f04c1fed50 | |||
4474c533e6 | |||
4374a24f79 | |||
383d082194 | |||
e9a7cc7bc7 | |||
8b07f8925f | |||
2af817d8dc | |||
0e240cb244 | |||
fc834b35cb | |||
4fa795dee9 | |||
33788ecd02 | |||
3d3017804d | |||
63ee2ba2e7 | |||
aac46aa353 | |||
c6e4daedd4 | |||
6b9b8ed889 | |||
1f000d9f84 | |||
9d5a702e1f | |||
bb1831f609 | |||
c628cf7ee7 | |||
1de73da333 | |||
c404de1773 | |||
cfcd48b6b2 | |||
a87e1d019d | |||
ef91e71d7b | |||
3bacfc5951 | |||
b5cd54da66 | |||
0e9925a481 | |||
7943b765ca | |||
a74e58f7d5 | |||
ea58f8db9c | |||
89e21eecea | |||
35df1dbcdf | |||
0972bba763 | |||
583b06ca9a | |||
6a4b1898b1 | |||
268f0a6321 | |||
e56a7e7e57 | |||
9d225fecb9 | |||
d24481f9a5 | |||
6a592827e8 | |||
451caf12fc | |||
7517b1baa9 | |||
5d582331d3 | |||
2d99d2c286 | |||
d881d45829 | |||
66aabcd2b4 | |||
6128d816de | |||
553358aa12 | |||
650f89ac13 | |||
1292dcf579 | |||
1c1078565a | |||
4d2d5defb9 | |||
75f27dc536 | |||
aa06f1adc5 | |||
a42c824e92 | |||
67e87bde94 | |||
a2735adc57 | |||
80bda1909c | |||
a46738dd9d | |||
c96b73bbda | |||
4fed9a1e50 | |||
b0495c23a6 | |||
007a4e5275 | |||
bf01219420 | |||
bcb7ba19f9 | |||
d870710af1 | |||
6244e6bf18 | |||
c1be1659ea | |||
6cda301f43 | |||
e5b314cc96 | |||
3383418837 | |||
3a44c4e765 | |||
0c5da2cf17 | |||
ecfba42651 | |||
26b4f598e2 | |||
737c2d8515 | |||
8a005a088d | |||
dcc534bb2d | |||
ebc6a1ade2 | |||
834089ef08 | |||
d30b66b633 | |||
6a4894e9d1 | |||
a44aa5db42 | |||
71c3274333 | |||
1961ca5197 | |||
ba2d7f418d | |||
83b4c25137 | |||
6ee8053a9b | |||
7b0e1c46c5 | |||
6c99bc1059 | |||
f0dadb0123 | |||
6afaae0c05 | |||
e4b9638bd5 | |||
27dee2a63a | |||
260feb7cef | |||
c778cd2ac9 | |||
9660e30ca5 | |||
5285003dee | |||
b5e8432e2f | |||
4ac96a8348 | |||
f7a0c94c16 | |||
16dc6ab57e | |||
5b2664a87a | |||
5070f1325f | |||
bc48c80240 | |||
ebe67e7bde | |||
211a0ab746 | |||
2f0c5d2b03 | |||
e166127c9f | |||
fed3aa8231 | |||
aca37844ba | |||
8b4ea05391 | |||
5e5c21e14f | |||
c85f36fa1f | |||
e68e13bc16 | |||
fffeef3db5 | |||
4425b81e6d | |||
eb2a24dc3c | |||
cf0c212681 | |||
0b0502f308 | |||
e1c7db101c | |||
b64bb61207 | |||
c2ef17218a | |||
7d5167b373 | |||
8ce5bb4fdf | |||
9148bb33c3 | |||
800d3d5710 | |||
f89b4215a1 | |||
9d581bec25 | |||
b6048e5429 | |||
ac14519d76 | |||
84068a2e2e | |||
1cb672f8bd |
43
.gitignore
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
######################################################################
|
||||||
|
# Build Tools
|
||||||
|
|
||||||
|
.gradle
|
||||||
|
/build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# IDE
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
nbproject/private/
|
||||||
|
build/*
|
||||||
|
nbbuild/
|
||||||
|
dist/
|
||||||
|
nbdist/
|
||||||
|
.nb-gradle/
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Others
|
||||||
|
*.log
|
||||||
|
*.xml.versionsBackup
|
||||||
|
|
||||||
|
!*/build/*.java
|
||||||
|
!*/build/*.html
|
||||||
|
!*/build/*.xml
|
44
README.md
@ -2,17 +2,13 @@
|
|||||||
|
|
||||||
一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适的。于是利用空闲休息时间开始自己写了一套后台系统。如此有了若依。她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。
|
一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适的。于是利用空闲休息时间开始自己写了一套后台系统。如此有了若依。她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。
|
||||||
|
|
||||||
性别男,若依是女儿的名字。
|
性别男,若依是给还没有出生女儿取的名字(寓意:你若不离不弃,我必生死相依)
|
||||||
|
|
||||||
若依基于hplus和inspinia两套后台系统模板开发。有需要可自行到群内下载。
|
若依基于hplus和inspinia两套后台系统模板开发。有需要可自行到群内下载。
|
||||||
|
|
||||||
http://www.zi-han.net/theme/hplus
|
> RuoYi从3.0开始,进行模块拆分,将原先的单应用转变为多模块,如需单应用,请移步 [RuoYi-fast](https://gitee.com/y_project/RuoYi-fast)
|
||||||
|
|
||||||
http://webapplayers.com/inspinia_admin-v2.7.1
|
> 推荐使用阿里云部署,通用云产品代金券 :[点我领取](https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=brki8iof)
|
||||||
|
|
||||||
阿里云优惠活动(2CPU 4GRAM 1M带宽 40G高效云盘):https://promotion.aliyun.com/ntms/act/vm/aliyun-group/buy.html?group=BphATfDhsQ
|
|
||||||
|
|
||||||
云产品通用1000元代金券,可叠加官网常规优惠使用 :https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=brki8iof
|
|
||||||
|
|
||||||
## 内置功能
|
## 内置功能
|
||||||
|
|
||||||
@ -30,43 +26,47 @@ http://webapplayers.com/inspinia_admin-v2.7.1
|
|||||||
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
|
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
|
||||||
13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。
|
13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。
|
||||||
14. 系统接口:根据业务代码自动生成相关的api接口文档。
|
14. 系统接口:根据业务代码自动生成相关的api接口文档。
|
||||||
15. 在线构建器:拖动表单元素生成相应的HTML代码。
|
15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。
|
||||||
16. 连接池监视:监视当期系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。
|
16. 在线构建器:拖动表单元素生成相应的HTML代码。
|
||||||
|
17. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。
|
||||||
## 在线体验
|
## 在线体验
|
||||||
> admin/admin123
|
> admin/admin123
|
||||||
|
> 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
|
||||||
|
|
||||||
地址:http://www.ruoyi.club
|
演示地址:http://ruoyi.vip
|
||||||
|
|
||||||
|
文档地址:http://doc.ruoyi.vip
|
||||||
|
|
||||||
## 演示图
|
## 演示图
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/25b5e333768d013d45a990c152dbe4d9d6e.jpg"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/25b5e333768d013d45a990c152dbe4d9d6e.jpg"/></td>
|
||||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132411_4c5I_1438828.png"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/dfadf4d864242745486aa0167110dfcbeb8.jpg"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132436_rRBh_1438828.png"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/2e1ed87df9b476ed73ed650df20cf009b78.jpg"/></td>
|
||||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132442_umjM_1438828.png"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/91bef110740ba9e36ff00804f8748a787fb.jpg"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132449_OtY8_1438828.png"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/9a2851988f4e7433c9322154534865f57d7.jpg"/></td>
|
||||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132454_4Evz_1438828.png"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/396293f80b1e8cce8671f56c296bee78a3a.jpg"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132520_Zzkj_1438828.png"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/787b3b06430a403655b48b9bcd1fa829555.jpg"/></td>
|
||||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132539_5bJe_1438828.png"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/a51820009836276b778bc89d4d0e217e26d.jpg"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132548_ne4U_1438828.png"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/5fb138478adeda6825e206d21f67ecd0625.jpg"/></td>
|
||||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132557_Fab4_1438828.png"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/fa2f027a10707a4eb4fc47d5ea1c3d2b772.jpg"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132617_MLmV_1438828.png"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/a714056081523b7dfa782cda866e8be4adc.jpg"/></td>
|
||||||
<td><img src="https://static.oschina.net/uploads/space/2018/0902/132626_3iBs_1438828.png"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/ab4b5797dfb2bc68c4974ad5458bd5f5bcf.jpg"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
## 若依交流群
|
## 若依交流群
|
||||||
|
|
||||||
QQ群: [](http://shang.qq.com/wpa/qunwpa?idkey=4a9a52f5d9d9c65a8ea67859170ba835d95fc50ec74a2a722293e60e036b5016) 或 [](https://jq.qq.com/?_wv=1027&k=5HBAaYN),推荐点击按钮入群,当然如果无法成功操作,请自行搜索群号`1389287`进行添加
|
QQ群: [](https://jq.qq.com/?_wv=1027&k=5HBAaYN) [](https://jq.qq.com/?_wv=1027&k=5cHeRVW) [](https://jq.qq.com/?_wv=1027&k=53R0L5Z) 点击按钮入群。
|
14
bin/clean.bat
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
@echo off
|
||||||
|
echo.
|
||||||
|
echo [<5B><>Ϣ] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
echo.
|
||||||
|
|
||||||
|
cd %~dp0
|
||||||
|
cd..
|
||||||
|
|
||||||
|
call mvn clean
|
||||||
|
|
||||||
|
cd bin
|
||||||
|
pause
|
13
bin/package.bat
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
@echo off
|
||||||
|
echo.
|
||||||
|
echo [<5B><>Ϣ] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><CCA3><EFBFBD><EFBFBD><EFBFBD>jar<61><72><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
echo.
|
||||||
|
|
||||||
|
cd %~dp0
|
||||||
|
cd..
|
||||||
|
|
||||||
|
call mvn clean package -Dmaven.test.skip=true
|
||||||
|
|
||||||
|
pause
|
255
pom.xml
@ -1,89 +1,69 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>RuoYi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>2.4.0</version>
|
<version>3.2</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>RuoYi</name>
|
<name>ruoyi</name>
|
||||||
|
<url>http://www.ruoyi.vip</url>
|
||||||
<description>若依管理系统</description>
|
<description>若依管理系统</description>
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
|
||||||
<version>2.0.4.RELEASE</version>
|
|
||||||
<relativePath />
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
<ruoyi.version>3.2</ruoyi.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<shiro.version>1.4.0</shiro.version>
|
<shiro.version>1.4.0</shiro.version>
|
||||||
<thymeleaf.extras.shiro.version>2.0.0</thymeleaf.extras.shiro.version>
|
<thymeleaf.extras.shiro.version>2.0.0</thymeleaf.extras.shiro.version>
|
||||||
<mybatis.spring.boot.starter.version>1.3.2</mybatis.spring.boot.starter.version>
|
<mybatis.boot.version>1.3.2</mybatis.boot.version>
|
||||||
<pagehelper.spring.boot.starter.version>1.2.5</pagehelper.spring.boot.starter.version>
|
|
||||||
<fastjson.version>1.2.47</fastjson.version>
|
|
||||||
<druid.version>1.1.10</druid.version>
|
<druid.version>1.1.10</druid.version>
|
||||||
<commons.io.version>2.5</commons.io.version>
|
|
||||||
<commons.fileupload.version>1.3.3</commons.fileupload.version>
|
|
||||||
<bitwalker.version>1.19</bitwalker.version>
|
<bitwalker.version>1.19</bitwalker.version>
|
||||||
<lombok.version>1.16.18</lombok.version>
|
|
||||||
<velocity.version>1.7</velocity.version>
|
|
||||||
<kaptcha.version>2.3.2</kaptcha.version>
|
<kaptcha.version>2.3.2</kaptcha.version>
|
||||||
<swagger.version>2.7.0</swagger.version>
|
<swagger.version>2.7.0</swagger.version>
|
||||||
<jsoup.version>1.11.3</jsoup.version>
|
<pagehelper.boot.version>1.2.5</pagehelper.boot.version>
|
||||||
|
<oshi.version>3.9.1</oshi.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>2.1.1.RELEASE</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>ruoyi-admin</module>
|
||||||
|
<module>ruoyi-framework</module>
|
||||||
|
<module>ruoyi-system</module>
|
||||||
|
<module>ruoyi-quartz</module>
|
||||||
|
<module>ruoyi-generator</module>
|
||||||
|
<module>ruoyi-common</module>
|
||||||
|
</modules>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- SpringBoot 核心包 -->
|
<!--Spring框架基本的核心工具-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
<artifactId>spring-context-support</artifactId>
|
||||||
<!--
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
-->
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringBoot 测试 -->
|
<!-- SpringBoot集成mybatis框架 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
<scope>test</scope>
|
<version>${mybatis.boot.version}</version>
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- SpringBoot 拦截器 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-aop</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- SpringBoot Web容器 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- SpringBoot集成thymeleaf模板 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- spring-boot-devtools -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
|
||||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Mysql驱动包 -->
|
<!-- Mysql驱动包 -->
|
||||||
@ -92,165 +72,28 @@
|
|||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringBoot集成mybatis框架 -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
|
||||||
<version>${mybatis.spring.boot.starter.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- pagehelper 分页插件 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.pagehelper</groupId>
|
|
||||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
|
||||||
<version>${pagehelper.spring.boot.starter.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--阿里数据库连接池 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>druid-spring-boot-starter</artifactId>
|
|
||||||
<version>${druid.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--常用工具类 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--io常用工具类 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-io</groupId>
|
|
||||||
<artifactId>commons-io</artifactId>
|
|
||||||
<version>${commons.io.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--文件上传工具类 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-fileupload</groupId>
|
|
||||||
<artifactId>commons-fileupload</artifactId>
|
|
||||||
<version>${commons.fileupload.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--Shiro核心框架 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.shiro</groupId>
|
|
||||||
<artifactId>shiro-core</artifactId>
|
|
||||||
<version>${shiro.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Shiro使用Srping框架 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.shiro</groupId>
|
|
||||||
<artifactId>shiro-spring</artifactId>
|
|
||||||
<version>${shiro.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Shiro使用EhCache缓存框架 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.shiro</groupId>
|
|
||||||
<artifactId>shiro-ehcache</artifactId>
|
|
||||||
<version>${shiro.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- thymeleaf模板引擎和shiro框架的整合 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.theborakompanioni</groupId>
|
|
||||||
<artifactId>thymeleaf-extras-shiro</artifactId>
|
|
||||||
<version>${thymeleaf.extras.shiro.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 阿里JSON解析器 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>fastjson</artifactId>
|
|
||||||
<version>${fastjson.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 解析客户端操作系统、浏览器等 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>eu.bitwalker</groupId>
|
|
||||||
<artifactId>UserAgentUtils</artifactId>
|
|
||||||
<version>${bitwalker.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--Spring框架基本的核心工具-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-context-support</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 定时任务 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.quartz-scheduler</groupId>
|
|
||||||
<artifactId>quartz</artifactId>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.mchange</groupId>
|
|
||||||
<artifactId>c3p0</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--velocity代码生成使用模板 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.velocity</groupId>
|
|
||||||
<artifactId>velocity</artifactId>
|
|
||||||
<version>${velocity.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--验证码 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.penggle</groupId>
|
|
||||||
<artifactId>kaptcha</artifactId>
|
|
||||||
<version>${kaptcha.version}</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
</exclusion>
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- swagger2-->
|
<!-- 日志工具类 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.springfox</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>springfox-swagger2</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>${swagger.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- swagger2-UI-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.springfox</groupId>
|
|
||||||
<artifactId>springfox-swagger-ui</artifactId>
|
|
||||||
<version>${swagger.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- HTML解析器 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jsoup</groupId>
|
|
||||||
<artifactId>jsoup</artifactId>
|
|
||||||
<version>${jsoup.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- excel工具 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>poi-ooxml</artifactId>
|
|
||||||
<version>3.9</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.artifactId}</finalName>
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
80
ruoyi-admin/pom.xml
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>ruoyi</artifactId>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<version>3.2</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<artifactId>ruoyi-admin</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
web服务入口
|
||||||
|
</description>
|
||||||
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- spring-boot-devtools -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
|
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- swagger2-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
|
<version>${swagger.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- swagger2-UI-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
|
<version>${swagger.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 核心模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-framework</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
<configuration>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
<warName>${artifactId}</warName>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
<finalName>${artifactId}</finalName>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
@ -11,7 +11,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||||
@MapperScan("com.ruoyi.project.*.*.mapper")
|
@MapperScan("com.ruoyi.*.mapper")
|
||||||
public class RuoYiApplication
|
public class RuoYiApplication
|
||||||
{
|
{
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
@ -15,5 +15,4 @@ public class RuoYiServletInitializer extends SpringBootServletInitializer
|
|||||||
{
|
{
|
||||||
return application.sources(RuoYiApplication.class);
|
return application.sources(RuoYiApplication.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.common;
|
package com.ruoyi.web.controller.common;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
@ -6,10 +6,17 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.util.ResourceUtils;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.config.Global;
|
||||||
import com.ruoyi.common.utils.file.FileUtils;
|
import com.ruoyi.common.utils.file.FileUtils;
|
||||||
|
import com.ruoyi.framework.config.ServerConfig;
|
||||||
|
import com.ruoyi.framework.util.FileUploadUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用请求处理
|
* 通用请求处理
|
||||||
@ -21,17 +28,32 @@ public class CommonController
|
|||||||
{
|
{
|
||||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||||
|
|
||||||
@RequestMapping("common/download")
|
/**
|
||||||
|
* 文件上传路径
|
||||||
|
*/
|
||||||
|
public static final String UPLOAD_PATH = "/profile/upload/";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ServerConfig serverConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用下载请求
|
||||||
|
*
|
||||||
|
* @param fileName 文件名称
|
||||||
|
* @param delete 是否删除
|
||||||
|
*/
|
||||||
|
@GetMapping("common/download")
|
||||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||||
{
|
{
|
||||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String filePath = ResourceUtils.getURL("classpath:").getPath() + "static/file/" + fileName;
|
String filePath = Global.getDownloadPath() + fileName;
|
||||||
|
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding("utf-8");
|
||||||
response.setContentType("multipart/form-data");
|
response.setContentType("multipart/form-data");
|
||||||
response.setHeader("Content-Disposition", "attachment;fileName=" + setFileDownloadHeader(request, realFileName));
|
response.setHeader("Content-Disposition",
|
||||||
|
"attachment;fileName=" + setFileDownloadHeader(request, realFileName));
|
||||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||||
if (delete)
|
if (delete)
|
||||||
{
|
{
|
||||||
@ -44,6 +66,31 @@ public class CommonController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用上传请求
|
||||||
|
*/
|
||||||
|
@PostMapping("/common/upload")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 上传文件路径
|
||||||
|
String filePath = Global.getUploadPath();
|
||||||
|
// 上传并返回新文件名称
|
||||||
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
|
String url = serverConfig.getUrl() + UPLOAD_PATH + fileName;
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("fileName", fileName);
|
||||||
|
ajax.put("url", url);
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException
|
public String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
final String agent = request.getHeader("USER-AGENT");
|
final String agent = request.getHeader("USER-AGENT");
|
||||||
@ -70,6 +117,5 @@ public class CommonController
|
|||||||
filename = URLEncoder.encode(filename, "utf-8");
|
filename = URLEncoder.encode(filename, "utf-8");
|
||||||
}
|
}
|
||||||
return filename;
|
return filename;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +1,10 @@
|
|||||||
package com.ruoyi.project.monitor.druid;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* druid 监控
|
* druid 监控
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
import com.ruoyi.framework.web.domain.Server;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务器监控
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/monitor/server")
|
||||||
|
public class ServerController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "monitor/server";
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:server:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String server(ModelMap mmap) throws Exception
|
||||||
|
{
|
||||||
|
Server server = new Server();
|
||||||
|
server.copyTo();
|
||||||
|
mmap.put("server", server);
|
||||||
|
return prefix + "/server";
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.monitor.job.controller;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
@ -10,14 +10,15 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.quartz.domain.SysJob;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.quartz.service.ISysJobService;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.monitor.job.domain.Job;
|
|
||||||
import com.ruoyi.project.monitor.job.service.IJobService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调度任务信息操作处理
|
* 调度任务信息操作处理
|
||||||
@ -26,12 +27,12 @@ import com.ruoyi.project.monitor.job.service.IJobService;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/job")
|
@RequestMapping("/monitor/job")
|
||||||
public class JobController extends BaseController
|
public class SysJobController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "monitor/job";
|
private String prefix = "monitor/job";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IJobService jobService;
|
private ISysJobService jobService;
|
||||||
|
|
||||||
@RequiresPermissions("monitor:job:view")
|
@RequiresPermissions("monitor:job:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@ -43,10 +44,10 @@ public class JobController extends BaseController
|
|||||||
@RequiresPermissions("monitor:job:list")
|
@RequiresPermissions("monitor:job:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(Job job)
|
public TableDataInfo list(SysJob job)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<Job> list = jobService.selectJobList(job);
|
List<SysJob> list = jobService.selectJobList(job);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,18 +55,11 @@ public class JobController extends BaseController
|
|||||||
@RequiresPermissions("monitor:job:export")
|
@RequiresPermissions("monitor:job:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(Job job) throws Exception
|
public AjaxResult export(SysJob job)
|
||||||
{
|
{
|
||||||
try
|
List<SysJob> list = jobService.selectJobList(job);
|
||||||
{
|
ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
|
||||||
List<Job> list = jobService.selectJobList(job);
|
return util.exportExcel(list, "定时任务");
|
||||||
ExcelUtil<Job> util = new ExcelUtil<Job>(Job.class);
|
|
||||||
return util.exportExcel(list, "job");
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return error("导出Excel失败,请联系网站管理员!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "定时任务", businessType = BusinessType.DELETE)
|
@Log(title = "定时任务", businessType = BusinessType.DELETE)
|
||||||
@ -86,6 +80,15 @@ public class JobController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:job:detail")
|
||||||
|
@GetMapping("/detail/{jobId}")
|
||||||
|
public String detail(@PathVariable("jobId") Long jobId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("name", "job");
|
||||||
|
mmap.put("job", jobService.selectJobById(jobId));
|
||||||
|
return prefix + "/detail";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务调度状态修改
|
* 任务调度状态修改
|
||||||
*/
|
*/
|
||||||
@ -93,8 +96,9 @@ public class JobController extends BaseController
|
|||||||
@RequiresPermissions("monitor:job:changeStatus")
|
@RequiresPermissions("monitor:job:changeStatus")
|
||||||
@PostMapping("/changeStatus")
|
@PostMapping("/changeStatus")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult changeStatus(Job job)
|
public AjaxResult changeStatus(SysJob job)
|
||||||
{
|
{
|
||||||
|
job.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(jobService.changeStatus(job));
|
return toAjax(jobService.changeStatus(job));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +109,7 @@ public class JobController extends BaseController
|
|||||||
@RequiresPermissions("monitor:job:changeStatus")
|
@RequiresPermissions("monitor:job:changeStatus")
|
||||||
@PostMapping("/run")
|
@PostMapping("/run")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult run(Job job)
|
public AjaxResult run(SysJob job)
|
||||||
{
|
{
|
||||||
return toAjax(jobService.run(job));
|
return toAjax(jobService.run(job));
|
||||||
}
|
}
|
||||||
@ -126,8 +130,9 @@ public class JobController extends BaseController
|
|||||||
@RequiresPermissions("monitor:job:add")
|
@RequiresPermissions("monitor:job:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(Job job)
|
public AjaxResult addSave(SysJob job)
|
||||||
{
|
{
|
||||||
|
job.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(jobService.insertJobCron(job));
|
return toAjax(jobService.insertJobCron(job));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,8 +153,19 @@ public class JobController extends BaseController
|
|||||||
@RequiresPermissions("monitor:job:edit")
|
@RequiresPermissions("monitor:job:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(Job job)
|
public AjaxResult editSave(SysJob job)
|
||||||
{
|
{
|
||||||
|
job.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(jobService.updateJobCron(job));
|
return toAjax(jobService.updateJobCron(job));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验cron表达式是否有效
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkCronExpressionIsValid")
|
||||||
|
@ResponseBody
|
||||||
|
public boolean checkCronExpressionIsValid(SysJob job)
|
||||||
|
{
|
||||||
|
return jobService.checkCronExpressionIsValid(job.getCronExpression());
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
import com.ruoyi.quartz.domain.SysJobLog;
|
||||||
|
import com.ruoyi.quartz.service.ISysJobLogService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调度日志操作处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/monitor/jobLog")
|
||||||
|
public class SysJobLogController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "monitor/job";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysJobLogService jobLogService;
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:job:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String jobLog()
|
||||||
|
{
|
||||||
|
return prefix + "/jobLog";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:job:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysJobLog jobLog)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysJobLog> list = jobLogService.selectJobLogList(jobLog);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "调度日志", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("monitor:job:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(SysJobLog jobLog)
|
||||||
|
{
|
||||||
|
List<SysJobLog> list = jobLogService.selectJobLogList(jobLog);
|
||||||
|
ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
|
||||||
|
return util.exportExcel(list, "调度日志");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "调度日志", businessType = BusinessType.DELETE)
|
||||||
|
@RequiresPermissions("monitor:job:remove")
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(jobLogService.deleteJobLogByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:job:detail")
|
||||||
|
@GetMapping("/detail/{jobLogId}")
|
||||||
|
public String detail(@PathVariable("jobLogId") Long jobLogId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("name", "jobLog");
|
||||||
|
mmap.put("jobLog", jobLogService.selectJobLogById(jobLogId));
|
||||||
|
return prefix + "/detail";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "调度日志", businessType = BusinessType.CLEAN)
|
||||||
|
@RequiresPermissions("monitor:job:remove")
|
||||||
|
@PostMapping("/clean")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult clean()
|
||||||
|
{
|
||||||
|
jobLogService.cleanJobLog();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.monitor.logininfor.controller;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
@ -8,14 +8,14 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.system.domain.SysLogininfor;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.service.ISysLogininforService;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.monitor.logininfor.domain.Logininfor;
|
|
||||||
import com.ruoyi.project.monitor.logininfor.service.ILogininforService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统访问记录
|
* 系统访问记录
|
||||||
@ -24,12 +24,12 @@ import com.ruoyi.project.monitor.logininfor.service.ILogininforService;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/logininfor")
|
@RequestMapping("/monitor/logininfor")
|
||||||
public class LogininforController extends BaseController
|
public class SysLogininforController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "monitor/logininfor";
|
private String prefix = "monitor/logininfor";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ILogininforService logininforService;
|
private ISysLogininforService logininforService;
|
||||||
|
|
||||||
@RequiresPermissions("monitor:logininfor:view")
|
@RequiresPermissions("monitor:logininfor:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@ -41,10 +41,10 @@ public class LogininforController extends BaseController
|
|||||||
@RequiresPermissions("monitor:logininfor:list")
|
@RequiresPermissions("monitor:logininfor:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(Logininfor logininfor)
|
public TableDataInfo list(SysLogininfor logininfor)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<Logininfor> list = logininforService.selectLogininforList(logininfor);
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,18 +52,11 @@ public class LogininforController extends BaseController
|
|||||||
@RequiresPermissions("monitor:logininfor:export")
|
@RequiresPermissions("monitor:logininfor:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(Logininfor logininfor) throws Exception
|
public AjaxResult export(SysLogininfor logininfor)
|
||||||
{
|
{
|
||||||
try
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
{
|
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||||
List<Logininfor> list = logininforService.selectLogininforList(logininfor);
|
return util.exportExcel(list, "登陆日志");
|
||||||
ExcelUtil<Logininfor> util = new ExcelUtil<Logininfor>(Logininfor.class);
|
|
||||||
return util.exportExcel(list, "logininfor");
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return error("导出Excel失败,请联系网站管理员!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:logininfor:remove")
|
@RequiresPermissions("monitor:logininfor:remove")
|
||||||
@ -74,4 +67,14 @@ public class LogininforController extends BaseController
|
|||||||
{
|
{
|
||||||
return toAjax(logininforService.deleteLogininforByIds(ids));
|
return toAjax(logininforService.deleteLogininforByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:logininfor:remove")
|
||||||
|
@Log(title = "登陆日志", businessType = BusinessType.CLEAN)
|
||||||
|
@PostMapping("/clean")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult clean()
|
||||||
|
{
|
||||||
|
logininforService.cleanLogininfor();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.monitor.operlog.controller;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
@ -10,14 +10,14 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.system.domain.SysOperLog;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.service.ISysOperLogService;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.monitor.operlog.domain.OperLog;
|
|
||||||
import com.ruoyi.project.monitor.operlog.service.IOperLogService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志记录
|
* 操作日志记录
|
||||||
@ -26,12 +26,12 @@ import com.ruoyi.project.monitor.operlog.service.IOperLogService;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/operlog")
|
@RequestMapping("/monitor/operlog")
|
||||||
public class OperlogController extends BaseController
|
public class SysOperlogController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "monitor/operlog";
|
private String prefix = "monitor/operlog";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IOperLogService operLogService;
|
private ISysOperLogService operLogService;
|
||||||
|
|
||||||
@RequiresPermissions("monitor:operlog:view")
|
@RequiresPermissions("monitor:operlog:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@ -43,10 +43,10 @@ public class OperlogController extends BaseController
|
|||||||
@RequiresPermissions("monitor:operlog:list")
|
@RequiresPermissions("monitor:operlog:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(OperLog operLog)
|
public TableDataInfo list(SysOperLog operLog)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<OperLog> list = operLogService.selectOperLogList(operLog);
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,18 +54,11 @@ public class OperlogController extends BaseController
|
|||||||
@RequiresPermissions("monitor:operlog:export")
|
@RequiresPermissions("monitor:operlog:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(OperLog operLog) throws Exception
|
public AjaxResult export(SysOperLog operLog)
|
||||||
{
|
{
|
||||||
try
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
{
|
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||||
List<OperLog> list = operLogService.selectOperLogList(operLog);
|
return util.exportExcel(list, "操作日志");
|
||||||
ExcelUtil<OperLog> util = new ExcelUtil<OperLog>(OperLog.class);
|
|
||||||
return util.exportExcel(list, "operLog");
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return error("导出Excel失败,请联系网站管理员!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:operlog:remove")
|
@RequiresPermissions("monitor:operlog:remove")
|
||||||
@ -78,9 +71,19 @@ public class OperlogController extends BaseController
|
|||||||
|
|
||||||
@RequiresPermissions("monitor:operlog:detail")
|
@RequiresPermissions("monitor:operlog:detail")
|
||||||
@GetMapping("/detail/{operId}")
|
@GetMapping("/detail/{operId}")
|
||||||
public String detail(@PathVariable("operId") Long deptId, ModelMap mmap)
|
public String detail(@PathVariable("operId") Long operId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("operLog", operLogService.selectOperLogById(deptId));
|
mmap.put("operLog", operLogService.selectOperLogById(operId));
|
||||||
return prefix + "/detail";
|
return prefix + "/detail";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||||
|
@RequiresPermissions("monitor:operlog:remove")
|
||||||
|
@PostMapping("/clean")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult clean()
|
||||||
|
{
|
||||||
|
operLogService.cleanOperLog();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.monitor.online.controller;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
@ -9,16 +9,17 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.utils.security.ShiroUtils;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.enums.OnlineStatus;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
|
import com.ruoyi.framework.shiro.session.OnlineSession;
|
||||||
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.system.domain.SysUserOnline;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
import com.ruoyi.system.service.ISysUserOnlineService;
|
||||||
import com.ruoyi.project.monitor.online.domain.OnlineSession;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
import com.ruoyi.project.monitor.online.domain.UserOnline;
|
|
||||||
import com.ruoyi.project.monitor.online.service.IUserOnlineService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在线用户监控
|
* 在线用户监控
|
||||||
@ -27,12 +28,12 @@ import com.ruoyi.project.monitor.online.service.IUserOnlineService;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/online")
|
@RequestMapping("/monitor/online")
|
||||||
public class UserOnlineController extends BaseController
|
public class SysUserOnlineController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "monitor/online";
|
private String prefix = "monitor/online";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IUserOnlineService userOnlineService;
|
private ISysUserOnlineService userOnlineService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OnlineSessionDAO onlineSessionDAO;
|
private OnlineSessionDAO onlineSessionDAO;
|
||||||
@ -47,10 +48,10 @@ public class UserOnlineController extends BaseController
|
|||||||
@RequiresPermissions("monitor:online:list")
|
@RequiresPermissions("monitor:online:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(UserOnline userOnline)
|
public TableDataInfo list(SysUserOnline userOnline)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<UserOnline> list = userOnlineService.selectUserOnlineList(userOnline);
|
List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +63,7 @@ public class UserOnlineController extends BaseController
|
|||||||
{
|
{
|
||||||
for (String sessionId : ids)
|
for (String sessionId : ids)
|
||||||
{
|
{
|
||||||
UserOnline online = userOnlineService.selectOnlineById(sessionId);
|
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
|
||||||
if (online == null)
|
if (online == null)
|
||||||
{
|
{
|
||||||
return error("用户已下线");
|
return error("用户已下线");
|
||||||
@ -76,8 +77,8 @@ public class UserOnlineController extends BaseController
|
|||||||
{
|
{
|
||||||
return error("当前登陆用户无法强退");
|
return error("当前登陆用户无法强退");
|
||||||
}
|
}
|
||||||
onlineSession.setStatus(OnlineSession.OnlineStatus.off_line);
|
onlineSession.setStatus(OnlineStatus.off_line);
|
||||||
online.setStatus(OnlineSession.OnlineStatus.off_line);
|
online.setStatus(OnlineStatus.off_line);
|
||||||
userOnlineService.saveOnline(online);
|
userOnlineService.saveOnline(online);
|
||||||
}
|
}
|
||||||
return success();
|
return success();
|
||||||
@ -89,7 +90,7 @@ public class UserOnlineController extends BaseController
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult forceLogout(String sessionId)
|
public AjaxResult forceLogout(String sessionId)
|
||||||
{
|
{
|
||||||
UserOnline online = userOnlineService.selectOnlineById(sessionId);
|
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
|
||||||
if (sessionId.equals(ShiroUtils.getSessionId()))
|
if (sessionId.equals(ShiroUtils.getSessionId()))
|
||||||
{
|
{
|
||||||
return error("当前登陆用户无法强退");
|
return error("当前登陆用户无法强退");
|
||||||
@ -103,10 +104,9 @@ public class UserOnlineController extends BaseController
|
|||||||
{
|
{
|
||||||
return error("用户已下线");
|
return error("用户已下线");
|
||||||
}
|
}
|
||||||
onlineSession.setStatus(OnlineSession.OnlineStatus.off_line);
|
onlineSession.setStatus(OnlineStatus.off_line);
|
||||||
online.setStatus(OnlineSession.OnlineStatus.off_line);
|
online.setStatus(OnlineStatus.off_line);
|
||||||
userOnlineService.saveOnline(online);
|
userOnlineService.saveOnline(online);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.user.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
import com.google.code.kaptcha.Constants;
|
import com.google.code.kaptcha.Constants;
|
||||||
import com.google.code.kaptcha.Producer;
|
import com.google.code.kaptcha.Producer;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图片验证码(支持算术形式)
|
* 图片验证码(支持算术形式)
|
||||||
@ -23,9 +23,8 @@ import com.ruoyi.framework.web.controller.BaseController;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/captcha")
|
@RequestMapping("/captcha")
|
||||||
public class CaptchaController extends BaseController
|
public class SysCaptchaController extends BaseController
|
||||||
{
|
{
|
||||||
|
|
||||||
@Resource(name = "captchaProducer")
|
@Resource(name = "captchaProducer")
|
||||||
private Producer captchaProducer;
|
private Producer captchaProducer;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.config.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
@ -10,14 +10,15 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.domain.SysConfig;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.system.config.domain.Config;
|
|
||||||
import com.ruoyi.project.system.config.service.IConfigService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数配置 信息操作处理
|
* 参数配置 信息操作处理
|
||||||
@ -26,12 +27,12 @@ import com.ruoyi.project.system.config.service.IConfigService;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/config")
|
@RequestMapping("/system/config")
|
||||||
public class ConfigController extends BaseController
|
public class SysConfigController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/config";
|
private String prefix = "system/config";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IConfigService configService;
|
private ISysConfigService configService;
|
||||||
|
|
||||||
@RequiresPermissions("system:config:view")
|
@RequiresPermissions("system:config:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@ -46,10 +47,10 @@ public class ConfigController extends BaseController
|
|||||||
@RequiresPermissions("system:config:list")
|
@RequiresPermissions("system:config:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(Config config)
|
public TableDataInfo list(SysConfig config)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<Config> list = configService.selectConfigList(config);
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,18 +58,11 @@ public class ConfigController extends BaseController
|
|||||||
@RequiresPermissions("system:config:export")
|
@RequiresPermissions("system:config:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(Config config) throws Exception
|
public AjaxResult export(SysConfig config)
|
||||||
{
|
{
|
||||||
try
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
{
|
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||||
List<Config> list = configService.selectConfigList(config);
|
return util.exportExcel(list, "参数数据");
|
||||||
ExcelUtil<Config> util = new ExcelUtil<Config>(Config.class);
|
|
||||||
return util.exportExcel(list, "config");
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return error("导出Excel失败,请联系网站管理员!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,8 +81,9 @@ public class ConfigController extends BaseController
|
|||||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(Config config)
|
public AjaxResult addSave(SysConfig config)
|
||||||
{
|
{
|
||||||
|
config.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(configService.insertConfig(config));
|
return toAjax(configService.insertConfig(config));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,8 +104,9 @@ public class ConfigController extends BaseController
|
|||||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(Config config)
|
public AjaxResult editSave(SysConfig config)
|
||||||
{
|
{
|
||||||
|
config.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(configService.updateConfig(config));
|
return toAjax(configService.updateConfig(config));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,9 +127,8 @@ public class ConfigController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/checkConfigKeyUnique")
|
@PostMapping("/checkConfigKeyUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkConfigKeyUnique(Config config)
|
public String checkConfigKeyUnique(SysConfig config)
|
||||||
{
|
{
|
||||||
return configService.checkConfigKeyUnique(config);
|
return configService.checkConfigKeyUnique(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,8 +1,7 @@
|
|||||||
package com.ruoyi.project.system.dept.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@ -12,14 +11,15 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.project.system.dept.domain.Dept;
|
import com.ruoyi.system.domain.SysDept;
|
||||||
import com.ruoyi.project.system.dept.service.IDeptService;
|
import com.ruoyi.system.domain.SysRole;
|
||||||
import com.ruoyi.project.system.role.domain.Role;
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门信息
|
* 部门信息
|
||||||
@ -28,12 +28,12 @@ import com.ruoyi.project.system.role.domain.Role;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/dept")
|
@RequestMapping("/system/dept")
|
||||||
public class DeptController extends BaseController
|
public class SysDeptController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/dept";
|
private String prefix = "system/dept";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDeptService deptService;
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
@RequiresPermissions("system:dept:view")
|
@RequiresPermissions("system:dept:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@ -45,9 +45,9 @@ public class DeptController extends BaseController
|
|||||||
@RequiresPermissions("system:dept:list")
|
@RequiresPermissions("system:dept:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Dept> list(Dept dept)
|
public List<SysDept> list(SysDept dept)
|
||||||
{
|
{
|
||||||
List<Dept> deptList = deptService.selectDeptList(dept);
|
List<SysDept> deptList = deptService.selectDeptList(dept);
|
||||||
return deptList;
|
return deptList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,8 +68,9 @@ public class DeptController extends BaseController
|
|||||||
@RequiresPermissions("system:dept:add")
|
@RequiresPermissions("system:dept:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(Dept dept)
|
public AjaxResult addSave(SysDept dept)
|
||||||
{
|
{
|
||||||
|
dept.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(deptService.insertDept(dept));
|
return toAjax(deptService.insertDept(dept));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +80,12 @@ public class DeptController extends BaseController
|
|||||||
@GetMapping("/edit/{deptId}")
|
@GetMapping("/edit/{deptId}")
|
||||||
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("dept", deptService.selectDeptById(deptId));
|
SysDept dept = deptService.selectDeptById(deptId);
|
||||||
|
if (StringUtils.isNotNull(dept) && 100L == deptId)
|
||||||
|
{
|
||||||
|
dept.setParentName("无");
|
||||||
|
}
|
||||||
|
mmap.put("dept", dept);
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,8 +96,9 @@ public class DeptController extends BaseController
|
|||||||
@RequiresPermissions("system:dept:edit")
|
@RequiresPermissions("system:dept:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(Dept dept)
|
public AjaxResult editSave(SysDept dept)
|
||||||
{
|
{
|
||||||
|
dept.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(deptService.updateDept(dept));
|
return toAjax(deptService.updateDept(dept));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +127,7 @@ public class DeptController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/checkDeptNameUnique")
|
@PostMapping("/checkDeptNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkDeptNameUnique(Dept dept)
|
public String checkDeptNameUnique(SysDept dept)
|
||||||
{
|
{
|
||||||
return deptService.checkDeptNameUnique(dept);
|
return deptService.checkDeptNameUnique(dept);
|
||||||
}
|
}
|
||||||
@ -142,7 +149,7 @@ public class DeptController extends BaseController
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Map<String, Object>> treeData()
|
public List<Map<String, Object>> treeData()
|
||||||
{
|
{
|
||||||
List<Map<String, Object>> tree = deptService.selectDeptTree();
|
List<Map<String, Object>> tree = deptService.selectDeptTree(new SysDept());
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +158,7 @@ public class DeptController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/roleDeptTreeData")
|
@GetMapping("/roleDeptTreeData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Map<String, Object>> deptTreeData(Role role)
|
public List<Map<String, Object>> deptTreeData(SysRole role)
|
||||||
{
|
{
|
||||||
List<Map<String, Object>> tree = deptService.roleDeptTreeData(role);
|
List<Map<String, Object>> tree = deptService.roleDeptTreeData(role);
|
||||||
return tree;
|
return tree;
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.dict.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
@ -10,14 +10,15 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.domain.SysDictData;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.system.service.ISysDictDataService;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.system.dict.domain.DictData;
|
|
||||||
import com.ruoyi.project.system.dict.service.IDictDataService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据字典信息
|
* 数据字典信息
|
||||||
@ -26,12 +27,12 @@ import com.ruoyi.project.system.dict.service.IDictDataService;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/dict/data")
|
@RequestMapping("/system/dict/data")
|
||||||
public class DictDataController extends BaseController
|
public class SysDictDataController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/dict/data";
|
private String prefix = "system/dict/data";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDictDataService dictDataService;
|
private ISysDictDataService dictDataService;
|
||||||
|
|
||||||
@RequiresPermissions("system:dict:view")
|
@RequiresPermissions("system:dict:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@ -43,10 +44,10 @@ public class DictDataController extends BaseController
|
|||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@RequiresPermissions("system:dict:list")
|
@RequiresPermissions("system:dict:list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(DictData dictData)
|
public TableDataInfo list(SysDictData dictData)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<DictData> list = dictDataService.selectDictDataList(dictData);
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,18 +55,11 @@ public class DictDataController extends BaseController
|
|||||||
@RequiresPermissions("system:dict:export")
|
@RequiresPermissions("system:dict:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(DictData dictData) throws Exception
|
public AjaxResult export(SysDictData dictData)
|
||||||
{
|
{
|
||||||
try
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
{
|
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||||
List<DictData> list = dictDataService.selectDictDataList(dictData);
|
return util.exportExcel(list, "字典数据");
|
||||||
ExcelUtil<DictData> util = new ExcelUtil<DictData>(DictData.class);
|
|
||||||
return util.exportExcel(list, "dictData");
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return error("导出Excel失败,请联系网站管理员!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,8 +79,9 @@ public class DictDataController extends BaseController
|
|||||||
@RequiresPermissions("system:dict:add")
|
@RequiresPermissions("system:dict:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(DictData dict)
|
public AjaxResult addSave(SysDictData dict)
|
||||||
{
|
{
|
||||||
|
dict.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(dictDataService.insertDictData(dict));
|
return toAjax(dictDataService.insertDictData(dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,8 +102,9 @@ public class DictDataController extends BaseController
|
|||||||
@RequiresPermissions("system:dict:edit")
|
@RequiresPermissions("system:dict:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(DictData dict)
|
public AjaxResult editSave(SysDictData dict)
|
||||||
{
|
{
|
||||||
|
dict.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(dictDataService.updateDictData(dict));
|
return toAjax(dictDataService.updateDictData(dict));
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.dict.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
@ -10,14 +10,15 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.domain.SysDictType;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.system.service.ISysDictTypeService;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.system.dict.domain.DictType;
|
|
||||||
import com.ruoyi.project.system.dict.service.IDictTypeService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据字典信息
|
* 数据字典信息
|
||||||
@ -26,12 +27,12 @@ import com.ruoyi.project.system.dict.service.IDictTypeService;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/dict")
|
@RequestMapping("/system/dict")
|
||||||
public class DictTypeController extends BaseController
|
public class SysDictTypeController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/dict/type";
|
private String prefix = "system/dict/type";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDictTypeService dictTypeService;
|
private ISysDictTypeService dictTypeService;
|
||||||
|
|
||||||
@RequiresPermissions("system:dict:view")
|
@RequiresPermissions("system:dict:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@ -43,10 +44,10 @@ public class DictTypeController extends BaseController
|
|||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@RequiresPermissions("system:dict:list")
|
@RequiresPermissions("system:dict:list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(DictType dictType)
|
public TableDataInfo list(SysDictType dictType)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<DictType> list = dictTypeService.selectDictTypeList(dictType);
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,18 +55,12 @@ public class DictTypeController extends BaseController
|
|||||||
@RequiresPermissions("system:dict:export")
|
@RequiresPermissions("system:dict:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(DictType dictType) throws Exception
|
public AjaxResult export(SysDictType dictType)
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
List<DictType> list = dictTypeService.selectDictTypeList(dictType);
|
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||||
ExcelUtil<DictType> util = new ExcelUtil<DictType>(DictType.class);
|
return util.exportExcel(list, "字典类型");
|
||||||
return util.exportExcel(list, "dictType");
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return error("导出Excel失败,请联系网站管理员!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,8 +79,9 @@ public class DictTypeController extends BaseController
|
|||||||
@RequiresPermissions("system:dict:add")
|
@RequiresPermissions("system:dict:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(DictType dict)
|
public AjaxResult addSave(SysDictType dict)
|
||||||
{
|
{
|
||||||
|
dict.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(dictTypeService.insertDictType(dict));
|
return toAjax(dictTypeService.insertDictType(dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,8 +102,9 @@ public class DictTypeController extends BaseController
|
|||||||
@RequiresPermissions("system:dict:edit")
|
@RequiresPermissions("system:dict:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(DictType dict)
|
public AjaxResult editSave(SysDictType dict)
|
||||||
{
|
{
|
||||||
|
dict.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(dictTypeService.updateDictType(dict));
|
return toAjax(dictTypeService.updateDictType(dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +141,7 @@ public class DictTypeController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/checkDictTypeUnique")
|
@PostMapping("/checkDictTypeUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkDictTypeUnique(DictType dictType)
|
public String checkDictTypeUnique(SysDictType dictType)
|
||||||
{
|
{
|
||||||
return dictTypeService.checkDictTypeUnique(dictType);
|
return dictTypeService.checkDictTypeUnique(dictType);
|
||||||
}
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import com.ruoyi.common.config.Global;
|
||||||
|
import com.ruoyi.system.domain.SysMenu;
|
||||||
|
import com.ruoyi.system.domain.SysUser;
|
||||||
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页 业务处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class SysIndexController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysMenuService menuService;
|
||||||
|
|
||||||
|
// 系统首页
|
||||||
|
@GetMapping("/index")
|
||||||
|
public String index(ModelMap mmap)
|
||||||
|
{
|
||||||
|
// 取身份信息
|
||||||
|
SysUser user = getSysUser();
|
||||||
|
// 根据用户id取出菜单
|
||||||
|
List<SysMenu> menus = menuService.selectMenusByUser(user);
|
||||||
|
mmap.put("menus", menus);
|
||||||
|
mmap.put("user", user);
|
||||||
|
mmap.put("copyrightYear", Global.getCopyrightYear());
|
||||||
|
return "index";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 系统介绍
|
||||||
|
@GetMapping("/system/main")
|
||||||
|
public String main(ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("version", Global.getVersion());
|
||||||
|
return "main";
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.user.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -10,10 +10,10 @@ import org.springframework.stereotype.Controller;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.utils.ServletUtils;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.framework.util.ServletUtils;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录验证
|
* 登录验证
|
||||||
@ -21,9 +21,8 @@ import com.ruoyi.framework.web.domain.AjaxResult;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class LoginController extends BaseController
|
public class SysLoginController extends BaseController
|
||||||
{
|
{
|
||||||
|
|
||||||
@GetMapping("/login")
|
@GetMapping("/login")
|
||||||
public String login(HttpServletRequest request, HttpServletResponse response)
|
public String login(HttpServletRequest request, HttpServletResponse response)
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.menu.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -11,13 +11,14 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.project.system.menu.domain.Menu;
|
import com.ruoyi.system.domain.SysMenu;
|
||||||
import com.ruoyi.project.system.menu.service.IMenuService;
|
import com.ruoyi.system.domain.SysRole;
|
||||||
import com.ruoyi.project.system.role.domain.Role;
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单信息
|
* 菜单信息
|
||||||
@ -26,13 +27,12 @@ import com.ruoyi.project.system.role.domain.Role;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/menu")
|
@RequestMapping("/system/menu")
|
||||||
public class MenuController extends BaseController
|
public class SysMenuController extends BaseController
|
||||||
{
|
{
|
||||||
|
|
||||||
private String prefix = "system/menu";
|
private String prefix = "system/menu";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMenuService menuService;
|
private ISysMenuService menuService;
|
||||||
|
|
||||||
@RequiresPermissions("system:menu:view")
|
@RequiresPermissions("system:menu:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@ -44,9 +44,9 @@ public class MenuController extends BaseController
|
|||||||
@RequiresPermissions("system:menu:list")
|
@RequiresPermissions("system:menu:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Menu> list(Menu menu)
|
public List<SysMenu> list(SysMenu menu)
|
||||||
{
|
{
|
||||||
List<Menu> menuList = menuService.selectMenuList(menu);
|
List<SysMenu> menuList = menuService.selectMenuList(menu);
|
||||||
return menuList;
|
return menuList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,6 +67,7 @@ public class MenuController extends BaseController
|
|||||||
{
|
{
|
||||||
return error(1, "菜单已分配,不允许删除");
|
return error(1, "菜单已分配,不允许删除");
|
||||||
}
|
}
|
||||||
|
ShiroUtils.clearCachedAuthorizationInfo();
|
||||||
return toAjax(menuService.deleteMenuById(menuId));
|
return toAjax(menuService.deleteMenuById(menuId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,14 +77,14 @@ public class MenuController extends BaseController
|
|||||||
@GetMapping("/add/{parentId}")
|
@GetMapping("/add/{parentId}")
|
||||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
Menu menu = null;
|
SysMenu menu = null;
|
||||||
if (0L != parentId)
|
if (0L != parentId)
|
||||||
{
|
{
|
||||||
menu = menuService.selectMenuById(parentId);
|
menu = menuService.selectMenuById(parentId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
menu = new Menu();
|
menu = new SysMenu();
|
||||||
menu.setMenuId(0L);
|
menu.setMenuId(0L);
|
||||||
menu.setMenuName("主目录");
|
menu.setMenuName("主目录");
|
||||||
}
|
}
|
||||||
@ -98,8 +99,10 @@ public class MenuController extends BaseController
|
|||||||
@RequiresPermissions("system:menu:add")
|
@RequiresPermissions("system:menu:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(Menu menu)
|
public AjaxResult addSave(SysMenu menu)
|
||||||
{
|
{
|
||||||
|
menu.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
ShiroUtils.clearCachedAuthorizationInfo();
|
||||||
return toAjax(menuService.insertMenu(menu));
|
return toAjax(menuService.insertMenu(menu));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,8 +123,10 @@ public class MenuController extends BaseController
|
|||||||
@RequiresPermissions("system:menu:edit")
|
@RequiresPermissions("system:menu:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(Menu menu)
|
public AjaxResult editSave(SysMenu menu)
|
||||||
{
|
{
|
||||||
|
menu.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
ShiroUtils.clearCachedAuthorizationInfo();
|
||||||
return toAjax(menuService.updateMenu(menu));
|
return toAjax(menuService.updateMenu(menu));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +144,7 @@ public class MenuController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/checkMenuNameUnique")
|
@PostMapping("/checkMenuNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkMenuNameUnique(Menu menu)
|
public String checkMenuNameUnique(SysMenu menu)
|
||||||
{
|
{
|
||||||
return menuService.checkMenuNameUnique(menu);
|
return menuService.checkMenuNameUnique(menu);
|
||||||
}
|
}
|
||||||
@ -149,7 +154,7 @@ public class MenuController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/roleMenuTreeData")
|
@GetMapping("/roleMenuTreeData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Map<String, Object>> roleMenuTreeData(Role role)
|
public List<Map<String, Object>> roleMenuTreeData(SysRole role)
|
||||||
{
|
{
|
||||||
List<Map<String, Object>> tree = menuService.roleMenuTreeData(role);
|
List<Map<String, Object>> tree = menuService.roleMenuTreeData(role);
|
||||||
return tree;
|
return tree;
|
||||||
@ -160,7 +165,7 @@ public class MenuController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/menuTreeData")
|
@GetMapping("/menuTreeData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Map<String, Object>> menuTreeData(Role role)
|
public List<Map<String, Object>> menuTreeData(SysRole role)
|
||||||
{
|
{
|
||||||
List<Map<String, Object>> tree = menuService.menuTreeData();
|
List<Map<String, Object>> tree = menuService.menuTreeData();
|
||||||
return tree;
|
return tree;
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.notice.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
@ -10,13 +10,14 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.project.system.notice.domain.Notice;
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
import com.ruoyi.project.system.notice.service.INoticeService;
|
import com.ruoyi.system.service.ISysNoticeService;
|
||||||
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告 信息操作处理
|
* 公告 信息操作处理
|
||||||
@ -25,12 +26,12 @@ import com.ruoyi.project.system.notice.service.INoticeService;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/notice")
|
@RequestMapping("/system/notice")
|
||||||
public class NoticeController extends BaseController
|
public class SysNoticeController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/notice";
|
private String prefix = "system/notice";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private INoticeService noticeService;
|
private ISysNoticeService noticeService;
|
||||||
|
|
||||||
@RequiresPermissions("system:notice:view")
|
@RequiresPermissions("system:notice:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@ -45,10 +46,10 @@ public class NoticeController extends BaseController
|
|||||||
@RequiresPermissions("system:notice:list")
|
@RequiresPermissions("system:notice:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(Notice notice)
|
public TableDataInfo list(SysNotice notice)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<Notice> list = noticeService.selectNoticeList(notice);
|
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,8 +69,9 @@ public class NoticeController extends BaseController
|
|||||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(Notice notice)
|
public AjaxResult addSave(SysNotice notice)
|
||||||
{
|
{
|
||||||
|
notice.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(noticeService.insertNotice(notice));
|
return toAjax(noticeService.insertNotice(notice));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,8 +92,9 @@ public class NoticeController extends BaseController
|
|||||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(Notice notice)
|
public AjaxResult editSave(SysNotice notice)
|
||||||
{
|
{
|
||||||
|
notice.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(noticeService.updateNotice(notice));
|
return toAjax(noticeService.updateNotice(notice));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,5 +109,4 @@ public class NoticeController extends BaseController
|
|||||||
{
|
{
|
||||||
return toAjax(noticeService.deleteNoticeByIds(ids));
|
return toAjax(noticeService.deleteNoticeByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.post.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
@ -10,14 +10,15 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.system.post.domain.Post;
|
|
||||||
import com.ruoyi.project.system.post.service.IPostService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位信息操作处理
|
* 岗位信息操作处理
|
||||||
@ -26,12 +27,12 @@ import com.ruoyi.project.system.post.service.IPostService;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/post")
|
@RequestMapping("/system/post")
|
||||||
public class PostController extends BaseController
|
public class SysPostController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/post";
|
private String prefix = "system/post";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPostService postService;
|
private ISysPostService postService;
|
||||||
|
|
||||||
@RequiresPermissions("system:post:view")
|
@RequiresPermissions("system:post:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@ -43,10 +44,10 @@ public class PostController extends BaseController
|
|||||||
@RequiresPermissions("system:post:list")
|
@RequiresPermissions("system:post:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(Post post)
|
public TableDataInfo list(SysPost post)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<Post> list = postService.selectPostList(post);
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,18 +55,11 @@ public class PostController extends BaseController
|
|||||||
@RequiresPermissions("system:post:export")
|
@RequiresPermissions("system:post:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(Post post) throws Exception
|
public AjaxResult export(SysPost post)
|
||||||
{
|
{
|
||||||
try
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
{
|
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||||
List<Post> list = postService.selectPostList(post);
|
return util.exportExcel(list, "岗位数据");
|
||||||
ExcelUtil<Post> util = new ExcelUtil<Post>(Post.class);
|
|
||||||
return util.exportExcel(list, "post");
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return error("导出Excel失败,请联系网站管理员!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:post:remove")
|
@RequiresPermissions("system:post:remove")
|
||||||
@ -100,8 +94,9 @@ public class PostController extends BaseController
|
|||||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(Post post)
|
public AjaxResult addSave(SysPost post)
|
||||||
{
|
{
|
||||||
|
post.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(postService.insertPost(post));
|
return toAjax(postService.insertPost(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,8 +117,9 @@ public class PostController extends BaseController
|
|||||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(Post post)
|
public AjaxResult editSave(SysPost post)
|
||||||
{
|
{
|
||||||
|
post.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(postService.updatePost(post));
|
return toAjax(postService.updatePost(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +128,7 @@ public class PostController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/checkPostNameUnique")
|
@PostMapping("/checkPostNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkPostNameUnique(Post post)
|
public String checkPostNameUnique(SysPost post)
|
||||||
{
|
{
|
||||||
return postService.checkPostNameUnique(post);
|
return postService.checkPostNameUnique(post);
|
||||||
}
|
}
|
||||||
@ -142,9 +138,8 @@ public class PostController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/checkPostCodeUnique")
|
@PostMapping("/checkPostCodeUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkPostCodeUnique(Post post)
|
public String checkPostCodeUnique(SysPost post)
|
||||||
{
|
{
|
||||||
return postService.checkPostCodeUnique(post);
|
return postService.checkPostCodeUnique(post);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,178 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.config.Global;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
|
import com.ruoyi.framework.util.FileUploadUtils;
|
||||||
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
|
import com.ruoyi.system.domain.SysUser;
|
||||||
|
import com.ruoyi.system.service.ISysDictDataService;
|
||||||
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人信息 业务处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/user/profile")
|
||||||
|
public class SysProfileController extends BaseController
|
||||||
|
{
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);
|
||||||
|
|
||||||
|
private String prefix = "system/user/profile";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDictDataService dictDataService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人信息
|
||||||
|
*/
|
||||||
|
@GetMapping()
|
||||||
|
public String profile(ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysUser user = getSysUser();
|
||||||
|
user.setSex(dictDataService.selectDictLabel("sys_user_sex", user.getSex()));
|
||||||
|
mmap.put("user", user);
|
||||||
|
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
|
||||||
|
mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
|
||||||
|
return prefix + "/profile";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/checkPassword")
|
||||||
|
@ResponseBody
|
||||||
|
public boolean checkPassword(String password)
|
||||||
|
{
|
||||||
|
SysUser user = getSysUser();
|
||||||
|
if (passwordService.matches(user, password))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/resetPwd")
|
||||||
|
public String resetPwd(ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysUser user = getSysUser();
|
||||||
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
|
return prefix + "/resetPwd";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/resetPwd")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult resetPwd(String oldPassword, String newPassword)
|
||||||
|
{
|
||||||
|
SysUser user = getSysUser();
|
||||||
|
if (StringUtils.isNotEmpty(newPassword) && passwordService.matches(user, oldPassword))
|
||||||
|
{
|
||||||
|
user.setSalt(ShiroUtils.randomSalt());
|
||||||
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
|
||||||
|
if (userService.resetUserPwd(user) > 0)
|
||||||
|
{
|
||||||
|
setSysUser(userService.selectUserById(user.getUserId()));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
return error();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return error("修改密码失败,旧密码错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit")
|
||||||
|
public String edit(ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysUser user = getSysUser();
|
||||||
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改头像
|
||||||
|
*/
|
||||||
|
@GetMapping("/avatar")
|
||||||
|
public String avatar(ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysUser user = getSysUser();
|
||||||
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
|
return prefix + "/avatar";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/update")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult update(SysUser user)
|
||||||
|
{
|
||||||
|
SysUser currentUser = getSysUser();
|
||||||
|
currentUser.setUserName(user.getUserName());
|
||||||
|
currentUser.setEmail(user.getEmail());
|
||||||
|
currentUser.setPhonenumber(user.getPhonenumber());
|
||||||
|
currentUser.setSex(user.getSex());
|
||||||
|
if (userService.updateUserInfo(currentUser) > 0)
|
||||||
|
{
|
||||||
|
setSysUser(userService.selectUserById(currentUser.getUserId()));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
return error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存头像
|
||||||
|
*/
|
||||||
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/updateAvatar")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
|
||||||
|
{
|
||||||
|
SysUser currentUser = getSysUser();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!file.isEmpty())
|
||||||
|
{
|
||||||
|
String avatar = FileUploadUtils.upload(Global.getAvatarPath(), file);
|
||||||
|
currentUser.setAvatar(avatar);
|
||||||
|
if (userService.updateUserInfo(currentUser) > 0)
|
||||||
|
{
|
||||||
|
setSysUser(userService.selectUserById(currentUser.getUserId()));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return error();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("修改头像失败!", e);
|
||||||
|
return error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.role.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
@ -11,14 +11,15 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.domain.SysRole;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.system.role.domain.Role;
|
|
||||||
import com.ruoyi.project.system.role.service.IRoleService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色信息
|
* 角色信息
|
||||||
@ -27,13 +28,12 @@ import com.ruoyi.project.system.role.service.IRoleService;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/role")
|
@RequestMapping("/system/role")
|
||||||
public class RoleController extends BaseController
|
public class SysRoleController extends BaseController
|
||||||
{
|
{
|
||||||
|
|
||||||
private String prefix = "system/role";
|
private String prefix = "system/role";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRoleService roleService;
|
private ISysRoleService roleService;
|
||||||
|
|
||||||
@RequiresPermissions("system:role:view")
|
@RequiresPermissions("system:role:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@ -45,10 +45,10 @@ public class RoleController extends BaseController
|
|||||||
@RequiresPermissions("system:role:list")
|
@RequiresPermissions("system:role:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(Role role)
|
public TableDataInfo list(SysRole role)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<Role> list = roleService.selectRoleList(role);
|
List<SysRole> list = roleService.selectRoleList(role);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,18 +56,11 @@ public class RoleController extends BaseController
|
|||||||
@RequiresPermissions("system:role:export")
|
@RequiresPermissions("system:role:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(Role role) throws Exception
|
public AjaxResult export(SysRole role)
|
||||||
{
|
{
|
||||||
try
|
List<SysRole> list = roleService.selectRoleList(role);
|
||||||
{
|
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
||||||
List<Role> list = roleService.selectRoleList(role);
|
return util.exportExcel(list, "角色数据");
|
||||||
ExcelUtil<Role> util = new ExcelUtil<Role>(Role.class);
|
|
||||||
return util.exportExcel(list, "role");
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return error("导出Excel失败,请联系网站管理员!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,8 +80,10 @@ public class RoleController extends BaseController
|
|||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(Role role)
|
public AjaxResult addSave(SysRole role)
|
||||||
{
|
{
|
||||||
|
role.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
ShiroUtils.clearCachedAuthorizationInfo();
|
||||||
return toAjax(roleService.insertRole(role));
|
return toAjax(roleService.insertRole(role));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -111,8 +106,10 @@ public class RoleController extends BaseController
|
|||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(Role role)
|
public AjaxResult editSave(SysRole role)
|
||||||
{
|
{
|
||||||
|
role.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
ShiroUtils.clearCachedAuthorizationInfo();
|
||||||
return toAjax(roleService.updateRole(role));
|
return toAjax(roleService.updateRole(role));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,8 +131,9 @@ public class RoleController extends BaseController
|
|||||||
@PostMapping("/rule")
|
@PostMapping("/rule")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult ruleSave(Role role)
|
public AjaxResult ruleSave(SysRole role)
|
||||||
{
|
{
|
||||||
|
role.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(roleService.updateRule(role));
|
return toAjax(roleService.updateRule(role));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +158,7 @@ public class RoleController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/checkRoleNameUnique")
|
@PostMapping("/checkRoleNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkRoleNameUnique(Role role)
|
public String checkRoleNameUnique(SysRole role)
|
||||||
{
|
{
|
||||||
return roleService.checkRoleNameUnique(role);
|
return roleService.checkRoleNameUnique(role);
|
||||||
}
|
}
|
||||||
@ -170,7 +168,7 @@ public class RoleController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/checkRoleKeyUnique")
|
@PostMapping("/checkRoleKeyUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkRoleKeyUnique(Role role)
|
public String checkRoleKeyUnique(SysRole role)
|
||||||
{
|
{
|
||||||
return roleService.checkRoleKeyUnique(role);
|
return roleService.checkRoleKeyUnique(role);
|
||||||
}
|
}
|
||||||
@ -184,4 +182,15 @@ public class RoleController extends BaseController
|
|||||||
return prefix + "/tree";
|
return prefix + "/tree";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色状态修改
|
||||||
|
*/
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
|
@RequiresPermissions("system:role:edit")
|
||||||
|
@PostMapping("/changeStatus")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult changeStatus(SysRole role)
|
||||||
|
{
|
||||||
|
return toAjax(roleService.changeStatus(role));
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.user.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
@ -11,17 +11,20 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.system.domain.SysUser;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
import com.ruoyi.project.system.post.service.IPostService;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
import com.ruoyi.project.system.role.service.IRoleService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
import com.ruoyi.project.system.user.domain.User;
|
|
||||||
import com.ruoyi.project.system.user.service.IUserService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
@ -30,18 +33,21 @@ import com.ruoyi.project.system.user.service.IUserService;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/user")
|
@RequestMapping("/system/user")
|
||||||
public class UserController extends BaseController
|
public class SysUserController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/user";
|
private String prefix = "system/user";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IUserService userService;
|
private ISysUserService userService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRoleService roleService;
|
private ISysRoleService roleService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPostService postService;
|
private ISysPostService postService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
@RequiresPermissions("system:user:view")
|
@RequiresPermissions("system:user:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@ -53,10 +59,10 @@ public class UserController extends BaseController
|
|||||||
@RequiresPermissions("system:user:list")
|
@RequiresPermissions("system:user:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(User user)
|
public TableDataInfo list(SysUser user)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<User> list = userService.selectUserList(user);
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,18 +70,33 @@ public class UserController extends BaseController
|
|||||||
@RequiresPermissions("system:user:export")
|
@RequiresPermissions("system:user:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(User user) throws Exception
|
public AjaxResult export(SysUser user)
|
||||||
{
|
{
|
||||||
try
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
{
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
List<User> list = userService.selectUserList(user);
|
return util.exportExcel(list, "用户数据");
|
||||||
ExcelUtil<User> util = new ExcelUtil<User>(User.class);
|
|
||||||
return util.exportExcel(list, "user");
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||||
|
@RequiresPermissions("system:user:import")
|
||||||
|
@PostMapping("/importData")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||||
{
|
{
|
||||||
return error("导出Excel失败,请联系网站管理员!");
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
|
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||||
|
String operName = getSysUser().getLoginName();
|
||||||
|
String message = userService.importUser(userList, updateSupport, operName);
|
||||||
|
return AjaxResult.success(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:user:view")
|
||||||
|
@GetMapping("/importTemplate")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult importTemplate()
|
||||||
|
{
|
||||||
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
|
return util.importTemplateExcel("用户数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,12 +118,15 @@ public class UserController extends BaseController
|
|||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(User user)
|
public AjaxResult addSave(SysUser user)
|
||||||
{
|
{
|
||||||
if (StringUtils.isNotNull(user.getUserId()) && User.isAdmin(user.getUserId()))
|
if (StringUtils.isNotNull(user.getUserId()) && SysUser.isAdmin(user.getUserId()))
|
||||||
{
|
{
|
||||||
return error("不允许修改超级管理员用户");
|
return error("不允许修改超级管理员用户");
|
||||||
}
|
}
|
||||||
|
user.setSalt(ShiroUtils.randomSalt());
|
||||||
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
||||||
|
user.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(userService.insertUser(user));
|
return toAjax(userService.insertUser(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,12 +150,13 @@ public class UserController extends BaseController
|
|||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(User user)
|
public AjaxResult editSave(SysUser user)
|
||||||
{
|
{
|
||||||
if (StringUtils.isNotNull(user.getUserId()) && User.isAdmin(user.getUserId()))
|
if (StringUtils.isNotNull(user.getUserId()) && SysUser.isAdmin(user.getUserId()))
|
||||||
{
|
{
|
||||||
return error("不允许修改超级管理员用户");
|
return error("不允许修改超级管理员用户");
|
||||||
}
|
}
|
||||||
|
user.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(userService.updateUser(user));
|
return toAjax(userService.updateUser(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,8 +173,10 @@ public class UserController extends BaseController
|
|||||||
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/resetPwd")
|
@PostMapping("/resetPwd")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult resetPwd(User user)
|
public AjaxResult resetPwdSave(SysUser user)
|
||||||
{
|
{
|
||||||
|
user.setSalt(ShiroUtils.randomSalt());
|
||||||
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
||||||
return toAjax(userService.resetUserPwd(user));
|
return toAjax(userService.resetUserPwd(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +201,7 @@ public class UserController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/checkLoginNameUnique")
|
@PostMapping("/checkLoginNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkLoginNameUnique(User user)
|
public String checkLoginNameUnique(SysUser user)
|
||||||
{
|
{
|
||||||
return userService.checkLoginNameUnique(user.getLoginName());
|
return userService.checkLoginNameUnique(user.getLoginName());
|
||||||
}
|
}
|
||||||
@ -184,7 +211,7 @@ public class UserController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/checkPhoneUnique")
|
@PostMapping("/checkPhoneUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkPhoneUnique(User user)
|
public String checkPhoneUnique(SysUser user)
|
||||||
{
|
{
|
||||||
return userService.checkPhoneUnique(user);
|
return userService.checkPhoneUnique(user);
|
||||||
}
|
}
|
||||||
@ -194,8 +221,20 @@ public class UserController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/checkEmailUnique")
|
@PostMapping("/checkEmailUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkEmailUnique(User user)
|
public String checkEmailUnique(SysUser user)
|
||||||
{
|
{
|
||||||
return userService.checkEmailUnique(user);
|
return userService.checkEmailUnique(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户状态修改
|
||||||
|
*/
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
|
@RequiresPermissions("system:user:edit")
|
||||||
|
@PostMapping("/changeStatus")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult changeStatus(SysUser user)
|
||||||
|
{
|
||||||
|
return toAjax(userService.changeStatus(user));
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,10 +1,10 @@
|
|||||||
package com.ruoyi.project.tool.build;
|
package com.ruoyi.web.controller.tool;
|
||||||
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* build 表单构建
|
* build 表单构建
|
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.tool.gen.controller;
|
package com.ruoyi.web.controller.tool;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -12,13 +12,13 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.support.Convert;
|
import com.ruoyi.common.support.Convert;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.generator.domain.TableInfo;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.generator.service.IGenService;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.tool.gen.domain.TableInfo;
|
|
||||||
import com.ruoyi.project.tool.gen.service.IGenService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 代码生成 操作处理
|
* 代码生成 操作处理
|
@ -1,10 +1,10 @@
|
|||||||
package com.ruoyi.project.tool.swagger;
|
package com.ruoyi.web.controller.tool;
|
||||||
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* swagger 接口
|
* swagger 接口
|
@ -1,15 +1,18 @@
|
|||||||
package com.ruoyi.project.tool.swagger;
|
package com.ruoyi.web.controller.tool;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
@ -1,8 +1,8 @@
|
|||||||
package com.ruoyi.framework.config;
|
package com.ruoyi.web.core.config;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import com.ruoyi.common.config.Global;
|
||||||
import springfox.documentation.builders.ApiInfoBuilder;
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
import springfox.documentation.builders.PathSelectors;
|
import springfox.documentation.builders.PathSelectors;
|
||||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
@ -21,10 +21,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|||||||
@EnableSwagger2
|
@EnableSwagger2
|
||||||
public class SwaggerConfig
|
public class SwaggerConfig
|
||||||
{
|
{
|
||||||
/** 系统基础配置 */
|
|
||||||
@Autowired
|
|
||||||
private RuoYiConfig ruoYiConfig;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建API
|
* 创建API
|
||||||
*/
|
*/
|
||||||
@ -36,7 +32,7 @@ public class SwaggerConfig
|
|||||||
.apiInfo(apiInfo())
|
.apiInfo(apiInfo())
|
||||||
.select()
|
.select()
|
||||||
// 指定当前包路径
|
// 指定当前包路径
|
||||||
.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
|
.apis(RequestHandlerSelectors.basePackage("com.ruoyi.web.controller.tool"))
|
||||||
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
||||||
.paths(PathSelectors.any())
|
.paths(PathSelectors.any())
|
||||||
.build();
|
.build();
|
||||||
@ -51,8 +47,8 @@ public class SwaggerConfig
|
|||||||
return new ApiInfoBuilder()
|
return new ApiInfoBuilder()
|
||||||
.title("标题:若依管理系统_接口文档")
|
.title("标题:若依管理系统_接口文档")
|
||||||
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
||||||
.contact(new Contact(ruoYiConfig.getName(), null, null))
|
.contact(new Contact(Global.getName(), null, null))
|
||||||
.version("版本号:" + ruoYiConfig.getVersion())
|
.version("版本号:" + Global.getVersion())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,11 +2,11 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driverClassName: com.mysql.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true
|
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: password
|
password: password
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
@ -17,32 +17,33 @@ spring:
|
|||||||
username:
|
username:
|
||||||
password:
|
password:
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
initial-size: 10
|
initialSize: 5
|
||||||
# 最大连接池数量
|
|
||||||
max-active: 100
|
|
||||||
# 最小连接池数量
|
# 最小连接池数量
|
||||||
min-idle: 10
|
minIdle: 10
|
||||||
|
# 最大连接池数量
|
||||||
|
maxActive: 20
|
||||||
# 配置获取连接等待超时的时间
|
# 配置获取连接等待超时的时间
|
||||||
max-wait: 60000
|
maxWait: 60000
|
||||||
# 打开PSCache,并且指定每个连接上PSCache的大小
|
|
||||||
pool-prepared-statements: true
|
|
||||||
max-pool-prepared-statement-per-connection-size: 20
|
|
||||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||||
timeBetweenEvictionRunsMillis: 60000
|
timeBetweenEvictionRunsMillis: 60000
|
||||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||||
min-evictable-idle-time-millis: 300000
|
minEvictableIdleTimeMillis: 300000
|
||||||
validation-query: SELECT 1 FROM DUAL
|
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||||
test-while-idle: true
|
maxEvictableIdleTimeMillis: 900000
|
||||||
test-on-borrow: false
|
# 配置检测连接是否有效
|
||||||
test-on-return: false
|
validationQuery: SELECT 1 FROM DUAL
|
||||||
stat-view-servlet:
|
testWhileIdle: true
|
||||||
|
testOnBorrow: false
|
||||||
|
testOnReturn: false
|
||||||
|
statViewServlet:
|
||||||
enabled: true
|
enabled: true
|
||||||
url-pattern: /monitor/druid/*
|
url-pattern: /monitor/druid/*
|
||||||
filter:
|
filter:
|
||||||
stat:
|
stat:
|
||||||
|
# 慢SQL记录
|
||||||
log-slow-sql: true
|
log-slow-sql: true
|
||||||
slow-sql-millis: 1000
|
slow-sql-millis: 1000
|
||||||
merge-sql: false
|
merge-sql: true
|
||||||
wall:
|
wall:
|
||||||
config:
|
config:
|
||||||
multi-statement-allow: true
|
multi-statement-allow: true
|
@ -1,18 +1,19 @@
|
|||||||
# 项目相关配置
|
# 项目相关配置
|
||||||
ruoyi:
|
ruoyi:
|
||||||
#名称
|
# 名称
|
||||||
name: RuoYi
|
name: RuoYi
|
||||||
#版本
|
# 版本
|
||||||
version: 2.4.0
|
version: 3.2.0
|
||||||
#版权年份
|
# 版权年份
|
||||||
copyrightYear: 2018
|
copyrightYear: 2019
|
||||||
#头像上传路径
|
# 文件上传路径
|
||||||
profile: D:/profile/
|
profile: D:/profile/
|
||||||
# 获取ip地址开关
|
# 获取ip地址开关
|
||||||
addressEnabled: false
|
addressEnabled: true
|
||||||
#开发环境配置
|
|
||||||
|
# 开发环境配置
|
||||||
server:
|
server:
|
||||||
#服务端口
|
# 服务端口
|
||||||
port: 80
|
port: 80
|
||||||
servlet:
|
servlet:
|
||||||
# 项目contextPath
|
# 项目contextPath
|
||||||
@ -24,55 +25,64 @@ server:
|
|||||||
max-threads: 800
|
max-threads: 800
|
||||||
# Tomcat启动初始化的线程数,默认值25
|
# Tomcat启动初始化的线程数,默认值25
|
||||||
min-spare-threads: 30
|
min-spare-threads: 30
|
||||||
#日志配置
|
|
||||||
|
# 日志配置
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
com.ruoyi: debug
|
com.ruoyi: debug
|
||||||
org.springframework: WARN
|
org.springframework: WARN
|
||||||
org.spring.springboot.dao: debug
|
org.spring.springboot.dao: debug
|
||||||
#用户配置
|
|
||||||
|
# 用户配置
|
||||||
user:
|
user:
|
||||||
password:
|
password:
|
||||||
#密码错误{maxRetryCount}次锁定10分钟
|
# 密码错误{maxRetryCount}次锁定10分钟
|
||||||
maxRetryCount: 5
|
maxRetryCount: 5
|
||||||
#Spring配置
|
|
||||||
|
# Spring配置
|
||||||
spring:
|
spring:
|
||||||
|
# 模板引擎
|
||||||
thymeleaf:
|
thymeleaf:
|
||||||
mode: HTML
|
mode: HTML
|
||||||
encoding: utf-8
|
encoding: utf-8
|
||||||
# 禁用缓存
|
# 禁用缓存
|
||||||
cache: false
|
cache: false
|
||||||
|
# 资源信息
|
||||||
messages:
|
messages:
|
||||||
#国际化资源文件路径
|
# 国际化资源文件路径
|
||||||
basename: i18n/messages
|
basename: i18n/messages
|
||||||
jackson:
|
jackson:
|
||||||
time-zone: GMT+8
|
time-zone: GMT+8
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
profiles:
|
profiles:
|
||||||
active: druid
|
active: druid
|
||||||
#文件上传
|
# 文件上传
|
||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
max-file-size: 30MB
|
max-file-size: 30MB
|
||||||
max-request-size: 30MB
|
max-request-size: 30MB
|
||||||
|
# 服务模块
|
||||||
devtools:
|
devtools:
|
||||||
restart:
|
restart:
|
||||||
#热部署开关
|
# 热部署开关
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
# MyBatis
|
# MyBatis
|
||||||
mybatis:
|
mybatis:
|
||||||
# 搜索指定包别名
|
# 搜索指定包别名
|
||||||
typeAliasesPackage: com.ruoyi.project
|
typeAliasesPackage: com.ruoyi
|
||||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||||
mapperLocations: classpath:mybatis/**/*Mapper.xml
|
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||||
# 加载全局的配置文件
|
# 加载全局的配置文件
|
||||||
configLocation: classpath:mybatis/mybatis-config.xml
|
configLocation: classpath:mapper/mybatis-config.xml
|
||||||
# PageHelper
|
|
||||||
|
# PageHelper分页插件
|
||||||
pagehelper:
|
pagehelper:
|
||||||
helperDialect: mysql
|
helperDialect: mysql
|
||||||
reasonable: true
|
reasonable: true
|
||||||
supportMethodsArguments: true
|
supportMethodsArguments: true
|
||||||
params: count=countSql
|
params: count=countSql
|
||||||
|
|
||||||
# Shiro
|
# Shiro
|
||||||
shiro:
|
shiro:
|
||||||
user:
|
user:
|
||||||
@ -102,6 +112,7 @@ shiro:
|
|||||||
dbSyncPeriod: 1
|
dbSyncPeriod: 1
|
||||||
# 相隔多久检查一次session的有效性,默认就是10分钟
|
# 相隔多久检查一次session的有效性,默认就是10分钟
|
||||||
validationInterval: 10
|
validationInterval: 10
|
||||||
|
|
||||||
# 防止XSS攻击
|
# 防止XSS攻击
|
||||||
xss:
|
xss:
|
||||||
# 过滤开关
|
# 过滤开关
|
||||||
@ -110,12 +121,13 @@ xss:
|
|||||||
excludes: /system/notice/*
|
excludes: /system/notice/*
|
||||||
# 匹配链接
|
# 匹配链接
|
||||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||||
|
|
||||||
# 代码生成
|
# 代码生成
|
||||||
gen:
|
gen:
|
||||||
# 作者
|
# 作者
|
||||||
author: ruoyi
|
author: ruoyi
|
||||||
# 默认生成包路径 module 需改成自己的模块名称 如 system monitor tool
|
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
|
||||||
packageName: com.ruoyi.project.module
|
packageName: com.ruoyi.system
|
||||||
# 自动去除表前缀,默认是true
|
# 自动去除表前缀,默认是true
|
||||||
autoRemovePre: true
|
autoRemovePre: true
|
||||||
# 表前缀(类名不会包含表前缀)
|
# 表前缀(类名不会包含表前缀)
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ehcache name="ruoyi">
|
<ehcache name="ruoyi" updateCheck="false">
|
||||||
|
|
||||||
<!-- 磁盘缓存位置 -->
|
<!-- 磁盘缓存位置 -->
|
||||||
<diskStore path="java.io.tmpdir"/>
|
<diskStore path="java.io.tmpdir"/>
|
@ -3,11 +3,11 @@ not.null=* 必须填写
|
|||||||
user.jcaptcha.error=验证码错误
|
user.jcaptcha.error=验证码错误
|
||||||
user.not.exists=用户不存在/密码错误
|
user.not.exists=用户不存在/密码错误
|
||||||
user.password.not.match=用户不存在/密码错误
|
user.password.not.match=用户不存在/密码错误
|
||||||
user.password.retry.limit.count=密码输入错误{0}次,{1}
|
user.password.retry.limit.count=密码输入错误{0}次
|
||||||
user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定10分钟
|
user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定10分钟
|
||||||
user.password.delete=对不起,您的账号已被删除
|
user.password.delete=对不起,您的账号已被删除
|
||||||
user.blocked=用户已封禁,原因:{0}
|
user.blocked=用户已封禁,请联系管理员
|
||||||
role.blocked=角色已封禁,原因:{0}
|
role.blocked=角色已封禁,请联系管理员
|
||||||
user.logout.success=退出成功
|
user.logout.success=退出成功
|
||||||
|
|
||||||
length.not.valid=长度必须在{min}到{max}个字符之间
|
length.not.valid=长度必须在{min}到{max}个字符之间
|
8
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.js
vendored
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
/**
|
||||||
|
* 基于bootstrap-table-mobile修改
|
||||||
|
* 修正部分iPhone手机不显示卡片视图
|
||||||
|
* Copyright (c) 2019 ruoyi
|
||||||
|
*/
|
||||||
|
!function ($) {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var resetView = function (that) {
|
||||||
|
if (that.options.height || that.options.showFooter) {
|
||||||
|
setTimeout(that.resetView(), 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 判断是否 iphone
|
||||||
|
var isIPhone = function () {
|
||||||
|
let browserName = navigator.userAgent.toLowerCase();
|
||||||
|
return /(iphone)/i.test(browserName);
|
||||||
|
};
|
||||||
|
|
||||||
|
var changeView = function (that, width, height) {
|
||||||
|
if (that.options.minHeight) {
|
||||||
|
if (checkValuesLessEqual(width, that.options.minWidth) && checkValuesLessEqual(height, that.options.minHeight)) {
|
||||||
|
conditionCardView(that);
|
||||||
|
} else if (checkValuesGreater(width, that.options.minWidth) && checkValuesGreater(height, that.options.minHeight)) {
|
||||||
|
conditionFullView(that);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (checkValuesLessEqual(width, that.options.minWidth) || isIPhone()) {
|
||||||
|
conditionCardView(that);
|
||||||
|
} else if (checkValuesGreater(width, that.options.minWidth)) {
|
||||||
|
conditionFullView(that);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resetView(that);
|
||||||
|
};
|
||||||
|
|
||||||
|
var checkValuesLessEqual = function (currentValue, targetValue) {
|
||||||
|
return currentValue <= targetValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
var checkValuesGreater = function (currentValue, targetValue) {
|
||||||
|
return currentValue > targetValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
var conditionCardView = function (that) {
|
||||||
|
changeTableView(that, false);
|
||||||
|
};
|
||||||
|
|
||||||
|
var conditionFullView = function (that) {
|
||||||
|
changeTableView(that, true);
|
||||||
|
};
|
||||||
|
|
||||||
|
var changeTableView = function (that, cardViewState) {
|
||||||
|
that.options.cardView = cardViewState;
|
||||||
|
that.toggleView();
|
||||||
|
};
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.defaults, {
|
||||||
|
mobileResponsive: false,
|
||||||
|
minWidth: 562,
|
||||||
|
minHeight: undefined,
|
||||||
|
checkOnInit: true,
|
||||||
|
toggled: false
|
||||||
|
});
|
||||||
|
|
||||||
|
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||||
|
_init = BootstrapTable.prototype.init;
|
||||||
|
|
||||||
|
BootstrapTable.prototype.init = function () {
|
||||||
|
_init.apply(this, Array.prototype.slice.apply(arguments));
|
||||||
|
|
||||||
|
if (!this.options.mobileResponsive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.options.minWidth) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var that = this;
|
||||||
|
$(window).resize(function () {
|
||||||
|
changeView(that, $(this).width(), $(this).height())
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.options.checkOnInit) {
|
||||||
|
changeView(this, $(window).width(), $(window).height());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}(jQuery);
|
@ -4,7 +4,11 @@
|
|||||||
.bootstrap-tree-table .treetable-table{border:0 !important;margin-bottom:0}
|
.bootstrap-tree-table .treetable-table{border:0 !important;margin-bottom:0}
|
||||||
.bootstrap-tree-table .treetable-table tbody {display:block;height:auto;overflow-y:auto;}
|
.bootstrap-tree-table .treetable-table tbody {display:block;height:auto;overflow-y:auto;}
|
||||||
.bootstrap-tree-table .treetable-table thead, .treetable-table tbody tr {display:table;width:100%;table-layout:fixed;}
|
.bootstrap-tree-table .treetable-table thead, .treetable-table tbody tr {display:table;width:100%;table-layout:fixed;}
|
||||||
.bootstrap-tree-table .treetable-thead th{line-height:24px;border: 0 !important;border-radius: 4px;border-left:0px solid #e7eaec !important;border-bottom:1px solid #ccc!important;text-align: center;}
|
.bootstrap-tree-table .treetable-thead th{line-height:24px;border: 0 !important;border-radius: 4px;border-left:0px solid #e7eaec !important;border-bottom:1px solid #ccc!important;text-align: left;}
|
||||||
.bootstrap-tree-table .treetable-thead tr :first-child{border-left:0 !important}
|
.bootstrap-tree-table .treetable-thead tr :first-child{border-left:0 !important}
|
||||||
.bootstrap-tree-table .treetable-tbody td{border: 0 !important;border-left:0px solid #e7eaec !important;border-bottom:1px solid #e7eaec!important;overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
|
.bootstrap-tree-table .treetable-tbody td{border: 0 !important;border-left:0px solid #e7eaec !important;border-bottom:1px solid #e7eaec!important;overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
|
||||||
.bootstrap-tree-table .treetable-tbody tr :first-child{border-left:0 !important}
|
.bootstrap-tree-table .treetable-tbody tr :first-child{border-left:0 !important}
|
||||||
|
.bootstrap-tree-table .treetable-bars .tool-left, .bootstrap-tree-table .treetable-bars .tool-right{margin-top: 10px; margin-bottom: 10px;}
|
||||||
|
.bootstrap-tree-table .treetable-bars .tool-left{float: left;}
|
||||||
|
.bootstrap-tree-table .treetable-bars .tool-right{float: right;}
|
||||||
|
.bootstrap-tree-table .treetable-bars .columns li label{display: block;padding: 3px 20px;clear: both;font-weight: 400;line-height: 1.428571429;max-width: 100%;margin-bottom: 5px;cursor:pointer;}
|
670
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js
vendored
Normal file
@ -0,0 +1,670 @@
|
|||||||
|
/**
|
||||||
|
* bootstrapTreeTable
|
||||||
|
*
|
||||||
|
* @author swifly
|
||||||
|
*/
|
||||||
|
(function($) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
$.fn.bootstrapTreeTable = function(options, param) {
|
||||||
|
var target = $(this).data('bootstrap.tree.table');
|
||||||
|
target = target ? target : $(this);
|
||||||
|
// 如果是调用方法
|
||||||
|
if (typeof options == 'string') {
|
||||||
|
return $.fn.bootstrapTreeTable.methods[options](target, param);
|
||||||
|
}
|
||||||
|
// 如果是初始化组件
|
||||||
|
options = $.extend({}, $.fn.bootstrapTreeTable.defaults, options || {});
|
||||||
|
target.hasSelectItem = false;// 是否有radio或checkbox
|
||||||
|
target.data_list = null; //用于缓存格式化后的数据-按父分组
|
||||||
|
target.data_obj = null; //用于缓存格式化后的数据-按id存对象
|
||||||
|
target.hiddenColumns = []; //用于存放被隐藏列的field
|
||||||
|
target.lastAjaxParams; //用户最后一次请求的参数
|
||||||
|
target.isFixWidth=false; //是否有固定宽度
|
||||||
|
// 初始化
|
||||||
|
var init = function() {
|
||||||
|
// 初始化容器
|
||||||
|
initContainer();
|
||||||
|
// 初始化工具栏
|
||||||
|
initToolbar();
|
||||||
|
// 初始化表头
|
||||||
|
initHeader();
|
||||||
|
// 初始化表体
|
||||||
|
initBody();
|
||||||
|
// 初始化数据服务
|
||||||
|
initServer();
|
||||||
|
// 动态设置表头宽度
|
||||||
|
autoTheadWidth(true);
|
||||||
|
// 缓存target对象
|
||||||
|
target.data('bootstrap.tree.table', target);
|
||||||
|
}
|
||||||
|
// 初始化容器
|
||||||
|
var initContainer = function() {
|
||||||
|
// 在外层包装一下div,样式用的bootstrap-table的
|
||||||
|
var $main_div = $("<div class='bootstrap-tree-table'></div>");
|
||||||
|
var $treetable = $("<div class='treetable-table'></div>");
|
||||||
|
target.before($main_div);
|
||||||
|
$main_div.append($treetable);
|
||||||
|
$treetable.append(target);
|
||||||
|
target.addClass("table");
|
||||||
|
if (options.striped) {
|
||||||
|
target.addClass('table-striped');
|
||||||
|
}
|
||||||
|
if (options.bordered) {
|
||||||
|
target.addClass('table-bordered');
|
||||||
|
}
|
||||||
|
if (options.hover) {
|
||||||
|
target.addClass('table-hover');
|
||||||
|
}
|
||||||
|
if (options.condensed) {
|
||||||
|
target.addClass('table-condensed');
|
||||||
|
}
|
||||||
|
target.html("");
|
||||||
|
}
|
||||||
|
// 初始化工具栏
|
||||||
|
var initToolbar = function() {
|
||||||
|
var $toolbar = $("<div class='treetable-bars'></div>");
|
||||||
|
if (options.toolbar) {
|
||||||
|
$(options.toolbar).addClass('tool-left');
|
||||||
|
$toolbar.append($(options.toolbar));
|
||||||
|
}
|
||||||
|
var $rightToolbar = $('<div class="btn-group tool-right">');
|
||||||
|
$toolbar.append($rightToolbar);
|
||||||
|
target.parent().before($toolbar);
|
||||||
|
// 是否显示刷新按钮
|
||||||
|
if (options.showRefresh) {
|
||||||
|
var $refreshBtn = $('<button class="btn btn-default btn-outline" type="button" aria-label="refresh" title="刷新"><i class="glyphicon glyphicon-repeat"></i></button>');
|
||||||
|
$rightToolbar.append($refreshBtn);
|
||||||
|
registerRefreshBtnClickEvent($refreshBtn);
|
||||||
|
}
|
||||||
|
// 是否显示列选项
|
||||||
|
if (options.showColumns) {
|
||||||
|
var $columns_div = $('<div class="btn-group pull-right" title="列"><button type="button" aria-label="columns" class="btn btn-default btn-outline dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="glyphicon glyphicon-list"></i> <span class="caret"></span></button></div>');
|
||||||
|
var $columns_ul = $('<ul class="dropdown-menu columns" role="menu"></ul>');
|
||||||
|
$.each(options.columns, function(i, column) {
|
||||||
|
if (column.field != 'selectItem') {
|
||||||
|
var _li = null;
|
||||||
|
if(typeof column.visible == "undefined"||column.visible==true){
|
||||||
|
_li = $('<li role="menuitem"><label><input type="checkbox" checked="checked" data-field="'+column.field+'" value="'+column.field+'" > '+column.title+'</label></li>');
|
||||||
|
}else{
|
||||||
|
_li = $('<li role="menuitem"><label><input type="checkbox" data-field="'+column.field+'" value="'+column.field+'" > '+column.title+'</label></li>');
|
||||||
|
target.hiddenColumns.push(column.field);
|
||||||
|
}
|
||||||
|
$columns_ul.append(_li);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$columns_div.append($columns_ul);
|
||||||
|
$rightToolbar.append($columns_div);
|
||||||
|
// 注册列选项事件
|
||||||
|
registerColumnClickEvent();
|
||||||
|
}else{
|
||||||
|
$.each(options.columns, function(i, column) {
|
||||||
|
if (column.field != 'selectItem') {
|
||||||
|
if(!(typeof column.visible == "undefined"||column.visible==true)){
|
||||||
|
target.hiddenColumns.push(column.field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 初始化隐藏列
|
||||||
|
var initHiddenColumns = function(){
|
||||||
|
$.each(target.hiddenColumns, function(i, field) {
|
||||||
|
target.find("."+field+"_cls").hide();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 初始化表头
|
||||||
|
var initHeader = function() {
|
||||||
|
var $thr = $('<tr></tr>');
|
||||||
|
$.each(options.columns, function(i, column) {
|
||||||
|
var $th = null;
|
||||||
|
// 判断有没有选择列
|
||||||
|
if (i == 0 && column.field == 'selectItem') {
|
||||||
|
target.hasSelectItem = true;
|
||||||
|
$th = $('<th style="width:36px"></th>');
|
||||||
|
} else {
|
||||||
|
$th = $('<th style="' + ((column.width) ? ('width:' + column.width) : '') + '" class="' + column.field + '_cls"></th>');
|
||||||
|
}
|
||||||
|
if((!target.isFixWidth)&& column.width){
|
||||||
|
target.isFixWidth = column.width.indexOf("px")>-1?true:false;
|
||||||
|
}
|
||||||
|
$th.text(column.title);
|
||||||
|
$thr.append($th);
|
||||||
|
});
|
||||||
|
var $thead = $('<thead class="treetable-thead"></thead>');
|
||||||
|
$thead.append($thr);
|
||||||
|
target.append($thead);
|
||||||
|
}
|
||||||
|
// 初始化表体
|
||||||
|
var initBody = function() {
|
||||||
|
var $tbody = $('<tbody class="treetable-tbody"></tbody>');
|
||||||
|
target.append($tbody);
|
||||||
|
// 默认高度
|
||||||
|
if (options.height) {
|
||||||
|
$tbody.css("height", options.height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 初始化数据服务
|
||||||
|
var initServer = function(parms) {
|
||||||
|
// 加载数据前先清空
|
||||||
|
target.data_list = {};
|
||||||
|
target.data_obj = {};
|
||||||
|
var $tbody = target.find("tbody");
|
||||||
|
// 添加加载loading
|
||||||
|
var $loading = '<tr><td colspan="' + options.columns.length + '"><div style="display: block;text-align: center;">正在努力地加载数据中,请稍候……</div></td></tr>'
|
||||||
|
$tbody.html($loading);
|
||||||
|
if (options.url) {
|
||||||
|
$.ajax({
|
||||||
|
type: options.type,
|
||||||
|
url: options.url,
|
||||||
|
data: parms ? parms : options.ajaxParams,
|
||||||
|
dataType: "JSON",
|
||||||
|
success: function(data, textStatus, jqXHR) {
|
||||||
|
renderTable(data);
|
||||||
|
},
|
||||||
|
error: function(xhr, textStatus) {
|
||||||
|
var _errorMsg = '<tr><td colspan="' + options.columns.length + '"><div style="display: block;text-align: center;">' + xhr.responseText + '</div></td></tr>'
|
||||||
|
$tbody.html(_errorMsg);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
renderTable(options.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 加载完数据后渲染表格
|
||||||
|
var renderTable = function(data) {
|
||||||
|
var $tbody = target.find("tbody");
|
||||||
|
// 先清空
|
||||||
|
$tbody.html("");
|
||||||
|
if (!data || data.length <= 0) {
|
||||||
|
var _empty = '<tr><td colspan="' + options.columns.length + '"><div style="display: block;text-align: center;">没有找到匹配的记录</div></td></tr>'
|
||||||
|
$tbody.html(_empty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 缓存并格式化数据
|
||||||
|
formatData(data);
|
||||||
|
// 获取所有根节点
|
||||||
|
var rootNode = target.data_list["_root_"];
|
||||||
|
// 开始绘制
|
||||||
|
if (rootNode) {
|
||||||
|
$.each(rootNode, function(i, item) {
|
||||||
|
var _child_row_id = "row_id_" + i
|
||||||
|
recursionNode(item, 1, _child_row_id, "row_root");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 下边的操作主要是为了查询时让一些没有根节点的节点显示
|
||||||
|
$.each(data, function(i, item) {
|
||||||
|
if (!item.isShow) {
|
||||||
|
var tr = renderRow(item, false, 1, "", "");
|
||||||
|
$tbody.append(tr);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
target.append($tbody);
|
||||||
|
registerExpanderEvent();
|
||||||
|
registerRowClickEvent();
|
||||||
|
initHiddenColumns();
|
||||||
|
// 动态设置表头宽度
|
||||||
|
autoTheadWidth()
|
||||||
|
}
|
||||||
|
// 动态设置表头宽度
|
||||||
|
var autoTheadWidth = function(initFlag) {
|
||||||
|
if(options.height>0){
|
||||||
|
var $thead = target.find("thead");
|
||||||
|
var $tbody = target.find("tbody");
|
||||||
|
var borderWidth = parseInt(target.css("border-left-width")) + parseInt(target.css("border-right-width"))
|
||||||
|
|
||||||
|
$thead.css("width", $tbody.children(":first").width());
|
||||||
|
if(initFlag){
|
||||||
|
var resizeWaiter = false;
|
||||||
|
$(window).resize(function() {
|
||||||
|
if(!resizeWaiter){
|
||||||
|
resizeWaiter = true;
|
||||||
|
setTimeout(function(){
|
||||||
|
if(!target.isFixWidth){
|
||||||
|
$tbody.css("width", target.parent().width()-borderWidth);
|
||||||
|
}
|
||||||
|
$thead.css("width", $tbody.children(":first").width());
|
||||||
|
resizeWaiter = false;
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 缓存并格式化数据
|
||||||
|
var formatData = function(data) {
|
||||||
|
var _root = options.rootIdValue ? options.rootIdValue : null
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
// 添加一个默认属性,用来判断当前节点有没有被显示
|
||||||
|
item.isShow = false;
|
||||||
|
// 这里兼容几种常见Root节点写法
|
||||||
|
// 默认的几种判断
|
||||||
|
var _defaultRootFlag = item[options.parentCode] == '0' ||
|
||||||
|
item[options.parentCode] == 0 ||
|
||||||
|
item[options.parentCode] == null ||
|
||||||
|
item[options.parentCode] == '';
|
||||||
|
if (!item[options.parentCode] || (_root ? (item[options.parentCode] == options.rootIdValue) : _defaultRootFlag)) {
|
||||||
|
if (!target.data_list["_root_"]) {
|
||||||
|
target.data_list["_root_"] = [];
|
||||||
|
}
|
||||||
|
if (!target.data_obj["id_" + item[options.code]]) {
|
||||||
|
target.data_list["_root_"].push(item);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!target.data_list["_n_" + item[options.parentCode]]) {
|
||||||
|
target.data_list["_n_" + item[options.parentCode]] = [];
|
||||||
|
}
|
||||||
|
if (!target.data_obj["id_" + item[options.code]]) {
|
||||||
|
target.data_list["_n_" + item[options.parentCode]].push(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
target.data_obj["id_" + item[options.code]] = item;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 递归获取子节点并且设置子节点
|
||||||
|
var recursionNode = function(parentNode, lv, row_id, p_id) {
|
||||||
|
var $tbody = target.find("tbody");
|
||||||
|
var _ls = target.data_list["_n_" + parentNode[options.code]];
|
||||||
|
var $tr = renderRow(parentNode, _ls ? true : false, lv, row_id, p_id);
|
||||||
|
$tbody.append($tr);
|
||||||
|
if (_ls) {
|
||||||
|
$.each(_ls, function(i, item) {
|
||||||
|
var _child_row_id = row_id + "_" + i
|
||||||
|
recursionNode(item, (lv + 1), _child_row_id, row_id)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 绘制行
|
||||||
|
var renderRow = function(item, isP, lv, row_id, p_id) {
|
||||||
|
// 标记已显示
|
||||||
|
item.isShow = true;
|
||||||
|
item.row_id = row_id;
|
||||||
|
item.p_id = p_id;
|
||||||
|
item.lv = lv;
|
||||||
|
var $tr = $('<tr id="' + row_id + '" pid="' + p_id + '"></tr>');
|
||||||
|
var _icon = options.expanderCollapsedClass;
|
||||||
|
if (options.expandAll) {
|
||||||
|
$tr.css("display", "table");
|
||||||
|
_icon = options.expanderExpandedClass;
|
||||||
|
} else if (lv == 1) {
|
||||||
|
$tr.css("display", "table");
|
||||||
|
_icon = (options.expandFirst) ? options.expanderExpandedClass : options.expanderCollapsedClass;
|
||||||
|
} else if (lv == 2) {
|
||||||
|
if (options.expandFirst) {
|
||||||
|
$tr.css("display", "table");
|
||||||
|
} else {
|
||||||
|
$tr.css("display", "none");
|
||||||
|
}
|
||||||
|
_icon = options.expanderCollapsedClass;
|
||||||
|
} else {
|
||||||
|
$tr.css("display", "none");
|
||||||
|
_icon = options.expanderCollapsedClass;
|
||||||
|
}
|
||||||
|
$.each(options.columns, function(index, column) {
|
||||||
|
// 判断有没有选择列
|
||||||
|
if (column.field == 'selectItem') {
|
||||||
|
target.hasSelectItem = true;
|
||||||
|
var $td = $('<td style="text-align:center;width:36px"></td>');
|
||||||
|
if (column.radio) {
|
||||||
|
var _ipt = $('<input name="select_item" type="radio" value="' + item[options.code] + '"></input>');
|
||||||
|
$td.append(_ipt);
|
||||||
|
}
|
||||||
|
if (column.checkbox) {
|
||||||
|
var _ipt = $('<input name="select_item" type="checkbox" value="' + item[options.code] + '"></input>');
|
||||||
|
$td.append(_ipt);
|
||||||
|
}
|
||||||
|
$tr.append($td);
|
||||||
|
} else {
|
||||||
|
var $td = $('<td name="' + column.field + '" class="' + column.field + '_cls"></td>');
|
||||||
|
if(column.width){
|
||||||
|
$td.css("width",column.width);
|
||||||
|
}
|
||||||
|
if(column.align){
|
||||||
|
$td.css("text-align",column.align);
|
||||||
|
}
|
||||||
|
if(options.expandColumn == index){
|
||||||
|
$td.css("text-align","left");
|
||||||
|
}
|
||||||
|
if(column.valign){
|
||||||
|
$td.css("vertical-align",column.valign);
|
||||||
|
}
|
||||||
|
if(options.showTitle){
|
||||||
|
$td.addClass("ellipsis");
|
||||||
|
}
|
||||||
|
// 增加formatter渲染
|
||||||
|
if (column.formatter) {
|
||||||
|
$td.html(column.formatter.call(this, item[column.field], item, index));
|
||||||
|
} else {
|
||||||
|
if(options.showTitle){
|
||||||
|
// 只在字段没有formatter时才添加title属性
|
||||||
|
$td.attr("title",item[column.field]);
|
||||||
|
}
|
||||||
|
$td.text(item[column.field]);
|
||||||
|
}
|
||||||
|
if (options.expandColumn == index) {
|
||||||
|
if (!isP) {
|
||||||
|
$td.prepend('<span class="treetable-expander"></span>')
|
||||||
|
} else {
|
||||||
|
$td.prepend('<span class="treetable-expander ' + _icon + '"></span>')
|
||||||
|
}
|
||||||
|
for (var int = 0; int < (lv - 1); int++) {
|
||||||
|
$td.prepend('<span class="treetable-indent"></span>')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tr.append($td);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return $tr;
|
||||||
|
}
|
||||||
|
// 注册刷新按钮点击事件
|
||||||
|
var registerRefreshBtnClickEvent = function(btn) {
|
||||||
|
$(btn).off('click').on('click', function () {
|
||||||
|
target.refresh();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 注册列选项事件
|
||||||
|
var registerColumnClickEvent = function() {
|
||||||
|
$(".bootstrap-tree-table .treetable-bars .columns label input").off('click').on('click', function () {
|
||||||
|
var $this = $(this);
|
||||||
|
if($this.prop('checked')){
|
||||||
|
target.showColumn($(this).val());
|
||||||
|
}else{
|
||||||
|
target.hideColumn($(this).val());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 注册行点击选中事件
|
||||||
|
var registerRowClickEvent = function() {
|
||||||
|
target.find("tbody").find("tr").unbind();
|
||||||
|
target.find("tbody").find("tr").click(function() {
|
||||||
|
if (target.hasSelectItem) {
|
||||||
|
var _ipt = $(this).find("input[name='select_item']");
|
||||||
|
if (_ipt.attr("type") == "radio") {
|
||||||
|
_ipt.prop('checked', true);
|
||||||
|
target.find("tbody").find("tr").removeClass("treetable-selected");
|
||||||
|
$(this).addClass("treetable-selected");
|
||||||
|
} else {
|
||||||
|
if (_ipt.prop('checked')) {
|
||||||
|
_ipt.prop('checked', false);
|
||||||
|
$(this).removeClass("treetable-selected");
|
||||||
|
} else {
|
||||||
|
_ipt.prop('checked', true);
|
||||||
|
$(this).addClass("treetable-selected");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 注册小图标点击事件--展开缩起
|
||||||
|
var registerExpanderEvent = function() {
|
||||||
|
target.find("tbody").find("tr").find(".treetable-expander").unbind();
|
||||||
|
target.find("tbody").find("tr").find(".treetable-expander").click(function() {
|
||||||
|
var _isExpanded = $(this).hasClass(options.expanderExpandedClass);
|
||||||
|
var _isCollapsed = $(this).hasClass(options.expanderCollapsedClass);
|
||||||
|
if (_isExpanded || _isCollapsed) {
|
||||||
|
var tr = $(this).parent().parent();
|
||||||
|
var row_id = tr.attr("id");
|
||||||
|
var _ls = target.find("tbody").find("tr[id^='" + row_id + "_']"); //下所有
|
||||||
|
if (_isExpanded) {
|
||||||
|
$(this).removeClass(options.expanderExpandedClass);
|
||||||
|
$(this).addClass(options.expanderCollapsedClass);
|
||||||
|
if (_ls && _ls.length > 0) {
|
||||||
|
$.each(_ls, function(index, item) {
|
||||||
|
$(item).css("display", "none");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$(this).removeClass(options.expanderCollapsedClass);
|
||||||
|
$(this).addClass(options.expanderExpandedClass);
|
||||||
|
if (_ls && _ls.length > 0) {
|
||||||
|
$.each(_ls, function(index, item) {
|
||||||
|
// 父icon
|
||||||
|
var _p_icon = $("#" + $(item).attr("pid")).children().eq(options.expandColumn).find(".treetable-expander");
|
||||||
|
if (_p_icon.hasClass(options.expanderExpandedClass)) {
|
||||||
|
$(item).css("display", "table");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 刷新数据
|
||||||
|
target.refresh = function(parms) {
|
||||||
|
if(parms){
|
||||||
|
target.lastAjaxParams=parms;
|
||||||
|
}
|
||||||
|
initServer(target.lastAjaxParams);
|
||||||
|
}
|
||||||
|
// 添加数据刷新表格
|
||||||
|
target.appendData = function(data) {
|
||||||
|
// 下边的操作主要是为了查询时让一些没有根节点的节点显示
|
||||||
|
$.each(data, function(i, item) {
|
||||||
|
var _data = target.data_obj["id_" + item[options.code]];
|
||||||
|
var _p_data = target.data_obj["id_" + item[options.parentCode]];
|
||||||
|
var _c_list = target.data_list["_n_" + item[options.parentCode]];
|
||||||
|
var row_id = ""; //行id
|
||||||
|
var p_id = ""; //父行id
|
||||||
|
var _lv = 1; //如果没有父就是1默认显示
|
||||||
|
var tr; //要添加行的对象
|
||||||
|
if (_data && _data.row_id && _data.row_id != "") {
|
||||||
|
row_id = _data.row_id; // 如果已经存在了,就直接引用原来的
|
||||||
|
}
|
||||||
|
if (_p_data) {
|
||||||
|
p_id = _p_data.row_id;
|
||||||
|
if (row_id == "") {
|
||||||
|
var _tmp = 0
|
||||||
|
if (_c_list && _c_list.length > 0) {
|
||||||
|
_tmp = _c_list.length;
|
||||||
|
}
|
||||||
|
row_id = _p_data.row_id + "_" + _tmp;
|
||||||
|
}
|
||||||
|
_lv = _p_data.lv + 1; //如果有父
|
||||||
|
// 绘制行
|
||||||
|
tr = renderRow(item, false, _lv, row_id, p_id);
|
||||||
|
|
||||||
|
var _p_icon = $("#" + _p_data.row_id).children().eq(options.expandColumn).find(".treetable-expander");
|
||||||
|
var _isExpanded = _p_icon.hasClass(options.expanderExpandedClass);
|
||||||
|
var _isCollapsed = _p_icon.hasClass(options.expanderCollapsedClass);
|
||||||
|
// 父节点有没有展开收缩按钮
|
||||||
|
if (_isExpanded || _isCollapsed) {
|
||||||
|
// 父节点展开状态显示新加行
|
||||||
|
if (_isExpanded) {
|
||||||
|
tr.css("display", "table");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 父节点没有展开收缩按钮则添加
|
||||||
|
_p_icon.addClass(options.expanderCollapsedClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_data) {
|
||||||
|
$("#" + _data.row_id).before(tr);
|
||||||
|
$("#" + _data.row_id).remove();
|
||||||
|
} else {
|
||||||
|
// 计算父的同级下一行
|
||||||
|
var _tmp_ls = _p_data.row_id.split("_");
|
||||||
|
var _p_next = _p_data.row_id.substring(0, _p_data.row_id.length - 1) + (parseInt(_tmp_ls[_tmp_ls.length - 1]) + 1);
|
||||||
|
// 画上
|
||||||
|
$("#" + _p_next).before(tr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tr = renderRow(item, false, _lv, row_id, p_id);
|
||||||
|
if (_data) {
|
||||||
|
$("#" + _data.row_id).before(tr);
|
||||||
|
$("#" + _data.row_id).remove();
|
||||||
|
} else {
|
||||||
|
// 画上
|
||||||
|
var tbody = target.find("tbody");
|
||||||
|
tbody.append(tr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item.isShow = true;
|
||||||
|
// 缓存并格式化数据
|
||||||
|
formatData([item]);
|
||||||
|
});
|
||||||
|
registerExpanderEvent();
|
||||||
|
registerRowClickEvent();
|
||||||
|
initHiddenColumns();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 展开/折叠指定的行
|
||||||
|
target.toggleRow=function(id) {
|
||||||
|
var _rowData = target.data_obj["id_" + id];
|
||||||
|
var $row_expander = $("#"+_rowData.row_id).find(".treetable-expander");
|
||||||
|
$row_expander.trigger("click");
|
||||||
|
}
|
||||||
|
// 展开指定的行
|
||||||
|
target.expandRow=function(id) {
|
||||||
|
var _rowData = target.data_obj["id_" + id];
|
||||||
|
var $row_expander = $("#"+_rowData.row_id).find(".treetable-expander");
|
||||||
|
var _isCollapsed = $row_expander.hasClass(target.options.expanderCollapsedClass);
|
||||||
|
if (_isCollapsed) {
|
||||||
|
$row_expander.trigger("click");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 折叠 指定的行
|
||||||
|
target.collapseRow=function(id) {
|
||||||
|
var _rowData = target.data_obj["id_" + id];
|
||||||
|
var $row_expander = $("#"+_rowData.row_id).find(".treetable-expander");
|
||||||
|
var _isExpanded = $row_expander.hasClass(target.options.expanderExpandedClass);
|
||||||
|
if (_isExpanded) {
|
||||||
|
$row_expander.trigger("click");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 展开所有的行
|
||||||
|
target.expandAll=function() {
|
||||||
|
target.find("tbody").find("tr").find(".treetable-expander").each(function(i,n){
|
||||||
|
var _isCollapsed = $(n).hasClass(options.expanderCollapsedClass);
|
||||||
|
if (_isCollapsed) {
|
||||||
|
$(n).trigger("click");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 折叠所有的行
|
||||||
|
target.collapseAll=function() {
|
||||||
|
target.find("tbody").find("tr").find(".treetable-expander").each(function(i,n){
|
||||||
|
var _isExpanded = $(n).hasClass(options.expanderExpandedClass);
|
||||||
|
if (_isExpanded) {
|
||||||
|
$(n).trigger("click");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 显示指定列
|
||||||
|
target.showColumn=function(field,flag) {
|
||||||
|
var _index = $.inArray(field, target.hiddenColumns);
|
||||||
|
if (_index > -1) {
|
||||||
|
target.hiddenColumns.splice(_index, 1);
|
||||||
|
}
|
||||||
|
target.find("."+field+"_cls").show();
|
||||||
|
//是否更新列选项状态
|
||||||
|
if(flag&&options.showColumns){
|
||||||
|
var $input = $(".bootstrap-tree-table .treetable-bars .columns label").find("input[value='"+field+"']")
|
||||||
|
$input.prop("checked", 'checked');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 隐藏指定列
|
||||||
|
target.hideColumn=function(field,flag) {
|
||||||
|
target.hiddenColumns.push(field);
|
||||||
|
target.find("."+field+"_cls").hide();
|
||||||
|
//是否更新列选项状态
|
||||||
|
if(flag&&options.showColumns){
|
||||||
|
var $input = $(".bootstrap-tree-table .treetable-bars .columns label").find("input[value='"+field+"']")
|
||||||
|
$input.prop("checked", '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 初始化
|
||||||
|
init();
|
||||||
|
return target;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 组件方法封装........
|
||||||
|
$.fn.bootstrapTreeTable.methods = {
|
||||||
|
// 为了兼容bootstrap-table的写法,统一返回数组,这里返回了表格显示列的数据
|
||||||
|
getSelections: function(target, data) {
|
||||||
|
// 所有被选中的记录input
|
||||||
|
var _ipt = target.find("tbody").find("tr").find("input[name='select_item']:checked");
|
||||||
|
var chk_value = [];
|
||||||
|
// 如果是radio
|
||||||
|
if (_ipt.attr("type") == "radio") {
|
||||||
|
var _data = target.data_obj["id_" + _ipt.val()];
|
||||||
|
chk_value.push(_data);
|
||||||
|
} else {
|
||||||
|
_ipt.each(function(_i, _item) {
|
||||||
|
var _data = target.data_obj["id_" + $(_item).val()];
|
||||||
|
chk_value.push(_data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return chk_value;
|
||||||
|
},
|
||||||
|
// 刷新记录
|
||||||
|
refresh: function(target, parms) {
|
||||||
|
if (parms) {
|
||||||
|
target.refresh(parms);
|
||||||
|
} else {
|
||||||
|
target.refresh();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 添加数据到表格
|
||||||
|
appendData: function(target, data) {
|
||||||
|
if (data) {
|
||||||
|
target.appendData(data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 展开/折叠指定的行
|
||||||
|
toggleRow: function(target, id) {
|
||||||
|
target.toggleRow(id);
|
||||||
|
},
|
||||||
|
// 展开指定的行
|
||||||
|
expandRow: function(target, id) {
|
||||||
|
target.expandRow(id);
|
||||||
|
},
|
||||||
|
// 折叠 指定的行
|
||||||
|
collapseRow: function(target, id) {
|
||||||
|
target.collapseRow(id);
|
||||||
|
},
|
||||||
|
// 展开所有的行
|
||||||
|
expandAll: function(target) {
|
||||||
|
target.expandAll();
|
||||||
|
},
|
||||||
|
// 折叠所有的行
|
||||||
|
collapseAll: function(target) {
|
||||||
|
target.collapseAll();
|
||||||
|
},
|
||||||
|
// 显示指定列
|
||||||
|
showColumn: function(target,field) {
|
||||||
|
target.showColumn(field,true);
|
||||||
|
},
|
||||||
|
// 隐藏指定列
|
||||||
|
hideColumn: function(target,field) {
|
||||||
|
target.hideColumn(field,true);
|
||||||
|
}
|
||||||
|
// 组件的其他方法也可以进行类似封装........
|
||||||
|
};
|
||||||
|
|
||||||
|
$.fn.bootstrapTreeTable.defaults = {
|
||||||
|
code: 'code', // 选取记录返回的值,用于设置父子关系
|
||||||
|
parentCode: 'parentCode', // 用于设置父子关系
|
||||||
|
rootIdValue: null, // 设置根节点id值----可指定根节点,默认为null,"",0,"0"
|
||||||
|
data: null, // 构造table的数据集合
|
||||||
|
type: "GET", // 请求数据的ajax类型
|
||||||
|
url: null, // 请求数据的ajax的url
|
||||||
|
ajaxParams: {}, // 请求数据的ajax的data属性
|
||||||
|
expandColumn: 0, // 在哪一列上面显示展开按钮
|
||||||
|
expandAll: false, // 是否全部展开
|
||||||
|
expandFirst: true, // 是否默认第一级展开--expandAll为false时生效
|
||||||
|
striped: false, // 是否各行渐变色
|
||||||
|
bordered: true, // 是否显示边框
|
||||||
|
hover: true, // 是否鼠标悬停
|
||||||
|
condensed: false, // 是否紧缩表格
|
||||||
|
columns: [], // 列
|
||||||
|
toolbar: null, // 顶部工具条
|
||||||
|
height: 0, // 表格高度
|
||||||
|
showTitle: true, // 是否采用title属性显示字段内容(被formatter格式化的字段不会显示)
|
||||||
|
showColumns: true, // 是否显示内容列下拉框
|
||||||
|
showRefresh: true, // 是否显示刷新按钮
|
||||||
|
expanderExpandedClass: 'glyphicon glyphicon-chevron-down', // 展开的按钮的图标
|
||||||
|
expanderCollapsedClass: 'glyphicon glyphicon-chevron-right' // 缩起的按钮的图标
|
||||||
|
|
||||||
|
};
|
||||||
|
})(jQuery);
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 601 B After Width: | Height: | Size: 601 B |
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
Before Width: | Height: | Size: 570 B After Width: | Height: | Size: 570 B |
Before Width: | Height: | Size: 762 B After Width: | Height: | Size: 762 B |
Before Width: | Height: | Size: 399 B After Width: | Height: | Size: 399 B |
Before Width: | Height: | Size: 710 B After Width: | Height: | Size: 710 B |
Before Width: | Height: | Size: 432 B After Width: | Height: | Size: 432 B |
Before Width: | Height: | Size: 534 B After Width: | Height: | Size: 534 B |
Before Width: | Height: | Size: 529 B After Width: | Height: | Size: 529 B |
Before Width: | Height: | Size: 467 B After Width: | Height: | Size: 467 B |
Before Width: | Height: | Size: 45 B After Width: | Height: | Size: 45 B |
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 381 B |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 45 B After Width: | Height: | Size: 45 B |
Before Width: | Height: | Size: 933 B After Width: | Height: | Size: 933 B |
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 381 B |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 421 B |
Before Width: | Height: | Size: 45 B After Width: | Height: | Size: 45 B |
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 381 B |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |