mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-20 02:08:15 +08:00
Merge branch 'dev' of gitee.com:zendwang/RuoYi-Vue-Plus into dev
Conflicts: ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
This commit is contained in:
commit
2708bde544
@ -8,7 +8,6 @@
|
|||||||
[]()
|
[]()
|
||||||
[]()
|
[]()
|
||||||
[]()
|
[]()
|
||||||
[]()
|
|
||||||
|
|
||||||
> RuoYi-Vue-Plus 是基于 RuoYi-Vue 针对 `分布式集群` 场景升级(不兼容原框架)
|
> RuoYi-Vue-Plus 是基于 RuoYi-Vue 针对 `分布式集群` 场景升级(不兼容原框架)
|
||||||
|
|
||||||
@ -22,7 +21,7 @@
|
|||||||
| 原框架 | RuoYi-Vue | [RuoYi-Vue官网](http://ruoyi.vip/) | 定期同步需要的功能 |
|
| 原框架 | RuoYi-Vue | [RuoYi-Vue官网](http://ruoyi.vip/) | 定期同步需要的功能 |
|
||||||
| 前端开发框架 | Vue、Element UI | [Element UI官网](https://element.eleme.cn/#/zh-CN) | |
|
| 前端开发框架 | Vue、Element UI | [Element UI官网](https://element.eleme.cn/#/zh-CN) | |
|
||||||
| 后端开发框架 | SpringBoot | [SpringBoot官网](https://spring.io/projects/spring-boot/#learn) | |
|
| 后端开发框架 | SpringBoot | [SpringBoot官网](https://spring.io/projects/spring-boot/#learn) | |
|
||||||
| 容器框架 | Undertow | [Undertow官网](https://undertow.io/) | 基于 Netty 的高性能容器 |
|
| 容器框架 | Undertow | [Undertow官网](https://undertow.io/) | 基于 XNIO 的高性能容器 |
|
||||||
| 权限认证框架 | Spring Security、Jwt | [SpringSecurity官网](https://spring.io/projects/spring-security#learn) | 支持多终端认证系统 |
|
| 权限认证框架 | Spring Security、Jwt | [SpringSecurity官网](https://spring.io/projects/spring-security#learn) | 支持多终端认证系统 |
|
||||||
| 关系数据库 | MySQL | [MySQL官网](https://dev.mysql.com/) | 适配 8.X 最低 5.7 |
|
| 关系数据库 | MySQL | [MySQL官网](https://dev.mysql.com/) | 适配 8.X 最低 5.7 |
|
||||||
| 缓存数据库 | Redis | [Redis官网](https://redis.io/) | 适配 6.X 最低 4.X |
|
| 缓存数据库 | Redis | [Redis官网](https://redis.io/) | 适配 6.X 最低 4.X |
|
||||||
|
|||||||
29
pom.xml
29
pom.xml
@ -24,6 +24,7 @@
|
|||||||
<swagger-annotations.version>1.5.22</swagger-annotations.version>
|
<swagger-annotations.version>1.5.22</swagger-annotations.version>
|
||||||
<poi.version>4.1.2</poi.version>
|
<poi.version>4.1.2</poi.version>
|
||||||
<easyexcel.version>2.2.11</easyexcel.version>
|
<easyexcel.version>2.2.11</easyexcel.version>
|
||||||
|
<cglib.version>3.3.0</cglib.version>
|
||||||
<velocity.version>2.3</velocity.version>
|
<velocity.version>2.3</velocity.version>
|
||||||
<mybatis-plus.version>3.4.3.4</mybatis-plus.version>
|
<mybatis-plus.version>3.4.3.4</mybatis-plus.version>
|
||||||
<p6spy.version>3.9.1</p6spy.version>
|
<p6spy.version>3.9.1</p6spy.version>
|
||||||
@ -33,7 +34,7 @@
|
|||||||
<redisson.version>3.16.4</redisson.version>
|
<redisson.version>3.16.4</redisson.version>
|
||||||
<lock4j.version>2.2.1</lock4j.version>
|
<lock4j.version>2.2.1</lock4j.version>
|
||||||
<dynamic-ds.version>3.4.1</dynamic-ds.version>
|
<dynamic-ds.version>3.4.1</dynamic-ds.version>
|
||||||
<tlog.version>1.3.4</tlog.version>
|
<tlog.version>1.3.5</tlog.version>
|
||||||
<xxl-job.version>2.3.0</xxl-job.version>
|
<xxl-job.version>2.3.0</xxl-job.version>
|
||||||
|
|
||||||
<!-- jdk11 缺失依赖 jaxb-->
|
<!-- jdk11 缺失依赖 jaxb-->
|
||||||
@ -114,6 +115,12 @@
|
|||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cglib</groupId>
|
||||||
|
<artifactId>cglib</artifactId>
|
||||||
|
<version>${cglib.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- velocity代码生成使用模板 -->
|
<!-- velocity代码生成使用模板 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.velocity</groupId>
|
<groupId>org.apache.velocity</groupId>
|
||||||
@ -196,29 +203,13 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.yomahub</groupId>
|
<groupId>com.yomahub</groupId>
|
||||||
<artifactId>tlog-spring-boot-configuration</artifactId>
|
<artifactId>tlog-web-spring-boot-starter</artifactId>
|
||||||
<version>${tlog.version}</version>
|
<version>${tlog.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.yomahub</groupId>
|
<groupId>com.yomahub</groupId>
|
||||||
<artifactId>tlog-webroot</artifactId>
|
<artifactId>tlog-xxljob-spring-boot-starter</artifactId>
|
||||||
<version>${tlog.version}</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>javassist</artifactId>
|
|
||||||
<groupId>org.javassist</groupId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>guava</artifactId>
|
|
||||||
<groupId>com.google.guava</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.yomahub</groupId>
|
|
||||||
<artifactId>tlog-xxl-job</artifactId>
|
|
||||||
<version>${tlog.version}</version>
|
<version>${tlog.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@ -120,11 +120,11 @@ security:
|
|||||||
- /*/api-docs
|
- /*/api-docs
|
||||||
# druid 监控配置
|
# druid 监控配置
|
||||||
- /druid/**
|
- /druid/**
|
||||||
|
# 用户放行
|
||||||
|
permit-all:
|
||||||
# actuator 监控配置
|
# actuator 监控配置
|
||||||
- /actuator
|
- /actuator
|
||||||
- /actuator/**
|
- /actuator/**
|
||||||
# 用户放行
|
|
||||||
permit-all:
|
|
||||||
|
|
||||||
# 重复提交
|
# 重复提交
|
||||||
repeat-submit:
|
repeat-submit:
|
||||||
|
|||||||
@ -64,6 +64,11 @@
|
|||||||
<artifactId>easyexcel</artifactId>
|
<artifactId>easyexcel</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cglib</groupId>
|
||||||
|
<artifactId>cglib</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- yml解析器 -->
|
<!-- yml解析器 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.yaml</groupId>
|
<groupId>org.yaml</groupId>
|
||||||
@ -135,16 +140,6 @@
|
|||||||
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>
|
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.yomahub</groupId>
|
|
||||||
<artifactId>tlog-spring-boot-configuration</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.yomahub</groupId>
|
|
||||||
<artifactId>tlog-webroot</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.common.core.domain.entity;
|
package com.ruoyi.common.core.domain.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.ruoyi.common.core.domain.TreeEntity;
|
import com.ruoyi.common.core.domain.TreeEntity;
|
||||||
@ -65,6 +66,7 @@ public class SysMenu extends TreeEntity {
|
|||||||
* 路由参数
|
* 路由参数
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "路由参数")
|
@ApiModelProperty(value = "路由参数")
|
||||||
|
@TableField("`query`")
|
||||||
private String query;
|
private String query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.ruoyi.common.core.mybatisplus.core;
|
package com.ruoyi.common.core.mybatisplus.core;
|
||||||
|
|
||||||
import cn.hutool.core.bean.copier.CopyOptions;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
@ -23,14 +22,9 @@ public interface IServicePlus<T, V> extends IService<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id 主键id
|
* @param id 主键id
|
||||||
* @param copyOptions copy条件
|
|
||||||
* @return V对象
|
* @return V对象
|
||||||
*/
|
*/
|
||||||
V getVoById(Serializable id, CopyOptions copyOptions);
|
V getVoById(Serializable id);
|
||||||
|
|
||||||
default V getVoById(Serializable id) {
|
|
||||||
return getVoById(id, new CopyOptions());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param convertor 自定义转换器
|
* @param convertor 自定义转换器
|
||||||
@ -41,14 +35,9 @@ public interface IServicePlus<T, V> extends IService<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param idList id列表
|
* @param idList id列表
|
||||||
* @param copyOptions copy条件
|
|
||||||
* @return V对象
|
* @return V对象
|
||||||
*/
|
*/
|
||||||
List<V> listVoByIds(Collection<? extends Serializable> idList, CopyOptions copyOptions);
|
List<V> listVoByIds(Collection<? extends Serializable> idList);
|
||||||
|
|
||||||
default List<V> listVoByIds(Collection<? extends Serializable> idList) {
|
|
||||||
return listVoByIds(idList, new CopyOptions());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param convertor 自定义转换器
|
* @param convertor 自定义转换器
|
||||||
@ -64,14 +53,9 @@ public interface IServicePlus<T, V> extends IService<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param columnMap 表字段 map 对象
|
* @param columnMap 表字段 map 对象
|
||||||
* @param copyOptions copy条件
|
|
||||||
* @return V对象
|
* @return V对象
|
||||||
*/
|
*/
|
||||||
List<V> listVoByMap(Map<String, Object> columnMap, CopyOptions copyOptions);
|
List<V> listVoByMap(Map<String, Object> columnMap);
|
||||||
|
|
||||||
default List<V> listVoByMap(Map<String, Object> columnMap) {
|
|
||||||
return listVoByMap(columnMap, new CopyOptions());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param convertor 自定义转换器
|
* @param convertor 自定义转换器
|
||||||
@ -87,14 +71,9 @@ public interface IServicePlus<T, V> extends IService<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param queryWrapper 查询条件
|
* @param queryWrapper 查询条件
|
||||||
* @param copyOptions copy条件
|
|
||||||
* @return V对象
|
* @return V对象
|
||||||
*/
|
*/
|
||||||
V getVoOne(Wrapper<T> queryWrapper, CopyOptions copyOptions);
|
V getVoOne(Wrapper<T> queryWrapper);
|
||||||
|
|
||||||
default V getVoOne(Wrapper<T> queryWrapper) {
|
|
||||||
return getVoOne(queryWrapper, new CopyOptions());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param convertor 自定义转换器
|
* @param convertor 自定义转换器
|
||||||
@ -105,14 +84,9 @@ public interface IServicePlus<T, V> extends IService<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param queryWrapper 查询条件
|
* @param queryWrapper 查询条件
|
||||||
* @param copyOptions copy条件
|
|
||||||
* @return V对象
|
* @return V对象
|
||||||
*/
|
*/
|
||||||
List<V> listVo(Wrapper<T> queryWrapper, CopyOptions copyOptions);
|
List<V> listVo(Wrapper<T> queryWrapper);
|
||||||
|
|
||||||
default List<V> listVo(Wrapper<T> queryWrapper) {
|
|
||||||
return listVo(queryWrapper, new CopyOptions());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param convertor 自定义转换器
|
* @param convertor 自定义转换器
|
||||||
@ -139,14 +113,9 @@ public interface IServicePlus<T, V> extends IService<T> {
|
|||||||
/**
|
/**
|
||||||
* @param page 分页对象
|
* @param page 分页对象
|
||||||
* @param queryWrapper 查询条件
|
* @param queryWrapper 查询条件
|
||||||
* @param copyOptions copy条件
|
|
||||||
* @return V对象
|
* @return V对象
|
||||||
*/
|
*/
|
||||||
PagePlus<T, V> pageVo(PagePlus<T, V> page, Wrapper<T> queryWrapper, CopyOptions copyOptions);
|
PagePlus<T, V> pageVo(PagePlus<T, V> page, Wrapper<T> queryWrapper);
|
||||||
|
|
||||||
default PagePlus<T, V> pageVo(PagePlus<T, V> page, Wrapper<T> queryWrapper) {
|
|
||||||
return pageVo(page, queryWrapper, new CopyOptions());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param convertor 自定义转换器
|
* @param convertor 自定义转换器
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.ruoyi.common.core.mybatisplus.core;
|
package com.ruoyi.common.core.mybatisplus.core;
|
||||||
|
|
||||||
import cn.hutool.core.bean.copier.CopyOptions;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
@ -165,9 +164,9 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T, V> extends ServiceI
|
|||||||
* @param id 主键ID
|
* @param id 主键ID
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public V getVoById(Serializable id, CopyOptions copyOptions) {
|
public V getVoById(Serializable id) {
|
||||||
T t = getBaseMapper().selectById(id);
|
T t = getBaseMapper().selectById(id);
|
||||||
return BeanCopyUtils.oneCopy(t, copyOptions, voClass);
|
return BeanCopyUtils.copy(t, voClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -176,12 +175,12 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T, V> extends ServiceI
|
|||||||
* @param idList 主键ID列表
|
* @param idList 主键ID列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<V> listVoByIds(Collection<? extends Serializable> idList, CopyOptions copyOptions) {
|
public List<V> listVoByIds(Collection<? extends Serializable> idList) {
|
||||||
List<T> list = getBaseMapper().selectBatchIds(idList);
|
List<T> list = getBaseMapper().selectBatchIds(idList);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return BeanCopyUtils.listCopy(list, copyOptions, voClass);
|
return BeanCopyUtils.copyList(list, voClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -190,12 +189,12 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T, V> extends ServiceI
|
|||||||
* @param columnMap 表字段 map 对象
|
* @param columnMap 表字段 map 对象
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<V> listVoByMap(Map<String, Object> columnMap, CopyOptions copyOptions) {
|
public List<V> listVoByMap(Map<String, Object> columnMap) {
|
||||||
List<T> list = getBaseMapper().selectByMap(columnMap);
|
List<T> list = getBaseMapper().selectByMap(columnMap);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return BeanCopyUtils.listCopy(list, copyOptions, voClass);
|
return BeanCopyUtils.copyList(list, voClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -205,9 +204,9 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T, V> extends ServiceI
|
|||||||
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
|
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public V getVoOne(Wrapper<T> queryWrapper, CopyOptions copyOptions) {
|
public V getVoOne(Wrapper<T> queryWrapper) {
|
||||||
T t = getOne(queryWrapper, true);
|
T t = getOne(queryWrapper, true);
|
||||||
return BeanCopyUtils.oneCopy(t, copyOptions, voClass);
|
return BeanCopyUtils.copy(t, voClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -216,12 +215,12 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T, V> extends ServiceI
|
|||||||
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
|
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<V> listVo(Wrapper<T> queryWrapper, CopyOptions copyOptions) {
|
public List<V> listVo(Wrapper<T> queryWrapper) {
|
||||||
List<T> list = getBaseMapper().selectList(queryWrapper);
|
List<T> list = getBaseMapper().selectList(queryWrapper);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return BeanCopyUtils.listCopy(list, copyOptions, voClass);
|
return BeanCopyUtils.copyList(list, voClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -231,9 +230,9 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T, V> extends ServiceI
|
|||||||
* @param queryWrapper 实体对象封装操作类
|
* @param queryWrapper 实体对象封装操作类
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PagePlus<T, V> pageVo(PagePlus<T, V> page, Wrapper<T> queryWrapper, CopyOptions copyOptions) {
|
public PagePlus<T, V> pageVo(PagePlus<T, V> page, Wrapper<T> queryWrapper) {
|
||||||
PagePlus<T, V> result = getBaseMapper().selectPage(page, queryWrapper);
|
PagePlus<T, V> result = getBaseMapper().selectPage(page, queryWrapper);
|
||||||
List<V> volist = BeanCopyUtils.listCopy(result.getRecords(), copyOptions, voClass);
|
List<V> volist = BeanCopyUtils.copyList(result.getRecords(), voClass);
|
||||||
result.setRecordsVo(volist);
|
result.setRecordsVo(volist);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import com.alibaba.excel.context.AnalysisContext;
|
|||||||
import com.alibaba.excel.event.AnalysisEventListener;
|
import com.alibaba.excel.event.AnalysisEventListener;
|
||||||
import com.alibaba.excel.exception.ExcelAnalysisException;
|
import com.alibaba.excel.exception.ExcelAnalysisException;
|
||||||
import com.alibaba.excel.exception.ExcelDataConvertException;
|
import com.alibaba.excel.exception.ExcelDataConvertException;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.ruoyi.common.utils.JsonUtils;
|
||||||
import com.ruoyi.common.utils.ValidatorUtils;
|
import com.ruoyi.common.utils.ValidatorUtils;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -84,7 +84,7 @@ public class DefaultExcelListener<T> extends AnalysisEventListener<T> implements
|
|||||||
@Override
|
@Override
|
||||||
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
|
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
|
||||||
this.headMap = headMap;
|
this.headMap = headMap;
|
||||||
log.debug("解析到一条表头数据: {}", JSON.toJSONString(headMap));
|
log.debug("解析到一条表头数据: {}", JsonUtils.toJsonString(headMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,66 +1,120 @@
|
|||||||
package com.ruoyi.common.utils;
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
import cn.hutool.core.bean.copier.BeanCopier;
|
|
||||||
import cn.hutool.core.bean.copier.CopyOptions;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.ReflectUtil;
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
|
import cn.hutool.extra.cglib.CglibUtil;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bean深拷贝工具
|
* bean深拷贝工具(基于 cglib 性能优异)
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class BeanCopyUtils {
|
public class BeanCopyUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单对象基于class创建拷贝
|
* 单对象基于class创建拷贝
|
||||||
*
|
*
|
||||||
* @param source 数据来源实体
|
* @param source 数据来源实体
|
||||||
* @param copyOptions copy条件
|
* @param desc 描述对象 转换后的对象
|
||||||
* @param desc 描述对象 转换后的对象
|
|
||||||
* @return desc
|
* @return desc
|
||||||
*/
|
*/
|
||||||
public static <T, V> V oneCopy(T source, CopyOptions copyOptions, Class<V> desc) {
|
public static <T, V> V copy(T source, Class<V> desc) {
|
||||||
V v = ReflectUtil.newInstanceIfPossible(desc);
|
if (ObjectUtil.isNull(source)) {
|
||||||
return oneCopy(source, copyOptions, v);
|
return null;
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNull(desc)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return CglibUtil.copy(source, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单对象基于对象创建拷贝
|
* 单对象基于对象创建拷贝
|
||||||
*
|
*
|
||||||
* @param source 数据来源实体
|
* @param source 数据来源实体
|
||||||
* @param copyOptions copy条件
|
* @param desc 转换后的对象
|
||||||
* @param desc 转换后的对象
|
|
||||||
* @return desc
|
* @return desc
|
||||||
*/
|
*/
|
||||||
public static <T, V> V oneCopy(T source, CopyOptions copyOptions, V desc) {
|
public static <T, V> V copy(T source, V desc) {
|
||||||
if (ObjectUtil.isNull(source)) {
|
if (ObjectUtil.isNull(source)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return BeanCopier.create(source, desc, copyOptions).copy();
|
if (ObjectUtil.isNull(desc)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
CglibUtil.copy(source, desc);
|
||||||
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表对象基于class创建拷贝
|
* 列表对象基于class创建拷贝
|
||||||
*
|
*
|
||||||
* @param sourceList 数据来源实体列表
|
* @param sourceList 数据来源实体列表
|
||||||
* @param copyOptions copy条件
|
* @param desc 描述对象 转换后的对象
|
||||||
* @param desc 描述对象 转换后的对象
|
|
||||||
* @return desc
|
* @return desc
|
||||||
*/
|
*/
|
||||||
public static <T, V> List<V> listCopy(List<T> sourceList, CopyOptions copyOptions, Class<V> desc) {
|
public static <T, V> List<V> copyList(List<T> sourceList, Class<V> desc) {
|
||||||
if (ObjectUtil.isNull(sourceList)) {
|
if (ObjectUtil.isNull(sourceList)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (CollUtil.isEmpty(sourceList)) {
|
if (CollUtil.isEmpty(sourceList)) {
|
||||||
return CollUtil.newArrayList();
|
return CollUtil.newArrayList();
|
||||||
}
|
}
|
||||||
return sourceList.stream()
|
return CglibUtil.copyList(sourceList, () -> ReflectUtil.newInstanceIfPossible(desc));
|
||||||
.map(source -> oneCopy(source, copyOptions, desc))
|
}
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
/**
|
||||||
|
* bean拷贝到map
|
||||||
|
*
|
||||||
|
* @param bean 数据来源实体
|
||||||
|
* @return map对象
|
||||||
|
*/
|
||||||
|
public static <T> Map<String, Object> copyToMap(T bean) {
|
||||||
|
if (ObjectUtil.isNull(bean)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return CglibUtil.toMap(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* map拷贝到bean
|
||||||
|
*
|
||||||
|
* @param map 数据来源
|
||||||
|
* @param beanClass bean类
|
||||||
|
* @return bean对象
|
||||||
|
*/
|
||||||
|
public static <T> T mapToBean(Map<String, Object> map, Class<T> beanClass) {
|
||||||
|
if (MapUtil.isEmpty(map)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNull(beanClass)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return CglibUtil.toBean(map, beanClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* map拷贝到bean
|
||||||
|
*
|
||||||
|
* @param map 数据来源
|
||||||
|
* @param bean bean对象
|
||||||
|
* @return bean对象
|
||||||
|
*/
|
||||||
|
public static <T> T mapToBean(Map<String, Object> map, T bean) {
|
||||||
|
if (MapUtil.isEmpty(map)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNull(bean)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return CglibUtil.fillBean(map, bean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package com.ruoyi.common.utils;
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
|
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
@ -12,6 +14,7 @@ import java.util.Date;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||||
|
|
||||||
public static String YYYY = "yyyy";
|
public static String YYYY = "yyyy";
|
||||||
|
|||||||
@ -1,158 +0,0 @@
|
|||||||
package com.ruoyi.common.utils;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import com.ruoyi.common.constant.Constants;
|
|
||||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字典工具类
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
* @deprecated 3.5.0 版本删除 迁移至 {@link com.ruoyi.common.core.service.DictService}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class DictUtils {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分隔符
|
|
||||||
*/
|
|
||||||
public static final String SEPARATOR = ",";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置字典缓存
|
|
||||||
*
|
|
||||||
* @param key 参数键
|
|
||||||
* @param dictDatas 字典数据列表
|
|
||||||
*/
|
|
||||||
public static void setDictCache(String key, List<SysDictData> dictDatas) {
|
|
||||||
RedisUtils.setCacheObject(getCacheKey(key), dictDatas);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取字典缓存
|
|
||||||
*
|
|
||||||
* @param key 参数键
|
|
||||||
* @return dictDatas 字典数据列表
|
|
||||||
*/
|
|
||||||
public static List<SysDictData> getDictCache(String key) {
|
|
||||||
List<SysDictData> dictDatas = RedisUtils.getCacheObject(getCacheKey(key));
|
|
||||||
if (StringUtils.isNotNull(dictDatas)) {
|
|
||||||
return dictDatas;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据字典类型和字典值获取字典标签
|
|
||||||
*
|
|
||||||
* @param dictType 字典类型
|
|
||||||
* @param dictValue 字典值
|
|
||||||
* @return 字典标签
|
|
||||||
*/
|
|
||||||
public static String getDictLabel(String dictType, String dictValue) {
|
|
||||||
return getDictLabel(dictType, dictValue, SEPARATOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据字典类型和字典标签获取字典值
|
|
||||||
*
|
|
||||||
* @param dictType 字典类型
|
|
||||||
* @param dictLabel 字典标签
|
|
||||||
* @return 字典值
|
|
||||||
*/
|
|
||||||
public static String getDictValue(String dictType, String dictLabel) {
|
|
||||||
return getDictValue(dictType, dictLabel, SEPARATOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据字典类型和字典值获取字典标签
|
|
||||||
*
|
|
||||||
* @param dictType 字典类型
|
|
||||||
* @param dictValue 字典值
|
|
||||||
* @param separator 分隔符
|
|
||||||
* @return 字典标签
|
|
||||||
*/
|
|
||||||
public static String getDictLabel(String dictType, String dictValue, String separator) {
|
|
||||||
StringBuilder propertyString = new StringBuilder();
|
|
||||||
List<SysDictData> datas = getDictCache(dictType);
|
|
||||||
|
|
||||||
if (StringUtils.containsAny(dictValue, separator) && CollUtil.isNotEmpty(datas)) {
|
|
||||||
for (SysDictData dict : datas) {
|
|
||||||
for (String value : dictValue.split(separator)) {
|
|
||||||
if (value.equals(dict.getDictValue())) {
|
|
||||||
propertyString.append(dict.getDictLabel() + separator);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (SysDictData dict : datas) {
|
|
||||||
if (dictValue.equals(dict.getDictValue())) {
|
|
||||||
return dict.getDictLabel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return StringUtils.stripEnd(propertyString.toString(), separator);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据字典类型和字典标签获取字典值
|
|
||||||
*
|
|
||||||
* @param dictType 字典类型
|
|
||||||
* @param dictLabel 字典标签
|
|
||||||
* @param separator 分隔符
|
|
||||||
* @return 字典值
|
|
||||||
*/
|
|
||||||
public static String getDictValue(String dictType, String dictLabel, String separator) {
|
|
||||||
StringBuilder propertyString = new StringBuilder();
|
|
||||||
List<SysDictData> datas = getDictCache(dictType);
|
|
||||||
|
|
||||||
if (StringUtils.containsAny(dictLabel, separator) && CollUtil.isNotEmpty(datas)) {
|
|
||||||
for (SysDictData dict : datas) {
|
|
||||||
for (String label : dictLabel.split(separator)) {
|
|
||||||
if (label.equals(dict.getDictLabel())) {
|
|
||||||
propertyString.append(dict.getDictValue() + separator);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (SysDictData dict : datas) {
|
|
||||||
if (dictLabel.equals(dict.getDictLabel())) {
|
|
||||||
return dict.getDictValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return StringUtils.stripEnd(propertyString.toString(), separator);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除指定字典缓存
|
|
||||||
*
|
|
||||||
* @param key 字典键
|
|
||||||
*/
|
|
||||||
public static void removeDictCache(String key) {
|
|
||||||
RedisUtils.deleteObject(getCacheKey(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 清空字典缓存
|
|
||||||
*/
|
|
||||||
public static void clearDictCache() {
|
|
||||||
Collection<String> keys = RedisUtils.keys(Constants.SYS_DICT_KEY + "*");
|
|
||||||
RedisUtils.deleteObject(keys);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置cache key
|
|
||||||
*
|
|
||||||
* @param configKey 参数键
|
|
||||||
* @return 缓存键key
|
|
||||||
*/
|
|
||||||
public static String getCacheKey(String configKey) {
|
|
||||||
return Constants.SYS_DICT_KEY + configKey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -21,14 +21,18 @@ import java.util.Map;
|
|||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class JsonUtils {
|
public class JsonUtils {
|
||||||
|
|
||||||
private static ObjectMapper objectMapper = SpringUtils.getBean(ObjectMapper.class);
|
private static final ObjectMapper OBJECT_MAPPER = SpringUtils.getBean(ObjectMapper.class);
|
||||||
|
|
||||||
|
public static ObjectMapper getObjectMapper() {
|
||||||
|
return OBJECT_MAPPER;
|
||||||
|
}
|
||||||
|
|
||||||
public static String toJsonString(Object object) {
|
public static String toJsonString(Object object) {
|
||||||
if (StringUtils.isNull(object)) {
|
if (StringUtils.isNull(object)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return objectMapper.writeValueAsString(object);
|
return OBJECT_MAPPER.writeValueAsString(object);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@ -39,7 +43,7 @@ public class JsonUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return objectMapper.readValue(text, clazz);
|
return OBJECT_MAPPER.readValue(text, clazz);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@ -50,7 +54,7 @@ public class JsonUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return objectMapper.readValue(bytes, clazz);
|
return OBJECT_MAPPER.readValue(bytes, clazz);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@ -61,7 +65,7 @@ public class JsonUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return objectMapper.readValue(text, typeReference);
|
return OBJECT_MAPPER.readValue(text, typeReference);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@ -72,7 +76,7 @@ public class JsonUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return objectMapper.readValue(text, new TypeReference<Map<String, T>>() {
|
return OBJECT_MAPPER.readValue(text, new TypeReference<Map<String, T>>() {
|
||||||
});
|
});
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@ -84,7 +88,7 @@ public class JsonUtils {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return objectMapper.readValue(text, objectMapper.getTypeFactory().constructCollectionType(List.class, clazz));
|
return OBJECT_MAPPER.readValue(text, OBJECT_MAPPER.getTypeFactory().constructCollectionType(List.class, clazz));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,21 @@
|
|||||||
package com.ruoyi.common.utils;
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取i18n资源文件
|
* 获取i18n资源文件
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class MessageUtils {
|
public class MessageUtils {
|
||||||
|
|
||||||
|
private static final MessageSource MESSAGE_SOURCE = SpringUtils.getBean(MessageSource.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据消息键和参数 获取消息 委托给spring messageSource
|
* 根据消息键和参数 获取消息 委托给spring messageSource
|
||||||
*
|
*
|
||||||
@ -18,7 +24,6 @@ public class MessageUtils {
|
|||||||
* @return 获取国际化翻译值
|
* @return 获取国际化翻译值
|
||||||
*/
|
*/
|
||||||
public static String message(String code, Object... args) {
|
public static String message(String code, Object... args) {
|
||||||
MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
|
return MESSAGE_SOURCE.getMessage(code, args, LocaleContextHolder.getLocale());
|
||||||
return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,8 @@ import com.ruoyi.common.core.domain.PageQuery;
|
|||||||
import com.ruoyi.common.core.page.PagePlus;
|
import com.ruoyi.common.core.page.PagePlus;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.sql.SqlUtil;
|
import com.ruoyi.common.utils.sql.SqlUtil;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -16,6 +18,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class PageUtils {
|
public class PageUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.common.utils;
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import cn.hutool.core.collection.IterUtil;
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@ -23,7 +23,7 @@ import java.util.function.Consumer;
|
|||||||
@SuppressWarnings(value = {"unchecked", "rawtypes"})
|
@SuppressWarnings(value = {"unchecked", "rawtypes"})
|
||||||
public class RedisUtils {
|
public class RedisUtils {
|
||||||
|
|
||||||
private static RedissonClient client = SpringUtils.getBean(RedissonClient.class);
|
private static final RedissonClient CLIENT = SpringUtils.getBean(RedissonClient.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 限流
|
* 限流
|
||||||
@ -35,7 +35,7 @@ public class RedisUtils {
|
|||||||
* @return -1 表示失败
|
* @return -1 表示失败
|
||||||
*/
|
*/
|
||||||
public static long rateLimiter(String key, RateType rateType, int rate, int rateInterval) {
|
public static long rateLimiter(String key, RateType rateType, int rate, int rateInterval) {
|
||||||
RRateLimiter rateLimiter = client.getRateLimiter(key);
|
RRateLimiter rateLimiter = CLIENT.getRateLimiter(key);
|
||||||
rateLimiter.trySetRate(rateType, rate, rateInterval, RateIntervalUnit.SECONDS);
|
rateLimiter.trySetRate(rateType, rate, rateInterval, RateIntervalUnit.SECONDS);
|
||||||
if (rateLimiter.tryAcquire()) {
|
if (rateLimiter.tryAcquire()) {
|
||||||
return rateLimiter.availablePermits();
|
return rateLimiter.availablePermits();
|
||||||
@ -45,10 +45,10 @@ public class RedisUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取实例id
|
* 获取客户端实例
|
||||||
*/
|
*/
|
||||||
public static String getClientId() {
|
public static RedissonClient getClient() {
|
||||||
return client.getId();
|
return CLIENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,13 +59,13 @@ public class RedisUtils {
|
|||||||
* @param consumer 自定义处理
|
* @param consumer 自定义处理
|
||||||
*/
|
*/
|
||||||
public static <T> void publish(String channelKey, T msg, Consumer<T> consumer) {
|
public static <T> void publish(String channelKey, T msg, Consumer<T> consumer) {
|
||||||
RTopic topic = client.getTopic(channelKey);
|
RTopic topic = CLIENT.getTopic(channelKey);
|
||||||
topic.publish(msg);
|
topic.publish(msg);
|
||||||
consumer.accept(msg);
|
consumer.accept(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void publish(String channelKey, T msg) {
|
public static <T> void publish(String channelKey, T msg) {
|
||||||
RTopic topic = client.getTopic(channelKey);
|
RTopic topic = CLIENT.getTopic(channelKey);
|
||||||
topic.publish(msg);
|
topic.publish(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ public class RedisUtils {
|
|||||||
* @param consumer 自定义处理
|
* @param consumer 自定义处理
|
||||||
*/
|
*/
|
||||||
public static <T> void subscribe(String channelKey, Class<T> clazz, Consumer<T> consumer) {
|
public static <T> void subscribe(String channelKey, Class<T> clazz, Consumer<T> consumer) {
|
||||||
RTopic topic = client.getTopic(channelKey);
|
RTopic topic = CLIENT.getTopic(channelKey);
|
||||||
topic.addListener(clazz, (channel, msg) -> consumer.accept(msg));
|
topic.addListener(clazz, (channel, msg) -> consumer.accept(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,13 +94,13 @@ public class RedisUtils {
|
|||||||
/**
|
/**
|
||||||
* 缓存基本的对象,保留当前对象 TTL 有效期
|
* 缓存基本的对象,保留当前对象 TTL 有效期
|
||||||
*
|
*
|
||||||
* @param key 缓存的键值
|
* @param key 缓存的键值
|
||||||
* @param value 缓存的值
|
* @param value 缓存的值
|
||||||
* @param isSaveTtl 是否保留TTL有效期(例如: set之前ttl剩余90 set之后还是为90)
|
* @param isSaveTtl 是否保留TTL有效期(例如: set之前ttl剩余90 set之后还是为90)
|
||||||
* @since Redis 6.X 以上使用 setAndKeepTTL 兼容 5.X 方案
|
* @since Redis 6.X 以上使用 setAndKeepTTL 兼容 5.X 方案
|
||||||
*/
|
*/
|
||||||
public static <T> void setCacheObject(final String key, final T value, final boolean isSaveTtl) {
|
public static <T> void setCacheObject(final String key, final T value, final boolean isSaveTtl) {
|
||||||
RBucket<Object> bucket = client.getBucket(key);
|
RBucket<Object> bucket = CLIENT.getBucket(key);
|
||||||
if (isSaveTtl) {
|
if (isSaveTtl) {
|
||||||
try {
|
try {
|
||||||
bucket.setAndKeepTTL(value);
|
bucket.setAndKeepTTL(value);
|
||||||
@ -123,11 +123,24 @@ public class RedisUtils {
|
|||||||
* @param timeUnit 时间颗粒度
|
* @param timeUnit 时间颗粒度
|
||||||
*/
|
*/
|
||||||
public static <T> void setCacheObject(final String key, final T value, final long timeout, final TimeUnit timeUnit) {
|
public static <T> void setCacheObject(final String key, final T value, final long timeout, final TimeUnit timeUnit) {
|
||||||
RBucket<T> result = client.getBucket(key);
|
RBucket<T> result = CLIENT.getBucket(key);
|
||||||
result.set(value);
|
result.set(value);
|
||||||
result.expire(timeout, timeUnit);
|
result.expire(timeout, timeUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册对象监听器
|
||||||
|
*
|
||||||
|
* key 监听器需开启 `notify-keyspace-events` 等 redis 相关配置
|
||||||
|
*
|
||||||
|
* @param key 缓存的键值
|
||||||
|
* @param listener 监听器配置
|
||||||
|
*/
|
||||||
|
public static <T> void addObjectListener(final String key, final ObjectListener listener) {
|
||||||
|
RBucket<T> result = CLIENT.getBucket(key);
|
||||||
|
result.addListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置有效时间
|
* 设置有效时间
|
||||||
*
|
*
|
||||||
@ -148,7 +161,7 @@ public class RedisUtils {
|
|||||||
* @return true=设置成功;false=设置失败
|
* @return true=设置成功;false=设置失败
|
||||||
*/
|
*/
|
||||||
public static boolean expire(final String key, final long timeout, final TimeUnit unit) {
|
public static boolean expire(final String key, final long timeout, final TimeUnit unit) {
|
||||||
RBucket rBucket = client.getBucket(key);
|
RBucket rBucket = CLIENT.getBucket(key);
|
||||||
return rBucket.expire(timeout, unit);
|
return rBucket.expire(timeout, unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +172,7 @@ public class RedisUtils {
|
|||||||
* @return 缓存键值对应的数据
|
* @return 缓存键值对应的数据
|
||||||
*/
|
*/
|
||||||
public static <T> T getCacheObject(final String key) {
|
public static <T> T getCacheObject(final String key) {
|
||||||
RBucket<T> rBucket = client.getBucket(key);
|
RBucket<T> rBucket = CLIENT.getBucket(key);
|
||||||
return rBucket.get();
|
return rBucket.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,29 +183,26 @@ public class RedisUtils {
|
|||||||
* @return 剩余存活时间
|
* @return 剩余存活时间
|
||||||
*/
|
*/
|
||||||
public static <T> long getTimeToLive(final String key) {
|
public static <T> long getTimeToLive(final String key) {
|
||||||
RBucket<T> rBucket = client.getBucket(key);
|
RBucket<T> rBucket = CLIENT.getBucket(key);
|
||||||
return rBucket.remainTimeToLive();
|
return rBucket.remainTimeToLive();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除单个对象
|
* 删除单个对象
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key 缓存的键值
|
||||||
*/
|
*/
|
||||||
public static boolean deleteObject(final String key) {
|
public static boolean deleteObject(final String key) {
|
||||||
return client.getBucket(key).delete();
|
return CLIENT.getBucket(key).delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除集合对象
|
* 删除集合对象
|
||||||
*
|
*
|
||||||
* @param collection 多个对象
|
* @param collection 多个对象
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static void deleteObject(final Collection collection) {
|
public static void deleteObject(final Collection collection) {
|
||||||
RBatch batch = client.createBatch();
|
RBatch batch = CLIENT.createBatch();
|
||||||
collection.forEach(t -> {
|
collection.forEach(t -> {
|
||||||
batch.getBucket(t.toString()).deleteAsync();
|
batch.getBucket(t.toString()).deleteAsync();
|
||||||
});
|
});
|
||||||
@ -207,10 +217,23 @@ public class RedisUtils {
|
|||||||
* @return 缓存的对象
|
* @return 缓存的对象
|
||||||
*/
|
*/
|
||||||
public static <T> boolean setCacheList(final String key, final List<T> dataList) {
|
public static <T> boolean setCacheList(final String key, final List<T> dataList) {
|
||||||
RList<T> rList = client.getList(key);
|
RList<T> rList = CLIENT.getList(key);
|
||||||
return rList.addAll(dataList);
|
return rList.addAll(dataList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册List监听器
|
||||||
|
*
|
||||||
|
* key 监听器需开启 `notify-keyspace-events` 等 redis 相关配置
|
||||||
|
*
|
||||||
|
* @param key 缓存的键值
|
||||||
|
* @param listener 监听器配置
|
||||||
|
*/
|
||||||
|
public static <T> void addListListener(final String key, final ObjectListener listener) {
|
||||||
|
RList<T> rList = CLIENT.getList(key);
|
||||||
|
rList.addListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得缓存的list对象
|
* 获得缓存的list对象
|
||||||
*
|
*
|
||||||
@ -218,7 +241,7 @@ public class RedisUtils {
|
|||||||
* @return 缓存键值对应的数据
|
* @return 缓存键值对应的数据
|
||||||
*/
|
*/
|
||||||
public static <T> List<T> getCacheList(final String key) {
|
public static <T> List<T> getCacheList(final String key) {
|
||||||
RList<T> rList = client.getList(key);
|
RList<T> rList = CLIENT.getList(key);
|
||||||
return rList.readAll();
|
return rList.readAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,42 +253,68 @@ public class RedisUtils {
|
|||||||
* @return 缓存数据的对象
|
* @return 缓存数据的对象
|
||||||
*/
|
*/
|
||||||
public static <T> boolean setCacheSet(final String key, final Set<T> dataSet) {
|
public static <T> boolean setCacheSet(final String key, final Set<T> dataSet) {
|
||||||
RSet<T> rSet = client.getSet(key);
|
RSet<T> rSet = CLIENT.getSet(key);
|
||||||
return rSet.addAll(dataSet);
|
return rSet.addAll(dataSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册Set监听器
|
||||||
|
*
|
||||||
|
* key 监听器需开启 `notify-keyspace-events` 等 redis 相关配置
|
||||||
|
*
|
||||||
|
* @param key 缓存的键值
|
||||||
|
* @param listener 监听器配置
|
||||||
|
*/
|
||||||
|
public static <T> void addSetListener(final String key, final ObjectListener listener) {
|
||||||
|
RSet<T> rSet = CLIENT.getSet(key);
|
||||||
|
rSet.addListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得缓存的set
|
* 获得缓存的set
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key 缓存的key
|
||||||
* @return
|
* @return set对象
|
||||||
*/
|
*/
|
||||||
public static <T> Set<T> getCacheSet(final String key) {
|
public static <T> Set<T> getCacheSet(final String key) {
|
||||||
RSet<T> rSet = client.getSet(key);
|
RSet<T> rSet = CLIENT.getSet(key);
|
||||||
return rSet.readAll();
|
return rSet.readAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存Map
|
* 缓存Map
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key 缓存的键值
|
||||||
* @param dataMap
|
* @param dataMap 缓存的数据
|
||||||
*/
|
*/
|
||||||
public static <T> void setCacheMap(final String key, final Map<String, T> dataMap) {
|
public static <T> void setCacheMap(final String key, final Map<String, T> dataMap) {
|
||||||
if (dataMap != null) {
|
if (dataMap != null) {
|
||||||
RMap<String, T> rMap = client.getMap(key);
|
RMap<String, T> rMap = CLIENT.getMap(key);
|
||||||
rMap.putAll(dataMap);
|
rMap.putAll(dataMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册Map监听器
|
||||||
|
*
|
||||||
|
* key 监听器需开启 `notify-keyspace-events` 等 redis 相关配置
|
||||||
|
*
|
||||||
|
* @param key 缓存的键值
|
||||||
|
* @param listener 监听器配置
|
||||||
|
*/
|
||||||
|
public static <T> void addMapListener(final String key, final ObjectListener listener) {
|
||||||
|
RMap<String, T> rMap = CLIENT.getMap(key);
|
||||||
|
rMap.addListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得缓存的Map
|
* 获得缓存的Map
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key 缓存的键值
|
||||||
* @return
|
* @return map对象
|
||||||
*/
|
*/
|
||||||
public static <T> Map<String, T> getCacheMap(final String key) {
|
public static <T> Map<String, T> getCacheMap(final String key) {
|
||||||
RMap<String, T> rMap = client.getMap(key);
|
RMap<String, T> rMap = CLIENT.getMap(key);
|
||||||
return rMap.getAll(rMap.keySet());
|
return rMap.getAll(rMap.keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +326,7 @@ public class RedisUtils {
|
|||||||
* @param value 值
|
* @param value 值
|
||||||
*/
|
*/
|
||||||
public static <T> void setCacheMapValue(final String key, final String hKey, final T value) {
|
public static <T> void setCacheMapValue(final String key, final String hKey, final T value) {
|
||||||
RMap<String, T> rMap = client.getMap(key);
|
RMap<String, T> rMap = CLIENT.getMap(key);
|
||||||
rMap.put(hKey, value);
|
rMap.put(hKey, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +338,7 @@ public class RedisUtils {
|
|||||||
* @return Hash中的对象
|
* @return Hash中的对象
|
||||||
*/
|
*/
|
||||||
public static <T> T getCacheMapValue(final String key, final String hKey) {
|
public static <T> T getCacheMapValue(final String key, final String hKey) {
|
||||||
RMap<String, T> rMap = client.getMap(key);
|
RMap<String, T> rMap = CLIENT.getMap(key);
|
||||||
return rMap.get(hKey);
|
return rMap.get(hKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +350,7 @@ public class RedisUtils {
|
|||||||
* @return Hash中的对象
|
* @return Hash中的对象
|
||||||
*/
|
*/
|
||||||
public static <T> T delCacheMapValue(final String key, final String hKey) {
|
public static <T> T delCacheMapValue(final String key, final String hKey) {
|
||||||
RMap<String, T> rMap = client.getMap(key);
|
RMap<String, T> rMap = CLIENT.getMap(key);
|
||||||
return rMap.remove(hKey);
|
return rMap.remove(hKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +362,7 @@ public class RedisUtils {
|
|||||||
* @return Hash对象集合
|
* @return Hash对象集合
|
||||||
*/
|
*/
|
||||||
public static <K, V> Map<K, V> getMultiCacheMapValue(final String key, final Set<K> hKeys) {
|
public static <K, V> Map<K, V> getMultiCacheMapValue(final String key, final Set<K> hKeys) {
|
||||||
RMap<K, V> rMap = client.getMap(key);
|
RMap<K, V> rMap = CLIENT.getMap(key);
|
||||||
return rMap.getAll(hKeys);
|
return rMap.getAll(hKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,7 +373,7 @@ public class RedisUtils {
|
|||||||
* @return 对象列表
|
* @return 对象列表
|
||||||
*/
|
*/
|
||||||
public static Collection<String> keys(final String pattern) {
|
public static Collection<String> keys(final String pattern) {
|
||||||
Iterable<String> iterable = client.getKeys().getKeysByPattern(pattern);
|
Iterable<String> iterable = CLIENT.getKeys().getKeysByPattern(pattern);
|
||||||
return Lists.newArrayList(iterable);
|
return IterUtil.toList(iterable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,8 @@ package com.ruoyi.common.utils;
|
|||||||
import cn.hutool.http.HttpStatus;
|
import cn.hutool.http.HttpStatus;
|
||||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
@ -12,6 +14,7 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class SecurityUtils {
|
public class SecurityUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -3,6 +3,8 @@ package com.ruoyi.common.utils;
|
|||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.extra.servlet.ServletUtil;
|
import cn.hutool.extra.servlet.ServletUtil;
|
||||||
import cn.hutool.http.HttpStatus;
|
import cn.hutool.http.HttpStatus;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.context.request.RequestAttributes;
|
import org.springframework.web.context.request.RequestAttributes;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
@ -19,6 +21,7 @@ import java.nio.charset.StandardCharsets;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class ServletUtils extends ServletUtil {
|
public class ServletUtils extends ServletUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -7,6 +7,8 @@ import cn.hutool.core.util.ArrayUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.ReUtil;
|
import cn.hutool.core.util.ReUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@ -15,6 +17,7 @@ import java.util.*;
|
|||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
package com.ruoyi.common.utils;
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import lombok.AccessLevel;
|
||||||
import org.slf4j.LoggerFactory;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
|
|
||||||
@ -10,8 +11,9 @@ import java.util.concurrent.*;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class Threads {
|
public class Threads {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(Threads.class);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sleep等待,单位为毫秒
|
* sleep等待,单位为毫秒
|
||||||
@ -38,7 +40,7 @@ public class Threads {
|
|||||||
if (!pool.awaitTermination(120, TimeUnit.SECONDS)) {
|
if (!pool.awaitTermination(120, TimeUnit.SECONDS)) {
|
||||||
pool.shutdownNow();
|
pool.shutdownNow();
|
||||||
if (!pool.awaitTermination(120, TimeUnit.SECONDS)) {
|
if (!pool.awaitTermination(120, TimeUnit.SECONDS)) {
|
||||||
logger.info("Pool did not terminate");
|
log.info("Pool did not terminate");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
@ -67,7 +69,7 @@ public class Threads {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
logger.error(t.getMessage(), t);
|
log.error(t.getMessage(), t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,8 @@ import cn.hutool.core.lang.tree.Tree;
|
|||||||
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
||||||
import cn.hutool.core.lang.tree.TreeUtil;
|
import cn.hutool.core.lang.tree.TreeUtil;
|
||||||
import cn.hutool.core.lang.tree.parser.NodeParser;
|
import cn.hutool.core.lang.tree.parser.NodeParser;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -12,6 +14,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class TreeBuildUtils extends TreeUtil {
|
public class TreeBuildUtils extends TreeUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
package com.ruoyi.common.utils;
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import javax.validation.ConstraintViolation;
|
import javax.validation.ConstraintViolation;
|
||||||
import javax.validation.ConstraintViolationException;
|
import javax.validation.ConstraintViolationException;
|
||||||
import javax.validation.Validation;
|
import javax.validation.Validation;
|
||||||
@ -11,6 +14,7 @@ import java.util.Set;
|
|||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class ValidatorUtils {
|
public class ValidatorUtils {
|
||||||
|
|
||||||
private static final Validator VALID = Validation.buildDefaultValidatorFactory().getValidator();
|
private static final Validator VALID = Validation.buildDefaultValidatorFactory().getValidator();
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package com.ruoyi.common.utils.file;
|
package com.ruoyi.common.utils.file;
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
@ -12,6 +14,7 @@ import java.nio.charset.StandardCharsets;
|
|||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class FileUtils extends FileUtil {
|
public class FileUtils extends FileUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -7,6 +7,8 @@ import com.ruoyi.common.config.RuoYiConfig;
|
|||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
import com.ruoyi.common.utils.JsonUtils;
|
import com.ruoyi.common.utils.JsonUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -17,6 +19,7 @@ import java.util.Map;
|
|||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class AddressUtils {
|
public class AddressUtils {
|
||||||
|
|
||||||
// IP地址查询
|
// IP地址查询
|
||||||
|
|||||||
@ -9,6 +9,8 @@ import com.ruoyi.common.excel.ExcelListener;
|
|||||||
import com.ruoyi.common.excel.ExcelResult;
|
import com.ruoyi.common.excel.ExcelResult;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.file.FileUtils;
|
import com.ruoyi.common.utils.file.FileUtils;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -21,6 +23,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class ExcelUtil {
|
public class ExcelUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -2,6 +2,8 @@ package com.ruoyi.common.utils.reflect;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ReflectUtil;
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
@ -11,6 +13,7 @@ import java.lang.reflect.Method;
|
|||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class ReflectUtils extends ReflectUtil {
|
public class ReflectUtils extends ReflectUtil {
|
||||||
|
|
||||||
private static final String SETTER_PREFIX = "set";
|
private static final String SETTER_PREFIX = "set";
|
||||||
|
|||||||
@ -2,17 +2,20 @@ package com.ruoyi.common.utils.sql;
|
|||||||
|
|
||||||
import com.ruoyi.common.exception.UtilException;
|
import com.ruoyi.common.exception.UtilException;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sql操作工具类
|
* sql操作工具类
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class SqlUtil {
|
public class SqlUtil {
|
||||||
/**
|
/**
|
||||||
* 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序)
|
* 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序)
|
||||||
*/
|
*/
|
||||||
public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+";
|
public static final String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查字符,防止注入绕过
|
* 检查字符,防止注入绕过
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package com.ruoyi.monitor.admin.config;
|
|||||||
|
|
||||||
import de.codecentric.boot.admin.server.config.AdminServerProperties;
|
import de.codecentric.boot.admin.server.config.AdminServerProperties;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||||
@ -15,7 +14,6 @@ import org.springframework.security.web.authentication.SavedRequestAwareAuthenti
|
|||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true, proxyTargetClass = true)
|
|
||||||
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
private final String adminContextPath;
|
private final String adminContextPath;
|
||||||
@ -34,8 +32,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
//授予对所有静态资产和登录页面的公共访问权限。
|
//授予对所有静态资产和登录页面的公共访问权限。
|
||||||
.antMatchers(adminContextPath + "/assets/**").permitAll()
|
.antMatchers(adminContextPath + "/assets/**").permitAll()
|
||||||
.antMatchers(adminContextPath + "/login").permitAll()
|
.antMatchers(adminContextPath + "/login").permitAll()
|
||||||
.antMatchers("/actuator").anonymous()
|
.antMatchers("/actuator").permitAll()
|
||||||
.antMatchers("/actuator/**").anonymous()
|
.antMatchers("/actuator/**").permitAll()
|
||||||
//必须对每个其他请求进行身份验证
|
//必须对每个其他请求进行身份验证
|
||||||
.anyRequest().authenticated().and()
|
.anyRequest().authenticated().and()
|
||||||
//配置登录和注销
|
//配置登录和注销
|
||||||
|
|||||||
@ -63,6 +63,11 @@
|
|||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.yomahub</groupId>
|
||||||
|
<artifactId>tlog-web-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -35,14 +35,14 @@ public class PlusWebInvokeTimeInterceptor extends AbsTLogWebHandlerMethodInterce
|
|||||||
// 打印请求参数
|
// 打印请求参数
|
||||||
if (isJsonRequest(request)) {
|
if (isJsonRequest(request)) {
|
||||||
String jsonParam = new RequestWrapper(request).getBodyString();
|
String jsonParam = new RequestWrapper(request).getBodyString();
|
||||||
log.info("[PLUS]开始请求 => URL[{}],参数类型[json],参数:[{}]", url, jsonParam);
|
log.debug("[PLUS]开始请求 => URL[{}],参数类型[json],参数:[{}]", url, jsonParam);
|
||||||
} else {
|
} else {
|
||||||
Map<String, String[]> parameterMap = request.getParameterMap();
|
Map<String, String[]> parameterMap = request.getParameterMap();
|
||||||
if (MapUtil.isNotEmpty(parameterMap)) {
|
if (MapUtil.isNotEmpty(parameterMap)) {
|
||||||
String parameters = JsonUtils.toJsonString(parameterMap);
|
String parameters = JsonUtils.toJsonString(parameterMap);
|
||||||
log.info("[PLUS]开始请求 => URL[{}],参数类型[param],参数:[{}]", url, parameters);
|
log.debug("[PLUS]开始请求 => URL[{}],参数类型[param],参数:[{}]", url, parameters);
|
||||||
} else {
|
} else {
|
||||||
log.info("[PLUS]开始请求 => URL[{}],无参数", url);
|
log.debug("[PLUS]开始请求 => URL[{}],无参数", url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ public class PlusWebInvokeTimeInterceptor extends AbsTLogWebHandlerMethodInterce
|
|||||||
if (TLogContext.enableInvokeTimePrint()) {
|
if (TLogContext.enableInvokeTimePrint()) {
|
||||||
StopWatch stopWatch = invokeTimeTL.get();
|
StopWatch stopWatch = invokeTimeTL.get();
|
||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
log.info("[PLUS]结束请求 => URL[{}],耗时:[{}]毫秒", request.getMethod() + " " + request.getRequestURI(), stopWatch.getTime());
|
log.debug("[PLUS]结束请求 => URL[{}],耗时:[{}]毫秒", request.getMethod() + " " + request.getRequestURI(), stopWatch.getTime());
|
||||||
invokeTimeTL.remove();
|
invokeTimeTL.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,15 +8,12 @@ import com.ruoyi.common.core.domain.model.LoginUser;
|
|||||||
import com.ruoyi.common.core.service.UserService;
|
import com.ruoyi.common.core.service.UserService;
|
||||||
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.reflect.ReflectUtils;
|
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Before;
|
import org.aspectj.lang.annotation.Before;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据过滤处理
|
* 数据过滤处理
|
||||||
*
|
*
|
||||||
@ -137,9 +134,6 @@ public class DataScopeAspect {
|
|||||||
if (params instanceof BaseEntity) {
|
if (params instanceof BaseEntity) {
|
||||||
BaseEntity baseEntity = (BaseEntity) params;
|
BaseEntity baseEntity = (BaseEntity) params;
|
||||||
baseEntity.getParams().put(DATA_SCOPE, sql);
|
baseEntity.getParams().put(DATA_SCOPE, sql);
|
||||||
} else {
|
|
||||||
Map<String, Object> invoke = ReflectUtils.invokeGetter(params, "params");
|
|
||||||
invoke.put(DATA_SCOPE, sql);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ public class RateLimiterAspect {
|
|||||||
stringBuffer.append(ServletUtils.getClientIP()).append("-");
|
stringBuffer.append(ServletUtils.getClientIP()).append("-");
|
||||||
} else if (rateLimiter.limitType() == LimitType.CLUSTER){
|
} else if (rateLimiter.limitType() == LimitType.CLUSTER){
|
||||||
// 获取客户端实例id
|
// 获取客户端实例id
|
||||||
stringBuffer.append(RedisUtils.getClientId()).append("-");
|
stringBuffer.append(RedisUtils.getClient().getId()).append("-");
|
||||||
}
|
}
|
||||||
MethodSignature signature = (MethodSignature) point.getSignature();
|
MethodSignature signature = (MethodSignature) point.getSignature();
|
||||||
Method method = signature.getMethod();
|
Method method = signature.getMethod();
|
||||||
|
|||||||
@ -1,13 +1,8 @@
|
|||||||
package com.ruoyi.framework.config;
|
package com.ruoyi.framework.config;
|
||||||
|
|
||||||
import com.yomahub.tlog.core.aop.AspectLogAop;
|
import com.yomahub.tlog.springboot.TLogWebAutoConfiguration;
|
||||||
import com.yomahub.tlog.spring.TLogPropertyInit;
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
import com.yomahub.tlog.spring.TLogSpringAware;
|
|
||||||
import com.yomahub.tlog.springboot.property.TLogProperty;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
|
||||||
import org.springframework.core.annotation.Order;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 整合 TLog 框架配置
|
* 整合 TLog 框架配置
|
||||||
@ -15,29 +10,9 @@ import org.springframework.core.annotation.Order;
|
|||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @since 3.3.0
|
* @since 3.3.0
|
||||||
*/
|
*/
|
||||||
@Order(-999)
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Import(TLogProperty.class)
|
// 排除 web 自动配置 自定义实现
|
||||||
|
@EnableAutoConfiguration(exclude = TLogWebAutoConfiguration.class)
|
||||||
public class TLogConfig {
|
public class TLogConfig {
|
||||||
|
|
||||||
@Bean
|
|
||||||
public TLogPropertyInit tLogPropertyInit(TLogProperty tLogProperty) {
|
|
||||||
TLogPropertyInit tLogPropertyInit = new TLogPropertyInit();
|
|
||||||
tLogPropertyInit.setPattern(tLogProperty.getPattern());
|
|
||||||
tLogPropertyInit.setEnableInvokeTimePrint(tLogProperty.enableInvokeTimePrint());
|
|
||||||
tLogPropertyInit.setIdGenerator(tLogProperty.getIdGenerator());
|
|
||||||
tLogPropertyInit.setMdcEnable(tLogProperty.getMdcEnable());
|
|
||||||
return tLogPropertyInit;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public TLogSpringAware tLogSpringAware(){
|
|
||||||
return new TLogSpringAware();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public AspectLogAop aspectLogAop() {
|
|
||||||
return new AspectLogAop();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.yomahub</groupId>
|
<groupId>com.yomahub</groupId>
|
||||||
<artifactId>tlog-xxl-job</artifactId>
|
<artifactId>tlog-xxljob-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package com.ruoyi.job.config;
|
|||||||
|
|
||||||
import com.ruoyi.job.config.properties.XxlJobProperties;
|
import com.ruoyi.job.config.properties.XxlJobProperties;
|
||||||
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
||||||
import com.yomahub.tlog.springboot.lifecircle.TLogXxljobEnhanceInit;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
@ -40,9 +39,4 @@ public class XxlJobConfig {
|
|||||||
return xxlJobSpringExecutor;
|
return xxlJobSpringExecutor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
}
|
||||||
public TLogXxljobEnhanceInit tLogXxljobEnhanceInit(){
|
|
||||||
return new TLogXxljobEnhanceInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.text.StrJoiner;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.text.StrPool;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -31,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户 业务层处理
|
* 用户 业务层处理
|
||||||
@ -129,8 +129,10 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
|
|||||||
@Override
|
@Override
|
||||||
public String selectUserRoleGroup(String userName) {
|
public String selectUserRoleGroup(String userName) {
|
||||||
List<SysRole> list = roleMapper.selectRolesByUserName(userName);
|
List<SysRole> list = roleMapper.selectRolesByUserName(userName);
|
||||||
String idsStr = StrJoiner.of(StrPool.COMMA).append(list, (role) -> { return role.getRoleName(); }).toString();
|
if (CollUtil.isEmpty(list)) {
|
||||||
return idsStr;
|
return StringUtils.EMPTY;
|
||||||
|
}
|
||||||
|
return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(","));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,8 +144,10 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
|
|||||||
@Override
|
@Override
|
||||||
public String selectUserPostGroup(String userName) {
|
public String selectUserPostGroup(String userName) {
|
||||||
List<SysPost> list = postMapper.selectPostsByUserName(userName);
|
List<SysPost> list = postMapper.selectPostsByUserName(userName);
|
||||||
String idsStr = StrJoiner.of(StrPool.COMMA).append(list, (post) -> { return post.getPostName(); }).toString();
|
if (CollUtil.isEmpty(list)) {
|
||||||
return idsStr;
|
return StringUtils.EMPTY;
|
||||||
|
}
|
||||||
|
return list.stream().map(SysPost::getPostName).collect(Collectors.joining(","));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -27,33 +27,13 @@
|
|||||||
<result property="remark" column="remark"/>
|
<result property="remark" column="remark"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectMenuVo">
|
|
||||||
select menu_id,
|
|
||||||
menu_name,
|
|
||||||
parent_id,
|
|
||||||
order_num,
|
|
||||||
path,
|
|
||||||
component,
|
|
||||||
query,
|
|
||||||
is_frame,
|
|
||||||
is_cache,
|
|
||||||
menu_type,
|
|
||||||
visible,
|
|
||||||
status,
|
|
||||||
ifnull(perms, '') as perms,
|
|
||||||
icon,
|
|
||||||
create_time
|
|
||||||
from sys_menu
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
|
|
||||||
<select id="selectMenuTreeAll" resultMap="SysMenuResult">
|
<select id="selectMenuTreeAll" resultMap="SysMenuResult">
|
||||||
select distinct m.menu_id,
|
select distinct m.menu_id,
|
||||||
m.parent_id,
|
m.parent_id,
|
||||||
m.menu_name,
|
m.menu_name,
|
||||||
m.path,
|
m.path,
|
||||||
m.component,
|
m.component,
|
||||||
m.query,
|
m.`query`,
|
||||||
m.visible,
|
m.visible,
|
||||||
m.status,
|
m.status,
|
||||||
ifnull(m.perms, '') as perms,
|
ifnull(m.perms, '') as perms,
|
||||||
@ -70,7 +50,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult">
|
<select id="selectMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult">
|
||||||
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.query, m.visible, m.status,
|
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status,
|
||||||
ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
|
ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
|
||||||
from sys_menu m
|
from sys_menu m
|
||||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||||
@ -95,7 +75,7 @@
|
|||||||
m.menu_name,
|
m.menu_name,
|
||||||
m.path,
|
m.path,
|
||||||
m.component,
|
m.component,
|
||||||
m.query,
|
m.`query`,
|
||||||
m.visible,
|
m.visible,
|
||||||
m.status,
|
m.status,
|
||||||
ifnull(m.perms, '') as perms,
|
ifnull(m.perms, '') as perms,
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
# redis 密码
|
# redis 密码
|
||||||
# requirepass ruoyi123
|
# requirepass ruoyi123
|
||||||
|
|
||||||
|
# key 监听器配置
|
||||||
|
# notify-keyspace-events Ex
|
||||||
|
|
||||||
# 配置持久化文件存储路径
|
# 配置持久化文件存储路径
|
||||||
dir /redis/data
|
dir /redis/data
|
||||||
# 配置rdb
|
# 配置rdb
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user