main
吴顺杰 11 months ago
parent 7e8f292a48
commit d2819a22f2

@ -18,23 +18,29 @@
* 权限认证使用Jwt支持多终端认证系统。 * 权限认证使用Jwt支持多终端认证系统。
* 支持加载动态权限菜单,多方式轻松权限控制。 * 支持加载动态权限菜单,多方式轻松权限控制。
* 高效率开发,使用代码生成器可以一键生成前后端代码。 * 高效率开发,使用代码生成器可以一键生成前后端代码。
* 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev))版本[RuoYi-Vue3](https://github.com/yangzongzhuan/RuoYi-Vue3),保持同步更新。 *
* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast)Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev)
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud) )版本[RuoYi-Vue3](https://github.com/yangzongzhuan/RuoYi-Vue3),保持同步更新。
* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast)
Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi)
,微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)   * 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)  
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)   * 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link)
,腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)
  
## 内置功能 ## 内置功能
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。 1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。 2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
3. 岗位管理:配置系统用户所属担任职务。 3. 岗位管理:配置系统用户所属担任职务。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。 4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。 5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。 6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
7. 参数管理:对系统动态配置常用参数。 7. 参数管理:对系统动态配置常用参数。
8. 通知公告:系统通知公告信息发布维护。 8. 通知公告:系统通知公告信息发布维护。
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。 9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
10. 登录日志:系统登录日志记录查询包含登录异常。 10. 登录日志:系统登录日志记录查询包含登录异常。
11. 在线用户:当前系统中活跃用户状态监控。 11. 在线用户:当前系统中活跃用户状态监控。
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。 12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
@ -47,7 +53,7 @@
## 在线体验 ## 在线体验
- admin/admin123 - admin/admin123
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。 - 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
演示地址http://vue.ruoyi.vip 演示地址http://vue.ruoyi.vip
@ -90,7 +96,7 @@
</tr> </tr>
</table> </table>
## 若依前后端分离交流群 ## 若依前后端分离交流群
QQ群 [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/已满-201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [![加入QQ群](https://img.shields.io/badge/已满-101456076-blue.svg)](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [![加入QQ群](https://img.shields.io/badge/已满-101539465-blue.svg)](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [![加入QQ群](https://img.shields.io/badge/已满-264312783-blue.svg)](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [![加入QQ群](https://img.shields.io/badge/已满-167385320-blue.svg)](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [![加入QQ群](https://img.shields.io/badge/已满-104748341-blue.svg)](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [![加入QQ群](https://img.shields.io/badge/已满-160110482-blue.svg)](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [![加入QQ群](https://img.shields.io/badge/已满-170801498-blue.svg)](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) [![加入QQ群](https://img.shields.io/badge/已满-108482800-blue.svg)](https://jq.qq.com/?_wv=1027&k=eCx8eyoJ) [![加入QQ群](https://img.shields.io/badge/已满-101046199-blue.svg)](https://jq.qq.com/?_wv=1027&k=SpyH2875) [![加入QQ群](https://img.shields.io/badge/已满-136919097-blue.svg)](https://jq.qq.com/?_wv=1027&k=tKEt51dz) [![加入QQ群](https://img.shields.io/badge/143961921-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=0vBbSb0ztbBgVtn3kJS-Q4HUNYwip89G&authKey=8irq5PhutrZmWIvsUsklBxhj57l%2F1nOZqjzigkXZVoZE451GG4JHPOqW7AW6cf0T&noverify=0&group_code=143961921) 点击按钮入群。 QQ群 [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/已满-201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [![加入QQ群](https://img.shields.io/badge/已满-101456076-blue.svg)](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [![加入QQ群](https://img.shields.io/badge/已满-101539465-blue.svg)](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [![加入QQ群](https://img.shields.io/badge/已满-264312783-blue.svg)](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [![加入QQ群](https://img.shields.io/badge/已满-167385320-blue.svg)](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [![加入QQ群](https://img.shields.io/badge/已满-104748341-blue.svg)](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [![加入QQ群](https://img.shields.io/badge/已满-160110482-blue.svg)](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [![加入QQ群](https://img.shields.io/badge/已满-170801498-blue.svg)](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) [![加入QQ群](https://img.shields.io/badge/已满-108482800-blue.svg)](https://jq.qq.com/?_wv=1027&k=eCx8eyoJ) [![加入QQ群](https://img.shields.io/badge/已满-101046199-blue.svg)](https://jq.qq.com/?_wv=1027&k=SpyH2875) [![加入QQ群](https://img.shields.io/badge/已满-136919097-blue.svg)](https://jq.qq.com/?_wv=1027&k=tKEt51dz) [![加入QQ群](https://img.shields.io/badge/143961921-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=0vBbSb0ztbBgVtn3kJS-Q4HUNYwip89G&authKey=8irq5PhutrZmWIvsUsklBxhj57l%2F1nOZqjzigkXZVoZE451GG4JHPOqW7AW6cf0T&noverify=0&group_code=143961921)
点击按钮入群。

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
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>3.8.6</version> <version>3.8.6</version>
@ -11,7 +11,7 @@
<name>ruoyi</name> <name>ruoyi</name>
<url>http://www.ruoyi.vip</url> <url>http://www.ruoyi.vip</url>
<description>若依管理系统</description> <description>若依管理系统</description>
<properties> <properties>
<ruoyi.version>3.8.6</ruoyi.version> <ruoyi.version>3.8.6</ruoyi.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
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">
<parent> <parent>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
@ -35,7 +35,7 @@
</dependency> </dependency>
<!-- Mysql驱动包 --> <!-- Mysql驱动包 -->
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
@ -84,15 +84,15 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version> <version>3.1.0</version>
<configuration> <configuration>
<failOnMissingWebXml>false</failOnMissingWebXml> <failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName> <warName>${project.artifactId}</warName>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
</build> </build>

@ -11,12 +11,11 @@ import java.net.UnknownHostException;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class RuoYiApplication public class RuoYiApplication {
{
public static void main(String[] args) { public static void main(String[] args) {
// 热部署开关 todo // 热部署开关 todo
System.setProperty("spring.devtools.restart.enabled", "false"); System.setProperty("spring.devtools.restart.enabled", "false");

@ -5,14 +5,12 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
/** /**
* web * web
* *
* @author ruoyi * @author ruoyi
*/ */
public class RuoYiServletInitializer extends SpringBootServletInitializer public class RuoYiServletInitializer extends SpringBootServletInitializer {
{
@Override @Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
{
return application.sources(RuoYiApplication.class); return application.sources(RuoYiApplication.class);
} }
} }

@ -3,17 +3,21 @@ package com.ruoyi.page.controller;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.page.domain.Alarm; import com.ruoyi.page.domain.Alarm;
import com.ruoyi.page.domain.dto.request.AlarmFindRequest; import com.ruoyi.page.domain.dto.request.AlarmFindRequest;
import com.ruoyi.page.service.IAlarmService; import com.ruoyi.page.service.IAlarmService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.*; 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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**

@ -8,7 +8,6 @@ import com.ruoyi.page.domain.dto.request.EventPageRequest;
import com.ruoyi.page.service.IEventService; import com.ruoyi.page.service.IEventService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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.PathVariable; import org.springframework.web.bind.annotation.PathVariable;

@ -56,7 +56,6 @@ public class FireController extends BaseController {
* *
* @param id * @param id
* @return * @return
*
*/ */
@GetMapping("{id}") @GetMapping("{id}")
@ApiOperation(value = "通过主键查询单条119数据", response = Fire.class) @ApiOperation(value = "通过主键查询单条119数据", response = Fire.class)

@ -16,6 +16,7 @@ import javax.annotation.Resource;
/** /**
* quartz_log * quartz_log
*
* @author du * @author du
* @since 2024/6/6 9:16 * @since 2024/6/6 9:16
*/ */

@ -1,479 +1,222 @@
package com.ruoyi.page.domain; package com.ruoyi.page.domain;
import java.math.BigDecimal; import com.baomidou.mybatisplus.annotation.TableField;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/** /**
* alarm * alarm
* *
* @author ruoyi * @author ruoyi
* @date 2024-05-30 * @date 2024-05-30
*/ */
public class Alarm extends BaseEntity @Data
{ @EqualsAndHashCode(callSuper = true)
private static final long serialVersionUID = 1L; public class Alarm extends BaseEntity {
/** 主键id */ private static final long serialVersionUID = 682569575060211748L;
/**
* id
*/
private Long emergencyEventId; private Long emergencyEventId;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long emergencyEventSource; private Long emergencyEventSource;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long emergencyEventStatus; private Long emergencyEventStatus;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long warnResponseStatus; private Long warnResponseStatus;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long emergencyResponseStatus; private Long emergencyResponseStatus;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String emergencyEventTitle; private String emergencyEventTitle;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long emergencyEventType; private Long emergencyEventType;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long emergencyEventLevel; private Long emergencyEventLevel;
/** 报警时间 */ /**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date emergencyEventTime; private Date emergencyEventTime;
/** 报警内容 */ /**
*
*/
@Excel(name = "报警内容") @Excel(name = "报警内容")
private String emergencyEventDesc; private String emergencyEventDesc;
/** 报警地址 */ /**
*
*/
@Excel(name = "报警地址") @Excel(name = "报警地址")
private String emergencyEventAddress; private String emergencyEventAddress;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String emergencyEventArea; private String emergencyEventArea;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private BigDecimal emergencyEventLon; private BigDecimal emergencyEventLon;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private BigDecimal emergencyEventLat; private BigDecimal emergencyEventLat;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String submitUnit; private String submitUnit;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String submitUnitContact; private String submitUnitContact;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String submitUnitTelephone; private String submitUnitTelephone;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String reportPerson; private String reportPerson;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String reportPersonTelephone; private String reportPersonTelephone;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String fileUrls; private String fileUrls;
/** 是否删除 0未删除 1删除 */ /**
* 0 1
*/
private Integer delFlag; private Integer delFlag;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String sendOutTimes; private String sendOutTimes;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long groupId; private Long groupId;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long isRehearsal; private Long isRehearsal;
/** 报警电话 */ /**
*
*/
@Excel(name = "报警电话") @Excel(name = "报警电话")
private String alarmPhoneNumber; private String alarmPhoneNumber;
/** 源id */ /**
* id
*/
@Excel(name = "源id") @Excel(name = "源id")
private String sourceId; private String sourceId;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long isJudged; private Long isJudged;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String eventDetail; private String eventDetail;
/** 预警大类 */ /**
*
*/
@Excel(name = "预警大类") @Excel(name = "预警大类")
private String aiClass; private String aiClass;
/** 预警小类 */ /**
*
*/
@Excel(name = "预警小类") @Excel(name = "预警小类")
private String aiClass2; private String aiClass2;
/** 紧急程度 */ /**
*
*/
@Excel(name = "紧急程度") @Excel(name = "紧急程度")
private String aiLevel; private String aiLevel;
/** 紧急系数 */ /**
*
*/
@Excel(name = "紧急系数") @Excel(name = "紧急系数")
private BigDecimal aiNum; private BigDecimal aiNum;
public void setEmergencyEventId(Long emergencyEventId) /**
{ * 120event_id
this.emergencyEventId = emergencyEventId; */
} @ApiModelProperty(value = "120的event_id")
@TableField(value = "ai_120_id")
public Long getEmergencyEventId() private String ai120Id;
{
return emergencyEventId;
}
public void setEmergencyEventSource(Long emergencyEventSource)
{
this.emergencyEventSource = emergencyEventSource;
}
public Long getEmergencyEventSource()
{
return emergencyEventSource;
}
public void setEmergencyEventStatus(Long emergencyEventStatus)
{
this.emergencyEventStatus = emergencyEventStatus;
}
public Long getEmergencyEventStatus()
{
return emergencyEventStatus;
}
public void setWarnResponseStatus(Long warnResponseStatus)
{
this.warnResponseStatus = warnResponseStatus;
}
public Long getWarnResponseStatus()
{
return warnResponseStatus;
}
public void setEmergencyResponseStatus(Long emergencyResponseStatus)
{
this.emergencyResponseStatus = emergencyResponseStatus;
}
public Long getEmergencyResponseStatus()
{
return emergencyResponseStatus;
}
public void setEmergencyEventTitle(String emergencyEventTitle)
{
this.emergencyEventTitle = emergencyEventTitle;
}
public String getEmergencyEventTitle()
{
return emergencyEventTitle;
}
public void setEmergencyEventType(Long emergencyEventType)
{
this.emergencyEventType = emergencyEventType;
}
public Long getEmergencyEventType()
{
return emergencyEventType;
}
public void setEmergencyEventLevel(Long emergencyEventLevel)
{
this.emergencyEventLevel = emergencyEventLevel;
}
public Long getEmergencyEventLevel()
{
return emergencyEventLevel;
}
public void setEmergencyEventTime(Date emergencyEventTime)
{
this.emergencyEventTime = emergencyEventTime;
}
public Date getEmergencyEventTime()
{
return emergencyEventTime;
}
public void setEmergencyEventDesc(String emergencyEventDesc)
{
this.emergencyEventDesc = emergencyEventDesc;
}
public String getEmergencyEventDesc()
{
return emergencyEventDesc;
}
public void setEmergencyEventAddress(String emergencyEventAddress)
{
this.emergencyEventAddress = emergencyEventAddress;
}
public String getEmergencyEventAddress()
{
return emergencyEventAddress;
}
public void setEmergencyEventArea(String emergencyEventArea)
{
this.emergencyEventArea = emergencyEventArea;
}
public String getEmergencyEventArea()
{
return emergencyEventArea;
}
public void setEmergencyEventLon(BigDecimal emergencyEventLon)
{
this.emergencyEventLon = emergencyEventLon;
}
public BigDecimal getEmergencyEventLon()
{
return emergencyEventLon;
}
public void setEmergencyEventLat(BigDecimal emergencyEventLat)
{
this.emergencyEventLat = emergencyEventLat;
}
public BigDecimal getEmergencyEventLat()
{
return emergencyEventLat;
}
public void setSubmitUnit(String submitUnit)
{
this.submitUnit = submitUnit;
}
public String getSubmitUnit()
{
return submitUnit;
}
public void setSubmitUnitContact(String submitUnitContact)
{
this.submitUnitContact = submitUnitContact;
}
public String getSubmitUnitContact()
{
return submitUnitContact;
}
public void setSubmitUnitTelephone(String submitUnitTelephone)
{
this.submitUnitTelephone = submitUnitTelephone;
}
public String getSubmitUnitTelephone()
{
return submitUnitTelephone;
}
public void setReportPerson(String reportPerson)
{
this.reportPerson = reportPerson;
}
public String getReportPerson()
{
return reportPerson;
}
public void setReportPersonTelephone(String reportPersonTelephone)
{
this.reportPersonTelephone = reportPersonTelephone;
}
public String getReportPersonTelephone()
{
return reportPersonTelephone;
}
public void setFileUrls(String fileUrls)
{
this.fileUrls = fileUrls;
}
public String getFileUrls()
{
return fileUrls;
}
public void setDelFlag(Integer delFlag)
{
this.delFlag = delFlag;
}
public Integer getDelFlag()
{
return delFlag;
}
public void setSendOutTimes(String sendOutTimes)
{
this.sendOutTimes = sendOutTimes;
}
public String getSendOutTimes()
{
return sendOutTimes;
}
public void setGroupId(Long groupId)
{
this.groupId = groupId;
}
public Long getGroupId()
{
return groupId;
}
public void setIsRehearsal(Long isRehearsal)
{
this.isRehearsal = isRehearsal;
}
public Long getIsRehearsal()
{
return isRehearsal;
}
public void setAlarmPhoneNumber(String alarmPhoneNumber)
{
this.alarmPhoneNumber = alarmPhoneNumber;
}
public String getAlarmPhoneNumber()
{
return alarmPhoneNumber;
}
public void setSourceId(String sourceId)
{
this.sourceId = sourceId;
}
public String getSourceId()
{
return sourceId;
}
public void setIsJudged(Long isJudged)
{
this.isJudged = isJudged;
}
public Long getIsJudged()
{
return isJudged;
}
public void setEventDetail(String eventDetail)
{
this.eventDetail = eventDetail;
}
public String getEventDetail()
{
return eventDetail;
}
public void setAiClass(String aiClass)
{
this.aiClass = aiClass;
}
public String getAiClass()
{
return aiClass;
}
public void setAiClass2(String aiClass2)
{
this.aiClass2 = aiClass2;
}
public String getAiClass2()
{
return aiClass2;
}
public void setAiLevel(String aiLevel)
{
this.aiLevel = aiLevel;
}
public String getAiLevel()
{
return aiLevel;
}
public void setAiNum(BigDecimal aiNum)
{
this.aiNum = aiNum;
}
public BigDecimal getAiNum()
{
return aiNum;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("emergencyEventId", getEmergencyEventId())
.append("emergencyEventSource", getEmergencyEventSource())
.append("emergencyEventStatus", getEmergencyEventStatus())
.append("warnResponseStatus", getWarnResponseStatus())
.append("emergencyResponseStatus", getEmergencyResponseStatus())
.append("emergencyEventTitle", getEmergencyEventTitle())
.append("emergencyEventType", getEmergencyEventType())
.append("emergencyEventLevel", getEmergencyEventLevel())
.append("emergencyEventTime", getEmergencyEventTime())
.append("emergencyEventDesc", getEmergencyEventDesc())
.append("emergencyEventAddress", getEmergencyEventAddress())
.append("emergencyEventArea", getEmergencyEventArea())
.append("emergencyEventLon", getEmergencyEventLon())
.append("emergencyEventLat", getEmergencyEventLat())
.append("submitUnit", getSubmitUnit())
.append("submitUnitContact", getSubmitUnitContact())
.append("submitUnitTelephone", getSubmitUnitTelephone())
.append("reportPerson", getReportPerson())
.append("reportPersonTelephone", getReportPersonTelephone())
.append("remark", getRemark())
.append("fileUrls", getFileUrls())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("sendOutTimes", getSendOutTimes())
.append("groupId", getGroupId())
.append("isRehearsal", getIsRehearsal())
.append("alarmPhoneNumber", getAlarmPhoneNumber())
.append("sourceId", getSourceId())
.append("isJudged", getIsJudged())
.append("eventDetail", getEventDetail())
.append("aiClass", getAiClass())
.append("aiClass2", getAiClass2())
.append("aiLevel", getAiLevel())
.append("aiNum", getAiNum())
.toString();
}
} }

@ -14,13 +14,14 @@ import java.util.Date;
/** /**
* quartz_log * quartz_log
*
* @author du * @author du
* @since 2024/6/6 9:21 * @since 2024/6/6 9:21
*/ */
@Data @Data
@ApiModel("定时任务日志实体类") @ApiModel("定时任务日志实体类")
@TableName(value = "quartz_log") @TableName(value = "quartz_log")
public class QuartzLog implements Serializable { public class QuartzLog implements Serializable {
private static final long serialVersionUID = -96682169109217319L; private static final long serialVersionUID = -96682169109217319L;
@ -29,7 +30,7 @@ public class QuartzLog implements Serializable {
* id * id
*/ */
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
@TableId(value = "id",type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Long id; private Long id;
/** /**

@ -1,21 +1,21 @@
package com.ruoyi.page.mapper; package com.ruoyi.page.mapper;
import java.util.List;
import com.ruoyi.page.domain.Alarm; import com.ruoyi.page.domain.Alarm;
import com.ruoyi.page.domain.dto.request.AlarmFindRequest; import com.ruoyi.page.domain.dto.request.AlarmFindRequest;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* Mapper * Mapper
* *
* @author ruoyi * @author ruoyi
* @date 2024-05-30 * @date 2024-05-30
*/ */
public interface AlarmMapper public interface AlarmMapper {
{
/** /**
* *
* *
* @param emergencyEventId * @param emergencyEventId
* @return * @return
*/ */
@ -23,15 +23,15 @@ public interface AlarmMapper
/** /**
* *
* *
* @param req * @param req
* @return * @return
*/ */
public List<Alarm> selectAlarmList(@Param("req")AlarmFindRequest req); public List<Alarm> selectAlarmList(@Param("req") AlarmFindRequest req);
/** /**
* *
* *
* @param alarm * @param alarm
* @return * @return
*/ */
@ -39,7 +39,7 @@ public interface AlarmMapper
/** /**
* *
* *
* @param alarm * @param alarm
* @return * @return
*/ */
@ -47,7 +47,7 @@ public interface AlarmMapper
/** /**
* *
* *
* @param emergencyEventId * @param emergencyEventId
* @return * @return
*/ */
@ -55,7 +55,7 @@ public interface AlarmMapper
/** /**
* *
* *
* @param emergencyEventIds * @param emergencyEventIds
* @return * @return
*/ */

@ -8,15 +8,14 @@ import java.util.List;
/** /**
* Mapper * Mapper
* *
* @author ruoyi * @author ruoyi
* @date 2024-05-30 * @date 2024-05-30
*/ */
public interface EventMapper public interface EventMapper {
{
/** /**
* *
* *
* @param eventId * @param eventId
* @return * @return
*/ */
@ -24,7 +23,7 @@ public interface EventMapper
/** /**
* *
* *
* @param event * @param event
* @return * @return
*/ */
@ -32,7 +31,7 @@ public interface EventMapper
/** /**
* *
* *
* @param event * @param event
* @return * @return
*/ */
@ -40,7 +39,7 @@ public interface EventMapper
/** /**
* *
* *
* @param event * @param event
* @return * @return
*/ */
@ -48,7 +47,7 @@ public interface EventMapper
/** /**
* *
* *
* @param eventId * @param eventId
* @return * @return
*/ */
@ -56,7 +55,7 @@ public interface EventMapper
/** /**
* *
* *
* @param eventIds * @param eventIds
* @return * @return
*/ */

@ -7,15 +7,15 @@ import org.apache.ibatis.annotations.Param;
/** /**
* quartz_log * quartz_log
* *
* @author ruoyi * @author ruoyi
* @date 2024-05-30 * @date 2024-05-30
*/ */
public interface QuartzLogMapper extends BaseMapper<QuartzLog> public interface QuartzLogMapper extends BaseMapper<QuartzLog> {
{
/** /**
* *
*
* @param page * @param page
* @param quartzLog * @param quartzLog
* @return * @return

@ -1,20 +1,20 @@
package com.ruoyi.page.service; package com.ruoyi.page.service;
import java.util.List;
import com.ruoyi.page.domain.Alarm; import com.ruoyi.page.domain.Alarm;
import com.ruoyi.page.domain.dto.request.AlarmFindRequest; import com.ruoyi.page.domain.dto.request.AlarmFindRequest;
import java.util.List;
/** /**
* Service * Service
* *
* @author ruoyi * @author ruoyi
* @date 2024-05-30 * @date 2024-05-30
*/ */
public interface IAlarmService public interface IAlarmService {
{
/** /**
* *
* *
* @param emergencyEventId * @param emergencyEventId
* @return * @return
*/ */
@ -22,7 +22,7 @@ public interface IAlarmService
/** /**
* *
* *
* @param req * @param req
* @return * @return
*/ */
@ -30,7 +30,7 @@ public interface IAlarmService
/** /**
* *
* *
* @param alarm * @param alarm
* @return * @return
*/ */
@ -38,7 +38,7 @@ public interface IAlarmService
/** /**
* *
* *
* @param alarm * @param alarm
* @return * @return
*/ */
@ -46,7 +46,7 @@ public interface IAlarmService
/** /**
* *
* *
* @param emergencyEventIds * @param emergencyEventIds
* @return * @return
*/ */
@ -54,7 +54,7 @@ public interface IAlarmService
/** /**
* *
* *
* @param emergencyEventId * @param emergencyEventId
* @return * @return
*/ */

@ -7,15 +7,14 @@ import java.util.List;
/** /**
* Service * Service
* *
* @author ruoyi * @author ruoyi
* @date 2024-05-30 * @date 2024-05-30
*/ */
public interface IEventService public interface IEventService {
{
/** /**
* *
* *
* @param eventId * @param eventId
* @return * @return
*/ */
@ -23,7 +22,7 @@ public interface IEventService
/** /**
* *
* *
* @param req * @param req
* @return * @return
*/ */
@ -31,7 +30,7 @@ public interface IEventService
/** /**
* *
* *
* @param event * @param event
* @return * @return
*/ */
@ -39,7 +38,7 @@ public interface IEventService
/** /**
* *
* *
* @param event * @param event
* @return * @return
*/ */
@ -47,7 +46,7 @@ public interface IEventService
/** /**
* *
* *
* @param eventIds * @param eventIds
* @return * @return
*/ */
@ -55,7 +54,7 @@ public interface IEventService
/** /**
* *
* *
* @param eventId * @param eventId
* @return * @return
*/ */

@ -2,11 +2,11 @@ package com.ruoyi.page.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.page.domain.Event;
import com.ruoyi.page.domain.QuartzLog; import com.ruoyi.page.domain.QuartzLog;
/** /**
* quartz_log * quartz_log
*
* @author du * @author du
* @since 2024/6/6 9:20 * @since 2024/6/6 9:20
*/ */
@ -15,10 +15,11 @@ public interface QuartzLogService extends IService<QuartzLog> {
/** /**
* *
*
* @param page * @param page
* @param quartzLog * @param quartzLog
* @return * @return
*/ */
Page<QuartzLog> page(Page<QuartzLog> page,QuartzLog quartzLog); Page<QuartzLog> page(Page<QuartzLog> page, QuartzLog quartzLog);
} }

@ -1,99 +1,91 @@
package com.ruoyi.page.service.impl; package com.ruoyi.page.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.page.domain.Alarm;
import com.ruoyi.page.domain.dto.request.AlarmFindRequest; import com.ruoyi.page.domain.dto.request.AlarmFindRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.page.mapper.AlarmMapper; import com.ruoyi.page.mapper.AlarmMapper;
import com.ruoyi.page.domain.Alarm;
import com.ruoyi.page.service.IAlarmService; import com.ruoyi.page.service.IAlarmService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
/** /**
* Service * Service
* *
* @author ruoyi * @author ruoyi
* @date 2024-05-30 * @date 2024-05-30
*/ */
@Service @Service
public class AlarmServiceImpl implements IAlarmService public class AlarmServiceImpl implements IAlarmService {
{
@Resource @Resource
private AlarmMapper alarmMapper; private AlarmMapper alarmMapper;
/** /**
* *
* *
* @param emergencyEventId * @param emergencyEventId
* @return * @return
*/ */
@Override @Override
public Alarm selectAlarmByEmergencyEventId(Long emergencyEventId) public Alarm selectAlarmByEmergencyEventId(Long emergencyEventId) {
{
return alarmMapper.selectAlarmByEmergencyEventId(emergencyEventId); return alarmMapper.selectAlarmByEmergencyEventId(emergencyEventId);
} }
/** /**
* *
* *
* @param req * @param req
* @return * @return
*/ */
@Override @Override
public List<Alarm> selectAlarmList(AlarmFindRequest req) public List<Alarm> selectAlarmList(AlarmFindRequest req) {
{
return alarmMapper.selectAlarmList(req); return alarmMapper.selectAlarmList(req);
} }
/** /**
* *
* *
* @param alarm * @param alarm
* @return * @return
*/ */
@Override @Override
public int insertAlarm(Alarm alarm) public int insertAlarm(Alarm alarm) {
{
alarm.setCreateTime(DateUtils.getNowDate()); alarm.setCreateTime(DateUtils.getNowDate());
return alarmMapper.insertAlarm(alarm); return alarmMapper.insertAlarm(alarm);
} }
/** /**
* *
* *
* @param alarm * @param alarm
* @return * @return
*/ */
@Override @Override
public int updateAlarm(Alarm alarm) public int updateAlarm(Alarm alarm) {
{
alarm.setUpdateTime(DateUtils.getNowDate()); alarm.setUpdateTime(DateUtils.getNowDate());
return alarmMapper.updateAlarm(alarm); return alarmMapper.updateAlarm(alarm);
} }
/** /**
* *
* *
* @param emergencyEventIds * @param emergencyEventIds
* @return * @return
*/ */
@Override @Override
public int deleteAlarmByEmergencyEventIds(Long[] emergencyEventIds) public int deleteAlarmByEmergencyEventIds(Long[] emergencyEventIds) {
{
return alarmMapper.deleteAlarmByEmergencyEventIds(emergencyEventIds); return alarmMapper.deleteAlarmByEmergencyEventIds(emergencyEventIds);
} }
/** /**
* *
* *
* @param emergencyEventId * @param emergencyEventId
* @return * @return
*/ */
@Override @Override
public int deleteAlarmByEmergencyEventId(Long emergencyEventId) public int deleteAlarmByEmergencyEventId(Long emergencyEventId) {
{
return alarmMapper.deleteAlarmByEmergencyEventId(emergencyEventId); return alarmMapper.deleteAlarmByEmergencyEventId(emergencyEventId);
} }
} }

@ -4,7 +4,6 @@ import com.ruoyi.page.domain.Event;
import com.ruoyi.page.domain.dto.request.EventPageRequest; import com.ruoyi.page.domain.dto.request.EventPageRequest;
import com.ruoyi.page.mapper.EventMapper; import com.ruoyi.page.mapper.EventMapper;
import com.ruoyi.page.service.IEventService; import com.ruoyi.page.service.IEventService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -13,85 +12,78 @@ import java.util.List;
/** /**
* Service * Service
* *
* @author ruoyi * @author ruoyi
* @date 2024-05-30 * @date 2024-05-30
*/ */
@Service @Service
public class EventServiceImpl implements IEventService public class EventServiceImpl implements IEventService {
{
@Resource @Resource
private EventMapper eventMapper; private EventMapper eventMapper;
/** /**
* *
* *
* @param eventId * @param eventId
* @return * @return
*/ */
@Override @Override
public Event selectEventByEventId(String eventId) public Event selectEventByEventId(String eventId) {
{
return eventMapper.selectEventByEventId(eventId); return eventMapper.selectEventByEventId(eventId);
} }
/** /**
* *
* *
* @param req * @param req
* @return * @return
*/ */
@Override @Override
public List<Event> selectEventList(EventPageRequest req) public List<Event> selectEventList(EventPageRequest req) {
{
return eventMapper.selectEventList(req); return eventMapper.selectEventList(req);
} }
/** /**
* *
* *
* @param event * @param event
* @return * @return
*/ */
@Override @Override
public int insertEvent(Event event) public int insertEvent(Event event) {
{
return eventMapper.insertEvent(event); return eventMapper.insertEvent(event);
} }
/** /**
* *
* *
* @param event * @param event
* @return * @return
*/ */
@Override @Override
public int updateEvent(Event event) public int updateEvent(Event event) {
{
return eventMapper.updateEvent(event); return eventMapper.updateEvent(event);
} }
/** /**
* *
* *
* @param eventIds * @param eventIds
* @return * @return
*/ */
@Override @Override
public int deleteEventByEventIds(String[] eventIds) public int deleteEventByEventIds(String[] eventIds) {
{
return eventMapper.deleteEventByEventIds(eventIds); return eventMapper.deleteEventByEventIds(eventIds);
} }
/** /**
* *
* *
* @param eventId * @param eventId
* @return * @return
*/ */
@Override @Override
public int deleteEventByEventId(String eventId) public int deleteEventByEventId(String eventId) {
{
return eventMapper.deleteEventByEventId(eventId); return eventMapper.deleteEventByEventId(eventId);
} }
} }

@ -9,19 +9,21 @@ import org.springframework.stereotype.Service;
/** /**
* quartz_log * quartz_log
*
* @author du * @author du
* @since 2024/6/6 9:40 * @since 2024/6/6 9:40
*/ */
@Service @Service
public class QuartzLogServiceImpl extends ServiceImpl<QuartzLogMapper, QuartzLog> implements QuartzLogService { public class QuartzLogServiceImpl extends ServiceImpl<QuartzLogMapper, QuartzLog> implements QuartzLogService {
/** /**
* *
*
* @param page * @param page
* @param quartzLog * @param quartzLog
* @return * @return
*/ */
@Override @Override
public Page<QuartzLog> page(Page<QuartzLog> page, QuartzLog quartzLog) { public Page<QuartzLog> page(Page<QuartzLog> page, QuartzLog quartzLog) {
return baseMapper.page(page,quartzLog); return baseMapper.page(page, quartzLog);
} }
} }

@ -1,15 +1,5 @@
package com.ruoyi.web.controller.common; package com.ruoyi.web.controller.common;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.google.code.kaptcha.Producer; import com.google.code.kaptcha.Producer;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.CacheConstants;
@ -19,15 +9,25 @@ import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.sign.Base64; import com.ruoyi.common.utils.sign.Base64;
import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
public class CaptchaController public class CaptchaController {
{
@Resource(name = "captchaProducer") @Resource(name = "captchaProducer")
private Producer captchaProducer; private Producer captchaProducer;
@ -36,20 +36,19 @@ public class CaptchaController
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@Autowired @Autowired
private ISysConfigService configService; private ISysConfigService configService;
/** /**
* *
*/ */
@GetMapping("/captchaImage") @GetMapping("/captchaImage")
public AjaxResult getCode(HttpServletResponse response) throws IOException public AjaxResult getCode(HttpServletResponse response) throws IOException {
{
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
boolean captchaEnabled = configService.selectCaptchaEnabled(); boolean captchaEnabled = configService.selectCaptchaEnabled();
ajax.put("captchaEnabled", captchaEnabled); ajax.put("captchaEnabled", captchaEnabled);
if (!captchaEnabled) if (!captchaEnabled) {
{
return ajax; return ajax;
} }
@ -62,15 +61,12 @@ public class CaptchaController
// 生成验证码 // 生成验证码
String captchaType = RuoYiConfig.getCaptchaType(); String captchaType = RuoYiConfig.getCaptchaType();
if ("math".equals(captchaType)) if ("math".equals(captchaType)) {
{
String capText = captchaProducerMath.createText(); String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@")); capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1); code = capText.substring(capText.lastIndexOf("@") + 1);
image = captchaProducerMath.createImage(capStr); image = captchaProducerMath.createImage(capStr);
} } else if ("char".equals(captchaType)) {
else if ("char".equals(captchaType))
{
capStr = code = captchaProducer.createText(); capStr = code = captchaProducer.createText();
image = captchaProducer.createImage(capStr); image = captchaProducer.createImage(capStr);
} }
@ -78,12 +74,9 @@ public class CaptchaController
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
// 转换流信息写出 // 转换流信息写出
FastByteArrayOutputStream os = new FastByteArrayOutputStream(); FastByteArrayOutputStream os = new FastByteArrayOutputStream();
try try {
{
ImageIO.write(image, "jpg", os); ImageIO.write(image, "jpg", os);
} } catch (IOException e) {
catch (IOException e)
{
return AjaxResult.error(e.getMessage()); return AjaxResult.error(e.getMessage());
} }

@ -1,9 +1,12 @@
package com.ruoyi.web.controller.common; package com.ruoyi.web.controller.common;
import java.util.ArrayList; import com.ruoyi.common.config.RuoYiConfig;
import java.util.List; import com.ruoyi.common.constant.Constants;
import javax.servlet.http.HttpServletRequest; import com.ruoyi.common.core.domain.AjaxResult;
import javax.servlet.http.HttpServletResponse; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.framework.config.ServerConfig;
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.beans.factory.annotation.Autowired;
@ -13,43 +16,35 @@ 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.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants; import javax.servlet.http.HttpServletRequest;
import com.ruoyi.common.core.domain.AjaxResult; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.StringUtils; import java.util.ArrayList;
import com.ruoyi.common.utils.file.FileUploadUtils; import java.util.List;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.framework.config.ServerConfig;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/common") @RequestMapping("/common")
public class CommonController public class CommonController {
{
private static final Logger log = LoggerFactory.getLogger(CommonController.class); private static final Logger log = LoggerFactory.getLogger(CommonController.class);
private static final String FILE_DELIMETER = ",";
@Autowired @Autowired
private ServerConfig serverConfig; private ServerConfig serverConfig;
private static final String FILE_DELIMETER = ",";
/** /**
* *
* *
* @param fileName * @param fileName
* @param delete * @param delete
*/ */
@GetMapping("/download") @GetMapping("/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
{ try {
try if (!FileUtils.checkAllowDownload(fileName)) {
{
if (!FileUtils.checkAllowDownload(fileName))
{
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
} }
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
@ -58,13 +53,10 @@ public class CommonController
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, realFileName); FileUtils.setAttachmentResponseHeader(response, realFileName);
FileUtils.writeBytes(filePath, response.getOutputStream()); FileUtils.writeBytes(filePath, response.getOutputStream());
if (delete) if (delete) {
{
FileUtils.deleteFile(filePath); FileUtils.deleteFile(filePath);
} }
} } catch (Exception e) {
catch (Exception e)
{
log.error("下载文件失败", e); log.error("下载文件失败", e);
} }
} }
@ -73,10 +65,8 @@ public class CommonController
* *
*/ */
@PostMapping("/upload") @PostMapping("/upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception public AjaxResult uploadFile(MultipartFile file) throws Exception {
{ try {
try
{
// 上传文件路径 // 上传文件路径
String filePath = RuoYiConfig.getUploadPath(); String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称 // 上传并返回新文件名称
@ -88,9 +78,7 @@ public class CommonController
ajax.put("newFileName", FileUtils.getName(fileName)); ajax.put("newFileName", FileUtils.getName(fileName));
ajax.put("originalFilename", file.getOriginalFilename()); ajax.put("originalFilename", file.getOriginalFilename());
return ajax; return ajax;
} } catch (Exception e) {
catch (Exception e)
{
return AjaxResult.error(e.getMessage()); return AjaxResult.error(e.getMessage());
} }
} }
@ -99,18 +87,15 @@ public class CommonController
* *
*/ */
@PostMapping("/uploads") @PostMapping("/uploads")
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception {
{ try {
try
{
// 上传文件路径 // 上传文件路径
String filePath = RuoYiConfig.getUploadPath(); String filePath = RuoYiConfig.getUploadPath();
List<String> urls = new ArrayList<String>(); List<String> urls = new ArrayList<String>();
List<String> fileNames = new ArrayList<String>(); List<String> fileNames = new ArrayList<String>();
List<String> newFileNames = new ArrayList<String>(); List<String> newFileNames = new ArrayList<String>();
List<String> originalFilenames = new ArrayList<String>(); List<String> originalFilenames = new ArrayList<String>();
for (MultipartFile file : files) for (MultipartFile file : files) {
{
// 上传并返回新文件名称 // 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file); String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName; String url = serverConfig.getUrl() + fileName;
@ -125,9 +110,7 @@ public class CommonController
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER)); ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER)); ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
return ajax; return ajax;
} } catch (Exception e) {
catch (Exception e)
{
return AjaxResult.error(e.getMessage()); return AjaxResult.error(e.getMessage());
} }
} }
@ -137,12 +120,9 @@ public class CommonController
*/ */
@GetMapping("/download/resource") @GetMapping("/download/resource")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
throws Exception throws Exception {
{ try {
try if (!FileUtils.checkAllowDownload(resource)) {
{
if (!FileUtils.checkAllowDownload(resource))
{
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource)); throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
} }
// 本地资源路径 // 本地资源路径
@ -154,9 +134,7 @@ public class CommonController
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName); FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream()); FileUtils.writeBytes(downloadPath, response.getOutputStream());
} } catch (Exception e) {
catch (Exception e)
{
log.error("下载文件失败", e); log.error("下载文件失败", e);
} }
} }

@ -1,12 +1,9 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import java.util.ArrayList; import com.ruoyi.common.constant.CacheConstants;
import java.util.Collection; import com.ruoyi.common.core.domain.AjaxResult;
import java.util.HashMap; import com.ruoyi.common.utils.StringUtils;
import java.util.List; import com.ruoyi.system.domain.SysCache;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisCallback; import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
@ -16,24 +13,27 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
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.common.constant.CacheConstants;
import com.ruoyi.common.core.domain.AjaxResult; import java.util.ArrayList;
import com.ruoyi.common.utils.StringUtils; import java.util.Collection;
import com.ruoyi.system.domain.SysCache; import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/monitor/cache") @RequestMapping("/monitor/cache")
public class CacheController public class CacheController {
{ private final static List<SysCache> caches = new ArrayList<SysCache>();
@Autowired @Autowired
private RedisTemplate<String, String> redisTemplate; private RedisTemplate<String, String> redisTemplate;
private final static List<SysCache> caches = new ArrayList<SysCache>();
{ {
caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息")); caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息")); caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
@ -46,8 +46,7 @@ public class CacheController
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping() @GetMapping()
public AjaxResult getInfo() throws Exception public AjaxResult getInfo() throws Exception {
{
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info()); Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats")); Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize()); Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
@ -70,23 +69,20 @@ public class CacheController
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getNames") @GetMapping("/getNames")
public AjaxResult cache() public AjaxResult cache() {
{
return AjaxResult.success(caches); return AjaxResult.success(caches);
} }
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getKeys/{cacheName}") @GetMapping("/getKeys/{cacheName}")
public AjaxResult getCacheKeys(@PathVariable String cacheName) public AjaxResult getCacheKeys(@PathVariable String cacheName) {
{
Set<String> cacheKeys = redisTemplate.keys(cacheName + "*"); Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
return AjaxResult.success(cacheKeys); return AjaxResult.success(cacheKeys);
} }
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getValue/{cacheName}/{cacheKey}") @GetMapping("/getValue/{cacheName}/{cacheKey}")
public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) {
{
String cacheValue = redisTemplate.opsForValue().get(cacheKey); String cacheValue = redisTemplate.opsForValue().get(cacheKey);
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue); SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
return AjaxResult.success(sysCache); return AjaxResult.success(sysCache);
@ -94,8 +90,7 @@ public class CacheController
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheName/{cacheName}") @DeleteMapping("/clearCacheName/{cacheName}")
public AjaxResult clearCacheName(@PathVariable String cacheName) public AjaxResult clearCacheName(@PathVariable String cacheName) {
{
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*"); Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
redisTemplate.delete(cacheKeys); redisTemplate.delete(cacheKeys);
return AjaxResult.success(); return AjaxResult.success();
@ -103,16 +98,14 @@ public class CacheController
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheKey/{cacheKey}") @DeleteMapping("/clearCacheKey/{cacheKey}")
public AjaxResult clearCacheKey(@PathVariable String cacheKey) public AjaxResult clearCacheKey(@PathVariable String cacheKey) {
{
redisTemplate.delete(cacheKey); redisTemplate.delete(cacheKey);
return AjaxResult.success(); return AjaxResult.success();
} }
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheAll") @DeleteMapping("/clearCacheAll")
public AjaxResult clearCacheAll() public AjaxResult clearCacheAll() {
{
Collection<String> cacheKeys = redisTemplate.keys("*"); Collection<String> cacheKeys = redisTemplate.keys("*");
redisTemplate.delete(cacheKeys); redisTemplate.delete(cacheKeys);
return AjaxResult.success(); return AjaxResult.success();

@ -1,25 +1,23 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.web.domain.Server;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
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 org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.web.domain.Server;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/monitor/server") @RequestMapping("/monitor/server")
public class ServerController public class ServerController {
{
@PreAuthorize("@ss.hasPermi('monitor:server:list')") @PreAuthorize("@ss.hasPermi('monitor:server:list')")
@GetMapping() @GetMapping()
public AjaxResult getInfo() throws Exception public AjaxResult getInfo() throws Exception {
{
Server server = new Server(); Server server = new Server();
server.copyTo(); server.copyTo();
return AjaxResult.success(server); return AjaxResult.success(server);

@ -1,15 +1,5 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
@ -19,16 +9,26 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.SysPasswordService; import com.ruoyi.framework.web.service.SysPasswordService;
import com.ruoyi.system.domain.SysLogininfor; import com.ruoyi.system.domain.SysLogininfor;
import com.ruoyi.system.service.ISysLogininforService; import com.ruoyi.system.service.ISysLogininforService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/** /**
* 访 * 访
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/monitor/logininfor") @RequestMapping("/monitor/logininfor")
public class SysLogininforController extends BaseController public class SysLogininforController extends BaseController {
{
@Autowired @Autowired
private ISysLogininforService logininforService; private ISysLogininforService logininforService;
@ -37,8 +37,7 @@ public class SysLogininforController extends BaseController
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysLogininfor logininfor) public TableDataInfo list(SysLogininfor logininfor) {
{
startPage(); startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list); return getDataTable(list);
@ -47,8 +46,7 @@ public class SysLogininforController extends BaseController
@Log(title = "登录日志", businessType = BusinessType.EXPORT) @Log(title = "登录日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SysLogininfor logininfor) public void export(HttpServletResponse response, SysLogininfor logininfor) {
{
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class); ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
util.exportExcel(response, list, "登录日志"); util.exportExcel(response, list, "登录日志");
@ -57,16 +55,14 @@ public class SysLogininforController extends BaseController
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.DELETE) @Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{infoIds}") @DeleteMapping("/{infoIds}")
public AjaxResult remove(@PathVariable Long[] infoIds) public AjaxResult remove(@PathVariable Long[] infoIds) {
{
return toAjax(logininforService.deleteLogininforByIds(infoIds)); return toAjax(logininforService.deleteLogininforByIds(infoIds));
} }
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.CLEAN) @Log(title = "登录日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean") @DeleteMapping("/clean")
public AjaxResult clean() public AjaxResult clean() {
{
logininforService.cleanLogininfor(); logininforService.cleanLogininfor();
return success(); return success();
} }
@ -74,8 +70,7 @@ public class SysLogininforController extends BaseController
@PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
@Log(title = "账户解锁", businessType = BusinessType.OTHER) @Log(title = "账户解锁", businessType = BusinessType.OTHER)
@GetMapping("/unlock/{userName}") @GetMapping("/unlock/{userName}")
public AjaxResult unlock(@PathVariable("userName") String userName) public AjaxResult unlock(@PathVariable("userName") String userName) {
{
passwordService.clearLoginRecordCache(userName); passwordService.clearLoginRecordCache(userName);
return success(); return success();
} }

@ -1,15 +1,5 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
@ -18,23 +8,32 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysOperLog; import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.service.ISysOperLogService; import com.ruoyi.system.service.ISysOperLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/monitor/operlog") @RequestMapping("/monitor/operlog")
public class SysOperlogController extends BaseController public class SysOperlogController extends BaseController {
{
@Autowired @Autowired
private ISysOperLogService operLogService; private ISysOperLogService operLogService;
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')") @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysOperLog operLog) public TableDataInfo list(SysOperLog operLog) {
{
startPage(); startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog); List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list); return getDataTable(list);
@ -43,8 +42,7 @@ public class SysOperlogController extends BaseController
@Log(title = "操作日志", businessType = BusinessType.EXPORT) @Log(title = "操作日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')") @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SysOperLog operLog) public void export(HttpServletResponse response, SysOperLog operLog) {
{
List<SysOperLog> list = operLogService.selectOperLogList(operLog); List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class); ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
util.exportExcel(response, list, "操作日志"); util.exportExcel(response, list, "操作日志");
@ -53,16 +51,14 @@ public class SysOperlogController extends BaseController
@Log(title = "操作日志", businessType = BusinessType.DELETE) @Log(title = "操作日志", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/{operIds}") @DeleteMapping("/{operIds}")
public AjaxResult remove(@PathVariable Long[] operIds) public AjaxResult remove(@PathVariable Long[] operIds) {
{
return toAjax(operLogService.deleteOperLogByIds(operIds)); return toAjax(operLogService.deleteOperLogByIds(operIds));
} }
@Log(title = "操作日志", businessType = BusinessType.CLEAN) @Log(title = "操作日志", businessType = BusinessType.CLEAN)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/clean") @DeleteMapping("/clean")
public AjaxResult clean() public AjaxResult clean() {
{
operLogService.cleanOperLog(); operLogService.cleanOperLog();
return success(); return success();
} }

@ -1,16 +1,5 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
@ -22,16 +11,27 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysUserOnline; import com.ruoyi.system.domain.SysUserOnline;
import com.ruoyi.system.service.ISysUserOnlineService; import com.ruoyi.system.service.ISysUserOnlineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/** /**
* 线 * 线
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/monitor/online") @RequestMapping("/monitor/online")
public class SysUserOnlineController extends BaseController public class SysUserOnlineController extends BaseController {
{
@Autowired @Autowired
private ISysUserOnlineService userOnlineService; private ISysUserOnlineService userOnlineService;
@ -40,27 +40,18 @@ public class SysUserOnlineController extends BaseController
@PreAuthorize("@ss.hasPermi('monitor:online:list')") @PreAuthorize("@ss.hasPermi('monitor:online:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(String ipaddr, String userName) public TableDataInfo list(String ipaddr, String userName) {
{
Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>(); List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys) for (String key : keys) {
{
LoginUser user = redisCache.getCacheObject(key); LoginUser user = redisCache.getCacheObject(key);
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) {
{
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user)); userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
} } else if (StringUtils.isNotEmpty(ipaddr)) {
else if (StringUtils.isNotEmpty(ipaddr))
{
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user)); userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
} } else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) {
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
{
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user)); userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
} } else {
else
{
userOnlineList.add(userOnlineService.loginUserToUserOnline(user)); userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
} }
} }
@ -75,8 +66,7 @@ public class SysUserOnlineController extends BaseController
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')") @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
@Log(title = "在线用户", businessType = BusinessType.FORCE) @Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}") @DeleteMapping("/{tokenId}")
public AjaxResult forceLogout(@PathVariable String tokenId) public AjaxResult forceLogout(@PathVariable String tokenId) {
{
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId); redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
return success(); return success();
} }

@ -1,7 +1,13 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import com.ruoyi.common.annotation.Log;
import javax.servlet.http.HttpServletResponse; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -13,24 +19,18 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
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.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.AjaxResult; import java.util.List;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/system/config") @RequestMapping("/system/config")
public class SysConfigController extends BaseController public class SysConfigController extends BaseController {
{
@Autowired @Autowired
private ISysConfigService configService; private ISysConfigService configService;
@ -39,8 +39,7 @@ public class SysConfigController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:config:list')") @PreAuthorize("@ss.hasPermi('system:config:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysConfig config) public TableDataInfo list(SysConfig config) {
{
startPage(); startPage();
List<SysConfig> list = configService.selectConfigList(config); List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list); return getDataTable(list);
@ -49,8 +48,7 @@ public class SysConfigController extends BaseController
@Log(title = "参数管理", businessType = BusinessType.EXPORT) @Log(title = "参数管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')") @PreAuthorize("@ss.hasPermi('system:config:export')")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SysConfig config) public void export(HttpServletResponse response, SysConfig config) {
{
List<SysConfig> list = configService.selectConfigList(config); List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
util.exportExcel(response, list, "参数数据"); util.exportExcel(response, list, "参数数据");
@ -61,8 +59,7 @@ public class SysConfigController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:config:query')") @PreAuthorize("@ss.hasPermi('system:config:query')")
@GetMapping(value = "/{configId}") @GetMapping(value = "/{configId}")
public AjaxResult getInfo(@PathVariable Long configId) public AjaxResult getInfo(@PathVariable Long configId) {
{
return success(configService.selectConfigById(configId)); return success(configService.selectConfigById(configId));
} }
@ -70,8 +67,7 @@ public class SysConfigController extends BaseController
* *
*/ */
@GetMapping(value = "/configKey/{configKey}") @GetMapping(value = "/configKey/{configKey}")
public AjaxResult getConfigKey(@PathVariable String configKey) public AjaxResult getConfigKey(@PathVariable String configKey) {
{
return success(configService.selectConfigByKey(configKey)); return success(configService.selectConfigByKey(configKey));
} }
@ -81,10 +77,8 @@ public class SysConfigController extends BaseController
@PreAuthorize("@ss.hasPermi('system:config:add')") @PreAuthorize("@ss.hasPermi('system:config:add')")
@Log(title = "参数管理", businessType = BusinessType.INSERT) @Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysConfig config) public AjaxResult add(@Validated @RequestBody SysConfig config) {
{ if (!configService.checkConfigKeyUnique(config)) {
if (!configService.checkConfigKeyUnique(config))
{
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
} }
config.setCreateBy(getUsername()); config.setCreateBy(getUsername());
@ -97,10 +91,8 @@ public class SysConfigController extends BaseController
@PreAuthorize("@ss.hasPermi('system:config:edit')") @PreAuthorize("@ss.hasPermi('system:config:edit')")
@Log(title = "参数管理", businessType = BusinessType.UPDATE) @Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysConfig config) public AjaxResult edit(@Validated @RequestBody SysConfig config) {
{ if (!configService.checkConfigKeyUnique(config)) {
if (!configService.checkConfigKeyUnique(config))
{
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
} }
config.setUpdateBy(getUsername()); config.setUpdateBy(getUsername());
@ -113,8 +105,7 @@ public class SysConfigController extends BaseController
@PreAuthorize("@ss.hasPermi('system:config:remove')") @PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.DELETE) @Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}") @DeleteMapping("/{configIds}")
public AjaxResult remove(@PathVariable Long[] configIds) public AjaxResult remove(@PathVariable Long[] configIds) {
{
configService.deleteConfigByIds(configIds); configService.deleteConfigByIds(configIds);
return success(); return success();
} }
@ -125,8 +116,7 @@ public class SysConfigController extends BaseController
@PreAuthorize("@ss.hasPermi('system:config:remove')") @PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.CLEAN) @Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache") @DeleteMapping("/refreshCache")
public AjaxResult refreshCache() public AjaxResult refreshCache() {
{
configService.resetConfigCache(); configService.resetConfigCache();
return success(); return success();
} }

@ -1,6 +1,13 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysDeptService;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
@ -13,24 +20,17 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
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.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import java.util.List;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysDeptService;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/system/dept") @RequestMapping("/system/dept")
public class SysDeptController extends BaseController public class SysDeptController extends BaseController {
{
@Autowired @Autowired
private ISysDeptService deptService; private ISysDeptService deptService;
@ -39,8 +39,7 @@ public class SysDeptController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:dept:list')") @PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list") @GetMapping("/list")
public AjaxResult list(SysDept dept) public AjaxResult list(SysDept dept) {
{
List<SysDept> depts = deptService.selectDeptList(dept); List<SysDept> depts = deptService.selectDeptList(dept);
return success(depts); return success(depts);
} }
@ -50,8 +49,7 @@ public class SysDeptController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:dept:list')") @PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list/exclude/{deptId}") @GetMapping("/list/exclude/{deptId}")
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) {
{
List<SysDept> depts = deptService.selectDeptList(new SysDept()); List<SysDept> depts = deptService.selectDeptList(new SysDept());
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
return success(depts); return success(depts);
@ -62,8 +60,7 @@ public class SysDeptController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:dept:query')") @PreAuthorize("@ss.hasPermi('system:dept:query')")
@GetMapping(value = "/{deptId}") @GetMapping(value = "/{deptId}")
public AjaxResult getInfo(@PathVariable Long deptId) public AjaxResult getInfo(@PathVariable Long deptId) {
{
deptService.checkDeptDataScope(deptId); deptService.checkDeptDataScope(deptId);
return success(deptService.selectDeptById(deptId)); return success(deptService.selectDeptById(deptId));
} }
@ -74,10 +71,8 @@ public class SysDeptController extends BaseController
@PreAuthorize("@ss.hasPermi('system:dept:add')") @PreAuthorize("@ss.hasPermi('system:dept:add')")
@Log(title = "部门管理", businessType = BusinessType.INSERT) @Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysDept dept) public AjaxResult add(@Validated @RequestBody SysDept dept) {
{ if (!deptService.checkDeptNameUnique(dept)) {
if (!deptService.checkDeptNameUnique(dept))
{
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
} }
dept.setCreateBy(getUsername()); dept.setCreateBy(getUsername());
@ -90,20 +85,14 @@ public class SysDeptController extends BaseController
@PreAuthorize("@ss.hasPermi('system:dept:edit')") @PreAuthorize("@ss.hasPermi('system:dept:edit')")
@Log(title = "部门管理", businessType = BusinessType.UPDATE) @Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysDept dept) public AjaxResult edit(@Validated @RequestBody SysDept dept) {
{
Long deptId = dept.getDeptId(); Long deptId = dept.getDeptId();
deptService.checkDeptDataScope(deptId); deptService.checkDeptDataScope(deptId);
if (!deptService.checkDeptNameUnique(dept)) if (!deptService.checkDeptNameUnique(dept)) {
{
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
} } else if (dept.getParentId().equals(deptId)) {
else if (dept.getParentId().equals(deptId))
{
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
} } else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) {
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
{
return error("该部门包含未停用的子部门!"); return error("该部门包含未停用的子部门!");
} }
dept.setUpdateBy(getUsername()); dept.setUpdateBy(getUsername());
@ -116,14 +105,11 @@ public class SysDeptController extends BaseController
@PreAuthorize("@ss.hasPermi('system:dept:remove')") @PreAuthorize("@ss.hasPermi('system:dept:remove')")
@Log(title = "部门管理", businessType = BusinessType.DELETE) @Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deptId}") @DeleteMapping("/{deptId}")
public AjaxResult remove(@PathVariable Long deptId) public AjaxResult remove(@PathVariable Long deptId) {
{ if (deptService.hasChildByDeptId(deptId)) {
if (deptService.hasChildByDeptId(deptId))
{
return warn("存在下级部门,不允许删除"); return warn("存在下级部门,不允许删除");
} }
if (deptService.checkDeptExistUser(deptId)) if (deptService.checkDeptExistUser(deptId)) {
{
return warn("部门存在用户,不允许删除"); return warn("部门存在用户,不允许删除");
} }
deptService.checkDeptDataScope(deptId); deptService.checkDeptDataScope(deptId);

@ -1,8 +1,15 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.ArrayList; import com.ruoyi.common.annotation.Log;
import java.util.List; import com.ruoyi.common.core.controller.BaseController;
import javax.servlet.http.HttpServletResponse; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysDictTypeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -14,26 +21,19 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
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.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.AjaxResult; import java.util.ArrayList;
import com.ruoyi.common.core.domain.entity.SysDictData; import java.util.List;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysDictTypeService;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/system/dict/data") @RequestMapping("/system/dict/data")
public class SysDictDataController extends BaseController public class SysDictDataController extends BaseController {
{
@Autowired @Autowired
private ISysDictDataService dictDataService; private ISysDictDataService dictDataService;
@ -42,8 +42,7 @@ public class SysDictDataController extends BaseController
@PreAuthorize("@ss.hasPermi('system:dict:list')") @PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysDictData dictData) public TableDataInfo list(SysDictData dictData) {
{
startPage(); startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData); List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list); return getDataTable(list);
@ -52,8 +51,7 @@ public class SysDictDataController extends BaseController
@Log(title = "字典数据", businessType = BusinessType.EXPORT) @Log(title = "字典数据", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')") @PreAuthorize("@ss.hasPermi('system:dict:export')")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SysDictData dictData) public void export(HttpServletResponse response, SysDictData dictData) {
{
List<SysDictData> list = dictDataService.selectDictDataList(dictData); List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
util.exportExcel(response, list, "字典数据"); util.exportExcel(response, list, "字典数据");
@ -64,8 +62,7 @@ public class SysDictDataController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:query')") @PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictCode}") @GetMapping(value = "/{dictCode}")
public AjaxResult getInfo(@PathVariable Long dictCode) public AjaxResult getInfo(@PathVariable Long dictCode) {
{
return success(dictDataService.selectDictDataById(dictCode)); return success(dictDataService.selectDictDataById(dictCode));
} }
@ -73,11 +70,9 @@ public class SysDictDataController extends BaseController
* *
*/ */
@GetMapping(value = "/type/{dictType}") @GetMapping(value = "/type/{dictType}")
public AjaxResult dictType(@PathVariable String dictType) public AjaxResult dictType(@PathVariable String dictType) {
{
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType); List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data)) if (StringUtils.isNull(data)) {
{
data = new ArrayList<SysDictData>(); data = new ArrayList<SysDictData>();
} }
return success(data); return success(data);
@ -89,8 +84,7 @@ public class SysDictDataController extends BaseController
@PreAuthorize("@ss.hasPermi('system:dict:add')") @PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典数据", businessType = BusinessType.INSERT) @Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysDictData dict) public AjaxResult add(@Validated @RequestBody SysDictData dict) {
{
dict.setCreateBy(getUsername()); dict.setCreateBy(getUsername());
return toAjax(dictDataService.insertDictData(dict)); return toAjax(dictDataService.insertDictData(dict));
} }
@ -101,8 +95,7 @@ public class SysDictDataController extends BaseController
@PreAuthorize("@ss.hasPermi('system:dict:edit')") @PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典数据", businessType = BusinessType.UPDATE) @Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictData dict) public AjaxResult edit(@Validated @RequestBody SysDictData dict) {
{
dict.setUpdateBy(getUsername()); dict.setUpdateBy(getUsername());
return toAjax(dictDataService.updateDictData(dict)); return toAjax(dictDataService.updateDictData(dict));
} }
@ -113,8 +106,7 @@ public class SysDictDataController extends BaseController
@PreAuthorize("@ss.hasPermi('system:dict:remove')") @PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE) @Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}") @DeleteMapping("/{dictCodes}")
public AjaxResult remove(@PathVariable Long[] dictCodes) public AjaxResult remove(@PathVariable Long[] dictCodes) {
{
dictDataService.deleteDictDataByIds(dictCodes); dictDataService.deleteDictDataByIds(dictCodes);
return success(); return success();
} }

@ -1,7 +1,13 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import com.ruoyi.common.annotation.Log;
import javax.servlet.http.HttpServletResponse; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictTypeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -13,31 +19,24 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
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.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.AjaxResult; import java.util.List;
import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictTypeService;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/system/dict/type") @RequestMapping("/system/dict/type")
public class SysDictTypeController extends BaseController public class SysDictTypeController extends BaseController {
{
@Autowired @Autowired
private ISysDictTypeService dictTypeService; private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')") @PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysDictType dictType) public TableDataInfo list(SysDictType dictType) {
{
startPage(); startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list); return getDataTable(list);
@ -46,8 +45,7 @@ public class SysDictTypeController extends BaseController
@Log(title = "字典类型", businessType = BusinessType.EXPORT) @Log(title = "字典类型", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')") @PreAuthorize("@ss.hasPermi('system:dict:export')")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SysDictType dictType) public void export(HttpServletResponse response, SysDictType dictType) {
{
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class); ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
util.exportExcel(response, list, "字典类型"); util.exportExcel(response, list, "字典类型");
@ -58,8 +56,7 @@ public class SysDictTypeController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:query')") @PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictId}") @GetMapping(value = "/{dictId}")
public AjaxResult getInfo(@PathVariable Long dictId) public AjaxResult getInfo(@PathVariable Long dictId) {
{
return success(dictTypeService.selectDictTypeById(dictId)); return success(dictTypeService.selectDictTypeById(dictId));
} }
@ -69,10 +66,8 @@ public class SysDictTypeController extends BaseController
@PreAuthorize("@ss.hasPermi('system:dict:add')") @PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典类型", businessType = BusinessType.INSERT) @Log(title = "字典类型", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysDictType dict) public AjaxResult add(@Validated @RequestBody SysDictType dict) {
{ if (!dictTypeService.checkDictTypeUnique(dict)) {
if (!dictTypeService.checkDictTypeUnique(dict))
{
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
} }
dict.setCreateBy(getUsername()); dict.setCreateBy(getUsername());
@ -85,10 +80,8 @@ public class SysDictTypeController extends BaseController
@PreAuthorize("@ss.hasPermi('system:dict:edit')") @PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典类型", businessType = BusinessType.UPDATE) @Log(title = "字典类型", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictType dict) public AjaxResult edit(@Validated @RequestBody SysDictType dict) {
{ if (!dictTypeService.checkDictTypeUnique(dict)) {
if (!dictTypeService.checkDictTypeUnique(dict))
{
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
} }
dict.setUpdateBy(getUsername()); dict.setUpdateBy(getUsername());
@ -101,8 +94,7 @@ public class SysDictTypeController extends BaseController
@PreAuthorize("@ss.hasPermi('system:dict:remove')") @PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE) @Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}") @DeleteMapping("/{dictIds}")
public AjaxResult remove(@PathVariable Long[] dictIds) public AjaxResult remove(@PathVariable Long[] dictIds) {
{
dictTypeService.deleteDictTypeByIds(dictIds); dictTypeService.deleteDictTypeByIds(dictIds);
return success(); return success();
} }
@ -113,8 +105,7 @@ public class SysDictTypeController extends BaseController
@PreAuthorize("@ss.hasPermi('system:dict:remove')") @PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.CLEAN) @Log(title = "字典类型", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache") @DeleteMapping("/refreshCache")
public AjaxResult refreshCache() public AjaxResult refreshCache() {
{
dictTypeService.resetDictCache(); dictTypeService.resetDictCache();
return success(); return success();
} }
@ -123,8 +114,7 @@ public class SysDictTypeController extends BaseController
* *
*/ */
@GetMapping("/optionselect") @GetMapping("/optionselect")
public AjaxResult optionselect() public AjaxResult optionselect() {
{
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return success(dictTypes); return success(dictTypes);
} }

@ -1,10 +1,10 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
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.common.config.RuoYiConfig;
import com.ruoyi.common.utils.StringUtils;
/** /**
* *
@ -12,9 +12,10 @@ import com.ruoyi.common.utils.StringUtils;
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
public class SysIndexController public class SysIndexController {
{ /**
/** 系统基础配置 */ *
*/
@Autowired @Autowired
private RuoYiConfig ruoyiConfig; private RuoYiConfig ruoyiConfig;
@ -22,8 +23,7 @@ public class SysIndexController
* 访 * 访
*/ */
@RequestMapping("/") @RequestMapping("/")
public String index() public String index() {
{
return StringUtils.format("欢迎使用{}后台管理框架当前版本v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion()); return StringUtils.format("欢迎使用{}后台管理框架当前版本v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
} }
} }

@ -1,12 +1,5 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysMenu;
@ -16,15 +9,22 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.web.service.SysLoginService; import com.ruoyi.framework.web.service.SysLoginService;
import com.ruoyi.framework.web.service.SysPermissionService; import com.ruoyi.framework.web.service.SysPermissionService;
import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.ISysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Set;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
public class SysLoginController public class SysLoginController {
{
@Autowired @Autowired
private SysLoginService loginService; private SysLoginService loginService;
@ -36,13 +36,12 @@ public class SysLoginController
/** /**
* *
* *
* @param loginBody * @param loginBody
* @return * @return
*/ */
@PostMapping("/login") @PostMapping("/login")
public AjaxResult login(@RequestBody LoginBody loginBody) public AjaxResult login(@RequestBody LoginBody loginBody) {
{
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
// 生成令牌 // 生成令牌
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
@ -53,12 +52,11 @@ public class SysLoginController
/** /**
* *
* *
* @return * @return
*/ */
@GetMapping("getInfo") @GetMapping("getInfo")
public AjaxResult getInfo() public AjaxResult getInfo() {
{
SysUser user = SecurityUtils.getLoginUser().getUser(); SysUser user = SecurityUtils.getLoginUser().getUser();
// 角色集合 // 角色集合
Set<String> roles = permissionService.getRolePermission(user); Set<String> roles = permissionService.getRolePermission(user);
@ -73,12 +71,11 @@ public class SysLoginController
/** /**
* *
* *
* @return * @return
*/ */
@GetMapping("getRouters") @GetMapping("getRouters")
public AjaxResult getRouters() public AjaxResult getRouters() {
{
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId); List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
return AjaxResult.success(menuService.buildMenus(menus)); return AjaxResult.success(menuService.buildMenus(menus));

@ -1,6 +1,13 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysMenuService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -12,24 +19,17 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
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.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import java.util.List;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysMenuService;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/system/menu") @RequestMapping("/system/menu")
public class SysMenuController extends BaseController public class SysMenuController extends BaseController {
{
@Autowired @Autowired
private ISysMenuService menuService; private ISysMenuService menuService;
@ -38,8 +38,7 @@ public class SysMenuController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:menu:list')") @PreAuthorize("@ss.hasPermi('system:menu:list')")
@GetMapping("/list") @GetMapping("/list")
public AjaxResult list(SysMenu menu) public AjaxResult list(SysMenu menu) {
{
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return success(menus); return success(menus);
} }
@ -49,8 +48,7 @@ public class SysMenuController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:menu:query')") @PreAuthorize("@ss.hasPermi('system:menu:query')")
@GetMapping(value = "/{menuId}") @GetMapping(value = "/{menuId}")
public AjaxResult getInfo(@PathVariable Long menuId) public AjaxResult getInfo(@PathVariable Long menuId) {
{
return success(menuService.selectMenuById(menuId)); return success(menuService.selectMenuById(menuId));
} }
@ -58,8 +56,7 @@ public class SysMenuController extends BaseController
* *
*/ */
@GetMapping("/treeselect") @GetMapping("/treeselect")
public AjaxResult treeselect(SysMenu menu) public AjaxResult treeselect(SysMenu menu) {
{
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return success(menuService.buildMenuTreeSelect(menus)); return success(menuService.buildMenuTreeSelect(menus));
} }
@ -68,8 +65,7 @@ public class SysMenuController extends BaseController
* *
*/ */
@GetMapping(value = "/roleMenuTreeselect/{roleId}") @GetMapping(value = "/roleMenuTreeselect/{roleId}")
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
{
List<SysMenu> menus = menuService.selectMenuList(getUserId()); List<SysMenu> menus = menuService.selectMenuList(getUserId());
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
@ -83,14 +79,10 @@ public class SysMenuController extends BaseController
@PreAuthorize("@ss.hasPermi('system:menu:add')") @PreAuthorize("@ss.hasPermi('system:menu:add')")
@Log(title = "菜单管理", businessType = BusinessType.INSERT) @Log(title = "菜单管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysMenu menu) public AjaxResult add(@Validated @RequestBody SysMenu menu) {
{ if (!menuService.checkMenuNameUnique(menu)) {
if (!menuService.checkMenuNameUnique(menu))
{
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
{
return error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头"); return error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
} }
menu.setCreateBy(getUsername()); menu.setCreateBy(getUsername());
@ -103,18 +95,12 @@ public class SysMenuController extends BaseController
@PreAuthorize("@ss.hasPermi('system:menu:edit')") @PreAuthorize("@ss.hasPermi('system:menu:edit')")
@Log(title = "菜单管理", businessType = BusinessType.UPDATE) @Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysMenu menu) public AjaxResult edit(@Validated @RequestBody SysMenu menu) {
{ if (!menuService.checkMenuNameUnique(menu)) {
if (!menuService.checkMenuNameUnique(menu))
{
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
{
return error("修改菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头"); return error("修改菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
} } else if (menu.getMenuId().equals(menu.getParentId())) {
else if (menu.getMenuId().equals(menu.getParentId()))
{
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己"); return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
} }
menu.setUpdateBy(getUsername()); menu.setUpdateBy(getUsername());
@ -127,14 +113,11 @@ public class SysMenuController extends BaseController
@PreAuthorize("@ss.hasPermi('system:menu:remove')") @PreAuthorize("@ss.hasPermi('system:menu:remove')")
@Log(title = "菜单管理", businessType = BusinessType.DELETE) @Log(title = "菜单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{menuId}") @DeleteMapping("/{menuId}")
public AjaxResult remove(@PathVariable("menuId") Long menuId) public AjaxResult remove(@PathVariable("menuId") Long menuId) {
{ if (menuService.hasChildByMenuId(menuId)) {
if (menuService.hasChildByMenuId(menuId))
{
return warn("存在子菜单,不允许删除"); return warn("存在子菜单,不允许删除");
} }
if (menuService.checkMenuExistRole(menuId)) if (menuService.checkMenuExistRole(menuId)) {
{
return warn("菜单已分配,不允许删除"); return warn("菜单已分配,不允许删除");
} }
return toAjax(menuService.deleteMenuById(menuId)); return toAjax(menuService.deleteMenuById(menuId));

@ -1,6 +1,12 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -12,23 +18,17 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
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.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import java.util.List;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/system/notice") @RequestMapping("/system/notice")
public class SysNoticeController extends BaseController public class SysNoticeController extends BaseController {
{
@Autowired @Autowired
private ISysNoticeService noticeService; private ISysNoticeService noticeService;
@ -37,8 +37,7 @@ public class SysNoticeController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:notice:list')") @PreAuthorize("@ss.hasPermi('system:notice:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysNotice notice) public TableDataInfo list(SysNotice notice) {
{
startPage(); startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice); List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list); return getDataTable(list);
@ -49,8 +48,7 @@ public class SysNoticeController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:notice:query')") @PreAuthorize("@ss.hasPermi('system:notice:query')")
@GetMapping(value = "/{noticeId}") @GetMapping(value = "/{noticeId}")
public AjaxResult getInfo(@PathVariable Long noticeId) public AjaxResult getInfo(@PathVariable Long noticeId) {
{
return success(noticeService.selectNoticeById(noticeId)); return success(noticeService.selectNoticeById(noticeId));
} }
@ -60,8 +58,7 @@ public class SysNoticeController extends BaseController
@PreAuthorize("@ss.hasPermi('system:notice:add')") @PreAuthorize("@ss.hasPermi('system:notice:add')")
@Log(title = "通知公告", businessType = BusinessType.INSERT) @Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysNotice notice) public AjaxResult add(@Validated @RequestBody SysNotice notice) {
{
notice.setCreateBy(getUsername()); notice.setCreateBy(getUsername());
return toAjax(noticeService.insertNotice(notice)); return toAjax(noticeService.insertNotice(notice));
} }
@ -72,8 +69,7 @@ public class SysNoticeController extends BaseController
@PreAuthorize("@ss.hasPermi('system:notice:edit')") @PreAuthorize("@ss.hasPermi('system:notice:edit')")
@Log(title = "通知公告", businessType = BusinessType.UPDATE) @Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysNotice notice) public AjaxResult edit(@Validated @RequestBody SysNotice notice) {
{
notice.setUpdateBy(getUsername()); notice.setUpdateBy(getUsername());
return toAjax(noticeService.updateNotice(notice)); return toAjax(noticeService.updateNotice(notice));
} }
@ -84,8 +80,7 @@ public class SysNoticeController extends BaseController
@PreAuthorize("@ss.hasPermi('system:notice:remove')") @PreAuthorize("@ss.hasPermi('system:notice:remove')")
@Log(title = "通知公告", businessType = BusinessType.DELETE) @Log(title = "通知公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}") @DeleteMapping("/{noticeIds}")
public AjaxResult remove(@PathVariable Long[] noticeIds) public AjaxResult remove(@PathVariable Long[] noticeIds) {
{
return toAjax(noticeService.deleteNoticeByIds(noticeIds)); return toAjax(noticeService.deleteNoticeByIds(noticeIds));
} }
} }

@ -1,7 +1,13 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import com.ruoyi.common.annotation.Log;
import javax.servlet.http.HttpServletResponse; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.service.ISysPostService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -13,24 +19,18 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
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.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.AjaxResult; import java.util.List;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.service.ISysPostService;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/system/post") @RequestMapping("/system/post")
public class SysPostController extends BaseController public class SysPostController extends BaseController {
{
@Autowired @Autowired
private ISysPostService postService; private ISysPostService postService;
@ -39,18 +39,16 @@ public class SysPostController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:post:list')") @PreAuthorize("@ss.hasPermi('system:post:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysPost post) public TableDataInfo list(SysPost post) {
{
startPage(); startPage();
List<SysPost> list = postService.selectPostList(post); List<SysPost> list = postService.selectPostList(post);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "岗位管理", businessType = BusinessType.EXPORT) @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:post:export')") @PreAuthorize("@ss.hasPermi('system:post:export')")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SysPost post) public void export(HttpServletResponse response, SysPost post) {
{
List<SysPost> list = postService.selectPostList(post); List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class); ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
util.exportExcel(response, list, "岗位数据"); util.exportExcel(response, list, "岗位数据");
@ -61,8 +59,7 @@ public class SysPostController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:post:query')") @PreAuthorize("@ss.hasPermi('system:post:query')")
@GetMapping(value = "/{postId}") @GetMapping(value = "/{postId}")
public AjaxResult getInfo(@PathVariable Long postId) public AjaxResult getInfo(@PathVariable Long postId) {
{
return success(postService.selectPostById(postId)); return success(postService.selectPostById(postId));
} }
@ -72,14 +69,10 @@ public class SysPostController extends BaseController
@PreAuthorize("@ss.hasPermi('system:post:add')") @PreAuthorize("@ss.hasPermi('system:post:add')")
@Log(title = "岗位管理", businessType = BusinessType.INSERT) @Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysPost post) public AjaxResult add(@Validated @RequestBody SysPost post) {
{ if (!postService.checkPostNameUnique(post)) {
if (!postService.checkPostNameUnique(post))
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
} } else if (!postService.checkPostCodeUnique(post)) {
else if (!postService.checkPostCodeUnique(post))
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
} }
post.setCreateBy(getUsername()); post.setCreateBy(getUsername());
@ -92,14 +85,10 @@ public class SysPostController extends BaseController
@PreAuthorize("@ss.hasPermi('system:post:edit')") @PreAuthorize("@ss.hasPermi('system:post:edit')")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE) @Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysPost post) public AjaxResult edit(@Validated @RequestBody SysPost post) {
{ if (!postService.checkPostNameUnique(post)) {
if (!postService.checkPostNameUnique(post))
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
} } else if (!postService.checkPostCodeUnique(post)) {
else if (!postService.checkPostCodeUnique(post))
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
} }
post.setUpdateBy(getUsername()); post.setUpdateBy(getUsername());
@ -112,8 +101,7 @@ public class SysPostController extends BaseController
@PreAuthorize("@ss.hasPermi('system:post:remove')") @PreAuthorize("@ss.hasPermi('system:post:remove')")
@Log(title = "岗位管理", businessType = BusinessType.DELETE) @Log(title = "岗位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{postIds}") @DeleteMapping("/{postIds}")
public AjaxResult remove(@PathVariable Long[] postIds) public AjaxResult remove(@PathVariable Long[] postIds) {
{
return toAjax(postService.deletePostByIds(postIds)); return toAjax(postService.deletePostByIds(postIds));
} }
@ -121,8 +109,7 @@ public class SysPostController extends BaseController
* *
*/ */
@GetMapping("/optionselect") @GetMapping("/optionselect")
public AjaxResult optionselect() public AjaxResult optionselect() {
{
List<SysPost> posts = postService.selectPostAll(); List<SysPost> posts = postService.selectPostAll();
return success(posts); return success(posts);
} }

@ -1,14 +1,5 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
@ -22,16 +13,24 @@ import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.MimeTypeUtils; import com.ruoyi.common.utils.file.MimeTypeUtils;
import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/system/user/profile") @RequestMapping("/system/user/profile")
public class SysProfileController extends BaseController public class SysProfileController extends BaseController {
{
@Autowired @Autowired
private ISysUserService userService; private ISysUserService userService;
@ -42,8 +41,7 @@ public class SysProfileController extends BaseController
* *
*/ */
@GetMapping @GetMapping
public AjaxResult profile() public AjaxResult profile() {
{
LoginUser loginUser = getLoginUser(); LoginUser loginUser = getLoginUser();
SysUser user = loginUser.getUser(); SysUser user = loginUser.getUser();
AjaxResult ajax = AjaxResult.success(user); AjaxResult ajax = AjaxResult.success(user);
@ -57,24 +55,20 @@ public class SysProfileController extends BaseController
*/ */
@Log(title = "个人信息", businessType = BusinessType.UPDATE) @Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult updateProfile(@RequestBody SysUser user) public AjaxResult updateProfile(@RequestBody SysUser user) {
{
LoginUser loginUser = getLoginUser(); LoginUser loginUser = getLoginUser();
SysUser currentUser = loginUser.getUser(); SysUser currentUser = loginUser.getUser();
currentUser.setNickName(user.getNickName()); currentUser.setNickName(user.getNickName());
currentUser.setEmail(user.getEmail()); currentUser.setEmail(user.getEmail());
currentUser.setPhonenumber(user.getPhonenumber()); currentUser.setPhonenumber(user.getPhonenumber());
currentUser.setSex(user.getSex()); currentUser.setSex(user.getSex());
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) {
{
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
} }
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) {
{
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
} }
if (userService.updateUserProfile(currentUser) > 0) if (userService.updateUserProfile(currentUser) > 0) {
{
// 更新缓存用户信息 // 更新缓存用户信息
tokenService.setLoginUser(loginUser); tokenService.setLoginUser(loginUser);
return success(); return success();
@ -87,21 +81,17 @@ public class SysProfileController extends BaseController
*/ */
@Log(title = "个人信息", businessType = BusinessType.UPDATE) @Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd") @PutMapping("/updatePwd")
public AjaxResult updatePwd(String oldPassword, String newPassword) public AjaxResult updatePwd(String oldPassword, String newPassword) {
{
LoginUser loginUser = getLoginUser(); LoginUser loginUser = getLoginUser();
String userName = loginUser.getUsername(); String userName = loginUser.getUsername();
String password = loginUser.getPassword(); String password = loginUser.getPassword();
if (!SecurityUtils.matchesPassword(oldPassword, password)) if (!SecurityUtils.matchesPassword(oldPassword, password)) {
{
return error("修改密码失败,旧密码错误"); return error("修改密码失败,旧密码错误");
} }
if (SecurityUtils.matchesPassword(newPassword, password)) if (SecurityUtils.matchesPassword(newPassword, password)) {
{
return error("新密码不能与旧密码相同"); return error("新密码不能与旧密码相同");
} }
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) {
{
// 更新缓存用户密码 // 更新缓存用户密码
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword)); loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
tokenService.setLoginUser(loginUser); tokenService.setLoginUser(loginUser);
@ -115,14 +105,11 @@ public class SysProfileController extends BaseController
*/ */
@Log(title = "用户头像", businessType = BusinessType.UPDATE) @Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar") @PostMapping("/avatar")
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception {
{ if (!file.isEmpty()) {
if (!file.isEmpty())
{
LoginUser loginUser = getLoginUser(); LoginUser loginUser = getLoginUser();
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION); String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) {
{
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", avatar); ajax.put("imgUrl", avatar);
// 更新缓存用户头像 // 更新缓存用户头像

@ -1,24 +1,23 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.RegisterBody; import com.ruoyi.common.core.domain.model.RegisterBody;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.SysRegisterService; import com.ruoyi.framework.web.service.SysRegisterService;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
public class SysRegisterController extends BaseController public class SysRegisterController extends BaseController {
{
@Autowired @Autowired
private SysRegisterService registerService; private SysRegisterService registerService;
@ -26,10 +25,8 @@ public class SysRegisterController extends BaseController
private ISysConfigService configService; private ISysConfigService configService;
@PostMapping("/register") @PostMapping("/register")
public AjaxResult register(@RequestBody RegisterBody user) public AjaxResult register(@RequestBody RegisterBody user) {
{ if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
{
return error("当前系统没有开启注册功能!"); return error("当前系统没有开启注册功能!");
} }
String msg = registerService.register(user); String msg = registerService.register(user);

@ -1,18 +1,5 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
@ -30,16 +17,29 @@ import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/system/role") @RequestMapping("/system/role")
public class SysRoleController extends BaseController public class SysRoleController extends BaseController {
{
@Autowired @Autowired
private ISysRoleService roleService; private ISysRoleService roleService;
@ -57,8 +57,7 @@ public class SysRoleController extends BaseController
@PreAuthorize("@ss.hasPermi('system:role:list')") @PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysRole role) public TableDataInfo list(SysRole role) {
{
startPage(); startPage();
List<SysRole> list = roleService.selectRoleList(role); List<SysRole> list = roleService.selectRoleList(role);
return getDataTable(list); return getDataTable(list);
@ -67,8 +66,7 @@ public class SysRoleController extends BaseController
@Log(title = "角色管理", businessType = BusinessType.EXPORT) @Log(title = "角色管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:role:export')") @PreAuthorize("@ss.hasPermi('system:role:export')")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SysRole role) public void export(HttpServletResponse response, SysRole role) {
{
List<SysRole> list = roleService.selectRoleList(role); List<SysRole> list = roleService.selectRoleList(role);
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
util.exportExcel(response, list, "角色数据"); util.exportExcel(response, list, "角色数据");
@ -79,8 +77,7 @@ public class SysRoleController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:role:query')") @PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/{roleId}") @GetMapping(value = "/{roleId}")
public AjaxResult getInfo(@PathVariable Long roleId) public AjaxResult getInfo(@PathVariable Long roleId) {
{
roleService.checkRoleDataScope(roleId); roleService.checkRoleDataScope(roleId);
return success(roleService.selectRoleById(roleId)); return success(roleService.selectRoleById(roleId));
} }
@ -91,14 +88,10 @@ public class SysRoleController extends BaseController
@PreAuthorize("@ss.hasPermi('system:role:add')") @PreAuthorize("@ss.hasPermi('system:role:add')")
@Log(title = "角色管理", businessType = BusinessType.INSERT) @Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysRole role) public AjaxResult add(@Validated @RequestBody SysRole role) {
{ if (!roleService.checkRoleNameUnique(role)) {
if (!roleService.checkRoleNameUnique(role))
{
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
} } else if (!roleService.checkRoleKeyUnique(role)) {
else if (!roleService.checkRoleKeyUnique(role))
{
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
} }
role.setCreateBy(getUsername()); role.setCreateBy(getUsername());
@ -112,26 +105,20 @@ public class SysRoleController extends BaseController
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE) @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysRole role) public AjaxResult edit(@Validated @RequestBody SysRole role) {
{
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId()); roleService.checkRoleDataScope(role.getRoleId());
if (!roleService.checkRoleNameUnique(role)) if (!roleService.checkRoleNameUnique(role)) {
{
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
} } else if (!roleService.checkRoleKeyUnique(role)) {
else if (!roleService.checkRoleKeyUnique(role))
{
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
} }
role.setUpdateBy(getUsername()); role.setUpdateBy(getUsername());
if (roleService.updateRole(role) > 0) if (roleService.updateRole(role) > 0) {
{
// 更新缓存用户权限 // 更新缓存用户权限
LoginUser loginUser = getLoginUser(); LoginUser loginUser = getLoginUser();
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) {
{
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
tokenService.setLoginUser(loginUser); tokenService.setLoginUser(loginUser);
@ -147,8 +134,7 @@ public class SysRoleController extends BaseController
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE) @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/dataScope") @PutMapping("/dataScope")
public AjaxResult dataScope(@RequestBody SysRole role) public AjaxResult dataScope(@RequestBody SysRole role) {
{
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId()); roleService.checkRoleDataScope(role.getRoleId());
return toAjax(roleService.authDataScope(role)); return toAjax(roleService.authDataScope(role));
@ -160,8 +146,7 @@ public class SysRoleController extends BaseController
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE) @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus") @PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysRole role) public AjaxResult changeStatus(@RequestBody SysRole role) {
{
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId()); roleService.checkRoleDataScope(role.getRoleId());
role.setUpdateBy(getUsername()); role.setUpdateBy(getUsername());
@ -174,8 +159,7 @@ public class SysRoleController extends BaseController
@PreAuthorize("@ss.hasPermi('system:role:remove')") @PreAuthorize("@ss.hasPermi('system:role:remove')")
@Log(title = "角色管理", businessType = BusinessType.DELETE) @Log(title = "角色管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{roleIds}") @DeleteMapping("/{roleIds}")
public AjaxResult remove(@PathVariable Long[] roleIds) public AjaxResult remove(@PathVariable Long[] roleIds) {
{
return toAjax(roleService.deleteRoleByIds(roleIds)); return toAjax(roleService.deleteRoleByIds(roleIds));
} }
@ -184,8 +168,7 @@ public class SysRoleController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:role:query')") @PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping("/optionselect") @GetMapping("/optionselect")
public AjaxResult optionselect() public AjaxResult optionselect() {
{
return success(roleService.selectRoleAll()); return success(roleService.selectRoleAll());
} }
@ -194,8 +177,7 @@ public class SysRoleController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:role:list')") @PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/allocatedList") @GetMapping("/authUser/allocatedList")
public TableDataInfo allocatedList(SysUser user) public TableDataInfo allocatedList(SysUser user) {
{
startPage(); startPage();
List<SysUser> list = userService.selectAllocatedList(user); List<SysUser> list = userService.selectAllocatedList(user);
return getDataTable(list); return getDataTable(list);
@ -206,8 +188,7 @@ public class SysRoleController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:role:list')") @PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/unallocatedList") @GetMapping("/authUser/unallocatedList")
public TableDataInfo unallocatedList(SysUser user) public TableDataInfo unallocatedList(SysUser user) {
{
startPage(); startPage();
List<SysUser> list = userService.selectUnallocatedList(user); List<SysUser> list = userService.selectUnallocatedList(user);
return getDataTable(list); return getDataTable(list);
@ -219,8 +200,7 @@ public class SysRoleController extends BaseController
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT) @Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancel") @PutMapping("/authUser/cancel")
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) {
{
return toAjax(roleService.deleteAuthUser(userRole)); return toAjax(roleService.deleteAuthUser(userRole));
} }
@ -230,8 +210,7 @@ public class SysRoleController extends BaseController
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT) @Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancelAll") @PutMapping("/authUser/cancelAll")
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) {
{
return toAjax(roleService.deleteAuthUsers(roleId, userIds)); return toAjax(roleService.deleteAuthUsers(roleId, userIds));
} }
@ -241,8 +220,7 @@ public class SysRoleController extends BaseController
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT) @Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/selectAll") @PutMapping("/authUser/selectAll")
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) {
{
roleService.checkRoleDataScope(roleId); roleService.checkRoleDataScope(roleId);
return toAjax(roleService.insertAuthUsers(roleId, userIds)); return toAjax(roleService.insertAuthUsers(roleId, userIds));
} }
@ -252,8 +230,7 @@ public class SysRoleController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:role:query')") @PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/deptTree/{roleId}") @GetMapping(value = "/deptTree/{roleId}")
public AjaxResult deptTree(@PathVariable("roleId") Long roleId) public AjaxResult deptTree(@PathVariable("roleId") Long roleId) {
{
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
ajax.put("depts", deptService.selectDeptTreeList(new SysDept())); ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));

@ -1,21 +1,5 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
@ -31,16 +15,32 @@ import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysPostService; import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/system/user") @RequestMapping("/system/user")
public class SysUserController extends BaseController public class SysUserController extends BaseController {
{
@Autowired @Autowired
private ISysUserService userService; private ISysUserService userService;
@ -58,8 +58,7 @@ public class SysUserController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:user:list')") @PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysUser user) public TableDataInfo list(SysUser user) {
{
startPage(); startPage();
List<SysUser> list = userService.selectUserList(user); List<SysUser> list = userService.selectUserList(user);
return getDataTable(list); return getDataTable(list);
@ -68,8 +67,7 @@ public class SysUserController extends BaseController
@Log(title = "用户管理", businessType = BusinessType.EXPORT) @Log(title = "用户管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:user:export')") @PreAuthorize("@ss.hasPermi('system:user:export')")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SysUser user) public void export(HttpServletResponse response, SysUser user) {
{
List<SysUser> list = userService.selectUserList(user); List<SysUser> list = userService.selectUserList(user);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
util.exportExcel(response, list, "用户数据"); util.exportExcel(response, list, "用户数据");
@ -78,8 +76,7 @@ public class SysUserController extends BaseController
@Log(title = "用户管理", businessType = BusinessType.IMPORT) @Log(title = "用户管理", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:user:import')") @PreAuthorize("@ss.hasPermi('system:user:import')")
@PostMapping("/importData") @PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
{
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
List<SysUser> userList = util.importExcel(file.getInputStream()); List<SysUser> userList = util.importExcel(file.getInputStream());
String operName = getUsername(); String operName = getUsername();
@ -88,8 +85,7 @@ public class SysUserController extends BaseController
} }
@PostMapping("/importTemplate") @PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) public void importTemplate(HttpServletResponse response) {
{
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
util.importTemplateExcel(response, "用户数据"); util.importTemplateExcel(response, "用户数据");
} }
@ -98,16 +94,14 @@ public class SysUserController extends BaseController
* *
*/ */
@PreAuthorize("@ss.hasPermi('system:user:query')") @PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping(value = { "/", "/{userId}" }) @GetMapping(value = {"/", "/{userId}"})
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) {
{
userService.checkUserDataScope(userId); userService.checkUserDataScope(userId);
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
List<SysRole> roles = roleService.selectRoleAll(); List<SysRole> roles = roleService.selectRoleAll();
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
ajax.put("posts", postService.selectPostAll()); ajax.put("posts", postService.selectPostAll());
if (StringUtils.isNotNull(userId)) if (StringUtils.isNotNull(userId)) {
{
SysUser sysUser = userService.selectUserById(userId); SysUser sysUser = userService.selectUserById(userId);
ajax.put(AjaxResult.DATA_TAG, sysUser); ajax.put(AjaxResult.DATA_TAG, sysUser);
ajax.put("postIds", postService.selectPostListByUserId(userId)); ajax.put("postIds", postService.selectPostListByUserId(userId));
@ -122,18 +116,12 @@ public class SysUserController extends BaseController
@PreAuthorize("@ss.hasPermi('system:user:add')") @PreAuthorize("@ss.hasPermi('system:user:add')")
@Log(title = "用户管理", businessType = BusinessType.INSERT) @Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysUser user) public AjaxResult add(@Validated @RequestBody SysUser user) {
{ if (!userService.checkUserNameUnique(user)) {
if (!userService.checkUserNameUnique(user))
{
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
} } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
{
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
} } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
{
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
} }
user.setCreateBy(getUsername()); user.setCreateBy(getUsername());
@ -147,20 +135,14 @@ public class SysUserController extends BaseController
@PreAuthorize("@ss.hasPermi('system:user:edit')") @PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysUser user) public AjaxResult edit(@Validated @RequestBody SysUser user) {
{
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId()); userService.checkUserDataScope(user.getUserId());
if (!userService.checkUserNameUnique(user)) if (!userService.checkUserNameUnique(user)) {
{
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
} } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
{
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
} } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
{
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
} }
user.setUpdateBy(getUsername()); user.setUpdateBy(getUsername());
@ -173,10 +155,8 @@ public class SysUserController extends BaseController
@PreAuthorize("@ss.hasPermi('system:user:remove')") @PreAuthorize("@ss.hasPermi('system:user:remove')")
@Log(title = "用户管理", businessType = BusinessType.DELETE) @Log(title = "用户管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}") @DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds) public AjaxResult remove(@PathVariable Long[] userIds) {
{ if (ArrayUtils.contains(userIds, getUserId())) {
if (ArrayUtils.contains(userIds, getUserId()))
{
return error("当前用户不能删除"); return error("当前用户不能删除");
} }
return toAjax(userService.deleteUserByIds(userIds)); return toAjax(userService.deleteUserByIds(userIds));
@ -188,8 +168,7 @@ public class SysUserController extends BaseController
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')") @PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/resetPwd") @PutMapping("/resetPwd")
public AjaxResult resetPwd(@RequestBody SysUser user) public AjaxResult resetPwd(@RequestBody SysUser user) {
{
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId()); userService.checkUserDataScope(user.getUserId());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
@ -203,8 +182,7 @@ public class SysUserController extends BaseController
@PreAuthorize("@ss.hasPermi('system:user:edit')") @PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus") @PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysUser user) public AjaxResult changeStatus(@RequestBody SysUser user) {
{
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId()); userService.checkUserDataScope(user.getUserId());
user.setUpdateBy(getUsername()); user.setUpdateBy(getUsername());
@ -216,8 +194,7 @@ public class SysUserController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:user:query')") @PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping("/authRole/{userId}") @GetMapping("/authRole/{userId}")
public AjaxResult authRole(@PathVariable("userId") Long userId) public AjaxResult authRole(@PathVariable("userId") Long userId) {
{
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
SysUser user = userService.selectUserById(userId); SysUser user = userService.selectUserById(userId);
List<SysRole> roles = roleService.selectRolesByUserId(userId); List<SysRole> roles = roleService.selectRolesByUserId(userId);
@ -232,8 +209,7 @@ public class SysUserController extends BaseController
@PreAuthorize("@ss.hasPermi('system:user:edit')") @PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.GRANT) @Log(title = "用户管理", businessType = BusinessType.GRANT)
@PutMapping("/authRole") @PutMapping("/authRole")
public AjaxResult insertAuthRole(Long userId, Long[] roleIds) public AjaxResult insertAuthRole(Long userId, Long[] roleIds) {
{
userService.checkUserDataScope(userId); userService.checkUserDataScope(userId);
userService.insertUserAuth(userId, roleIds); userService.insertUserAuth(userId, roleIds);
return success(); return success();
@ -244,8 +220,7 @@ public class SysUserController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:user:list')") @PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/deptTree") @GetMapping("/deptTree")
public AjaxResult deptTree(SysDept dept) public AjaxResult deptTree(SysDept dept) {
{
return success(deptService.selectDeptTreeList(dept)); return success(deptService.selectDeptTreeList(dept));
} }
} }

@ -1,17 +1,5 @@
package com.ruoyi.web.controller.tool; package com.ruoyi.web.controller.tool;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.web.bind.annotation.DeleteMapping;
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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
@ -21,18 +9,31 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.DeleteMapping;
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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/** /**
* swagger * swagger
* *
* @author ruoyi * @author ruoyi
*/ */
@Api("用户信息管理") @Api("用户信息管理")
@RestController @RestController
@RequestMapping("/test/user") @RequestMapping("/test/user")
public class TestController extends BaseController public class TestController extends BaseController {
{
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>(); private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
{ {
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888")); users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666")); users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
@ -40,8 +41,7 @@ public class TestController extends BaseController
@ApiOperation("获取用户列表") @ApiOperation("获取用户列表")
@GetMapping("/list") @GetMapping("/list")
public R<List<UserEntity>> userList() public R<List<UserEntity>> userList() {
{
List<UserEntity> userList = new ArrayList<UserEntity>(users.values()); List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
return R.ok(userList); return R.ok(userList);
} }
@ -49,30 +49,24 @@ public class TestController extends BaseController
@ApiOperation("获取用户详细") @ApiOperation("获取用户详细")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@GetMapping("/{userId}") @GetMapping("/{userId}")
public R<UserEntity> getUser(@PathVariable Integer userId) public R<UserEntity> getUser(@PathVariable Integer userId) {
{ if (!users.isEmpty() && users.containsKey(userId)) {
if (!users.isEmpty() && users.containsKey(userId))
{
return R.ok(users.get(userId)); return R.ok(users.get(userId));
} } else {
else
{
return R.fail("用户不存在"); return R.fail("用户不存在");
} }
} }
@ApiOperation("新增用户") @ApiOperation("新增用户")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class), @ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class), @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class), @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class) @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
}) })
@PostMapping("/save") @PostMapping("/save")
public R<String> save(UserEntity user) public R<String> save(UserEntity user) {
{ if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) {
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return R.fail("用户ID不能为空"); return R.fail("用户ID不能为空");
} }
users.put(user.getUserId(), user); users.put(user.getUserId(), user);
@ -81,14 +75,11 @@ public class TestController extends BaseController
@ApiOperation("更新用户") @ApiOperation("更新用户")
@PutMapping("/update") @PutMapping("/update")
public R<String> update(@RequestBody UserEntity user) public R<String> update(@RequestBody UserEntity user) {
{ if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) {
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return R.fail("用户ID不能为空"); return R.fail("用户ID不能为空");
} }
if (users.isEmpty() || !users.containsKey(user.getUserId())) if (users.isEmpty() || !users.containsKey(user.getUserId())) {
{
return R.fail("用户不存在"); return R.fail("用户不存在");
} }
users.remove(user.getUserId()); users.remove(user.getUserId());
@ -99,23 +90,18 @@ public class TestController extends BaseController
@ApiOperation("删除用户信息") @ApiOperation("删除用户信息")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@DeleteMapping("/{userId}") @DeleteMapping("/{userId}")
public R<String> delete(@PathVariable Integer userId) public R<String> delete(@PathVariable Integer userId) {
{ if (!users.isEmpty() && users.containsKey(userId)) {
if (!users.isEmpty() && users.containsKey(userId))
{
users.remove(userId); users.remove(userId);
return R.ok(); return R.ok();
} } else {
else
{
return R.fail("用户不存在"); return R.fail("用户不存在");
} }
} }
} }
@ApiModel(value = "UserEntity", description = "用户实体") @ApiModel(value = "UserEntity", description = "用户实体")
class UserEntity class UserEntity {
{
@ApiModelProperty("用户ID") @ApiModelProperty("用户ID")
private Integer userId; private Integer userId;
@ -128,56 +114,46 @@ class UserEntity
@ApiModelProperty("用户手机") @ApiModelProperty("用户手机")
private String mobile; private String mobile;
public UserEntity() public UserEntity() {
{
} }
public UserEntity(Integer userId, String username, String password, String mobile) public UserEntity(Integer userId, String username, String password, String mobile) {
{
this.userId = userId; this.userId = userId;
this.username = username; this.username = username;
this.password = password; this.password = password;
this.mobile = mobile; this.mobile = mobile;
} }
public Integer getUserId() public Integer getUserId() {
{
return userId; return userId;
} }
public void setUserId(Integer userId) public void setUserId(Integer userId) {
{
this.userId = userId; this.userId = userId;
} }
public String getUsername() public String getUsername() {
{
return username; return username;
} }
public void setUsername(String username) public void setUsername(String username) {
{
this.username = username; this.username = username;
} }
public String getPassword() public String getPassword() {
{
return password; return password;
} }
public void setPassword(String password) public void setPassword(String password) {
{
this.password = password; this.password = password;
} }
public String getMobile() public String getMobile() {
{
return mobile; return mobile;
} }
public void setMobile(String mobile) public void setMobile(String mobile) {
{
this.mobile = mobile; this.mobile = mobile;
} }
} }

@ -1,28 +1,18 @@
package com.ruoyi.web.core.config; package com.ruoyi.web.core.config;
import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired; import com.ruoyi.common.config.RuoYiConfig;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
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.RuoYiConfig;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
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;
import springfox.documentation.service.ApiInfo; import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.Contact; import springfox.documentation.service.Contact;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.service.SecurityScheme;
import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;

@ -1,61 +1,61 @@
# 数据源配置 # 数据源配置
spring: spring:
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://localhost:3306/algorithms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://localhost:3306/algorithms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: jichuang@123 password: jichuang@123
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭
enabled: false enabled: false
url: url:
username: username:
password: password:
# 初始连接数 # 初始连接数
initialSize: 5 initialSize: 5
# 最小连接池数量 # 最小连接池数量
minIdle: 10 minIdle: 10
# 最大连接池数量 # 最大连接池数量
maxActive: 20 maxActive: 20
# 配置获取连接等待超时的时间 # 配置获取连接等待超时的时间
maxWait: 60000 maxWait: 60000
# 配置连接超时时间 # 配置连接超时时间
connectTimeout: 30000 connectTimeout: 30000
# 配置网络超时时间 # 配置网络超时时间
socketTimeout: 60000 socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000 timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒 # 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000 minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒 # 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000 maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效 # 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true testWhileIdle: true
testOnBorrow: false testOnBorrow: false
testOnReturn: false testOnReturn: false
webStatFilter: webStatFilter:
enabled: true enabled: true
statViewServlet: statViewServlet:
enabled: true enabled: true
# 设置白名单,不填则允许所有访问 # 设置白名单,不填则允许所有访问
allow: allow:
url-pattern: /druid/* url-pattern: /druid/*
# 控制台管理用户名和密码 # 控制台管理用户名和密码
login-username: ruoyi login-username: ruoyi
login-password: 123456 login-password: 123456
filter: filter:
stat: stat:
enabled: true enabled: true
# 慢SQL记录 # 慢SQL记录
log-slow-sql: true log-slow-sql: true
slow-sql-millis: 1000 slow-sql-millis: 1000
merge-sql: true merge-sql: true
wall: wall:
config: config:
multi-statement-allow: true multi-statement-allow: true

@ -116,7 +116,12 @@ pagehelper:
# Swagger配置 # Swagger配置
knife4j: knife4j:
enable: true enable: false
# production: true
basic:
enable": false
username: yingji
password: Yingji@123.
# 防止XSS攻击 # 防止XSS攻击

@ -11,12 +11,9 @@ user.blocked=用户已封禁,请联系管理员
role.blocked=角色已封禁,请联系管理员 role.blocked=角色已封禁,请联系管理员
login.blocked=很遗憾访问IP已被列入系统黑名单 login.blocked=很遗憾访问IP已被列入系统黑名单
user.logout.success=退出成功 user.logout.success=退出成功
length.not.valid=长度必须在{min}到{max}个字符之间 length.not.valid=长度必须在{min}到{max}个字符之间
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成且必须以非数字开头 user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成且必须以非数字开头
user.password.not.valid=* 5-50个字符 user.password.not.valid=* 5-50个字符
user.email.not.valid=邮箱格式错误 user.email.not.valid=邮箱格式错误
user.mobile.phone.number.not.valid=手机号格式错误 user.mobile.phone.number.not.valid=手机号格式错误
user.login.success=登录成功 user.login.success=登录成功
@ -24,11 +21,9 @@ user.register.success=注册成功
user.notfound=请重新登录 user.notfound=请重新登录
user.forcelogout=管理员强制退出,请重新登录 user.forcelogout=管理员强制退出,请重新登录
user.unknown.error=未知错误,请重新登录 user.unknown.error=未知错误,请重新登录
##文件上传消息 ##文件上传消息
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB
upload.filename.exceed.length=上传的文件名最长{0}个字符 upload.filename.exceed.length=上传的文件名最长{0}个字符
##权限 ##权限
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]

@ -1,31 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration> <configuration>
<!-- 日志存放路径 --> <!-- 日志存放路径 -->
<property name="log.path" value="/home/ruoyi/logs" /> <property name="log.path" value="/home/ruoyi/logs"/>
<!-- 日志输出格式 --> <!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 --> <!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
</encoder> </encoder>
</appender> </appender>
<!-- 系统日志输出 --> <!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file> <file>${log.path}/sys-info.log</file>
<!-- 循环政策:基于时间创建日志文件 --> <!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 --> <!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern> <fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 --> <!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory> <maxHistory>60</maxHistory>
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
</encoder> </encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter"> <filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 --> <!-- 过滤的级别 -->
<level>INFO</level> <level>INFO</level>
<!-- 匹配时的操作:接收(记录) --> <!-- 匹配时的操作:接收(记录) -->
@ -33,16 +33,16 @@
<!-- 不匹配时的操作:拒绝(不记录) --> <!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch> <onMismatch>DENY</onMismatch>
</filter> </filter>
</appender> </appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file> <file>${log.path}/sys-error.log</file>
<!-- 循环政策:基于时间创建日志文件 --> <!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 --> <!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern> <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 --> <!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory> <maxHistory>60</maxHistory>
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
@ -50,16 +50,16 @@
<filter class="ch.qos.logback.classic.filter.LevelFilter"> <filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 --> <!-- 过滤的级别 -->
<level>ERROR</level> <level>ERROR</level>
<!-- 匹配时的操作:接收(记录) --> <!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch> <onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) --> <!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch> <onMismatch>DENY</onMismatch>
</filter> </filter>
</appender> </appender>
<!-- 用户访问日志输出 --> <!-- 用户访问日志输出 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file> <file>${log.path}/sys-user.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 按天回滚 daily --> <!-- 按天回滚 daily -->
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern> <fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
@ -70,23 +70,23 @@
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
</encoder> </encoder>
</appender> </appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<root level="info"> <!-- 系统模块日志级别控制 -->
<appender-ref ref="console" /> <logger name="com.ruoyi" level="info"/>
</root> <!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info"> <root level="info">
<appender-ref ref="file_info" /> <appender-ref ref="file_info"/>
<appender-ref ref="file_error" /> <appender-ref ref="file_error"/>
</root> </root>
<!--系统用户操作日志--> <!--系统用户操作日志-->
<logger name="sys-user" level="info"> <logger name="sys-user" level="info">
<appender-ref ref="sys-user"/> <appender-ref ref="sys-user"/>
</logger> </logger>

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration <!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN" PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd"> "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration> <configuration>
<!-- 全局参数 --> <!-- 全局参数 -->
<settings> <settings>
<!-- 使全局的映射器启用或禁用缓存 --> <!-- 使全局的映射器启用或禁用缓存 -->
<setting name="cacheEnabled" value="true" /> <setting name="cacheEnabled" value="true"/>
<!-- 允许JDBC 支持自动生成主键 --> <!-- 允许JDBC 支持自动生成主键 -->
<setting name="useGeneratedKeys" value="true" /> <setting name="useGeneratedKeys" value="true"/>
<!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 --> <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
<setting name="defaultExecutorType" value="SIMPLE" /> <setting name="defaultExecutorType" value="SIMPLE"/>
<!-- 指定 MyBatis 所用日志的具体实现 --> <!-- 指定 MyBatis 所用日志的具体实现 -->
<setting name="logImpl" value="SLF4J" /> <setting name="logImpl" value="SLF4J"/>
<!-- 使用驼峰命名法转换字段 --> <!-- 使用驼峰命名法转换字段 -->
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> --> <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
</settings> </settings>
</configuration> </configuration>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
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">
<parent> <parent>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
@ -56,19 +56,19 @@
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
</dependency> </dependency>
<!-- JSON工具类 --> <!-- JSON工具类 -->
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
</dependency> </dependency>
<!-- 动态数据源 --> <!-- 动态数据源 -->
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId> <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>3.5.2</version> <version>3.5.2</version>
</dependency> </dependency>
<!-- 阿里JSON解析器 --> <!-- 阿里JSON解析器 -->
<dependency> <dependency>

@ -8,12 +8,11 @@ import java.lang.annotation.Target;
/** /**
* 访 * 访
* *
* @author ruoyi * @author ruoyi
*/ */
@Target({ ElementType.METHOD, ElementType.TYPE }) @Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
public @interface Anonymous public @interface Anonymous {
{
} }

@ -8,14 +8,13 @@ import java.lang.annotation.Target;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
public @interface DataScope public @interface DataScope {
{
/** /**
* *
*/ */

@ -1,26 +1,26 @@
package com.ruoyi.common.annotation; package com.ruoyi.common.annotation;
import com.ruoyi.common.enums.DataSourceType;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited; import java.lang.annotation.Inherited;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import com.ruoyi.common.enums.DataSourceType;
/** /**
* *
* * <p>
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@Target({ ElementType.METHOD, ElementType.TYPE }) @Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
@Inherited @Inherited
public @interface DataSource public @interface DataSource {
{
/** /**
* *
*/ */

@ -1,23 +1,23 @@
package com.ruoyi.common.annotation; package com.ruoyi.common.annotation;
import com.ruoyi.common.utils.poi.ExcelHandlerAdapter;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import com.ruoyi.common.utils.poi.ExcelHandlerAdapter;
/** /**
* Excel * Excel
* *
* @author ruoyi * @author ruoyi
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
public @interface Excel public @interface Excel {
{
/** /**
* excel * excel
*/ */
@ -153,34 +153,28 @@ public @interface Excel
*/ */
Type type() default Type.ALL; Type type() default Type.ALL;
public enum Type public enum Type {
{
ALL(0), EXPORT(1), IMPORT(2); ALL(0), EXPORT(1), IMPORT(2);
private final int value; private final int value;
Type(int value) Type(int value) {
{
this.value = value; this.value = value;
} }
public int value() public int value() {
{
return this.value; return this.value;
} }
} }
public enum ColumnType public enum ColumnType {
{
NUMERIC(0), STRING(1), IMAGE(2); NUMERIC(0), STRING(1), IMAGE(2);
private final int value; private final int value;
ColumnType(int value) ColumnType(int value) {
{
this.value = value; this.value = value;
} }
public int value() public int value() {
{
return this.value; return this.value;
} }
} }

@ -7,12 +7,11 @@ import java.lang.annotation.Target;
/** /**
* Excel * Excel
* *
* @author ruoyi * @author ruoyi
*/ */
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface Excels public @interface Excels {
{
public Excel[] value(); public Excel[] value();
} }

@ -1,24 +1,23 @@
package com.ruoyi.common.annotation; package com.ruoyi.common.annotation;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.OperatorType;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.OperatorType;
/** /**
* *
*
* @author ruoyi
* *
* @author ruoyi
*/ */
@Target({ ElementType.PARAMETER, ElementType.METHOD }) @Target({ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
public @interface Log public @interface Log {
{
/** /**
* *
*/ */

@ -1,23 +1,23 @@
package com.ruoyi.common.annotation; package com.ruoyi.common.annotation;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.enums.LimitType;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.enums.LimitType;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
public @interface RateLimiter public @interface RateLimiter {
{
/** /**
* key * key
*/ */

@ -9,16 +9,14 @@ import java.lang.annotation.Target;
/** /**
* *
*
* @author ruoyi
* *
* @author ruoyi
*/ */
@Inherited @Inherited
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
public @interface RepeatSubmit public @interface RepeatSubmit {
{
/** /**
* (ms) * (ms)
*/ */

@ -5,91 +5,54 @@ import org.springframework.stereotype.Component;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@Component @Component
@ConfigurationProperties(prefix = "ruoyi") @ConfigurationProperties(prefix = "ruoyi")
public class RuoYiConfig public class RuoYiConfig {
{ /**
/** 项目名称 */ *
*/
private static String profile;
/**
*
*/
private static boolean addressEnabled;
/**
*
*/
private static String captchaType;
/**
*
*/
private String name; private String name;
/**
/** 版本 */ *
*/
private String version; private String version;
/**
/** 版权年份 */ *
*/
private String copyrightYear; private String copyrightYear;
/**
/** 实例演示开关 */ *
*/
private boolean demoEnabled; private boolean demoEnabled;
/** 上传路径 */ public static String getProfile() {
private static String profile;
/** 获取地址开关 */
private static boolean addressEnabled;
/** 验证码类型 */
private static String captchaType;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getVersion()
{
return version;
}
public void setVersion(String version)
{
this.version = version;
}
public String getCopyrightYear()
{
return copyrightYear;
}
public void setCopyrightYear(String copyrightYear)
{
this.copyrightYear = copyrightYear;
}
public boolean isDemoEnabled()
{
return demoEnabled;
}
public void setDemoEnabled(boolean demoEnabled)
{
this.demoEnabled = demoEnabled;
}
public static String getProfile()
{
return profile; return profile;
} }
public void setProfile(String profile) public void setProfile(String profile) {
{
RuoYiConfig.profile = profile; RuoYiConfig.profile = profile;
} }
public static boolean isAddressEnabled() public static boolean isAddressEnabled() {
{
return addressEnabled; return addressEnabled;
} }
public void setAddressEnabled(boolean addressEnabled) public void setAddressEnabled(boolean addressEnabled) {
{
RuoYiConfig.addressEnabled = addressEnabled; RuoYiConfig.addressEnabled = addressEnabled;
} }
@ -104,32 +67,60 @@ public class RuoYiConfig
/** /**
* *
*/ */
public static String getImportPath() public static String getImportPath() {
{
return getProfile() + "/import"; return getProfile() + "/import";
} }
/** /**
* *
*/ */
public static String getAvatarPath() public static String getAvatarPath() {
{
return getProfile() + "/avatar"; return getProfile() + "/avatar";
} }
/** /**
* *
*/ */
public static String getDownloadPath() public static String getDownloadPath() {
{
return getProfile() + "/download/"; return getProfile() + "/download/";
} }
/** /**
* *
*/ */
public static String getUploadPath() public static String getUploadPath() {
{
return getProfile() + "/upload"; return getProfile() + "/upload";
} }
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getCopyrightYear() {
return copyrightYear;
}
public void setCopyrightYear(String copyrightYear) {
this.copyrightYear = copyrightYear;
}
public boolean isDemoEnabled() {
return demoEnabled;
}
public void setDemoEnabled(boolean demoEnabled) {
this.demoEnabled = demoEnabled;
}
} }

@ -2,11 +2,10 @@ package com.ruoyi.common.constant;
/** /**
* key * key
* *
* @author ruoyi * @author ruoyi
*/ */
public class CacheConstants public class CacheConstants {
{
/** /**
* redis key * redis key
*/ */

@ -4,11 +4,10 @@ import io.jsonwebtoken.Claims;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class Constants public class Constants {
{
/** /**
* UTF-8 * UTF-8
*/ */
@ -63,7 +62,7 @@ public class Constants
* *
*/ */
public static final String LOGIN_FAIL = "Error"; public static final String LOGIN_FAIL = "Error";
/** /**
* *
*/ */
@ -132,16 +131,16 @@ public class Constants
/** /**
* json * json
*/ */
public static final String[] JSON_WHITELIST_STR = { "org.springframework", "com.ruoyi" }; public static final String[] JSON_WHITELIST_STR = {"org.springframework", "com.ruoyi"};
/** /**
* 访 * 访
*/ */
public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" }; public static final String[] JOB_WHITELIST_STR = {"com.ruoyi"};
/** /**
* *
*/ */
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", public static final String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
"org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config" }; "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config"};
} }

@ -2,116 +2,185 @@ package com.ruoyi.common.constant;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class GenConstants public class GenConstants {
{ /**
/** 单表(增删改查) */ *
*/
public static final String TPL_CRUD = "crud"; public static final String TPL_CRUD = "crud";
/** 树表(增删改查) */ /**
*
*/
public static final String TPL_TREE = "tree"; public static final String TPL_TREE = "tree";
/** 主子表(增删改查) */ /**
*
*/
public static final String TPL_SUB = "sub"; public static final String TPL_SUB = "sub";
/** 树编码字段 */ /**
*
*/
public static final String TREE_CODE = "treeCode"; public static final String TREE_CODE = "treeCode";
/** 树父编码字段 */ /**
*
*/
public static final String TREE_PARENT_CODE = "treeParentCode"; public static final String TREE_PARENT_CODE = "treeParentCode";
/** 树名称字段 */ /**
*
*/
public static final String TREE_NAME = "treeName"; public static final String TREE_NAME = "treeName";
/** 上级菜单ID字段 */ /**
* ID
*/
public static final String PARENT_MENU_ID = "parentMenuId"; public static final String PARENT_MENU_ID = "parentMenuId";
/** 上级菜单名称字段 */ /**
*
*/
public static final String PARENT_MENU_NAME = "parentMenuName"; public static final String PARENT_MENU_NAME = "parentMenuName";
/** 数据库字符串类型 */ /**
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" }; *
*/
/** 数据库文本类型 */ public static final String[] COLUMNTYPE_STR = {"char", "varchar", "nvarchar", "varchar2"};
public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" };
/**
/** 数据库时间类型 */ *
public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" }; */
public static final String[] COLUMNTYPE_TEXT = {"tinytext", "text", "mediumtext", "longtext"};
/** 数据库数字类型 */
public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer", /**
"bit", "bigint", "float", "double", "decimal" }; *
*/
/** 页面不需要编辑字段 */ public static final String[] COLUMNTYPE_TIME = {"datetime", "time", "date", "timestamp"};
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
/**
/** 页面不需要显示的列表字段 */ *
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by", */
"update_time" }; public static final String[] COLUMNTYPE_NUMBER = {"tinyint", "smallint", "mediumint", "int", "number", "integer",
"bit", "bigint", "float", "double", "decimal"};
/** 页面不需要查询字段 */
public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by", /**
"update_time", "remark" }; *
*/
/** Entity基类字段 */ public static final String[] COLUMNNAME_NOT_EDIT = {"id", "create_by", "create_time", "del_flag"};
public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
/**
/** Tree基类字段 */ *
public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" }; */
public static final String[] COLUMNNAME_NOT_LIST = {"id", "create_by", "create_time", "del_flag", "update_by",
/** 文本框 */ "update_time"};
/**
*
*/
public static final String[] COLUMNNAME_NOT_QUERY = {"id", "create_by", "create_time", "del_flag", "update_by",
"update_time", "remark"};
/**
* Entity
*/
public static final String[] BASE_ENTITY = {"createBy", "createTime", "updateBy", "updateTime", "remark"};
/**
* Tree
*/
public static final String[] TREE_ENTITY = {"parentName", "parentId", "orderNum", "ancestors", "children"};
/**
*
*/
public static final String HTML_INPUT = "input"; public static final String HTML_INPUT = "input";
/** 文本域 */ /**
*
*/
public static final String HTML_TEXTAREA = "textarea"; public static final String HTML_TEXTAREA = "textarea";
/** 下拉框 */ /**
*
*/
public static final String HTML_SELECT = "select"; public static final String HTML_SELECT = "select";
/** 单选框 */ /**
*
*/
public static final String HTML_RADIO = "radio"; public static final String HTML_RADIO = "radio";
/** 复选框 */ /**
*
*/
public static final String HTML_CHECKBOX = "checkbox"; public static final String HTML_CHECKBOX = "checkbox";
/** 日期控件 */ /**
*
*/
public static final String HTML_DATETIME = "datetime"; public static final String HTML_DATETIME = "datetime";
/** 图片上传控件 */ /**
*
*/
public static final String HTML_IMAGE_UPLOAD = "imageUpload"; public static final String HTML_IMAGE_UPLOAD = "imageUpload";
/** 文件上传控件 */ /**
*
*/
public static final String HTML_FILE_UPLOAD = "fileUpload"; public static final String HTML_FILE_UPLOAD = "fileUpload";
/** 富文本控件 */ /**
*
*/
public static final String HTML_EDITOR = "editor"; public static final String HTML_EDITOR = "editor";
/** 字符串类型 */ /**
*
*/
public static final String TYPE_STRING = "String"; public static final String TYPE_STRING = "String";
/** 整型 */ /**
*
*/
public static final String TYPE_INTEGER = "Integer"; public static final String TYPE_INTEGER = "Integer";
/** 长整型 */ /**
*
*/
public static final String TYPE_LONG = "Long"; public static final String TYPE_LONG = "Long";
/** 浮点型 */ /**
*
*/
public static final String TYPE_DOUBLE = "Double"; public static final String TYPE_DOUBLE = "Double";
/** 高精度计算类型 */ /**
*
*/
public static final String TYPE_BIGDECIMAL = "BigDecimal"; public static final String TYPE_BIGDECIMAL = "BigDecimal";
/** 时间类型 */ /**
*
*/
public static final String TYPE_DATE = "Date"; public static final String TYPE_DATE = "Date";
/** 模糊查询 */ /**
*
*/
public static final String QUERY_LIKE = "LIKE"; public static final String QUERY_LIKE = "LIKE";
/** 相等查询 */ /**
*
*/
public static final String QUERY_EQ = "EQ"; public static final String QUERY_EQ = "EQ";
/** 需要 */ /**
*
*/
public static final String REQUIRE = "1"; public static final String REQUIRE = "1";
} }

@ -2,11 +2,10 @@ package com.ruoyi.common.constant;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class HttpStatus public class HttpStatus {
{
/** /**
* *
*/ */

@ -2,30 +2,38 @@ package com.ruoyi.common.constant;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class ScheduleConstants public class ScheduleConstants {
{
public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
/** 执行目标key */ /**
* key
*/
public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
/** 默认 */ /**
*
*/
public static final String MISFIRE_DEFAULT = "0"; public static final String MISFIRE_DEFAULT = "0";
/** 立即触发执行 */ /**
*
*/
public static final String MISFIRE_IGNORE_MISFIRES = "1"; public static final String MISFIRE_IGNORE_MISFIRES = "1";
/** 触发一次执行 */ /**
*
*/
public static final String MISFIRE_FIRE_AND_PROCEED = "2"; public static final String MISFIRE_FIRE_AND_PROCEED = "2";
/** 不触发立即执行 */ /**
*
*/
public static final String MISFIRE_DO_NOTHING = "3"; public static final String MISFIRE_DO_NOTHING = "3";
public enum Status public enum Status {
{
/** /**
* *
*/ */
@ -37,13 +45,11 @@ public class ScheduleConstants
private String value; private String value;
private Status(String value) private Status(String value) {
{
this.value = value; this.value = value;
} }
public String getValue() public String getValue() {
{
return value; return value;
} }
} }

@ -2,65 +2,98 @@ package com.ruoyi.common.constant;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class UserConstants public class UserConstants {
{
/** /**
* *
*/ */
public static final String SYS_USER = "SYS_USER"; public static final String SYS_USER = "SYS_USER";
/** 正常状态 */ /**
*
*/
public static final String NORMAL = "0"; public static final String NORMAL = "0";
/** 异常状态 */ /**
*
*/
public static final String EXCEPTION = "1"; public static final String EXCEPTION = "1";
/** 用户封禁状态 */ /**
*
*/
public static final String USER_DISABLE = "1"; public static final String USER_DISABLE = "1";
/** 角色封禁状态 */ /**
*
*/
public static final String ROLE_DISABLE = "1"; public static final String ROLE_DISABLE = "1";
/** 部门正常状态 */ /**
*
*/
public static final String DEPT_NORMAL = "0"; public static final String DEPT_NORMAL = "0";
/** 部门停用状态 */ /**
*
*/
public static final String DEPT_DISABLE = "1"; public static final String DEPT_DISABLE = "1";
/** 字典正常状态 */ /**
*
*/
public static final String DICT_NORMAL = "0"; public static final String DICT_NORMAL = "0";
/** 是否为系统默认(是) */ /**
*
*/
public static final String YES = "Y"; public static final String YES = "Y";
/** 是否菜单外链(是) */ /**
*
*/
public static final String YES_FRAME = "0"; public static final String YES_FRAME = "0";
/** 是否菜单外链(否) */ /**
*
*/
public static final String NO_FRAME = "1"; public static final String NO_FRAME = "1";
/** 菜单类型(目录) */ /**
*
*/
public static final String TYPE_DIR = "M"; public static final String TYPE_DIR = "M";
/** 菜单类型(菜单) */ /**
*
*/
public static final String TYPE_MENU = "C"; public static final String TYPE_MENU = "C";
/** 菜单类型(按钮) */ /**
*
*/
public static final String TYPE_BUTTON = "F"; public static final String TYPE_BUTTON = "F";
/** Layout组件标识 */ /**
* Layout
*/
public final static String LAYOUT = "Layout"; public final static String LAYOUT = "Layout";
/** ParentView组件标识 */ /**
* ParentView
*/
public final static String PARENT_VIEW = "ParentView"; public final static String PARENT_VIEW = "ParentView";
/** InnerLink组件标识 */ /**
* InnerLink
*/
public final static String INNER_LINK = "InnerLink"; public final static String INNER_LINK = "InnerLink";
/** 校验是否唯一的返回标识 */ /**
*
*/
public final static boolean UNIQUE = true; public final static boolean UNIQUE = true;
public final static boolean NOT_UNIQUE = false; public final static boolean NOT_UNIQUE = false;

@ -1,12 +1,5 @@
package com.ruoyi.common.core.controller; package com.ruoyi.common.core.controller;
import java.beans.PropertyEditorSupport;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
@ -20,28 +13,32 @@ import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.sql.SqlUtil; import com.ruoyi.common.utils.sql.SqlUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import java.beans.PropertyEditorSupport;
import java.util.Date;
import java.util.List;
/** /**
* web * web
* *
* @author ruoyi * @author ruoyi
*/ */
public class BaseController public class BaseController {
{
protected final Logger logger = LoggerFactory.getLogger(this.getClass()); protected final Logger logger = LoggerFactory.getLogger(this.getClass());
/** /**
* Date * Date
*/ */
@InitBinder @InitBinder
public void initBinder(WebDataBinder binder) public void initBinder(WebDataBinder binder) {
{
// Date 类型转换 // Date 类型转换
binder.registerCustomEditor(Date.class, new PropertyEditorSupport() binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
{
@Override @Override
public void setAsText(String text) public void setAsText(String text) {
{
setValue(DateUtils.parseDate(text)); setValue(DateUtils.parseDate(text));
} }
}); });
@ -50,19 +47,16 @@ public class BaseController
/** /**
* *
*/ */
protected void startPage() protected void startPage() {
{
PageUtils.startPage(); PageUtils.startPage();
} }
/** /**
* *
*/ */
protected void startOrderBy() protected void startOrderBy() {
{
PageDomain pageDomain = TableSupport.buildPageRequest(); PageDomain pageDomain = TableSupport.buildPageRequest();
if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) {
{
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageHelper.orderBy(orderBy); PageHelper.orderBy(orderBy);
} }
@ -71,17 +65,15 @@ public class BaseController
/** /**
* 线 * 线
*/ */
protected void clearPage() protected void clearPage() {
{
PageUtils.clearPage(); PageUtils.clearPage();
} }
/** /**
* *
*/ */
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({"rawtypes", "unchecked"})
protected TableDataInfo getDataTable(List<?> list) protected TableDataInfo getDataTable(List<?> list) {
{
TableDataInfo rspData = new TableDataInfo(); TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS); rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功"); rspData.setMsg("查询成功");
@ -93,110 +85,97 @@ public class BaseController
/** /**
* *
*/ */
public AjaxResult success() public AjaxResult success() {
{
return AjaxResult.success(); return AjaxResult.success();
} }
/** /**
* *
*/ */
public AjaxResult error() public AjaxResult error() {
{
return AjaxResult.error(); return AjaxResult.error();
} }
/** /**
* *
*/ */
public AjaxResult success(String message) public AjaxResult success(String message) {
{
return AjaxResult.success(message); return AjaxResult.success(message);
} }
/** /**
* *
*/ */
public AjaxResult success(Object data) public AjaxResult success(Object data) {
{
return AjaxResult.success(data); return AjaxResult.success(data);
} }
/** /**
* *
*/ */
public AjaxResult error(String message) public AjaxResult error(String message) {
{
return AjaxResult.error(message); return AjaxResult.error(message);
} }
/** /**
* *
*/ */
public AjaxResult warn(String message) public AjaxResult warn(String message) {
{
return AjaxResult.warn(message); return AjaxResult.warn(message);
} }
/** /**
* *
* *
* @param rows * @param rows
* @return * @return
*/ */
protected AjaxResult toAjax(int rows) protected AjaxResult toAjax(int rows) {
{
return rows > 0 ? AjaxResult.success() : AjaxResult.error(); return rows > 0 ? AjaxResult.success() : AjaxResult.error();
} }
/** /**
* *
* *
* @param result * @param result
* @return * @return
*/ */
protected AjaxResult toAjax(boolean result) protected AjaxResult toAjax(boolean result) {
{
return result ? success() : error(); return result ? success() : error();
} }
/** /**
* *
*/ */
public String redirect(String url) public String redirect(String url) {
{
return StringUtils.format("redirect:{}", url); return StringUtils.format("redirect:{}", url);
} }
/** /**
* *
*/ */
public LoginUser getLoginUser() public LoginUser getLoginUser() {
{
return SecurityUtils.getLoginUser(); return SecurityUtils.getLoginUser();
} }
/** /**
* id * id
*/ */
public Long getUserId() public Long getUserId() {
{
return getLoginUser().getUserId(); return getLoginUser().getUserId();
} }
/** /**
* id * id
*/ */
public Long getDeptId() public Long getDeptId() {
{
return getLoginUser().getDeptId(); return getLoginUser().getDeptId();
} }
/** /**
* *
*/ */
public String getUsername() public String getUsername() {
{
return getLoginUser().getUsername(); return getLoginUser().getUsername();
} }
} }

@ -1,104 +1,99 @@
package com.ruoyi.common.core.domain; package com.ruoyi.common.core.domain;
import java.util.HashMap;
import java.util.Objects;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import java.util.HashMap;
import java.util.Objects;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class AjaxResult extends HashMap<String, Object> public class AjaxResult extends HashMap<String, Object> {
{ /**
private static final long serialVersionUID = 1L; *
*/
/** 状态码 */
public static final String CODE_TAG = "code"; public static final String CODE_TAG = "code";
/**
/** 返回内容 */ *
*/
public static final String MSG_TAG = "msg"; public static final String MSG_TAG = "msg";
/**
/** 数据对象 */ *
*/
public static final String DATA_TAG = "data"; public static final String DATA_TAG = "data";
private static final long serialVersionUID = 1L;
/** /**
* AjaxResult 使 * AjaxResult 使
*/ */
public AjaxResult() public AjaxResult() {
{
} }
/** /**
* AjaxResult * AjaxResult
* *
* @param code * @param code
* @param msg * @param msg
*/ */
public AjaxResult(int code, String msg) public AjaxResult(int code, String msg) {
{
super.put(CODE_TAG, code); super.put(CODE_TAG, code);
super.put(MSG_TAG, msg); super.put(MSG_TAG, msg);
} }
/** /**
* AjaxResult * AjaxResult
* *
* @param code * @param code
* @param msg * @param msg
* @param data * @param data
*/ */
public AjaxResult(int code, String msg, Object data) public AjaxResult(int code, String msg, Object data) {
{
super.put(CODE_TAG, code); super.put(CODE_TAG, code);
super.put(MSG_TAG, msg); super.put(MSG_TAG, msg);
if (StringUtils.isNotNull(data)) if (StringUtils.isNotNull(data)) {
{
super.put(DATA_TAG, data); super.put(DATA_TAG, data);
} }
} }
/** /**
* *
* *
* @return * @return
*/ */
public static AjaxResult success() public static AjaxResult success() {
{
return AjaxResult.success("操作成功"); return AjaxResult.success("操作成功");
} }
/** /**
* *
* *
* @return * @return
*/ */
public static AjaxResult success(Object data) public static AjaxResult success(Object data) {
{
return AjaxResult.success("操作成功", data); return AjaxResult.success("操作成功", data);
} }
/** /**
* *
* *
* @param msg * @param msg
* @return * @return
*/ */
public static AjaxResult success(String msg) public static AjaxResult success(String msg) {
{
return AjaxResult.success(msg, null); return AjaxResult.success(msg, null);
} }
/** /**
* *
* *
* @param msg * @param msg
* @param data * @param data
* @return * @return
*/ */
public static AjaxResult success(String msg, Object data) public static AjaxResult success(String msg, Object data) {
{
return new AjaxResult(HttpStatus.SUCCESS, msg, data); return new AjaxResult(HttpStatus.SUCCESS, msg, data);
} }
@ -108,65 +103,59 @@ public class AjaxResult extends HashMap<String, Object>
* @param msg * @param msg
* @return * @return
*/ */
public static AjaxResult warn(String msg) public static AjaxResult warn(String msg) {
{
return AjaxResult.warn(msg, null); return AjaxResult.warn(msg, null);
} }
/** /**
* *
* *
* @param msg * @param msg
* @param data * @param data
* @return * @return
*/ */
public static AjaxResult warn(String msg, Object data) public static AjaxResult warn(String msg, Object data) {
{
return new AjaxResult(HttpStatus.WARN, msg, data); return new AjaxResult(HttpStatus.WARN, msg, data);
} }
/** /**
* *
* *
* @return * @return
*/ */
public static AjaxResult error() public static AjaxResult error() {
{
return AjaxResult.error("操作失败"); return AjaxResult.error("操作失败");
} }
/** /**
* *
* *
* @param msg * @param msg
* @return * @return
*/ */
public static AjaxResult error(String msg) public static AjaxResult error(String msg) {
{
return AjaxResult.error(msg, null); return AjaxResult.error(msg, null);
} }
/** /**
* *
* *
* @param msg * @param msg
* @param data * @param data
* @return * @return
*/ */
public static AjaxResult error(String msg, Object data) public static AjaxResult error(String msg, Object data) {
{
return new AjaxResult(HttpStatus.ERROR, msg, data); return new AjaxResult(HttpStatus.ERROR, msg, data);
} }
/** /**
* *
* *
* @param code * @param code
* @param msg * @param msg
* @return * @return
*/ */
public static AjaxResult error(int code, String msg) public static AjaxResult error(int code, String msg) {
{
return new AjaxResult(code, msg, null); return new AjaxResult(code, msg, null);
} }
@ -175,8 +164,7 @@ public class AjaxResult extends HashMap<String, Object>
* *
* @return * @return
*/ */
public boolean isSuccess() public boolean isSuccess() {
{
return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG)); return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
} }
@ -185,8 +173,7 @@ public class AjaxResult extends HashMap<String, Object>
* *
* @return * @return
*/ */
public boolean isWarn() public boolean isWarn() {
{
return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG)); return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
} }
@ -195,21 +182,19 @@ public class AjaxResult extends HashMap<String, Object>
* *
* @return * @return
*/ */
public boolean isError() public boolean isError() {
{
return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG)); return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
} }
/** /**
* 便 * 便
* *
* @param key * @param key
* @param value * @param value
* @return * @return
*/ */
@Override @Override
public AjaxResult put(String key, Object value) public AjaxResult put(String key, Object value) {
{
super.put(key, value); super.put(key, value);
return this; return this;
} }

@ -1,121 +1,120 @@
package com.ruoyi.common.core.domain; package com.ruoyi.common.core.domain;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/** /**
* Entity * Entity
* *
* @author ruoyi * @author ruoyi
*/ */
public class BaseEntity implements Serializable public class BaseEntity implements Serializable {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 搜索值 */ /**
*
*/
@JsonIgnore @JsonIgnore
private String searchValue; private String searchValue;
/** 创建者 */ /**
*
*/
private String createBy; private String createBy;
/** 创建时间 */ /**
*
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
/** 更新者 */ /**
*
*/
private String updateBy; private String updateBy;
/** 更新时间 */ /**
*
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
/** 备注 */ /**
*
*/
private String remark; private String remark;
/** 请求参数 */ /**
*
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params; private Map<String, Object> params;
public String getSearchValue() public String getSearchValue() {
{
return searchValue; return searchValue;
} }
public void setSearchValue(String searchValue) public void setSearchValue(String searchValue) {
{
this.searchValue = searchValue; this.searchValue = searchValue;
} }
public String getCreateBy() public String getCreateBy() {
{
return createBy; return createBy;
} }
public void setCreateBy(String createBy) public void setCreateBy(String createBy) {
{
this.createBy = createBy; this.createBy = createBy;
} }
public Date getCreateTime() public Date getCreateTime() {
{
return createTime; return createTime;
} }
public void setCreateTime(Date createTime) public void setCreateTime(Date createTime) {
{
this.createTime = createTime; this.createTime = createTime;
} }
public String getUpdateBy() public String getUpdateBy() {
{
return updateBy; return updateBy;
} }
public void setUpdateBy(String updateBy) public void setUpdateBy(String updateBy) {
{
this.updateBy = updateBy; this.updateBy = updateBy;
} }
public Date getUpdateTime() public Date getUpdateTime() {
{
return updateTime; return updateTime;
} }
public void setUpdateTime(Date updateTime) public void setUpdateTime(Date updateTime) {
{
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public String getRemark() public String getRemark() {
{
return remark; return remark;
} }
public void setRemark(String remark) public void setRemark(String remark) {
{
this.remark = remark; this.remark = remark;
} }
public Map<String, Object> getParams() public Map<String, Object> getParams() {
{ if (params == null) {
if (params == null)
{
params = new HashMap<>(); params = new HashMap<>();
} }
return params; return params;
} }
public void setParams(Map<String, Object> params) public void setParams(Map<String, Object> params) {
{
this.params = params; this.params = params;
} }
} }

@ -1,71 +1,63 @@
package com.ruoyi.common.core.domain; package com.ruoyi.common.core.domain;
import java.io.Serializable;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
import java.io.Serializable;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class R<T> implements Serializable public class R<T> implements Serializable {
{ /**
private static final long serialVersionUID = 1L; *
*/
/** 成功 */
public static final int SUCCESS = HttpStatus.SUCCESS; public static final int SUCCESS = HttpStatus.SUCCESS;
/**
/** 失败 */ *
*/
public static final int FAIL = HttpStatus.ERROR; public static final int FAIL = HttpStatus.ERROR;
private static final long serialVersionUID = 1L;
private int code; private int code;
private String msg; private String msg;
private T data; private T data;
public static <T> R<T> ok() public static <T> R<T> ok() {
{
return restResult(null, SUCCESS, "操作成功"); return restResult(null, SUCCESS, "操作成功");
} }
public static <T> R<T> ok(T data) public static <T> R<T> ok(T data) {
{
return restResult(data, SUCCESS, "操作成功"); return restResult(data, SUCCESS, "操作成功");
} }
public static <T> R<T> ok(T data, String msg) public static <T> R<T> ok(T data, String msg) {
{
return restResult(data, SUCCESS, msg); return restResult(data, SUCCESS, msg);
} }
public static <T> R<T> fail() public static <T> R<T> fail() {
{
return restResult(null, FAIL, "操作失败"); return restResult(null, FAIL, "操作失败");
} }
public static <T> R<T> fail(String msg) public static <T> R<T> fail(String msg) {
{
return restResult(null, FAIL, msg); return restResult(null, FAIL, msg);
} }
public static <T> R<T> fail(T data) public static <T> R<T> fail(T data) {
{
return restResult(data, FAIL, "操作失败"); return restResult(data, FAIL, "操作失败");
} }
public static <T> R<T> fail(T data, String msg) public static <T> R<T> fail(T data, String msg) {
{
return restResult(data, FAIL, msg); return restResult(data, FAIL, msg);
} }
public static <T> R<T> fail(int code, String msg) public static <T> R<T> fail(int code, String msg) {
{
return restResult(null, code, msg); return restResult(null, code, msg);
} }
private static <T> R<T> restResult(T data, int code, String msg) private static <T> R<T> restResult(T data, int code, String msg) {
{
R<T> apiResult = new R<>(); R<T> apiResult = new R<>();
apiResult.setCode(code); apiResult.setCode(code);
apiResult.setData(data); apiResult.setData(data);
@ -73,43 +65,35 @@ public class R<T> implements Serializable
return apiResult; return apiResult;
} }
public int getCode() public static <T> Boolean isError(R<T> ret) {
{ return !isSuccess(ret);
}
public static <T> Boolean isSuccess(R<T> ret) {
return R.SUCCESS == ret.getCode();
}
public int getCode() {
return code; return code;
} }
public void setCode(int code) public void setCode(int code) {
{
this.code = code; this.code = code;
} }
public String getMsg() public String getMsg() {
{
return msg; return msg;
} }
public void setMsg(String msg) public void setMsg(String msg) {
{
this.msg = msg; this.msg = msg;
} }
public T getData() public T getData() {
{
return data; return data;
} }
public void setData(T data) public void setData(T data) {
{
this.data = data; this.data = data;
} }
public static <T> Boolean isError(R<T> ret)
{
return !isSuccess(ret);
}
public static <T> Boolean isSuccess(R<T> ret)
{
return R.SUCCESS == ret.getCode();
}
} }

@ -5,75 +5,74 @@ import java.util.List;
/** /**
* Tree * Tree
* *
* @author ruoyi * @author ruoyi
*/ */
public class TreeEntity extends BaseEntity public class TreeEntity extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 父菜单名称 */ /**
*
*/
private String parentName; private String parentName;
/** 父菜单ID */ /**
* ID
*/
private Long parentId; private Long parentId;
/** 显示顺序 */ /**
*
*/
private Integer orderNum; private Integer orderNum;
/** 祖级列表 */ /**
*
*/
private String ancestors; private String ancestors;
/** 子部门 */ /**
*
*/
private List<?> children = new ArrayList<>(); private List<?> children = new ArrayList<>();
public String getParentName() public String getParentName() {
{
return parentName; return parentName;
} }
public void setParentName(String parentName) public void setParentName(String parentName) {
{
this.parentName = parentName; this.parentName = parentName;
} }
public Long getParentId() public Long getParentId() {
{
return parentId; return parentId;
} }
public void setParentId(Long parentId) public void setParentId(Long parentId) {
{
this.parentId = parentId; this.parentId = parentId;
} }
public Integer getOrderNum() public Integer getOrderNum() {
{
return orderNum; return orderNum;
} }
public void setOrderNum(Integer orderNum) public void setOrderNum(Integer orderNum) {
{
this.orderNum = orderNum; this.orderNum = orderNum;
} }
public String getAncestors() public String getAncestors() {
{
return ancestors; return ancestors;
} }
public void setAncestors(String ancestors) public void setAncestors(String ancestors) {
{
this.ancestors = ancestors; this.ancestors = ancestors;
} }
public List<?> getChildren() public List<?> getChildren() {
{
return children; return children;
} }
public void setChildren(List<?> children) public void setChildren(List<?> children) {
{
this.children = children; this.children = children;
} }
} }

@ -1,77 +1,74 @@
package com.ruoyi.common.core.domain; package com.ruoyi.common.core.domain;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysMenu;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* Treeselect * Treeselect
* *
* @author ruoyi * @author ruoyi
*/ */
public class TreeSelect implements Serializable public class TreeSelect implements Serializable {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 节点ID */ /**
* ID
*/
private Long id; private Long id;
/** 节点名称 */ /**
*
*/
private String label; private String label;
/** 子节点 */ /**
*
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children; private List<TreeSelect> children;
public TreeSelect() public TreeSelect() {
{
} }
public TreeSelect(SysDept dept) public TreeSelect(SysDept dept) {
{
this.id = dept.getDeptId(); this.id = dept.getDeptId();
this.label = dept.getDeptName(); this.label = dept.getDeptName();
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
} }
public TreeSelect(SysMenu menu) public TreeSelect(SysMenu menu) {
{
this.id = menu.getMenuId(); this.id = menu.getMenuId();
this.label = menu.getMenuName(); this.label = menu.getMenuName();
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
} }
public Long getId() public Long getId() {
{
return id; return id;
} }
public void setId(Long id) public void setId(Long id) {
{
this.id = id; this.id = id;
} }
public String getLabel() public String getLabel() {
{
return label; return label;
} }
public void setLabel(String label) public void setLabel(String label) {
{
this.label = label; this.label = label;
} }
public List<TreeSelect> getChildren() public List<TreeSelect> getChildren() {
{
return children; return children;
} }
public void setChildren(List<TreeSelect> children) public void setChildren(List<TreeSelect> children) {
{
this.children = children; this.children = children;
} }
} }

@ -1,203 +1,203 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import java.util.ArrayList; import com.ruoyi.common.core.domain.BaseEntity;
import java.util.List; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.Email; import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import java.util.ArrayList;
import org.apache.commons.lang3.builder.ToStringStyle; import java.util.List;
import com.ruoyi.common.core.domain.BaseEntity;
/** /**
* sys_dept * sys_dept
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysDept extends BaseEntity public class SysDept extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 部门ID */ /**
* ID
*/
private Long deptId; private Long deptId;
/** 父部门ID */ /**
* ID
*/
private Long parentId; private Long parentId;
/** 祖级列表 */ /**
*
*/
private String ancestors; private String ancestors;
/** 部门名称 */ /**
*
*/
private String deptName; private String deptName;
/** 显示顺序 */ /**
*
*/
private Integer orderNum; private Integer orderNum;
/** 负责人 */ /**
*
*/
private String leader; private String leader;
/** 联系电话 */ /**
*
*/
private String phone; private String phone;
/** 邮箱 */ /**
*
*/
private String email; private String email;
/** 部门状态:0正常,1停用 */ /**
* :0,1
*/
private String status; private String status;
/** 删除标志0代表存在 2代表删除 */ /**
* 0 2
*/
private String delFlag; private String delFlag;
/** 父部门名称 */ /**
*
*/
private String parentName; private String parentName;
/** 子部门 */ /**
*
*/
private List<SysDept> children = new ArrayList<SysDept>(); private List<SysDept> children = new ArrayList<SysDept>();
public Long getDeptId() public Long getDeptId() {
{
return deptId; return deptId;
} }
public void setDeptId(Long deptId) public void setDeptId(Long deptId) {
{
this.deptId = deptId; this.deptId = deptId;
} }
public Long getParentId() public Long getParentId() {
{
return parentId; return parentId;
} }
public void setParentId(Long parentId) public void setParentId(Long parentId) {
{
this.parentId = parentId; this.parentId = parentId;
} }
public String getAncestors() public String getAncestors() {
{
return ancestors; return ancestors;
} }
public void setAncestors(String ancestors) public void setAncestors(String ancestors) {
{
this.ancestors = ancestors; this.ancestors = ancestors;
} }
@NotBlank(message = "部门名称不能为空") @NotBlank(message = "部门名称不能为空")
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
public String getDeptName() public String getDeptName() {
{
return deptName; return deptName;
} }
public void setDeptName(String deptName) public void setDeptName(String deptName) {
{
this.deptName = deptName; this.deptName = deptName;
} }
@NotNull(message = "显示顺序不能为空") @NotNull(message = "显示顺序不能为空")
public Integer getOrderNum() public Integer getOrderNum() {
{
return orderNum; return orderNum;
} }
public void setOrderNum(Integer orderNum) public void setOrderNum(Integer orderNum) {
{
this.orderNum = orderNum; this.orderNum = orderNum;
} }
public String getLeader() public String getLeader() {
{
return leader; return leader;
} }
public void setLeader(String leader) public void setLeader(String leader) {
{
this.leader = leader; this.leader = leader;
} }
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
public String getPhone() public String getPhone() {
{
return phone; return phone;
} }
public void setPhone(String phone) public void setPhone(String phone) {
{
this.phone = phone; this.phone = phone;
} }
@Email(message = "邮箱格式不正确") @Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail() public String getEmail() {
{
return email; return email;
} }
public void setEmail(String email) public void setEmail(String email) {
{
this.email = email; this.email = email;
} }
public String getStatus() public String getStatus() {
{
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status) {
{
this.status = status; this.status = status;
} }
public String getDelFlag() public String getDelFlag() {
{
return delFlag; return delFlag;
} }
public void setDelFlag(String delFlag) public void setDelFlag(String delFlag) {
{
this.delFlag = delFlag; this.delFlag = delFlag;
} }
public String getParentName() public String getParentName() {
{
return parentName; return parentName;
} }
public void setParentName(String parentName) public void setParentName(String parentName) {
{
this.parentName = parentName; this.parentName = parentName;
} }
public List<SysDept> getChildren() public List<SysDept> getChildren() {
{
return children; return children;
} }
public void setChildren(List<SysDept> children) public void setChildren(List<SysDept> children) {
{
this.children = children; this.children = children;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("deptId", getDeptId()) .append("deptId", getDeptId())
.append("parentId", getParentId()) .append("parentId", getParentId())
.append("ancestors", getAncestors()) .append("ancestors", getAncestors())
.append("deptName", getDeptName()) .append("deptName", getDeptName())
.append("orderNum", getOrderNum()) .append("orderNum", getOrderNum())
.append("leader", getLeader()) .append("leader", getLeader())
.append("phone", getPhone()) .append("phone", getPhone())
.append("email", getEmail()) .append("email", getEmail())
.append("status", getStatus()) .append("status", getStatus())
.append("delFlag", getDelFlag()) .append("delFlag", getDelFlag())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.toString(); .toString();
} }
} }

@ -1,176 +1,175 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType; import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
/** /**
* sys_dict_data * sys_dict_data
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysDictData extends BaseEntity public class SysDictData extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 字典编码 */ /**
*
*/
@Excel(name = "字典编码", cellType = ColumnType.NUMERIC) @Excel(name = "字典编码", cellType = ColumnType.NUMERIC)
private Long dictCode; private Long dictCode;
/** 字典排序 */ /**
*
*/
@Excel(name = "字典排序", cellType = ColumnType.NUMERIC) @Excel(name = "字典排序", cellType = ColumnType.NUMERIC)
private Long dictSort; private Long dictSort;
/** 字典标签 */ /**
*
*/
@Excel(name = "字典标签") @Excel(name = "字典标签")
private String dictLabel; private String dictLabel;
/** 字典键值 */ /**
*
*/
@Excel(name = "字典键值") @Excel(name = "字典键值")
private String dictValue; private String dictValue;
/** 字典类型 */ /**
*
*/
@Excel(name = "字典类型") @Excel(name = "字典类型")
private String dictType; private String dictType;
/** 样式属性(其他样式扩展) */ /**
*
*/
private String cssClass; private String cssClass;
/** 表格字典样式 */ /**
*
*/
private String listClass; private String listClass;
/** 是否默认Y是 N否 */ /**
* Y N
*/
@Excel(name = "是否默认", readConverterExp = "Y=是,N=否") @Excel(name = "是否默认", readConverterExp = "Y=是,N=否")
private String isDefault; private String isDefault;
/** 状态0正常 1停用 */ /**
* 0 1
*/
@Excel(name = "状态", readConverterExp = "0=正常,1=停用") @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
public Long getDictCode() public Long getDictCode() {
{
return dictCode; return dictCode;
} }
public void setDictCode(Long dictCode) public void setDictCode(Long dictCode) {
{
this.dictCode = dictCode; this.dictCode = dictCode;
} }
public Long getDictSort() public Long getDictSort() {
{
return dictSort; return dictSort;
} }
public void setDictSort(Long dictSort) public void setDictSort(Long dictSort) {
{
this.dictSort = dictSort; this.dictSort = dictSort;
} }
@NotBlank(message = "字典标签不能为空") @NotBlank(message = "字典标签不能为空")
@Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符")
public String getDictLabel() public String getDictLabel() {
{
return dictLabel; return dictLabel;
} }
public void setDictLabel(String dictLabel) public void setDictLabel(String dictLabel) {
{
this.dictLabel = dictLabel; this.dictLabel = dictLabel;
} }
@NotBlank(message = "字典键值不能为空") @NotBlank(message = "字典键值不能为空")
@Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符")
public String getDictValue() public String getDictValue() {
{
return dictValue; return dictValue;
} }
public void setDictValue(String dictValue) public void setDictValue(String dictValue) {
{
this.dictValue = dictValue; this.dictValue = dictValue;
} }
@NotBlank(message = "字典类型不能为空") @NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符")
public String getDictType() public String getDictType() {
{
return dictType; return dictType;
} }
public void setDictType(String dictType) public void setDictType(String dictType) {
{
this.dictType = dictType; this.dictType = dictType;
} }
@Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符") @Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
public String getCssClass() public String getCssClass() {
{
return cssClass; return cssClass;
} }
public void setCssClass(String cssClass) public void setCssClass(String cssClass) {
{
this.cssClass = cssClass; this.cssClass = cssClass;
} }
public String getListClass() public String getListClass() {
{
return listClass; return listClass;
} }
public void setListClass(String listClass) public void setListClass(String listClass) {
{
this.listClass = listClass; this.listClass = listClass;
} }
public boolean getDefault() public boolean getDefault() {
{
return UserConstants.YES.equals(this.isDefault); return UserConstants.YES.equals(this.isDefault);
} }
public String getIsDefault() public String getIsDefault() {
{
return isDefault; return isDefault;
} }
public void setIsDefault(String isDefault) public void setIsDefault(String isDefault) {
{
this.isDefault = isDefault; this.isDefault = isDefault;
} }
public String getStatus() public String getStatus() {
{
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status) {
{
this.status = status; this.status = status;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("dictCode", getDictCode()) .append("dictCode", getDictCode())
.append("dictSort", getDictSort()) .append("dictSort", getDictSort())
.append("dictLabel", getDictLabel()) .append("dictLabel", getDictLabel())
.append("dictValue", getDictValue()) .append("dictValue", getDictValue())
.append("dictType", getDictType()) .append("dictType", getDictType())
.append("cssClass", getCssClass()) .append("cssClass", getCssClass())
.append("listClass", getListClass()) .append("listClass", getListClass())
.append("isDefault", getIsDefault()) .append("isDefault", getIsDefault())
.append("status", getStatus()) .append("status", getStatus())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("remark", getRemark()) .append("remark", getRemark())
.toString(); .toString();
} }
} }

@ -1,96 +1,96 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType; import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
/** /**
* sys_dict_type * sys_dict_type
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysDictType extends BaseEntity public class SysDictType extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 字典主键 */ /**
*
*/
@Excel(name = "字典主键", cellType = ColumnType.NUMERIC) @Excel(name = "字典主键", cellType = ColumnType.NUMERIC)
private Long dictId; private Long dictId;
/** 字典名称 */ /**
*
*/
@Excel(name = "字典名称") @Excel(name = "字典名称")
private String dictName; private String dictName;
/** 字典类型 */ /**
*
*/
@Excel(name = "字典类型") @Excel(name = "字典类型")
private String dictType; private String dictType;
/** 状态0正常 1停用 */ /**
* 0 1
*/
@Excel(name = "状态", readConverterExp = "0=正常,1=停用") @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
public Long getDictId() public Long getDictId() {
{
return dictId; return dictId;
} }
public void setDictId(Long dictId) public void setDictId(Long dictId) {
{
this.dictId = dictId; this.dictId = dictId;
} }
@NotBlank(message = "字典名称不能为空") @NotBlank(message = "字典名称不能为空")
@Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
public String getDictName() public String getDictName() {
{
return dictName; return dictName;
} }
public void setDictName(String dictName) public void setDictName(String dictName) {
{
this.dictName = dictName; this.dictName = dictName;
} }
@NotBlank(message = "字典类型不能为空") @NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
@Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)") @Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)")
public String getDictType() public String getDictType() {
{
return dictType; return dictType;
} }
public void setDictType(String dictType) public void setDictType(String dictType) {
{
this.dictType = dictType; this.dictType = dictType;
} }
public String getStatus() public String getStatus() {
{
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status) {
{
this.status = status; this.status = status;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("dictId", getDictId()) .append("dictId", getDictId())
.append("dictName", getDictName()) .append("dictName", getDictName())
.append("dictType", getDictType()) .append("dictType", getDictType())
.append("status", getStatus()) .append("status", getStatus())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("remark", getRemark()) .append("remark", getRemark())
.toString(); .toString();
} }
} }

@ -1,259 +1,259 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import java.util.ArrayList; import com.ruoyi.common.core.domain.BaseEntity;
import java.util.List; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import java.util.ArrayList;
import org.apache.commons.lang3.builder.ToStringStyle; import java.util.List;
import com.ruoyi.common.core.domain.BaseEntity;
/** /**
* sys_menu * sys_menu
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysMenu extends BaseEntity public class SysMenu extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 菜单ID */ /**
* ID
*/
private Long menuId; private Long menuId;
/** 菜单名称 */ /**
*
*/
private String menuName; private String menuName;
/** 父菜单名称 */ /**
*
*/
private String parentName; private String parentName;
/** 父菜单ID */ /**
* ID
*/
private Long parentId; private Long parentId;
/** 显示顺序 */ /**
*
*/
private Integer orderNum; private Integer orderNum;
/** 路由地址 */ /**
*
*/
private String path; private String path;
/** 组件路径 */ /**
*
*/
private String component; private String component;
/** 路由参数 */ /**
*
*/
private String query; private String query;
/** 是否为外链0是 1否 */ /**
* 0 1
*/
private String isFrame; private String isFrame;
/** 是否缓存0缓存 1不缓存 */ /**
* 0 1
*/
private String isCache; private String isCache;
/** 类型M目录 C菜单 F按钮 */ /**
* M C F
*/
private String menuType; private String menuType;
/** 显示状态0显示 1隐藏 */ /**
* 0 1
*/
private String visible; private String visible;
/** 菜单状态0正常 1停用 */ /**
* 0 1
*/
private String status; private String status;
/** 权限字符串 */ /**
*
*/
private String perms; private String perms;
/** 菜单图标 */ /**
*
*/
private String icon; private String icon;
/** 子菜单 */ /**
*
*/
private List<SysMenu> children = new ArrayList<SysMenu>(); private List<SysMenu> children = new ArrayList<SysMenu>();
public Long getMenuId() public Long getMenuId() {
{
return menuId; return menuId;
} }
public void setMenuId(Long menuId) public void setMenuId(Long menuId) {
{
this.menuId = menuId; this.menuId = menuId;
} }
@NotBlank(message = "菜单名称不能为空") @NotBlank(message = "菜单名称不能为空")
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
public String getMenuName() public String getMenuName() {
{
return menuName; return menuName;
} }
public void setMenuName(String menuName) public void setMenuName(String menuName) {
{
this.menuName = menuName; this.menuName = menuName;
} }
public String getParentName() public String getParentName() {
{
return parentName; return parentName;
} }
public void setParentName(String parentName) public void setParentName(String parentName) {
{
this.parentName = parentName; this.parentName = parentName;
} }
public Long getParentId() public Long getParentId() {
{
return parentId; return parentId;
} }
public void setParentId(Long parentId) public void setParentId(Long parentId) {
{
this.parentId = parentId; this.parentId = parentId;
} }
@NotNull(message = "显示顺序不能为空") @NotNull(message = "显示顺序不能为空")
public Integer getOrderNum() public Integer getOrderNum() {
{
return orderNum; return orderNum;
} }
public void setOrderNum(Integer orderNum) public void setOrderNum(Integer orderNum) {
{
this.orderNum = orderNum; this.orderNum = orderNum;
} }
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符") @Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
public String getPath() public String getPath() {
{
return path; return path;
} }
public void setPath(String path) public void setPath(String path) {
{
this.path = path; this.path = path;
} }
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符") @Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
public String getComponent() public String getComponent() {
{
return component; return component;
} }
public void setComponent(String component) public void setComponent(String component) {
{
this.component = component; this.component = component;
} }
public String getQuery() public String getQuery() {
{
return query; return query;
} }
public void setQuery(String query) public void setQuery(String query) {
{
this.query = query; this.query = query;
} }
public String getIsFrame() public String getIsFrame() {
{
return isFrame; return isFrame;
} }
public void setIsFrame(String isFrame) public void setIsFrame(String isFrame) {
{
this.isFrame = isFrame; this.isFrame = isFrame;
} }
public String getIsCache() public String getIsCache() {
{
return isCache; return isCache;
} }
public void setIsCache(String isCache) public void setIsCache(String isCache) {
{
this.isCache = isCache; this.isCache = isCache;
} }
@NotBlank(message = "菜单类型不能为空") @NotBlank(message = "菜单类型不能为空")
public String getMenuType() public String getMenuType() {
{
return menuType; return menuType;
} }
public void setMenuType(String menuType) public void setMenuType(String menuType) {
{
this.menuType = menuType; this.menuType = menuType;
} }
public String getVisible() public String getVisible() {
{
return visible; return visible;
} }
public void setVisible(String visible) public void setVisible(String visible) {
{
this.visible = visible; this.visible = visible;
} }
public String getStatus() public String getStatus() {
{
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status) {
{
this.status = status; this.status = status;
} }
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
public String getPerms() public String getPerms() {
{
return perms; return perms;
} }
public void setPerms(String perms) public void setPerms(String perms) {
{
this.perms = perms; this.perms = perms;
} }
public String getIcon() public String getIcon() {
{
return icon; return icon;
} }
public void setIcon(String icon) public void setIcon(String icon) {
{
this.icon = icon; this.icon = icon;
} }
public List<SysMenu> getChildren() public List<SysMenu> getChildren() {
{
return children; return children;
} }
public void setChildren(List<SysMenu> children) public void setChildren(List<SysMenu> children) {
{
this.children = children; this.children = children;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("menuId", getMenuId()) .append("menuId", getMenuId())
.append("menuName", getMenuName()) .append("menuName", getMenuName())
.append("parentId", getParentId()) .append("parentId", getParentId())
.append("orderNum", getOrderNum()) .append("orderNum", getOrderNum())
.append("path", getPath()) .append("path", getPath())
.append("component", getComponent()) .append("component", getComponent())
.append("isFrame", getIsFrame()) .append("isFrame", getIsFrame())
.append("IsCache", getIsCache()) .append("IsCache", getIsCache())
.append("menuType", getMenuType()) .append("menuType", getMenuType())
.append("visible", getVisible()) .append("visible", getVisible())
.append("status ", getStatus()) .append("status ", getStatus())
.append("perms", getPerms()) .append("perms", getPerms())
.append("icon", getIcon()) .append("icon", getIcon())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("remark", getRemark()) .append("remark", getRemark())
.toString(); .toString();
} }
} }

@ -1,241 +1,237 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import java.util.Set;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType; import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Set;
/** /**
* sys_role * sys_role
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysRole extends BaseEntity public class SysRole extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 角色ID */ /**
* ID
*/
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC) @Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
private Long roleId; private Long roleId;
/** 角色名称 */ /**
*
*/
@Excel(name = "角色名称") @Excel(name = "角色名称")
private String roleName; private String roleName;
/** 角色权限 */ /**
*
*/
@Excel(name = "角色权限") @Excel(name = "角色权限")
private String roleKey; private String roleKey;
/** 角色排序 */ /**
*
*/
@Excel(name = "角色排序") @Excel(name = "角色排序")
private Integer roleSort; private Integer roleSort;
/** 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限5仅本人数据权限 */ /**
* 12345
*/
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
private String dataScope; private String dataScope;
/** 菜单树选择项是否关联显示( 0父子不互相关联显示 1父子互相关联显示 */ /**
* 0 1
*/
private boolean menuCheckStrictly; private boolean menuCheckStrictly;
/** 部门树选择项是否关联显示0父子不互相关联显示 1父子互相关联显示 */ /**
* 0 1
*/
private boolean deptCheckStrictly; private boolean deptCheckStrictly;
/** 角色状态0正常 1停用 */ /**
* 0 1
*/
@Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
/** 删除标志0代表存在 2代表删除 */ /**
* 0 2
*/
private String delFlag; private String delFlag;
/** 用户是否存在此角色标识 默认不存在 */ /**
*
*/
private boolean flag = false; private boolean flag = false;
/** 菜单组 */ /**
*
*/
private Long[] menuIds; private Long[] menuIds;
/** 部门组(数据权限) */ /**
*
*/
private Long[] deptIds; private Long[] deptIds;
/** 角色菜单权限 */ /**
*
*/
private Set<String> permissions; private Set<String> permissions;
public SysRole() public SysRole() {
{
} }
public SysRole(Long roleId) public SysRole(Long roleId) {
{
this.roleId = roleId; this.roleId = roleId;
} }
public Long getRoleId() public static boolean isAdmin(Long roleId) {
{ return roleId != null && 1L == roleId;
}
public Long getRoleId() {
return roleId; return roleId;
} }
public void setRoleId(Long roleId) public void setRoleId(Long roleId) {
{
this.roleId = roleId; this.roleId = roleId;
} }
public boolean isAdmin() public boolean isAdmin() {
{
return isAdmin(this.roleId); return isAdmin(this.roleId);
} }
public static boolean isAdmin(Long roleId)
{
return roleId != null && 1L == roleId;
}
@NotBlank(message = "角色名称不能为空") @NotBlank(message = "角色名称不能为空")
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
public String getRoleName() public String getRoleName() {
{
return roleName; return roleName;
} }
public void setRoleName(String roleName) public void setRoleName(String roleName) {
{
this.roleName = roleName; this.roleName = roleName;
} }
@NotBlank(message = "权限字符不能为空") @NotBlank(message = "权限字符不能为空")
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
public String getRoleKey() public String getRoleKey() {
{
return roleKey; return roleKey;
} }
public void setRoleKey(String roleKey) public void setRoleKey(String roleKey) {
{
this.roleKey = roleKey; this.roleKey = roleKey;
} }
@NotNull(message = "显示顺序不能为空") @NotNull(message = "显示顺序不能为空")
public Integer getRoleSort() public Integer getRoleSort() {
{
return roleSort; return roleSort;
} }
public void setRoleSort(Integer roleSort) public void setRoleSort(Integer roleSort) {
{
this.roleSort = roleSort; this.roleSort = roleSort;
} }
public String getDataScope() public String getDataScope() {
{
return dataScope; return dataScope;
} }
public void setDataScope(String dataScope) public void setDataScope(String dataScope) {
{
this.dataScope = dataScope; this.dataScope = dataScope;
} }
public boolean isMenuCheckStrictly() public boolean isMenuCheckStrictly() {
{
return menuCheckStrictly; return menuCheckStrictly;
} }
public void setMenuCheckStrictly(boolean menuCheckStrictly) public void setMenuCheckStrictly(boolean menuCheckStrictly) {
{
this.menuCheckStrictly = menuCheckStrictly; this.menuCheckStrictly = menuCheckStrictly;
} }
public boolean isDeptCheckStrictly() public boolean isDeptCheckStrictly() {
{
return deptCheckStrictly; return deptCheckStrictly;
} }
public void setDeptCheckStrictly(boolean deptCheckStrictly) public void setDeptCheckStrictly(boolean deptCheckStrictly) {
{
this.deptCheckStrictly = deptCheckStrictly; this.deptCheckStrictly = deptCheckStrictly;
} }
public String getStatus() public String getStatus() {
{
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status) {
{
this.status = status; this.status = status;
} }
public String getDelFlag() public String getDelFlag() {
{
return delFlag; return delFlag;
} }
public void setDelFlag(String delFlag) public void setDelFlag(String delFlag) {
{
this.delFlag = delFlag; this.delFlag = delFlag;
} }
public boolean isFlag() public boolean isFlag() {
{
return flag; return flag;
} }
public void setFlag(boolean flag) public void setFlag(boolean flag) {
{
this.flag = flag; this.flag = flag;
} }
public Long[] getMenuIds() public Long[] getMenuIds() {
{
return menuIds; return menuIds;
} }
public void setMenuIds(Long[] menuIds) public void setMenuIds(Long[] menuIds) {
{
this.menuIds = menuIds; this.menuIds = menuIds;
} }
public Long[] getDeptIds() public Long[] getDeptIds() {
{
return deptIds; return deptIds;
} }
public void setDeptIds(Long[] deptIds) public void setDeptIds(Long[] deptIds) {
{
this.deptIds = deptIds; this.deptIds = deptIds;
} }
public Set<String> getPermissions() public Set<String> getPermissions() {
{
return permissions; return permissions;
} }
public void setPermissions(Set<String> permissions) public void setPermissions(Set<String> permissions) {
{
this.permissions = permissions; this.permissions = permissions;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId()) .append("roleId", getRoleId())
.append("roleName", getRoleName()) .append("roleName", getRoleName())
.append("roleKey", getRoleKey()) .append("roleKey", getRoleKey())
.append("roleSort", getRoleSort()) .append("roleSort", getRoleSort())
.append("dataScope", getDataScope()) .append("dataScope", getDataScope())
.append("menuCheckStrictly", isMenuCheckStrictly()) .append("menuCheckStrictly", isMenuCheckStrictly())
.append("deptCheckStrictly", isDeptCheckStrictly()) .append("deptCheckStrictly", isDeptCheckStrictly())
.append("status", getStatus()) .append("status", getStatus())
.append("delFlag", getDelFlag()) .append("delFlag", getDelFlag())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("remark", getRemark()) .append("remark", getRemark())
.toString(); .toString();
} }
} }

@ -1,324 +1,322 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import java.util.Date;
import java.util.List;
import javax.validation.constraints.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType; import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.annotation.Excel.Type; import com.ruoyi.common.annotation.Excel.Type;
import com.ruoyi.common.annotation.Excels; import com.ruoyi.common.annotation.Excels;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.xss.Xss; import com.ruoyi.common.xss.Xss;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
/** /**
* sys_user * sys_user
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysUser extends BaseEntity public class SysUser extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 用户ID */ /**
* ID
*/
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号") @Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
private Long userId; private Long userId;
/** 部门ID */ /**
* ID
*/
@Excel(name = "部门编号", type = Type.IMPORT) @Excel(name = "部门编号", type = Type.IMPORT)
private Long deptId; private Long deptId;
/** 用户账号 */ /**
*
*/
@Excel(name = "登录名称") @Excel(name = "登录名称")
private String userName; private String userName;
/** 用户昵称 */ /**
*
*/
@Excel(name = "用户名称") @Excel(name = "用户名称")
private String nickName; private String nickName;
/** 用户邮箱 */ /**
*
*/
@Excel(name = "用户邮箱") @Excel(name = "用户邮箱")
private String email; private String email;
/** 手机号码 */ /**
*
*/
@Excel(name = "手机号码") @Excel(name = "手机号码")
private String phonenumber; private String phonenumber;
/** 用户性别 */ /**
*
*/
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String sex; private String sex;
/** 用户头像 */ /**
*
*/
private String avatar; private String avatar;
/** 密码 */ /**
*
*/
private String password; private String password;
/** 帐号状态0正常 1停用 */ /**
* 0 1
*/
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
/** 删除标志0代表存在 2代表删除 */ /**
* 0 2
*/
private String delFlag; private String delFlag;
/** 最后登录IP */ /**
* IP
*/
@Excel(name = "最后登录IP", type = Type.EXPORT) @Excel(name = "最后登录IP", type = Type.EXPORT)
private String loginIp; private String loginIp;
/** 最后登录时间 */ /**
*
*/
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
private Date loginDate; private Date loginDate;
/** 部门对象 */ /**
*
*/
@Excels({ @Excels({
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT) @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
}) })
private SysDept dept; private SysDept dept;
/** 角色对象 */ /**
*
*/
private List<SysRole> roles; private List<SysRole> roles;
/** 角色组 */ /**
*
*/
private Long[] roleIds; private Long[] roleIds;
/** 岗位组 */ /**
*
*/
private Long[] postIds; private Long[] postIds;
/** 角色ID */ /**
* ID
*/
private Long roleId; private Long roleId;
public SysUser() public SysUser() {
{
} }
public SysUser(Long userId) public SysUser(Long userId) {
{
this.userId = userId; this.userId = userId;
} }
public Long getUserId() public static boolean isAdmin(Long userId) {
{ return userId != null && 1L == userId;
}
public Long getUserId() {
return userId; return userId;
} }
public void setUserId(Long userId) public void setUserId(Long userId) {
{
this.userId = userId; this.userId = userId;
} }
public boolean isAdmin() public boolean isAdmin() {
{
return isAdmin(this.userId); return isAdmin(this.userId);
} }
public static boolean isAdmin(Long userId) public Long getDeptId() {
{
return userId != null && 1L == userId;
}
public Long getDeptId()
{
return deptId; return deptId;
} }
public void setDeptId(Long deptId) public void setDeptId(Long deptId) {
{
this.deptId = deptId; this.deptId = deptId;
} }
@Xss(message = "用户昵称不能包含脚本字符") @Xss(message = "用户昵称不能包含脚本字符")
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
public String getNickName() public String getNickName() {
{
return nickName; return nickName;
} }
public void setNickName(String nickName) public void setNickName(String nickName) {
{
this.nickName = nickName; this.nickName = nickName;
} }
@Xss(message = "用户账号不能包含脚本字符") @Xss(message = "用户账号不能包含脚本字符")
@NotBlank(message = "用户账号不能为空") @NotBlank(message = "用户账号不能为空")
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
public String getUserName() public String getUserName() {
{
return userName; return userName;
} }
public void setUserName(String userName) public void setUserName(String userName) {
{
this.userName = userName; this.userName = userName;
} }
@Email(message = "邮箱格式不正确") @Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail() public String getEmail() {
{
return email; return email;
} }
public void setEmail(String email) public void setEmail(String email) {
{
this.email = email; this.email = email;
} }
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
public String getPhonenumber() public String getPhonenumber() {
{
return phonenumber; return phonenumber;
} }
public void setPhonenumber(String phonenumber) public void setPhonenumber(String phonenumber) {
{
this.phonenumber = phonenumber; this.phonenumber = phonenumber;
} }
public String getSex() public String getSex() {
{
return sex; return sex;
} }
public void setSex(String sex) public void setSex(String sex) {
{
this.sex = sex; this.sex = sex;
} }
public String getAvatar() public String getAvatar() {
{
return avatar; return avatar;
} }
public void setAvatar(String avatar) public void setAvatar(String avatar) {
{
this.avatar = avatar; this.avatar = avatar;
} }
public String getPassword() public String getPassword() {
{
return password; return password;
} }
public void setPassword(String password) public void setPassword(String password) {
{
this.password = password; this.password = password;
} }
public String getStatus() public String getStatus() {
{
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status) {
{
this.status = status; this.status = status;
} }
public String getDelFlag() public String getDelFlag() {
{
return delFlag; return delFlag;
} }
public void setDelFlag(String delFlag) public void setDelFlag(String delFlag) {
{
this.delFlag = delFlag; this.delFlag = delFlag;
} }
public String getLoginIp() public String getLoginIp() {
{
return loginIp; return loginIp;
} }
public void setLoginIp(String loginIp) public void setLoginIp(String loginIp) {
{
this.loginIp = loginIp; this.loginIp = loginIp;
} }
public Date getLoginDate() public Date getLoginDate() {
{
return loginDate; return loginDate;
} }
public void setLoginDate(Date loginDate) public void setLoginDate(Date loginDate) {
{
this.loginDate = loginDate; this.loginDate = loginDate;
} }
public SysDept getDept() public SysDept getDept() {
{
return dept; return dept;
} }
public void setDept(SysDept dept) public void setDept(SysDept dept) {
{
this.dept = dept; this.dept = dept;
} }
public List<SysRole> getRoles() public List<SysRole> getRoles() {
{
return roles; return roles;
} }
public void setRoles(List<SysRole> roles) public void setRoles(List<SysRole> roles) {
{
this.roles = roles; this.roles = roles;
} }
public Long[] getRoleIds() public Long[] getRoleIds() {
{
return roleIds; return roleIds;
} }
public void setRoleIds(Long[] roleIds) public void setRoleIds(Long[] roleIds) {
{
this.roleIds = roleIds; this.roleIds = roleIds;
} }
public Long[] getPostIds() public Long[] getPostIds() {
{
return postIds; return postIds;
} }
public void setPostIds(Long[] postIds) public void setPostIds(Long[] postIds) {
{
this.postIds = postIds; this.postIds = postIds;
} }
public Long getRoleId() public Long getRoleId() {
{
return roleId; return roleId;
} }
public void setRoleId(Long roleId) public void setRoleId(Long roleId) {
{
this.roleId = roleId; this.roleId = roleId;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId()) .append("userId", getUserId())
.append("deptId", getDeptId()) .append("deptId", getDeptId())
.append("userName", getUserName()) .append("userName", getUserName())
.append("nickName", getNickName()) .append("nickName", getNickName())
.append("email", getEmail()) .append("email", getEmail())
.append("phonenumber", getPhonenumber()) .append("phonenumber", getPhonenumber())
.append("sex", getSex()) .append("sex", getSex())
.append("avatar", getAvatar()) .append("avatar", getAvatar())
.append("password", getPassword()) .append("password", getPassword())
.append("status", getStatus()) .append("status", getStatus())
.append("delFlag", getDelFlag()) .append("delFlag", getDelFlag())
.append("loginIp", getLoginIp()) .append("loginIp", getLoginIp())
.append("loginDate", getLoginDate()) .append("loginDate", getLoginDate())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("remark", getRemark()) .append("remark", getRemark())
.append("dept", getDept()) .append("dept", getDept())
.toString(); .toString();
} }
} }

@ -2,11 +2,10 @@ package com.ruoyi.common.core.domain.model;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class LoginBody public class LoginBody {
{
/** /**
* *
*/ */
@ -27,43 +26,35 @@ public class LoginBody
*/ */
private String uuid; private String uuid;
public String getUsername() public String getUsername() {
{
return username; return username;
} }
public void setUsername(String username) public void setUsername(String username) {
{
this.username = username; this.username = username;
} }
public String getPassword() public String getPassword() {
{
return password; return password;
} }
public void setPassword(String password) public void setPassword(String password) {
{
this.password = password; this.password = password;
} }
public String getCode() public String getCode() {
{
return code; return code;
} }
public void setCode(String code) public void setCode(String code) {
{
this.code = code; this.code = code;
} }
public String getUuid() public String getUuid() {
{
return uuid; return uuid;
} }
public void setUuid(String uuid) public void setUuid(String uuid) {
{
this.uuid = uuid; this.uuid = uuid;
} }
} }

@ -4,16 +4,16 @@ import com.alibaba.fastjson2.annotation.JSONField;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import java.util.Collection; import java.util.Collection;
import java.util.Set; import java.util.Set;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class LoginUser implements UserDetails public class LoginUser implements UserDetails {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
@ -71,64 +71,53 @@ public class LoginUser implements UserDetails
*/ */
private SysUser user; private SysUser user;
public LoginUser() public LoginUser() {
{
} }
public LoginUser(SysUser user, Set<String> permissions) public LoginUser(SysUser user, Set<String> permissions) {
{
this.user = user; this.user = user;
this.permissions = permissions; this.permissions = permissions;
} }
public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions) public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions) {
{
this.userId = userId; this.userId = userId;
this.deptId = deptId; this.deptId = deptId;
this.user = user; this.user = user;
this.permissions = permissions; this.permissions = permissions;
} }
public Long getUserId() public Long getUserId() {
{
return userId; return userId;
} }
public void setUserId(Long userId) public void setUserId(Long userId) {
{
this.userId = userId; this.userId = userId;
} }
public Long getDeptId() public Long getDeptId() {
{
return deptId; return deptId;
} }
public void setDeptId(Long deptId) public void setDeptId(Long deptId) {
{
this.deptId = deptId; this.deptId = deptId;
} }
public String getToken() public String getToken() {
{
return token; return token;
} }
public void setToken(String token) public void setToken(String token) {
{
this.token = token; this.token = token;
} }
@JSONField(serialize = false) @JSONField(serialize = false)
@Override @Override
public String getPassword() public String getPassword() {
{
return user.getPassword(); return user.getPassword();
} }
@Override @Override
public String getUsername() public String getUsername() {
{
return user.getUserName(); return user.getUserName();
} }
@ -137,130 +126,109 @@ public class LoginUser implements UserDetails
*/ */
@JSONField(serialize = false) @JSONField(serialize = false)
@Override @Override
public boolean isAccountNonExpired() public boolean isAccountNonExpired() {
{
return true; return true;
} }
/** /**
* , * ,
* *
* @return * @return
*/ */
@JSONField(serialize = false) @JSONField(serialize = false)
@Override @Override
public boolean isAccountNonLocked() public boolean isAccountNonLocked() {
{
return true; return true;
} }
/** /**
* (), * (),
* *
* @return * @return
*/ */
@JSONField(serialize = false) @JSONField(serialize = false)
@Override @Override
public boolean isCredentialsNonExpired() public boolean isCredentialsNonExpired() {
{
return true; return true;
} }
/** /**
* , * ,
* *
* @return * @return
*/ */
@JSONField(serialize = false) @JSONField(serialize = false)
@Override @Override
public boolean isEnabled() public boolean isEnabled() {
{
return true; return true;
} }
public Long getLoginTime() public Long getLoginTime() {
{
return loginTime; return loginTime;
} }
public void setLoginTime(Long loginTime) public void setLoginTime(Long loginTime) {
{
this.loginTime = loginTime; this.loginTime = loginTime;
} }
public String getIpaddr() public String getIpaddr() {
{
return ipaddr; return ipaddr;
} }
public void setIpaddr(String ipaddr) public void setIpaddr(String ipaddr) {
{
this.ipaddr = ipaddr; this.ipaddr = ipaddr;
} }
public String getLoginLocation() public String getLoginLocation() {
{
return loginLocation; return loginLocation;
} }
public void setLoginLocation(String loginLocation) public void setLoginLocation(String loginLocation) {
{
this.loginLocation = loginLocation; this.loginLocation = loginLocation;
} }
public String getBrowser() public String getBrowser() {
{
return browser; return browser;
} }
public void setBrowser(String browser) public void setBrowser(String browser) {
{
this.browser = browser; this.browser = browser;
} }
public String getOs() public String getOs() {
{
return os; return os;
} }
public void setOs(String os) public void setOs(String os) {
{
this.os = os; this.os = os;
} }
public Long getExpireTime() public Long getExpireTime() {
{
return expireTime; return expireTime;
} }
public void setExpireTime(Long expireTime) public void setExpireTime(Long expireTime) {
{
this.expireTime = expireTime; this.expireTime = expireTime;
} }
public Set<String> getPermissions() public Set<String> getPermissions() {
{
return permissions; return permissions;
} }
public void setPermissions(Set<String> permissions) public void setPermissions(Set<String> permissions) {
{
this.permissions = permissions; this.permissions = permissions;
} }
public SysUser getUser() public SysUser getUser() {
{
return user; return user;
} }
public void setUser(SysUser user) public void setUser(SysUser user) {
{
this.user = user; this.user = user;
} }
@Override @Override
public Collection<? extends GrantedAuthority> getAuthorities() public Collection<? extends GrantedAuthority> getAuthorities() {
{
return null; return null;
} }
} }

@ -2,10 +2,9 @@ package com.ruoyi.common.core.domain.model;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class RegisterBody extends LoginBody public class RegisterBody extends LoginBody {
{
} }

@ -4,98 +4,90 @@ import com.ruoyi.common.utils.StringUtils;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class PageDomain public class PageDomain {
{ /**
/** 当前记录起始索引 */ *
*/
private Integer pageNum; private Integer pageNum;
/** 每页显示记录数 */ /**
*
*/
private Integer pageSize; private Integer pageSize;
/** 排序列 */ /**
*
*/
private String orderByColumn; private String orderByColumn;
/** 排序的方向desc或者asc */ /**
* descasc
*/
private String isAsc = "asc"; private String isAsc = "asc";
/** 分页参数合理化 */ /**
*
*/
private Boolean reasonable = true; private Boolean reasonable = true;
public String getOrderBy() public String getOrderBy() {
{ if (StringUtils.isEmpty(orderByColumn)) {
if (StringUtils.isEmpty(orderByColumn))
{
return ""; return "";
} }
return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc; return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
} }
public Integer getPageNum() public Integer getPageNum() {
{
return pageNum; return pageNum;
} }
public void setPageNum(Integer pageNum) public void setPageNum(Integer pageNum) {
{
this.pageNum = pageNum; this.pageNum = pageNum;
} }
public Integer getPageSize() public Integer getPageSize() {
{
return pageSize; return pageSize;
} }
public void setPageSize(Integer pageSize) public void setPageSize(Integer pageSize) {
{
this.pageSize = pageSize; this.pageSize = pageSize;
} }
public String getOrderByColumn() public String getOrderByColumn() {
{
return orderByColumn; return orderByColumn;
} }
public void setOrderByColumn(String orderByColumn) public void setOrderByColumn(String orderByColumn) {
{
this.orderByColumn = orderByColumn; this.orderByColumn = orderByColumn;
} }
public String getIsAsc() public String getIsAsc() {
{
return isAsc; return isAsc;
} }
public void setIsAsc(String isAsc) public void setIsAsc(String isAsc) {
{ if (StringUtils.isNotEmpty(isAsc)) {
if (StringUtils.isNotEmpty(isAsc))
{
// 兼容前端排序类型 // 兼容前端排序类型
if ("ascending".equals(isAsc)) if ("ascending".equals(isAsc)) {
{
isAsc = "asc"; isAsc = "asc";
} } else if ("descending".equals(isAsc)) {
else if ("descending".equals(isAsc))
{
isAsc = "desc"; isAsc = "desc";
} }
this.isAsc = isAsc; this.isAsc = isAsc;
} }
} }
public Boolean getReasonable() public Boolean getReasonable() {
{ if (StringUtils.isNull(reasonable)) {
if (StringUtils.isNull(reasonable))
{
return Boolean.TRUE; return Boolean.TRUE;
} }
return reasonable; return reasonable;
} }
public void setReasonable(Boolean reasonable) public void setReasonable(Boolean reasonable) {
{
this.reasonable = reasonable; this.reasonable = reasonable;
} }
} }

@ -5,81 +5,78 @@ import java.util.List;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class TableDataInfo implements Serializable public class TableDataInfo implements Serializable {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 总记录数 */ /**
*
*/
private long total; private long total;
/** 列表数据 */ /**
*
*/
private List<?> rows; private List<?> rows;
/** 消息状态码 */ /**
*
*/
private int code; private int code;
/** 消息内容 */ /**
*
*/
private String msg; private String msg;
/** /**
* *
*/ */
public TableDataInfo() public TableDataInfo() {
{
} }
/** /**
* *
* *
* @param list * @param list
* @param total * @param total
*/ */
public TableDataInfo(List<?> list, int total) public TableDataInfo(List<?> list, int total) {
{
this.rows = list; this.rows = list;
this.total = total; this.total = total;
} }
public long getTotal() public long getTotal() {
{
return total; return total;
} }
public void setTotal(long total) public void setTotal(long total) {
{
this.total = total; this.total = total;
} }
public List<?> getRows() public List<?> getRows() {
{
return rows; return rows;
} }
public void setRows(List<?> rows) public void setRows(List<?> rows) {
{
this.rows = rows; this.rows = rows;
} }
public int getCode() public int getCode() {
{
return code; return code;
} }
public void setCode(int code) public void setCode(int code) {
{
this.code = code; this.code = code;
} }
public String getMsg() public String getMsg() {
{
return msg; return msg;
} }
public void setMsg(String msg) public void setMsg(String msg) {
{
this.msg = msg; this.msg = msg;
} }
} }

@ -5,11 +5,10 @@ import com.ruoyi.common.utils.ServletUtils;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class TableSupport public class TableSupport {
{
/** /**
* *
*/ */
@ -38,8 +37,7 @@ public class TableSupport
/** /**
* *
*/ */
public static PageDomain getPageDomain() public static PageDomain getPageDomain() {
{
PageDomain pageDomain = new PageDomain(); PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1)); pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10)); pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
@ -49,8 +47,7 @@ public class TableSupport
return pageDomain; return pageDomain;
} }
public static PageDomain buildPageRequest() public static PageDomain buildPageRequest() {
{
return getPageDomain(); return getPageDomain();
} }
} }

@ -1,11 +1,5 @@
package com.ruoyi.common.core.redis; package com.ruoyi.common.core.redis;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundSetOperations; import org.springframework.data.redis.core.BoundSetOperations;
import org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.HashOperations;
@ -13,64 +7,66 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations; import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/** /**
* spring redis * spring redis
* *
* @author ruoyi * @author ruoyi
**/ **/
@SuppressWarnings(value = { "unchecked", "rawtypes" }) @SuppressWarnings(value = {"unchecked", "rawtypes"})
@Component @Component
public class RedisCache public class RedisCache {
{
@Autowired @Autowired
public RedisTemplate redisTemplate; public RedisTemplate redisTemplate;
/** /**
* IntegerString * IntegerString
* *
* @param key * @param key
* @param value * @param value
*/ */
public <T> void setCacheObject(final String key, final T value) public <T> void setCacheObject(final String key, final T value) {
{
redisTemplate.opsForValue().set(key, value); redisTemplate.opsForValue().set(key, value);
} }
/** /**
* IntegerString * IntegerString
* *
* @param key * @param key
* @param value * @param value
* @param timeout * @param timeout
* @param timeUnit * @param timeUnit
*/ */
public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) {
{
redisTemplate.opsForValue().set(key, value, timeout, timeUnit); redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
} }
/** /**
* *
* *
* @param key Redis * @param key Redis
* @param timeout * @param timeout
* @return true=false= * @return true=false=
*/ */
public boolean expire(final String key, final long timeout) public boolean expire(final String key, final long timeout) {
{
return expire(key, timeout, TimeUnit.SECONDS); return expire(key, timeout, TimeUnit.SECONDS);
} }
/** /**
* *
* *
* @param key Redis * @param key Redis
* @param timeout * @param timeout
* @param unit * @param unit
* @return true=false= * @return true=false=
*/ */
public boolean expire(final String key, final long timeout, final TimeUnit unit) public boolean expire(final String key, final long timeout, final TimeUnit unit) {
{
return redisTemplate.expire(key, timeout, unit); return redisTemplate.expire(key, timeout, unit);
} }
@ -80,8 +76,7 @@ public class RedisCache
* @param key Redis * @param key Redis
* @return * @return
*/ */
public long getExpire(final String key) public long getExpire(final String key) {
{
return redisTemplate.getExpire(key); return redisTemplate.getExpire(key);
} }
@ -91,8 +86,7 @@ public class RedisCache
* @param key * @param key
* @return true false * @return true false
*/ */
public Boolean hasKey(String key) public Boolean hasKey(String key) {
{
return redisTemplate.hasKey(key); return redisTemplate.hasKey(key);
} }
@ -102,8 +96,7 @@ public class RedisCache
* @param key * @param key
* @return * @return
*/ */
public <T> T getCacheObject(final String key) public <T> T getCacheObject(final String key) {
{
ValueOperations<String, T> operation = redisTemplate.opsForValue(); ValueOperations<String, T> operation = redisTemplate.opsForValue();
return operation.get(key); return operation.get(key);
} }
@ -113,8 +106,7 @@ public class RedisCache
* *
* @param key * @param key
*/ */
public boolean deleteObject(final String key) public boolean deleteObject(final String key) {
{
return redisTemplate.delete(key); return redisTemplate.delete(key);
} }
@ -124,20 +116,18 @@ public class RedisCache
* @param collection * @param collection
* @return * @return
*/ */
public boolean deleteObject(final Collection collection) public boolean deleteObject(final Collection collection) {
{
return redisTemplate.delete(collection) > 0; return redisTemplate.delete(collection) > 0;
} }
/** /**
* List * List
* *
* @param key * @param key
* @param dataList List * @param dataList List
* @return * @return
*/ */
public <T> long setCacheList(final String key, final List<T> dataList) public <T> long setCacheList(final String key, final List<T> dataList) {
{
Long count = redisTemplate.opsForList().rightPushAll(key, dataList); Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
return count == null ? 0 : count; return count == null ? 0 : count;
} }
@ -148,24 +138,21 @@ public class RedisCache
* @param key * @param key
* @return * @return
*/ */
public <T> List<T> getCacheList(final String key) public <T> List<T> getCacheList(final String key) {
{
return redisTemplate.opsForList().range(key, 0, -1); return redisTemplate.opsForList().range(key, 0, -1);
} }
/** /**
* Set * Set
* *
* @param key * @param key
* @param dataSet * @param dataSet
* @return * @return
*/ */
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) {
{
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key); BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
Iterator<T> it = dataSet.iterator(); Iterator<T> it = dataSet.iterator();
while (it.hasNext()) while (it.hasNext()) {
{
setOperation.add(it.next()); setOperation.add(it.next());
} }
return setOperation; return setOperation;
@ -177,8 +164,7 @@ public class RedisCache
* @param key * @param key
* @return * @return
*/ */
public <T> Set<T> getCacheSet(final String key) public <T> Set<T> getCacheSet(final String key) {
{
return redisTemplate.opsForSet().members(key); return redisTemplate.opsForSet().members(key);
} }
@ -188,8 +174,7 @@ public class RedisCache
* @param key * @param key
* @param dataMap * @param dataMap
*/ */
public <T> void setCacheMap(final String key, final Map<String, T> dataMap) public <T> void setCacheMap(final String key, final Map<String, T> dataMap) {
{
if (dataMap != null) { if (dataMap != null) {
redisTemplate.opsForHash().putAll(key, dataMap); redisTemplate.opsForHash().putAll(key, dataMap);
} }
@ -201,32 +186,29 @@ public class RedisCache
* @param key * @param key
* @return * @return
*/ */
public <T> Map<String, T> getCacheMap(final String key) public <T> Map<String, T> getCacheMap(final String key) {
{
return redisTemplate.opsForHash().entries(key); return redisTemplate.opsForHash().entries(key);
} }
/** /**
* Hash * Hash
* *
* @param key Redis * @param key Redis
* @param hKey Hash * @param hKey Hash
* @param value * @param value
*/ */
public <T> void setCacheMapValue(final String key, final String hKey, final T value) public <T> void setCacheMapValue(final String key, final String hKey, final T value) {
{
redisTemplate.opsForHash().put(key, hKey, value); redisTemplate.opsForHash().put(key, hKey, value);
} }
/** /**
* Hash * Hash
* *
* @param key Redis * @param key Redis
* @param hKey Hash * @param hKey Hash
* @return Hash * @return Hash
*/ */
public <T> T getCacheMapValue(final String key, final String hKey) public <T> T getCacheMapValue(final String key, final String hKey) {
{
HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash(); HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
return opsForHash.get(key, hKey); return opsForHash.get(key, hKey);
} }
@ -234,24 +216,22 @@ public class RedisCache
/** /**
* Hash * Hash
* *
* @param key Redis * @param key Redis
* @param hKeys Hash * @param hKeys Hash
* @return Hash * @return Hash
*/ */
public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) {
{
return redisTemplate.opsForHash().multiGet(key, hKeys); return redisTemplate.opsForHash().multiGet(key, hKeys);
} }
/** /**
* Hash * Hash
* *
* @param key Redis * @param key Redis
* @param hKey Hash * @param hKey Hash
* @return * @return
*/ */
public boolean deleteCacheMapValue(final String key, final String hKey) public boolean deleteCacheMapValue(final String key, final String hKey) {
{
return redisTemplate.opsForHash().delete(key, hKey) > 0; return redisTemplate.opsForHash().delete(key, hKey) > 0;
} }
@ -261,8 +241,7 @@ public class RedisCache
* @param pattern * @param pattern
* @return * @return
*/ */
public Collection<String> keys(final String pattern) public Collection<String> keys(final String pattern) {
{
return redisTemplate.keys(pattern); return redisTemplate.keys(pattern);
} }
} }

@ -1,76 +1,82 @@
package com.ruoyi.common.core.text; package com.ruoyi.common.core.text;
import com.ruoyi.common.utils.StringUtils;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import com.ruoyi.common.utils.StringUtils;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class CharsetKit public class CharsetKit {
{ /**
/** ISO-8859-1 */ * ISO-8859-1
*/
public static final String ISO_8859_1 = "ISO-8859-1"; public static final String ISO_8859_1 = "ISO-8859-1";
/** UTF-8 */ /**
* UTF-8
*/
public static final String UTF_8 = "UTF-8"; public static final String UTF_8 = "UTF-8";
/** GBK */ /**
* GBK
*/
public static final String GBK = "GBK"; public static final String GBK = "GBK";
/** ISO-8859-1 */ /**
* ISO-8859-1
*/
public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1); public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1);
/** UTF-8 */ /**
* UTF-8
*/
public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8); public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8);
/** GBK */ /**
* GBK
*/
public static final Charset CHARSET_GBK = Charset.forName(GBK); public static final Charset CHARSET_GBK = Charset.forName(GBK);
/** /**
* Charset * Charset
* *
* @param charset * @param charset
* @return Charset * @return Charset
*/ */
public static Charset charset(String charset) public static Charset charset(String charset) {
{
return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset); return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset);
} }
/** /**
* *
* *
* @param source * @param source
* @param srcCharset ISO-8859-1 * @param srcCharset ISO-8859-1
* @param destCharset UTF-8 * @param destCharset UTF-8
* @return * @return
*/ */
public static String convert(String source, String srcCharset, String destCharset) public static String convert(String source, String srcCharset, String destCharset) {
{
return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset)); return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset));
} }
/** /**
* *
* *
* @param source * @param source
* @param srcCharset ISO-8859-1 * @param srcCharset ISO-8859-1
* @param destCharset UTF-8 * @param destCharset UTF-8
* @return * @return
*/ */
public static String convert(String source, Charset srcCharset, Charset destCharset) public static String convert(String source, Charset srcCharset, Charset destCharset) {
{ if (null == srcCharset) {
if (null == srcCharset)
{
srcCharset = StandardCharsets.ISO_8859_1; srcCharset = StandardCharsets.ISO_8859_1;
} }
if (null == destCharset) if (null == destCharset) {
{
destCharset = StandardCharsets.UTF_8; destCharset = StandardCharsets.UTF_8;
} }
if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) {
{
return source; return source;
} }
return new String(source.getBytes(srcCharset), destCharset); return new String(source.getBytes(srcCharset), destCharset);
@ -79,8 +85,7 @@ public class CharsetKit
/** /**
* @return * @return
*/ */
public static String systemCharset() public static String systemCharset() {
{
return Charset.defaultCharset().name(); return Charset.defaultCharset().name();
} }
} }

@ -1,38 +1,35 @@
package com.ruoyi.common.core.text; package com.ruoyi.common.core.text;
import com.ruoyi.common.utils.StringUtils;
import org.apache.commons.lang3.ArrayUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.Set; import java.util.Set;
import com.ruoyi.common.utils.StringUtils;
import org.apache.commons.lang3.ArrayUtils;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class Convert public class Convert {
{
/** /**
* <br> * <br>
* null<br> * null<br>
* *
* *
* @param value * @param value
* @param defaultValue * @param defaultValue
* @return * @return
*/ */
public static String toStr(Object value, String defaultValue) public static String toStr(Object value, String defaultValue) {
{ if (null == value) {
if (null == value)
{
return defaultValue; return defaultValue;
} }
if (value instanceof String) if (value instanceof String) {
{
return (String) value; return (String) value;
} }
return value.toString(); return value.toString();
@ -46,8 +43,7 @@ public class Convert
* @param value * @param value
* @return * @return
*/ */
public static String toStr(Object value) public static String toStr(Object value) {
{
return toStr(value, null); return toStr(value, null);
} }
@ -56,18 +52,15 @@ public class Convert
* null<br> * null<br>
* *
* *
* @param value * @param value
* @param defaultValue * @param defaultValue
* @return * @return
*/ */
public static Character toChar(Object value, Character defaultValue) public static Character toChar(Object value, Character defaultValue) {
{ if (null == value) {
if (null == value)
{
return defaultValue; return defaultValue;
} }
if (value instanceof Character) if (value instanceof Character) {
{
return (Character) value; return (Character) value;
} }
@ -83,8 +76,7 @@ public class Convert
* @param value * @param value
* @return * @return
*/ */
public static Character toChar(Object value) public static Character toChar(Object value) {
{
return toChar(value, null); return toChar(value, null);
} }
@ -93,35 +85,27 @@ public class Convert
* <code>null</code><br> * <code>null</code><br>
* *
* *
* @param value * @param value
* @param defaultValue * @param defaultValue
* @return * @return
*/ */
public static Byte toByte(Object value, Byte defaultValue) public static Byte toByte(Object value, Byte defaultValue) {
{ if (value == null) {
if (value == null)
{
return defaultValue; return defaultValue;
} }
if (value instanceof Byte) if (value instanceof Byte) {
{
return (Byte) value; return (Byte) value;
} }
if (value instanceof Number) if (value instanceof Number) {
{
return ((Number) value).byteValue(); return ((Number) value).byteValue();
} }
final String valueStr = toStr(value, null); final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr)) if (StringUtils.isEmpty(valueStr)) {
{
return defaultValue; return defaultValue;
} }
try try {
{
return Byte.parseByte(valueStr); return Byte.parseByte(valueStr);
} } catch (Exception e) {
catch (Exception e)
{
return defaultValue; return defaultValue;
} }
} }
@ -134,8 +118,7 @@ public class Convert
* @param value * @param value
* @return * @return
*/ */
public static Byte toByte(Object value) public static Byte toByte(Object value) {
{
return toByte(value, null); return toByte(value, null);
} }
@ -144,35 +127,27 @@ public class Convert
* <code>null</code><br> * <code>null</code><br>
* *
* *
* @param value * @param value
* @param defaultValue * @param defaultValue
* @return * @return
*/ */
public static Short toShort(Object value, Short defaultValue) public static Short toShort(Object value, Short defaultValue) {
{ if (value == null) {
if (value == null)
{
return defaultValue; return defaultValue;
} }
if (value instanceof Short) if (value instanceof Short) {
{
return (Short) value; return (Short) value;
} }
if (value instanceof Number) if (value instanceof Number) {
{
return ((Number) value).shortValue(); return ((Number) value).shortValue();
} }
final String valueStr = toStr(value, null); final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr)) if (StringUtils.isEmpty(valueStr)) {
{
return defaultValue; return defaultValue;
} }
try try {
{
return Short.parseShort(valueStr.trim()); return Short.parseShort(valueStr.trim());
} } catch (Exception e) {
catch (Exception e)
{
return defaultValue; return defaultValue;
} }
} }
@ -185,8 +160,7 @@ public class Convert
* @param value * @param value
* @return * @return
*/ */
public static Short toShort(Object value) public static Short toShort(Object value) {
{
return toShort(value, null); return toShort(value, null);
} }
@ -195,31 +169,24 @@ public class Convert
* <br> * <br>
* *
* *
* @param value * @param value
* @param defaultValue * @param defaultValue
* @return * @return
*/ */
public static Number toNumber(Object value, Number defaultValue) public static Number toNumber(Object value, Number defaultValue) {
{ if (value == null) {
if (value == null)
{
return defaultValue; return defaultValue;
} }
if (value instanceof Number) if (value instanceof Number) {
{
return (Number) value; return (Number) value;
} }
final String valueStr = toStr(value, null); final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr)) if (StringUtils.isEmpty(valueStr)) {
{
return defaultValue; return defaultValue;
} }
try try {
{
return NumberFormat.getInstance().parse(valueStr); return NumberFormat.getInstance().parse(valueStr);
} } catch (Exception e) {
catch (Exception e)
{
return defaultValue; return defaultValue;
} }
} }
@ -232,8 +199,7 @@ public class Convert
* @param value * @param value
* @return * @return
*/ */
public static Number toNumber(Object value) public static Number toNumber(Object value) {
{
return toNumber(value, null); return toNumber(value, null);
} }
@ -242,35 +208,27 @@ public class Convert
* <br> * <br>
* *
* *
* @param value * @param value
* @param defaultValue * @param defaultValue
* @return * @return
*/ */
public static Integer toInt(Object value, Integer defaultValue) public static Integer toInt(Object value, Integer defaultValue) {
{ if (value == null) {
if (value == null)
{
return defaultValue; return defaultValue;
} }
if (value instanceof Integer) if (value instanceof Integer) {
{
return (Integer) value; return (Integer) value;
} }
if (value instanceof Number) if (value instanceof Number) {
{
return ((Number) value).intValue(); return ((Number) value).intValue();
} }
final String valueStr = toStr(value, null); final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr)) if (StringUtils.isEmpty(valueStr)) {
{
return defaultValue; return defaultValue;
} }
try try {
{
return Integer.parseInt(valueStr.trim()); return Integer.parseInt(valueStr.trim());
} } catch (Exception e) {
catch (Exception e)
{
return defaultValue; return defaultValue;
} }
} }
@ -283,8 +241,7 @@ public class Convert
* @param value * @param value
* @return * @return
*/ */
public static Integer toInt(Object value) public static Integer toInt(Object value) {
{
return toInt(value, null); return toInt(value, null);
} }
@ -294,8 +251,7 @@ public class Convert
* @param str * @param str
* @return * @return
*/ */
public static Integer[] toIntArray(String str) public static Integer[] toIntArray(String str) {
{
return toIntArray(",", str); return toIntArray(",", str);
} }
@ -305,8 +261,7 @@ public class Convert
* @param str * @param str
* @return * @return
*/ */
public static Long[] toLongArray(String str) public static Long[] toLongArray(String str) {
{
return toLongArray(",", str); return toLongArray(",", str);
} }
@ -317,16 +272,13 @@ public class Convert
* @param split * @param split
* @return * @return
*/ */
public static Integer[] toIntArray(String split, String str) public static Integer[] toIntArray(String split, String str) {
{ if (StringUtils.isEmpty(str)) {
if (StringUtils.isEmpty(str)) return new Integer[]{};
{
return new Integer[] {};
} }
String[] arr = str.split(split); String[] arr = str.split(split);
final Integer[] ints = new Integer[arr.length]; final Integer[] ints = new Integer[arr.length];
for (int i = 0; i < arr.length; i++) for (int i = 0; i < arr.length; i++) {
{
final Integer v = toInt(arr[i], 0); final Integer v = toInt(arr[i], 0);
ints[i] = v; ints[i] = v;
} }
@ -337,19 +289,16 @@ public class Convert
* Long<br> * Long<br>
* *
* @param split * @param split
* @param str * @param str
* @return * @return
*/ */
public static Long[] toLongArray(String split, String str) public static Long[] toLongArray(String split, String str) {
{ if (StringUtils.isEmpty(str)) {
if (StringUtils.isEmpty(str)) return new Long[]{};
{
return new Long[] {};
} }
String[] arr = str.split(split); String[] arr = str.split(split);
final Long[] longs = new Long[arr.length]; final Long[] longs = new Long[arr.length];
for (int i = 0; i < arr.length; i++) for (int i = 0; i < arr.length; i++) {
{
final Long v = toLong(arr[i], null); final Long v = toLong(arr[i], null);
longs[i] = v; longs[i] = v;
} }
@ -362,8 +311,7 @@ public class Convert
* @param str * @param str
* @return * @return
*/ */
public static String[] toStrArray(String str) public static String[] toStrArray(String str) {
{
return toStrArray(",", str); return toStrArray(",", str);
} }
@ -374,8 +322,7 @@ public class Convert
* @param split * @param split
* @return * @return
*/ */
public static String[] toStrArray(String split, String str) public static String[] toStrArray(String split, String str) {
{
return str.split(split); return str.split(split);
} }
@ -384,36 +331,28 @@ public class Convert
* <br> * <br>
* *
* *
* @param value * @param value
* @param defaultValue * @param defaultValue
* @return * @return
*/ */
public static Long toLong(Object value, Long defaultValue) public static Long toLong(Object value, Long defaultValue) {
{ if (value == null) {
if (value == null)
{
return defaultValue; return defaultValue;
} }
if (value instanceof Long) if (value instanceof Long) {
{
return (Long) value; return (Long) value;
} }
if (value instanceof Number) if (value instanceof Number) {
{
return ((Number) value).longValue(); return ((Number) value).longValue();
} }
final String valueStr = toStr(value, null); final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr)) if (StringUtils.isEmpty(valueStr)) {
{
return defaultValue; return defaultValue;
} }
try try {
{
// 支持科学计数法 // 支持科学计数法
return new BigDecimal(valueStr.trim()).longValue(); return new BigDecimal(valueStr.trim()).longValue();
} } catch (Exception e) {
catch (Exception e)
{
return defaultValue; return defaultValue;
} }
} }
@ -426,8 +365,7 @@ public class Convert
* @param value * @param value
* @return * @return
*/ */
public static Long toLong(Object value) public static Long toLong(Object value) {
{
return toLong(value, null); return toLong(value, null);
} }
@ -436,36 +374,28 @@ public class Convert
* <br> * <br>
* *
* *
* @param value * @param value
* @param defaultValue * @param defaultValue
* @return * @return
*/ */
public static Double toDouble(Object value, Double defaultValue) public static Double toDouble(Object value, Double defaultValue) {
{ if (value == null) {
if (value == null)
{
return defaultValue; return defaultValue;
} }
if (value instanceof Double) if (value instanceof Double) {
{
return (Double) value; return (Double) value;
} }
if (value instanceof Number) if (value instanceof Number) {
{
return ((Number) value).doubleValue(); return ((Number) value).doubleValue();
} }
final String valueStr = toStr(value, null); final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr)) if (StringUtils.isEmpty(valueStr)) {
{
return defaultValue; return defaultValue;
} }
try try {
{
// 支持科学计数法 // 支持科学计数法
return new BigDecimal(valueStr.trim()).doubleValue(); return new BigDecimal(valueStr.trim()).doubleValue();
} } catch (Exception e) {
catch (Exception e)
{
return defaultValue; return defaultValue;
} }
} }
@ -478,8 +408,7 @@ public class Convert
* @param value * @param value
* @return * @return
*/ */
public static Double toDouble(Object value) public static Double toDouble(Object value) {
{
return toDouble(value, null); return toDouble(value, null);
} }
@ -488,35 +417,27 @@ public class Convert
* <br> * <br>
* *
* *
* @param value * @param value
* @param defaultValue * @param defaultValue
* @return * @return
*/ */
public static Float toFloat(Object value, Float defaultValue) public static Float toFloat(Object value, Float defaultValue) {
{ if (value == null) {
if (value == null)
{
return defaultValue; return defaultValue;
} }
if (value instanceof Float) if (value instanceof Float) {
{
return (Float) value; return (Float) value;
} }
if (value instanceof Number) if (value instanceof Number) {
{
return ((Number) value).floatValue(); return ((Number) value).floatValue();
} }
final String valueStr = toStr(value, null); final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr)) if (StringUtils.isEmpty(valueStr)) {
{
return defaultValue; return defaultValue;
} }
try try {
{
return Float.parseFloat(valueStr.trim()); return Float.parseFloat(valueStr.trim());
} } catch (Exception e) {
catch (Exception e)
{
return defaultValue; return defaultValue;
} }
} }
@ -529,8 +450,7 @@ public class Convert
* @param value * @param value
* @return * @return
*/ */
public static Float toFloat(Object value) public static Float toFloat(Object value) {
{
return toFloat(value, null); return toFloat(value, null);
} }
@ -539,28 +459,23 @@ public class Convert
* Stringtruefalseyesokno1,0 <br> * Stringtruefalseyesokno1,0 <br>
* *
* *
* @param value * @param value
* @param defaultValue * @param defaultValue
* @return * @return
*/ */
public static Boolean toBool(Object value, Boolean defaultValue) public static Boolean toBool(Object value, Boolean defaultValue) {
{ if (value == null) {
if (value == null)
{
return defaultValue; return defaultValue;
} }
if (value instanceof Boolean) if (value instanceof Boolean) {
{
return (Boolean) value; return (Boolean) value;
} }
String valueStr = toStr(value, null); String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr)) if (StringUtils.isEmpty(valueStr)) {
{
return defaultValue; return defaultValue;
} }
valueStr = valueStr.trim().toLowerCase(); valueStr = valueStr.trim().toLowerCase();
switch (valueStr) switch (valueStr) {
{
case "true": case "true":
case "yes": case "yes":
case "ok": case "ok":
@ -583,8 +498,7 @@ public class Convert
* @param value * @param value
* @return * @return
*/ */
public static Boolean toBool(Object value) public static Boolean toBool(Object value) {
{
return toBool(value, null); return toBool(value, null);
} }
@ -592,34 +506,27 @@ public class Convert
* Enum<br> * Enum<br>
* <br> * <br>
* *
* @param clazz EnumClass * @param clazz EnumClass
* @param value * @param value
* @param defaultValue * @param defaultValue
* @return Enum * @return Enum
*/ */
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue) public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue) {
{ if (value == null) {
if (value == null)
{
return defaultValue; return defaultValue;
} }
if (clazz.isAssignableFrom(value.getClass())) if (clazz.isAssignableFrom(value.getClass())) {
{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
E myE = (E) value; E myE = (E) value;
return myE; return myE;
} }
final String valueStr = toStr(value, null); final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr)) if (StringUtils.isEmpty(valueStr)) {
{
return defaultValue; return defaultValue;
} }
try try {
{
return Enum.valueOf(clazz, valueStr); return Enum.valueOf(clazz, valueStr);
} } catch (Exception e) {
catch (Exception e)
{
return defaultValue; return defaultValue;
} }
} }
@ -632,8 +539,7 @@ public class Convert
* @param value * @param value
* @return Enum * @return Enum
*/ */
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value) public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value) {
{
return toEnum(clazz, value, null); return toEnum(clazz, value, null);
} }
@ -642,35 +548,27 @@ public class Convert
* <br> * <br>
* *
* *
* @param value * @param value
* @param defaultValue * @param defaultValue
* @return * @return
*/ */
public static BigInteger toBigInteger(Object value, BigInteger defaultValue) public static BigInteger toBigInteger(Object value, BigInteger defaultValue) {
{ if (value == null) {
if (value == null)
{
return defaultValue; return defaultValue;
} }
if (value instanceof BigInteger) if (value instanceof BigInteger) {
{
return (BigInteger) value; return (BigInteger) value;
} }
if (value instanceof Long) if (value instanceof Long) {
{
return BigInteger.valueOf((Long) value); return BigInteger.valueOf((Long) value);
} }
final String valueStr = toStr(value, null); final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr)) if (StringUtils.isEmpty(valueStr)) {
{
return defaultValue; return defaultValue;
} }
try try {
{
return new BigInteger(valueStr); return new BigInteger(valueStr);
} } catch (Exception e) {
catch (Exception e)
{
return defaultValue; return defaultValue;
} }
} }
@ -683,8 +581,7 @@ public class Convert
* @param value * @param value
* @return * @return
*/ */
public static BigInteger toBigInteger(Object value) public static BigInteger toBigInteger(Object value) {
{
return toBigInteger(value, null); return toBigInteger(value, null);
} }
@ -693,43 +590,33 @@ public class Convert
* <br> * <br>
* *
* *
* @param value * @param value
* @param defaultValue * @param defaultValue
* @return * @return
*/ */
public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) {
{ if (value == null) {
if (value == null)
{
return defaultValue; return defaultValue;
} }
if (value instanceof BigDecimal) if (value instanceof BigDecimal) {
{
return (BigDecimal) value; return (BigDecimal) value;
} }
if (value instanceof Long) if (value instanceof Long) {
{
return new BigDecimal((Long) value); return new BigDecimal((Long) value);
} }
if (value instanceof Double) if (value instanceof Double) {
{
return BigDecimal.valueOf((Double) value); return BigDecimal.valueOf((Double) value);
} }
if (value instanceof Integer) if (value instanceof Integer) {
{
return new BigDecimal((Integer) value); return new BigDecimal((Integer) value);
} }
final String valueStr = toStr(value, null); final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr)) if (StringUtils.isEmpty(valueStr)) {
{
return defaultValue; return defaultValue;
} }
try try {
{
return new BigDecimal(valueStr); return new BigDecimal(valueStr);
} } catch (Exception e) {
catch (Exception e)
{
return defaultValue; return defaultValue;
} }
} }
@ -742,8 +629,7 @@ public class Convert
* @param value * @param value
* @return * @return
*/ */
public static BigDecimal toBigDecimal(Object value) public static BigDecimal toBigDecimal(Object value) {
{
return toBigDecimal(value, null); return toBigDecimal(value, null);
} }
@ -754,8 +640,7 @@ public class Convert
* @param obj * @param obj
* @return * @return
*/ */
public static String utf8Str(Object obj) public static String utf8Str(Object obj) {
{
return str(obj, CharsetKit.CHARSET_UTF_8); return str(obj, CharsetKit.CHARSET_UTF_8);
} }
@ -763,12 +648,11 @@ public class Convert
* <br> * <br>
* 1ByteByteBuffer 2Arrays.toString * 1ByteByteBuffer 2Arrays.toString
* *
* @param obj * @param obj
* @param charsetName * @param charsetName
* @return * @return
*/ */
public static String str(Object obj, String charsetName) public static String str(Object obj, String charsetName) {
{
return str(obj, Charset.forName(charsetName)); return str(obj, Charset.forName(charsetName));
} }
@ -776,32 +660,23 @@ public class Convert
* <br> * <br>
* 1ByteByteBuffer 2Arrays.toString * 1ByteByteBuffer 2Arrays.toString
* *
* @param obj * @param obj
* @param charset * @param charset
* @return * @return
*/ */
public static String str(Object obj, Charset charset) public static String str(Object obj, Charset charset) {
{ if (null == obj) {
if (null == obj)
{
return null; return null;
} }
if (obj instanceof String) if (obj instanceof String) {
{
return (String) obj; return (String) obj;
} } else if (obj instanceof byte[]) {
else if (obj instanceof byte[])
{
return str((byte[]) obj, charset); return str((byte[]) obj, charset);
} } else if (obj instanceof Byte[]) {
else if (obj instanceof Byte[])
{
byte[] bytes = ArrayUtils.toPrimitive((Byte[]) obj); byte[] bytes = ArrayUtils.toPrimitive((Byte[]) obj);
return str(bytes, charset); return str(bytes, charset);
} } else if (obj instanceof ByteBuffer) {
else if (obj instanceof ByteBuffer)
{
return str((ByteBuffer) obj, charset); return str((ByteBuffer) obj, charset);
} }
return obj.toString(); return obj.toString();
@ -810,31 +685,27 @@ public class Convert
/** /**
* byte * byte
* *
* @param bytes byte * @param bytes byte
* @param charset * @param charset
* @return * @return
*/ */
public static String str(byte[] bytes, String charset) public static String str(byte[] bytes, String charset) {
{
return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset)); return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset));
} }
/** /**
* *
* *
* @param data * @param data
* @param charset * @param charset
* @return * @return
*/ */
public static String str(byte[] data, Charset charset) public static String str(byte[] data, Charset charset) {
{ if (data == null) {
if (data == null)
{
return null; return null;
} }
if (null == charset) if (null == charset) {
{
return new String(data); return new String(data);
} }
return new String(data, charset); return new String(data, charset);
@ -843,14 +714,12 @@ public class Convert
/** /**
* byteBuffer * byteBuffer
* *
* @param data * @param data
* @param charset 使 * @param charset 使
* @return * @return
*/ */
public static String str(ByteBuffer data, String charset) public static String str(ByteBuffer data, String charset) {
{ if (data == null) {
if (data == null)
{
return null; return null;
} }
@ -860,55 +729,47 @@ public class Convert
/** /**
* byteBuffer * byteBuffer
* *
* @param data * @param data
* @param charset 使 * @param charset 使
* @return * @return
*/ */
public static String str(ByteBuffer data, Charset charset) public static String str(ByteBuffer data, Charset charset) {
{ if (null == charset) {
if (null == charset)
{
charset = Charset.defaultCharset(); charset = Charset.defaultCharset();
} }
return charset.decode(data).toString(); return charset.decode(data).toString();
} }
// ----------------------------------------------------------------------- 全角半角转换 // ----------------------------------------------------------------------- 全角半角转换
/** /**
* *
* *
* @param input String. * @param input String.
* @return . * @return .
*/ */
public static String toSBC(String input) public static String toSBC(String input) {
{
return toSBC(input, null); return toSBC(input, null);
} }
/** /**
* *
* *
* @param input String * @param input String
* @param notConvertSet * @param notConvertSet
* @return . * @return .
*/ */
public static String toSBC(String input, Set<Character> notConvertSet) public static String toSBC(String input, Set<Character> notConvertSet) {
{
char[] c = input.toCharArray(); char[] c = input.toCharArray();
for (int i = 0; i < c.length; i++) for (int i = 0; i < c.length; i++) {
{ if (null != notConvertSet && notConvertSet.contains(c[i])) {
if (null != notConvertSet && notConvertSet.contains(c[i]))
{
// 跳过不替换的字符 // 跳过不替换的字符
continue; continue;
} }
if (c[i] == ' ') if (c[i] == ' ') {
{
c[i] = '\u3000'; c[i] = '\u3000';
} } else if (c[i] < '\177') {
else if (c[i] < '\177')
{
c[i] = (char) (c[i] + 65248); c[i] = (char) (c[i] + 65248);
} }
@ -922,35 +783,28 @@ public class Convert
* @param input String. * @param input String.
* @return * @return
*/ */
public static String toDBC(String input) public static String toDBC(String input) {
{
return toDBC(input, null); return toDBC(input, null);
} }
/** /**
* *
* *
* @param text * @param text
* @param notConvertSet * @param notConvertSet
* @return * @return
*/ */
public static String toDBC(String text, Set<Character> notConvertSet) public static String toDBC(String text, Set<Character> notConvertSet) {
{
char[] c = text.toCharArray(); char[] c = text.toCharArray();
for (int i = 0; i < c.length; i++) for (int i = 0; i < c.length; i++) {
{ if (null != notConvertSet && notConvertSet.contains(c[i])) {
if (null != notConvertSet && notConvertSet.contains(c[i]))
{
// 跳过不替换的字符 // 跳过不替换的字符
continue; continue;
} }
if (c[i] == '\u3000') if (c[i] == '\u3000') {
{
c[i] = ' '; c[i] = ' ';
} } else if (c[i] > '\uFF00' && c[i] < '\uFF5F') {
else if (c[i] > '\uFF00' && c[i] < '\uFF5F')
{
c[i] = (char) (c[i] - 65248); c[i] = (char) (c[i] - 65248);
} }
} }
@ -965,31 +819,26 @@ public class Convert
* @param n * @param n
* @return * @return
*/ */
public static String digitUppercase(double n) public static String digitUppercase(double n) {
{ String[] fraction = {"角", "分"};
String[] fraction = { "角", "分" }; String[] digit = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"};
String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; String[][] unit = {{"元", "万", "亿"}, {"", "拾", "佰", "仟"}};
String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } };
String head = n < 0 ? "负" : ""; String head = n < 0 ? "负" : "";
n = Math.abs(n); n = Math.abs(n);
String s = ""; String s = "";
for (int i = 0; i < fraction.length; i++) for (int i = 0; i < fraction.length; i++) {
{
s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""); s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", "");
} }
if (s.length() < 1) if (s.length() < 1) {
{
s = "整"; s = "整";
} }
int integerPart = (int) Math.floor(n); int integerPart = (int) Math.floor(n);
for (int i = 0; i < unit[0].length && integerPart > 0; i++) for (int i = 0; i < unit[0].length && integerPart > 0; i++) {
{
String p = ""; String p = "";
for (int j = 0; j < unit[1].length && n > 0; j++) for (int j = 0; j < unit[1].length && n > 0; j++) {
{
p = digit[integerPart % 10] + unit[1][j] + p; p = digit[integerPart % 10] + unit[1][j] + p;
integerPart = integerPart / 10; integerPart = integerPart / 10;
} }

@ -4,11 +4,10 @@ import com.ruoyi.common.utils.StringUtils;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class StrFormatter public class StrFormatter {
{
public static final String EMPTY_JSON = "{}"; public static final String EMPTY_JSON = "{}";
public static final char C_BACKSLASH = '\\'; public static final char C_BACKSLASH = '\\';
public static final char C_DELIM_START = '{'; public static final char C_DELIM_START = '{';
@ -22,15 +21,13 @@ public class StrFormatter
* 使format("this is {} for {}", "a", "b") -> this is a for b<br> * 使format("this is {} for {}", "a", "b") -> this is a for b<br>
* {} format("this is \\{} for {}", "a", "b") -> this is \{} for a<br> * {} format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
* \ format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br> * \ format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
* *
* @param strPattern * @param strPattern
* @param argArray * @param argArray
* @return * @return
*/ */
public static String format(final String strPattern, final Object... argArray) public static String format(final String strPattern, final Object... argArray) {
{ if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) {
if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray))
{
return strPattern; return strPattern;
} }
final int strPatternLength = strPattern.length(); final int strPatternLength = strPattern.length();
@ -40,43 +37,30 @@ public class StrFormatter
int handledPosition = 0; int handledPosition = 0;
int delimIndex;// 占位符所在位置 int delimIndex;// 占位符所在位置
for (int argIndex = 0; argIndex < argArray.length; argIndex++) for (int argIndex = 0; argIndex < argArray.length; argIndex++) {
{
delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition); delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
if (delimIndex == -1) if (delimIndex == -1) {
{ if (handledPosition == 0) {
if (handledPosition == 0)
{
return strPattern; return strPattern;
} } else { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
else
{ // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
sbuf.append(strPattern, handledPosition, strPatternLength); sbuf.append(strPattern, handledPosition, strPatternLength);
return sbuf.toString(); return sbuf.toString();
} }
} } else {
else if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) {
{ if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) {
if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH)
{
if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH)
{
// 转义符之前还有一个转义符,占位符依旧有效 // 转义符之前还有一个转义符,占位符依旧有效
sbuf.append(strPattern, handledPosition, delimIndex - 1); sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(Convert.utf8Str(argArray[argIndex])); sbuf.append(Convert.utf8Str(argArray[argIndex]));
handledPosition = delimIndex + 2; handledPosition = delimIndex + 2;
} } else {
else
{
// 占位符被转义 // 占位符被转义
argIndex--; argIndex--;
sbuf.append(strPattern, handledPosition, delimIndex - 1); sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(C_DELIM_START); sbuf.append(C_DELIM_START);
handledPosition = delimIndex + 1; handledPosition = delimIndex + 1;
} }
} } else {
else
{
// 正常占位符 // 正常占位符
sbuf.append(strPattern, handledPosition, delimIndex); sbuf.append(strPattern, handledPosition, delimIndex);
sbuf.append(Convert.utf8Str(argArray[argIndex])); sbuf.append(Convert.utf8Str(argArray[argIndex]));

@ -2,12 +2,10 @@ package com.ruoyi.common.enums;
/** /**
* *
*
* @author ruoyi
* *
* @author ruoyi
*/ */
public enum BusinessStatus public enum BusinessStatus {
{
/** /**
* *
*/ */

@ -2,11 +2,10 @@ package com.ruoyi.common.enums;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public enum BusinessType public enum BusinessType {
{
/** /**
* *
*/ */
@ -51,7 +50,7 @@ public enum BusinessType
* *
*/ */
GENCODE, GENCODE,
/** /**
* *
*/ */

@ -2,11 +2,10 @@ package com.ruoyi.common.enums;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public enum DataSourceType public enum DataSourceType {
{
/** /**
* *
*/ */

@ -1,36 +1,32 @@
package com.ruoyi.common.enums; package com.ruoyi.common.enums;
import org.springframework.lang.Nullable;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.springframework.lang.Nullable;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public enum HttpMethod public enum HttpMethod {
{
GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
private static final Map<String, HttpMethod> mappings = new HashMap<>(16); private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
static static {
{ for (HttpMethod httpMethod : values()) {
for (HttpMethod httpMethod : values())
{
mappings.put(httpMethod.name(), httpMethod); mappings.put(httpMethod.name(), httpMethod);
} }
} }
@Nullable @Nullable
public static HttpMethod resolve(@Nullable String method) public static HttpMethod resolve(@Nullable String method) {
{
return (method != null ? mappings.get(method) : null); return (method != null ? mappings.get(method) : null);
} }
public boolean matches(String method) public boolean matches(String method) {
{
return (this == resolve(method)); return (this == resolve(method));
} }
} }

@ -6,8 +6,7 @@ package com.ruoyi.common.enums;
* @author ruoyi * @author ruoyi
*/ */
public enum LimitType public enum LimitType {
{
/** /**
* *
*/ */

@ -2,11 +2,10 @@ package com.ruoyi.common.enums;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public enum OperatorType public enum OperatorType {
{
/** /**
* *
*/ */

@ -2,29 +2,25 @@ package com.ruoyi.common.enums;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public enum UserStatus public enum UserStatus {
{
OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"); OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除");
private final String code; private final String code;
private final String info; private final String info;
UserStatus(String code, String info) UserStatus(String code, String info) {
{
this.code = code; this.code = code;
this.info = info; this.info = info;
} }
public String getCode() public String getCode() {
{
return code; return code;
} }
public String getInfo() public String getInfo() {
{
return info; return info;
} }
} }

@ -2,14 +2,12 @@ package com.ruoyi.common.exception;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class DemoModeException extends RuntimeException public class DemoModeException extends RuntimeException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public DemoModeException() public DemoModeException() {
{
} }
} }

@ -2,11 +2,10 @@ package com.ruoyi.common.exception;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class GlobalException extends RuntimeException public class GlobalException extends RuntimeException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
@ -16,7 +15,7 @@ public class GlobalException extends RuntimeException
/** /**
* *
* * <p>
* {@link CommonResult#getDetailMessage()} * {@link CommonResult#getDetailMessage()}
*/ */
private String detailMessage; private String detailMessage;
@ -24,34 +23,28 @@ public class GlobalException extends RuntimeException
/** /**
* *
*/ */
public GlobalException() public GlobalException() {
{
} }
public GlobalException(String message) public GlobalException(String message) {
{
this.message = message; this.message = message;
} }
public String getDetailMessage() public String getDetailMessage() {
{
return detailMessage; return detailMessage;
} }
public GlobalException setDetailMessage(String detailMessage) public GlobalException setDetailMessage(String detailMessage) {
{
this.detailMessage = detailMessage; this.detailMessage = detailMessage;
return this; return this;
} }
@Override @Override
public String getMessage() public String getMessage() {
{
return message; return message;
} }
public GlobalException setMessage(String message) public GlobalException setMessage(String message) {
{
this.message = message; this.message = message;
return this; return this;
} }

@ -2,11 +2,10 @@ package com.ruoyi.common.exception;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public final class ServiceException extends RuntimeException public final class ServiceException extends RuntimeException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
@ -21,7 +20,7 @@ public final class ServiceException extends RuntimeException
/** /**
* *
* * <p>
* {@link CommonResult#getDetailMessage()} * {@link CommonResult#getDetailMessage()}
*/ */
private String detailMessage; private String detailMessage;
@ -29,46 +28,38 @@ public final class ServiceException extends RuntimeException
/** /**
* *
*/ */
public ServiceException() public ServiceException() {
{
} }
public ServiceException(String message) public ServiceException(String message) {
{
this.message = message; this.message = message;
} }
public ServiceException(String message, Integer code) public ServiceException(String message, Integer code) {
{
this.message = message; this.message = message;
this.code = code; this.code = code;
} }
public String getDetailMessage() public String getDetailMessage() {
{
return detailMessage; return detailMessage;
} }
@Override public ServiceException setDetailMessage(String detailMessage) {
public String getMessage() this.detailMessage = detailMessage;
{ return this;
return message;
} }
public Integer getCode() @Override
{ public String getMessage() {
return code; return message;
} }
public ServiceException setMessage(String message) public ServiceException setMessage(String message) {
{
this.message = message; this.message = message;
return this; return this;
} }
public ServiceException setDetailMessage(String detailMessage) public Integer getCode() {
{ return code;
this.detailMessage = detailMessage;
return this;
} }
} }

@ -2,25 +2,21 @@ package com.ruoyi.common.exception;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class UtilException extends RuntimeException public class UtilException extends RuntimeException {
{
private static final long serialVersionUID = 8247610319171014183L; private static final long serialVersionUID = 8247610319171014183L;
public UtilException(Throwable e) public UtilException(Throwable e) {
{
super(e.getMessage(), e); super(e.getMessage(), e);
} }
public UtilException(String message) public UtilException(String message) {
{
super(message); super(message);
} }
public UtilException(String message, Throwable throwable) public UtilException(String message, Throwable throwable) {
{
super(message, throwable); super(message, throwable);
} }
} }

@ -5,11 +5,10 @@ import com.ruoyi.common.utils.StringUtils;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class BaseException extends RuntimeException public class BaseException extends RuntimeException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
@ -32,66 +31,54 @@ public class BaseException extends RuntimeException
*/ */
private String defaultMessage; private String defaultMessage;
public BaseException(String module, String code, Object[] args, String defaultMessage) public BaseException(String module, String code, Object[] args, String defaultMessage) {
{
this.module = module; this.module = module;
this.code = code; this.code = code;
this.args = args; this.args = args;
this.defaultMessage = defaultMessage; this.defaultMessage = defaultMessage;
} }
public BaseException(String module, String code, Object[] args) public BaseException(String module, String code, Object[] args) {
{
this(module, code, args, null); this(module, code, args, null);
} }
public BaseException(String module, String defaultMessage) public BaseException(String module, String defaultMessage) {
{
this(module, null, null, defaultMessage); this(module, null, null, defaultMessage);
} }
public BaseException(String code, Object[] args) public BaseException(String code, Object[] args) {
{
this(null, code, args, null); this(null, code, args, null);
} }
public BaseException(String defaultMessage) public BaseException(String defaultMessage) {
{
this(null, null, null, defaultMessage); this(null, null, null, defaultMessage);
} }
@Override @Override
public String getMessage() public String getMessage() {
{
String message = null; String message = null;
if (!StringUtils.isEmpty(code)) if (!StringUtils.isEmpty(code)) {
{
message = MessageUtils.message(code, args); message = MessageUtils.message(code, args);
} }
if (message == null) if (message == null) {
{
message = defaultMessage; message = defaultMessage;
} }
return message; return message;
} }
public String getModule() public String getModule() {
{
return module; return module;
} }
public String getCode() public String getCode() {
{
return code; return code;
} }
public Object[] getArgs() public Object[] getArgs() {
{
return args; return args;
} }
public String getDefaultMessage() public String getDefaultMessage() {
{
return defaultMessage; return defaultMessage;
} }
} }

@ -4,15 +4,13 @@ import com.ruoyi.common.exception.base.BaseException;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class FileException extends BaseException public class FileException extends BaseException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public FileException(String code, Object[] args) public FileException(String code, Object[] args) {
{
super("file", code, args, null); super("file", code, args, null);
} }

@ -2,15 +2,13 @@ package com.ruoyi.common.exception.file;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class FileNameLengthLimitExceededException extends FileException public class FileNameLengthLimitExceededException extends FileException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public FileNameLengthLimitExceededException(int defaultFileNameLength) public FileNameLengthLimitExceededException(int defaultFileNameLength) {
{ super("upload.filename.exceed.length", new Object[]{defaultFileNameLength});
super("upload.filename.exceed.length", new Object[] { defaultFileNameLength });
} }
} }

@ -2,15 +2,13 @@ package com.ruoyi.common.exception.file;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class FileSizeLimitExceededException extends FileException public class FileSizeLimitExceededException extends FileException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public FileSizeLimitExceededException(long defaultMaxSize) public FileSizeLimitExceededException(long defaultMaxSize) {
{ super("upload.exceed.maxSize", new Object[]{defaultMaxSize});
super("upload.exceed.maxSize", new Object[] { defaultMaxSize });
} }
} }

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save