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
This commit is contained in:
commit
07947ab8f8
@ -8,6 +8,7 @@
|
|||||||
[]()
|
[]()
|
||||||
[]()
|
[]()
|
||||||
[]()
|
[]()
|
||||||
|
[]()
|
||||||
|
|
||||||
> RuoYi-Vue-Plus 是基于 RuoYi-Vue 针对 `分布式集群` 场景升级(不兼容原框架)
|
> RuoYi-Vue-Plus 是基于 RuoYi-Vue 针对 `分布式集群` 场景升级(不兼容原框架)
|
||||||
|
|
||||||
@ -18,6 +19,7 @@
|
|||||||
| 当前框架 | RuoYi-Vue-Plus | [RuoYi-Vue-Plus文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) | 重写RuoYi-Vue全方位升级(不兼容原框架) |
|
| 当前框架 | RuoYi-Vue-Plus | [RuoYi-Vue-Plus文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) | 重写RuoYi-Vue全方位升级(不兼容原框架) |
|
||||||
| satoken分支 | RuoYi-Vue-Plus-satoken | [satoken分支地址](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/satoken/) | 使用satoken重构权限鉴权(公测 可尝试上生产) |
|
| satoken分支 | RuoYi-Vue-Plus-satoken | [satoken分支地址](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/satoken/) | 使用satoken重构权限鉴权(公测 可尝试上生产) |
|
||||||
| 单体分支 | RuoYi-Vue-Plus-fast | [fast分支地址](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/fast/) | 单体应用结构 |
|
| 单体分支 | RuoYi-Vue-Plus-fast | [fast分支地址](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/fast/) | 单体应用结构 |
|
||||||
|
| Vue3分支 | RuoYi-Vue-Plus-UI | [UI地址](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus-UI) | 由于组件还未完善 仅供学习 |
|
||||||
| 原框架 | 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) | |
|
||||||
|
|||||||
32
pom.xml
32
pom.xml
@ -31,10 +31,10 @@
|
|||||||
<hutool.version>5.7.16</hutool.version>
|
<hutool.version>5.7.16</hutool.version>
|
||||||
<okhttp.version>4.9.2</okhttp.version>
|
<okhttp.version>4.9.2</okhttp.version>
|
||||||
<spring-boot-admin.version>2.5.4</spring-boot-admin.version>
|
<spring-boot-admin.version>2.5.4</spring-boot-admin.version>
|
||||||
<redisson.version>3.16.4</redisson.version>
|
<redisson.version>3.16.6</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.5.0</dynamic-ds.version>
|
||||||
<tlog.version>1.3.5</tlog.version>
|
<tlog.version>1.3.6</tlog.version>
|
||||||
<xxl-job.version>2.3.0</xxl-job.version>
|
<xxl-job.version>2.3.0</xxl-job.version>
|
||||||
|
|
||||||
<!-- jdk11 缺失依赖 jaxb-->
|
<!-- jdk11 缺失依赖 jaxb-->
|
||||||
@ -161,7 +161,31 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-core</artifactId>
|
||||||
|
<version>${hutool.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-http</artifactId>
|
||||||
|
<version>${hutool.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-captcha</artifactId>
|
||||||
|
<version>${hutool.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-extra</artifactId>
|
||||||
|
<version>${hutool.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-jwt</artifactId>
|
||||||
<version>${hutool.version}</version>
|
<version>${hutool.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@ -95,10 +95,38 @@
|
|||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-extension</artifactId>
|
<artifactId>mybatis-plus-extension</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- dynamic-datasource 多数据源-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-http</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-captcha</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-jwt</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-extra</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
|
|||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface DataColumn {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 占位符关键字
|
||||||
|
*/
|
||||||
|
String key() default "deptName";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 占位符替换值
|
||||||
|
*/
|
||||||
|
String value() default "dept_id";
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限组
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface DataPermission {
|
||||||
|
|
||||||
|
DataColumn[] value();
|
||||||
|
|
||||||
|
}
|
||||||
@ -6,11 +6,14 @@ import java.lang.annotation.*;
|
|||||||
* 数据权限过滤注解
|
* 数据权限过滤注解
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
|
* @deprecated 3.6.0 移除 {@link com.ruoyi.common.annotation.DataPermission}
|
||||||
*/
|
*/
|
||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Documented
|
@Documented
|
||||||
|
@Deprecated
|
||||||
public @interface DataScope {
|
public @interface DataScope {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门表的别名
|
* 部门表的别名
|
||||||
*/
|
*/
|
||||||
@ -25,4 +28,5 @@ public @interface DataScope {
|
|||||||
* 是否过滤用户权限
|
* 是否过滤用户权限
|
||||||
*/
|
*/
|
||||||
boolean isUser() default false;
|
boolean isUser() default false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,11 +10,13 @@ import java.lang.annotation.*;
|
|||||||
* 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
|
* 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
|
* @deprecated 3.6.0 移除 使用原生注解处理 方法更全 {@link com.baomidou.dynamic.datasource.annotation.DS}
|
||||||
*/
|
*/
|
||||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Documented
|
@Documented
|
||||||
@Inherited
|
@Inherited
|
||||||
|
@Deprecated
|
||||||
public @interface DataSource {
|
public @interface DataSource {
|
||||||
/**
|
/**
|
||||||
* 切换数据源名称
|
* 切换数据源名称
|
||||||
|
|||||||
@ -1,5 +1,10 @@
|
|||||||
package com.ruoyi.common.core.domain;
|
package com.ruoyi.common.core.domain;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.sql.SqlUtil;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
@ -42,4 +47,47 @@ public class PageQuery implements Serializable {
|
|||||||
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
||||||
private String isAsc;
|
private String isAsc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前记录起始索引 默认值
|
||||||
|
*/
|
||||||
|
public static final int DEFAULT_PAGE_NUM = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每页显示记录数 默认值 默认查全部
|
||||||
|
*/
|
||||||
|
public static final int DEFAULT_PAGE_SIZE = Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
public <T> Page<T> build() {
|
||||||
|
Integer pageNum = ObjectUtil.defaultIfNull(getPageNum(), DEFAULT_PAGE_NUM);
|
||||||
|
Integer pageSize = ObjectUtil.defaultIfNull(getPageSize(), DEFAULT_PAGE_SIZE);
|
||||||
|
if (pageNum <= 0) {
|
||||||
|
pageNum = DEFAULT_PAGE_NUM;
|
||||||
|
}
|
||||||
|
Page<T> page = new Page<>(pageNum, pageSize);
|
||||||
|
OrderItem orderItem = buildOrderItem();
|
||||||
|
if (ObjectUtil.isNotNull(orderItem)) {
|
||||||
|
page.addOrder(orderItem);
|
||||||
|
}
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
private OrderItem buildOrderItem() {
|
||||||
|
// 兼容前端排序类型
|
||||||
|
if ("ascending".equals(isAsc)) {
|
||||||
|
isAsc = "asc";
|
||||||
|
} else if ("descending".equals(isAsc)) {
|
||||||
|
isAsc = "desc";
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(orderByColumn)) {
|
||||||
|
String orderBy = SqlUtil.escapeOrderBySql(orderByColumn);
|
||||||
|
orderBy = StringUtils.toUnderScoreCase(orderBy);
|
||||||
|
if ("asc".equals(isAsc)) {
|
||||||
|
return OrderItem.asc(orderBy);
|
||||||
|
} else if ("desc".equals(isAsc)) {
|
||||||
|
return OrderItem.desc(orderBy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.*;
|
|||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import com.ruoyi.common.xss.Xss;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -48,15 +49,17 @@ public class SysUser extends BaseEntity {
|
|||||||
* 用户账号
|
* 用户账号
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "用户账号")
|
@ApiModelProperty(value = "用户账号")
|
||||||
@NotBlank(message = "用户账号不能为空")
|
@Xss(message = "用户账号不能包含脚本字符")
|
||||||
|
@NotBlank(message = "用户账号不能为空")
|
||||||
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
|
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户昵称
|
* 用户昵称
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "用户昵称")
|
@ApiModelProperty(value = "用户昵称")
|
||||||
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
|
@Xss(message = "用户昵称不能包含脚本字符")
|
||||||
|
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
|
||||||
private String nickName;
|
private String nickName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -162,7 +165,7 @@ public class SysUser extends BaseEntity {
|
|||||||
private Long[] postIds;
|
private Long[] postIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色ID
|
* 数据权限 当前角色ID
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "角色ID")
|
@ApiModelProperty(value = "角色ID")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
|
|||||||
@ -1,9 +1,16 @@
|
|||||||
package com.ruoyi.common.core.mybatisplus.core;
|
package com.ruoyi.common.core.mybatisplus.core;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.common.utils.BeanCopyUtils;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义 Mapper 接口, 实现 自定义扩展
|
* 自定义 Mapper 接口, 实现 自定义扩展
|
||||||
@ -18,4 +25,63 @@ public interface BaseMapperPlus<T> extends BaseMapper<T> {
|
|||||||
*/
|
*/
|
||||||
int insertAll(@Param("list") Collection<T> batchList);
|
int insertAll(@Param("list") Collection<T> batchList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 ID 查询
|
||||||
|
*/
|
||||||
|
default <V> V selectVoById(Serializable id, Class<V> voClass){
|
||||||
|
T obj = this.selectById(id);
|
||||||
|
return BeanCopyUtils.copy(obj, voClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询(根据ID 批量查询)
|
||||||
|
*/
|
||||||
|
default <V> List<V> selectVoBatchIds(Collection<? extends Serializable> idList, Class<V> voClass){
|
||||||
|
List<T> list = this.selectBatchIds(idList);
|
||||||
|
if (list == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return BeanCopyUtils.copyList(list, voClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询(根据 columnMap 条件)
|
||||||
|
*/
|
||||||
|
default <V> List<V> selectVoByMap(Map<String, Object> map, Class<V> voClass){
|
||||||
|
List<T> list = this.selectByMap(map);
|
||||||
|
if (list == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return BeanCopyUtils.copyList(list, voClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 entity 条件,查询一条记录
|
||||||
|
*/
|
||||||
|
default <V> V selectVoOne(Wrapper<T> wrapper, Class<V> voClass) {
|
||||||
|
T obj = this.selectOne(wrapper);
|
||||||
|
return BeanCopyUtils.copy(obj, voClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 entity 条件,查询全部记录
|
||||||
|
*/
|
||||||
|
default <V> List<V> selectVoList(Wrapper<T> wrapper, Class<V> voClass) {
|
||||||
|
List<T> list = this.selectList(wrapper);
|
||||||
|
if (list == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return BeanCopyUtils.copyList(list, voClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询VO
|
||||||
|
*/
|
||||||
|
default <V, P extends IPage<V>> P selectVoPage(IPage<T> page, Wrapper<T> wrapper, Class<V> voClass) {
|
||||||
|
IPage<T> pageData = this.selectPage(page, wrapper);
|
||||||
|
IPage<V> voPage = new Page<>(pageData.getCurrent(), pageData.getSize(), pageData.getTotal());
|
||||||
|
voPage.setRecords(BeanCopyUtils.copyList(pageData.getRecords(), voClass));
|
||||||
|
return (P) voPage;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.ruoyi.common.core.mybatisplus.core;
|
|||||||
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;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||||
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||||
@ -160,76 +161,51 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T, V> extends ServiceI
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据 ID 查询
|
* 根据 ID 查询
|
||||||
*
|
|
||||||
* @param id 主键ID
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public V getVoById(Serializable id) {
|
public V getVoById(Serializable id) {
|
||||||
T t = getBaseMapper().selectById(id);
|
return getBaseMapper().selectVoById(id, voClass);
|
||||||
return BeanCopyUtils.copy(t, voClass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询(根据ID 批量查询)
|
* 查询(根据ID 批量查询)
|
||||||
*
|
|
||||||
* @param idList 主键ID列表
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<V> listVoByIds(Collection<? extends Serializable> idList) {
|
public List<V> listVoByIds(Collection<? extends Serializable> idList) {
|
||||||
List<T> list = getBaseMapper().selectBatchIds(idList);
|
return getBaseMapper().selectVoBatchIds(idList, voClass);
|
||||||
if (list == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return BeanCopyUtils.copyList(list, voClass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询(根据 columnMap 条件)
|
* 查询(根据 columnMap 条件)
|
||||||
*
|
|
||||||
* @param columnMap 表字段 map 对象
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<V> listVoByMap(Map<String, Object> columnMap) {
|
public List<V> listVoByMap(Map<String, Object> columnMap) {
|
||||||
List<T> list = getBaseMapper().selectByMap(columnMap);
|
return getBaseMapper().selectVoByMap(columnMap, voClass);
|
||||||
if (list == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return BeanCopyUtils.copyList(list, voClass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据 Wrapper,查询一条记录 <br/>
|
* 根据 Wrapper,查询一条记录 <br/>
|
||||||
* <p>结果集,如果是多个会抛出异常,随机取一条加上限制条件 wrapper.last("LIMIT 1")</p>
|
* <p>结果集,如果是多个会抛出异常,随机取一条加上限制条件 wrapper.last("LIMIT 1")</p>
|
||||||
*
|
|
||||||
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public V getVoOne(Wrapper<T> queryWrapper) {
|
public V getVoOne(Wrapper<T> queryWrapper) {
|
||||||
T t = getOne(queryWrapper, true);
|
return getBaseMapper().selectVoOne(queryWrapper, voClass);
|
||||||
return BeanCopyUtils.copy(t, voClass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询列表
|
* 查询列表
|
||||||
*
|
|
||||||
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<V> listVo(Wrapper<T> queryWrapper) {
|
public List<V> listVo(Wrapper<T> queryWrapper) {
|
||||||
List<T> list = getBaseMapper().selectList(queryWrapper);
|
return getBaseMapper().selectVoList(queryWrapper, voClass);
|
||||||
if (list == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return BeanCopyUtils.copyList(list, voClass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 翻页查询
|
* 翻页查询
|
||||||
*
|
* @deprecated 3.6.0 移除 请使用 {@link #pageVo(IPage, Wrapper)}
|
||||||
* @param page 翻页对象
|
|
||||||
* @param queryWrapper 实体对象封装操作类
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public PagePlus<T, V> pageVo(PagePlus<T, V> page, Wrapper<T> queryWrapper) {
|
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.copyList(result.getRecords(), voClass);
|
List<V> volist = BeanCopyUtils.copyList(result.getRecords(), voClass);
|
||||||
@ -237,4 +213,14 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T, V> extends ServiceI
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 翻页查询
|
||||||
|
*
|
||||||
|
* @param page 翻页对象
|
||||||
|
* @param queryWrapper 实体对象封装操作类
|
||||||
|
*/
|
||||||
|
public <P extends IPage<V>> P pageVo(IPage<T> page, Wrapper<T> queryWrapper) {
|
||||||
|
return getBaseMapper().selectVoPage(page, queryWrapper, voClass);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,9 +16,11 @@ import java.util.List;
|
|||||||
* @param <T> 数据库实体
|
* @param <T> 数据库实体
|
||||||
* @param <K> vo实体
|
* @param <K> vo实体
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
|
* @deprecated 3.6.0 删除 请使用 {@link com.ruoyi.common.core.domain.PageQuery#build()}
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
|
@Deprecated
|
||||||
public class PagePlus<T,K> implements IPage<T> {
|
public class PagePlus<T,K> implements IPage<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package com.ruoyi.common.core.page;
|
package com.ruoyi.common.core.page;
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpStatus;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -57,4 +59,29 @@ public class TableDataInfo<T> implements Serializable {
|
|||||||
this.total = total;
|
this.total = total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> TableDataInfo<T> build(IPage<T> page) {
|
||||||
|
TableDataInfo<T> rspData = new TableDataInfo<>();
|
||||||
|
rspData.setCode(HttpStatus.HTTP_OK);
|
||||||
|
rspData.setMsg("查询成功");
|
||||||
|
rspData.setRows(page.getRecords());
|
||||||
|
rspData.setTotal(page.getTotal());
|
||||||
|
return rspData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> TableDataInfo<T> build(List<T> list) {
|
||||||
|
TableDataInfo<T> rspData = new TableDataInfo<>();
|
||||||
|
rspData.setCode(HttpStatus.HTTP_OK);
|
||||||
|
rspData.setMsg("查询成功");
|
||||||
|
rspData.setRows(list);
|
||||||
|
rspData.setTotal(list.size());
|
||||||
|
return rspData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> TableDataInfo<T> build() {
|
||||||
|
TableDataInfo<T> rspData = new TableDataInfo<>();
|
||||||
|
rspData.setCode(HttpStatus.HTTP_OK);
|
||||||
|
rspData.setMsg("查询成功");
|
||||||
|
return rspData;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,71 @@
|
|||||||
|
package com.ruoyi.common.enums;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限类型
|
||||||
|
*
|
||||||
|
* 语法支持 spel 模板表达式
|
||||||
|
*
|
||||||
|
* 内置数据 user 当前用户 内容参考 SysUser
|
||||||
|
* 如需扩展数据 需往 SysUser 内注入
|
||||||
|
* 内置服务 sdss 系统数据权限服务 内容参考 SysDataScopeService
|
||||||
|
* 如需扩展更多自定义服务 可以参考 sdss 自行编写
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum DataScopeType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全部数据权限
|
||||||
|
*/
|
||||||
|
ALL("1", "", ""),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定数据权限
|
||||||
|
*/
|
||||||
|
CUSTOM("2", " #{#deptName} IN ( #{@sdss.getRoleCustom( #user.roleId )} ) ", ""),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门数据权限
|
||||||
|
*/
|
||||||
|
DEPT("3", " #{#deptName} = #{#user.deptId} ", ""),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门及以下数据权限
|
||||||
|
*/
|
||||||
|
DEPT_AND_CHILD("4", " #{#deptName} IN ( #{@sdss.getDeptAndChild( #user.deptId )} )", ""),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅本人数据权限
|
||||||
|
*/
|
||||||
|
SELF("5", " #{#userName} = #{#user.userId} " , " 1 = 0 ");
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语法 采用 spel 模板表达式
|
||||||
|
*/
|
||||||
|
private final String sqlTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不满足 sqlTemplate 则填充
|
||||||
|
*/
|
||||||
|
private final String elseSql;
|
||||||
|
|
||||||
|
public static DataScopeType findCode(String code) {
|
||||||
|
if (StringUtils.isBlank(code)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (DataScopeType type : values()) {
|
||||||
|
if (type.getCode().equals(code)) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -7,8 +7,10 @@ import lombok.Getter;
|
|||||||
* 数据源
|
* 数据源
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
|
* @deprecated 3.6.0 移除
|
||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@Deprecated
|
||||||
public enum DataSourceType {
|
public enum DataSourceType {
|
||||||
/**
|
/**
|
||||||
* 主库
|
* 主库
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.ruoyi.common.utils;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.http.HttpStatus;
|
import cn.hutool.http.HttpStatus;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
@ -17,7 +18,9 @@ import java.util.List;
|
|||||||
* 分页工具
|
* 分页工具
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
|
* @deprecated 3.6.0 删除 请使用 {@link PageQuery} 与 {@link TableDataInfo}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class PageUtils {
|
public class PageUtils {
|
||||||
|
|
||||||
@ -48,11 +51,13 @@ public class PageUtils {
|
|||||||
/**
|
/**
|
||||||
* 当前记录起始索引 默认值
|
* 当前记录起始索引 默认值
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int DEFAULT_PAGE_NUM = 1;
|
public static final int DEFAULT_PAGE_NUM = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每页显示记录数 默认值 默认查全部
|
* 每页显示记录数 默认值 默认查全部
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int DEFAULT_PAGE_SIZE = Integer.MAX_VALUE;
|
public static final int DEFAULT_PAGE_SIZE = Integer.MAX_VALUE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,7 +66,7 @@ public class PageUtils {
|
|||||||
* @param <T> domain 实体
|
* @param <T> domain 实体
|
||||||
* @param <K> vo 实体
|
* @param <K> vo 实体
|
||||||
* @return 分页对象
|
* @return 分页对象
|
||||||
* @deprecated 3.6.0 删除 请使用 {@link PageUtils#buildPagePlus(PageQuery)}
|
* @deprecated 3.6.0 删除 请使用 {@link PageQuery#build()}
|
||||||
* 由于使用 Servlet 获取只能从 param 获取 灵活性降低 故将传参操作交给用户
|
* 由于使用 Servlet 获取只能从 param 获取 灵活性降低 故将传参操作交给用户
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -81,22 +86,6 @@ public class PageUtils {
|
|||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T, K> PagePlus<T, K> buildPagePlus(PageQuery pageQuery) {
|
|
||||||
Integer pageNum = ObjectUtil.defaultIfNull(pageQuery.getPageNum(), DEFAULT_PAGE_NUM);
|
|
||||||
Integer pageSize = ObjectUtil.defaultIfNull(pageQuery.getPageSize(), DEFAULT_PAGE_SIZE);
|
|
||||||
String orderByColumn = pageQuery.getOrderByColumn();
|
|
||||||
String isAsc = pageQuery.getIsAsc();
|
|
||||||
if (pageNum <= 0) {
|
|
||||||
pageNum = DEFAULT_PAGE_NUM;
|
|
||||||
}
|
|
||||||
PagePlus<T, K> page = new PagePlus<>(pageNum, pageSize);
|
|
||||||
OrderItem orderItem = buildOrderItem(orderByColumn, isAsc);
|
|
||||||
if (ObjectUtil.isNotNull(orderItem)) {
|
|
||||||
page.addOrder(orderItem);
|
|
||||||
}
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static <T> Page<T> buildPage() {
|
public static <T> Page<T> buildPage() {
|
||||||
return buildPage(null, null);
|
return buildPage(null, null);
|
||||||
@ -107,7 +96,7 @@ public class PageUtils {
|
|||||||
*
|
*
|
||||||
* @param <T> domain 实体
|
* @param <T> domain 实体
|
||||||
* @return 分页对象
|
* @return 分页对象
|
||||||
* @deprecated 3.6.0 删除 请使用 {@link PageUtils#buildPage(PageQuery)}
|
* @deprecated 3.6.0 删除 请使用 {@link PageQuery#build()}
|
||||||
* 由于使用 Servlet 获取只能从 param 获取 灵活性降低 故将传参操作交给用户
|
* 由于使用 Servlet 获取只能从 param 获取 灵活性降低 故将传参操作交给用户
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -127,23 +116,6 @@ public class PageUtils {
|
|||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> Page<T> buildPage(PageQuery pageQuery) {
|
|
||||||
Integer pageNum = ObjectUtil.defaultIfNull(pageQuery.getPageNum(), DEFAULT_PAGE_NUM);
|
|
||||||
Integer pageSize = ObjectUtil.defaultIfNull(pageQuery.getPageSize(), DEFAULT_PAGE_SIZE);
|
|
||||||
String orderByColumn = pageQuery.getOrderByColumn();
|
|
||||||
String isAsc = pageQuery.getIsAsc();
|
|
||||||
if (pageNum <= 0) {
|
|
||||||
pageNum = DEFAULT_PAGE_NUM;
|
|
||||||
}
|
|
||||||
Page<T> page = new Page<>(pageNum, pageSize);
|
|
||||||
OrderItem orderItem = buildOrderItem(orderByColumn, isAsc);
|
|
||||||
if (ObjectUtil.isNotNull(orderItem)) {
|
|
||||||
page.addOrder(orderItem);
|
|
||||||
}
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static OrderItem buildOrderItem(String orderByColumn, String isAsc) {
|
private static OrderItem buildOrderItem(String orderByColumn, String isAsc) {
|
||||||
// 兼容前端排序类型
|
// 兼容前端排序类型
|
||||||
if ("ascending".equals(isAsc)) {
|
if ("ascending".equals(isAsc)) {
|
||||||
@ -163,6 +135,15 @@ public class PageUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建 MP 普通分页对象
|
||||||
|
*
|
||||||
|
* @param <T> domain 实体
|
||||||
|
* @return 分页对象
|
||||||
|
* @deprecated 3.6.0 删除 请使用 {@link PageQuery#build()}
|
||||||
|
* 由于使用 Servlet 获取只能从 param 获取 灵活性降低 故将传参操作交给用户
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static <T, K> TableDataInfo<K> buildDataInfo(PagePlus<T, K> page) {
|
public static <T, K> TableDataInfo<K> buildDataInfo(PagePlus<T, K> page) {
|
||||||
TableDataInfo<K> rspData = new TableDataInfo<>();
|
TableDataInfo<K> rspData = new TableDataInfo<>();
|
||||||
rspData.setCode(HttpStatus.HTTP_OK);
|
rspData.setCode(HttpStatus.HTTP_OK);
|
||||||
@ -172,6 +153,10 @@ public class PageUtils {
|
|||||||
return rspData;
|
return rspData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated 3.6.0 删除 请使用 {@link TableDataInfo#build(IPage)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static <T> TableDataInfo<T> buildDataInfo(Page<T> page) {
|
public static <T> TableDataInfo<T> buildDataInfo(Page<T> page) {
|
||||||
TableDataInfo<T> rspData = new TableDataInfo<>();
|
TableDataInfo<T> rspData = new TableDataInfo<>();
|
||||||
rspData.setCode(HttpStatus.HTTP_OK);
|
rspData.setCode(HttpStatus.HTTP_OK);
|
||||||
@ -181,6 +166,10 @@ public class PageUtils {
|
|||||||
return rspData;
|
return rspData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated 3.6.0 删除 请使用 {@link TableDataInfo#build(List)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static <T> TableDataInfo<T> buildDataInfo(List<T> list) {
|
public static <T> TableDataInfo<T> buildDataInfo(List<T> list) {
|
||||||
TableDataInfo<T> rspData = new TableDataInfo<>();
|
TableDataInfo<T> rspData = new TableDataInfo<>();
|
||||||
rspData.setCode(HttpStatus.HTTP_OK);
|
rspData.setCode(HttpStatus.HTTP_OK);
|
||||||
@ -190,6 +179,10 @@ public class PageUtils {
|
|||||||
return rspData;
|
return rspData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated 3.6.0 删除 请使用 {@link TableDataInfo#build()}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static <T> TableDataInfo<T> buildDataInfo() {
|
public static <T> TableDataInfo<T> buildDataInfo() {
|
||||||
TableDataInfo<T> rspData = new TableDataInfo<>();
|
TableDataInfo<T> rspData = new TableDataInfo<>();
|
||||||
rspData.setCode(HttpStatus.HTTP_OK);
|
rspData.setCode(HttpStatus.HTTP_OK);
|
||||||
|
|||||||
@ -22,13 +22,8 @@ public class TreeBuildUtils extends TreeUtil {
|
|||||||
*/
|
*/
|
||||||
public static final TreeNodeConfig DEFAULT_CONFIG = TreeNodeConfig.DEFAULT_CONFIG.setNameKey("label");
|
public static final TreeNodeConfig DEFAULT_CONFIG = TreeNodeConfig.DEFAULT_CONFIG.setNameKey("label");
|
||||||
|
|
||||||
/**
|
public static <T> List<Tree<Long>> build(List<T> list, Long parentId, NodeParser<T, Long> nodeParser) {
|
||||||
* 默认树父节点id
|
return TreeUtil.build(list, parentId, DEFAULT_CONFIG, nodeParser);
|
||||||
*/
|
|
||||||
public static final Long DEFAULT_PARENT_ID = 0L;
|
|
||||||
|
|
||||||
public static <T> List<Tree<Long>> build(List<T> list, NodeParser<T, Long> nodeParser) {
|
|
||||||
return TreeUtil.build(list, DEFAULT_PARENT_ID, DEFAULT_CONFIG, nodeParser);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
package com.ruoyi.common.utils;
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.NoArgsConstructor;
|
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.Validator;
|
import javax.validation.Validator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ import java.util.Set;
|
|||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class ValidatorUtils {
|
public class ValidatorUtils {
|
||||||
|
|
||||||
private static final Validator VALID = Validation.buildDefaultValidatorFactory().getValidator();
|
private static final Validator VALID = SpringUtils.getBean(Validator.class);
|
||||||
|
|
||||||
public static <T> void validate(T object, Class<?>... groups) {
|
public static <T> void validate(T object, Class<?>... groups) {
|
||||||
Set<ConstraintViolation<T>> validate = VALID.validate(object, groups);
|
Set<ConstraintViolation<T>> validate = VALID.validate(object, groups);
|
||||||
|
|||||||
26
ruoyi-common/src/main/java/com/ruoyi/common/xss/Xss.java
Normal file
26
ruoyi-common/src/main/java/com/ruoyi/common/xss/Xss.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package com.ruoyi.common.xss;
|
||||||
|
|
||||||
|
import javax.validation.Constraint;
|
||||||
|
import javax.validation.Payload;
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义xss校验注解
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(value = {ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.PARAMETER})
|
||||||
|
@Constraint(validatedBy = {XssValidator.class})
|
||||||
|
public @interface Xss {
|
||||||
|
|
||||||
|
String message() default "不允许任何脚本运行";
|
||||||
|
|
||||||
|
Class<?>[] groups() default {};
|
||||||
|
|
||||||
|
Class<? extends Payload>[] payload() default {};
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.ruoyi.common.xss;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ReUtil;
|
||||||
|
import cn.hutool.http.HtmlUtil;
|
||||||
|
|
||||||
|
import javax.validation.ConstraintValidator;
|
||||||
|
import javax.validation.ConstraintValidatorContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义xss校验注解实现
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public class XssValidator implements ConstraintValidator<Xss, String> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
|
||||||
|
return !ReUtil.contains(HtmlUtil.RE_HTML_MARK, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -36,7 +36,7 @@ public class TestBatchController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation(value = "新增批量方法")
|
@ApiOperation(value = "新增批量方法")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
// @DataSource(DataSourceType.SLAVE)
|
// @DS("slave")
|
||||||
public AjaxResult<Void> add() {
|
public AjaxResult<Void> add() {
|
||||||
List<TestDemo> list = new ArrayList<>();
|
List<TestDemo> list = new ArrayList<>();
|
||||||
for (int i = 0; i < 1000; i++) {
|
for (int i = 0; i < 1000; i++) {
|
||||||
@ -50,7 +50,7 @@ public class TestBatchController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation(value = "新增或更新批量方法")
|
@ApiOperation(value = "新增或更新批量方法")
|
||||||
@PostMapping("/addOrUpdate")
|
@PostMapping("/addOrUpdate")
|
||||||
// @DataSource(DataSourceType.SLAVE)
|
// @DS("slave")
|
||||||
public AjaxResult<Void> addOrUpdate() {
|
public AjaxResult<Void> addOrUpdate() {
|
||||||
List<TestDemo> list = new ArrayList<>();
|
List<TestDemo> list = new ArrayList<>();
|
||||||
for (int i = 0; i < 1000; i++) {
|
for (int i = 0; i < 1000; i++) {
|
||||||
@ -72,7 +72,7 @@ public class TestBatchController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation(value = "删除批量方法")
|
@ApiOperation(value = "删除批量方法")
|
||||||
@DeleteMapping()
|
@DeleteMapping()
|
||||||
// @DataSource(DataSourceType.SLAVE)
|
// @DS("slave")
|
||||||
public AjaxResult<Void> remove() {
|
public AjaxResult<Void> remove() {
|
||||||
return toAjax(iTestDemoService.remove(new LambdaQueryWrapper<TestDemo>()
|
return toAjax(iTestDemoService.remove(new LambdaQueryWrapper<TestDemo>()
|
||||||
.eq(TestDemo::getOrderNum, -1L)) ? 1 : 0);
|
.eq(TestDemo::getOrderNum, -1L)) ? 1 : 0);
|
||||||
|
|||||||
@ -1,12 +1,20 @@
|
|||||||
package com.ruoyi.demo.mapper;
|
package com.ruoyi.demo.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.common.annotation.DataColumn;
|
||||||
|
import com.ruoyi.common.annotation.DataPermission;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||||
import com.ruoyi.demo.domain.TestDemo;
|
import com.ruoyi.demo.domain.TestDemo;
|
||||||
import com.ruoyi.demo.domain.vo.TestDemoVo;
|
import com.ruoyi.demo.domain.vo.TestDemoVo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试单表Mapper接口
|
* 测试单表Mapper接口
|
||||||
*
|
*
|
||||||
@ -15,6 +23,37 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
*/
|
*/
|
||||||
public interface TestDemoMapper extends BaseMapperPlus<TestDemo> {
|
public interface TestDemoMapper extends BaseMapperPlus<TestDemo> {
|
||||||
|
|
||||||
|
@DataPermission({
|
||||||
|
@DataColumn(key = "deptName", value = "dept_id"),
|
||||||
|
@DataColumn(key = "userName", value = "user_id")
|
||||||
|
})
|
||||||
Page<TestDemoVo> customPageList(@Param("page") Page<TestDemo> page, @Param("ew") Wrapper<TestDemo> wrapper);
|
Page<TestDemoVo> customPageList(@Param("page") Page<TestDemo> page, @Param("ew") Wrapper<TestDemo> wrapper);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@DataPermission({
|
||||||
|
@DataColumn(key = "deptName", value = "dept_id"),
|
||||||
|
@DataColumn(key = "userName", value = "user_id")
|
||||||
|
})
|
||||||
|
<P extends IPage<TestDemo>> P selectPage(P page, @Param(Constants.WRAPPER) Wrapper<TestDemo> queryWrapper);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@DataPermission({
|
||||||
|
@DataColumn(key = "deptName", value = "dept_id"),
|
||||||
|
@DataColumn(key = "userName", value = "user_id")
|
||||||
|
})
|
||||||
|
List<TestDemo> selectList(@Param(Constants.WRAPPER) Wrapper<TestDemo> queryWrapper);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@DataPermission({
|
||||||
|
@DataColumn(key = "deptName", value = "dept_id"),
|
||||||
|
@DataColumn(key = "userName", value = "user_id")
|
||||||
|
})
|
||||||
|
int updateById(@Param(Constants.ENTITY) TestDemo entity);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@DataPermission({
|
||||||
|
@DataColumn(key = "deptName", value = "dept_id"),
|
||||||
|
@DataColumn(key = "userName", value = "user_id")
|
||||||
|
})
|
||||||
|
int deleteBatchIds(@Param(Constants.COLLECTION) Collection<? extends Serializable> idList);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,16 @@
|
|||||||
package com.ruoyi.demo.mapper;
|
package com.ruoyi.demo.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
|
import com.ruoyi.common.annotation.DataColumn;
|
||||||
|
import com.ruoyi.common.annotation.DataPermission;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||||
import com.ruoyi.demo.domain.TestTree;
|
import com.ruoyi.demo.domain.TestTree;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试树表Mapper接口
|
* 测试树表Mapper接口
|
||||||
@ -11,4 +20,24 @@ import com.ruoyi.demo.domain.TestTree;
|
|||||||
*/
|
*/
|
||||||
public interface TestTreeMapper extends BaseMapperPlus<TestTree> {
|
public interface TestTreeMapper extends BaseMapperPlus<TestTree> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@DataPermission({
|
||||||
|
@DataColumn(key = "deptName", value = "dept_id"),
|
||||||
|
@DataColumn(key = "userName", value = "user_id")
|
||||||
|
})
|
||||||
|
List<TestTree> selectList(@Param(Constants.WRAPPER) Wrapper<TestTree> queryWrapper);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@DataPermission({
|
||||||
|
@DataColumn(key = "deptName", value = "dept_id"),
|
||||||
|
@DataColumn(key = "userName", value = "user_id")
|
||||||
|
})
|
||||||
|
int updateById(@Param(Constants.ENTITY) TestTree entity);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@DataPermission({
|
||||||
|
@DataColumn(key = "deptName", value = "dept_id"),
|
||||||
|
@DataColumn(key = "userName", value = "user_id")
|
||||||
|
})
|
||||||
|
int deleteBatchIds(@Param(Constants.COLLECTION) Collection<? extends Serializable> idList);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,13 @@
|
|||||||
package com.ruoyi.demo.service.impl;
|
package com.ruoyi.demo.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
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.PageUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.demo.domain.TestDemo;
|
import com.ruoyi.demo.domain.TestDemo;
|
||||||
import com.ruoyi.demo.domain.bo.TestDemoBo;
|
import com.ruoyi.demo.domain.bo.TestDemoBo;
|
||||||
import com.ruoyi.demo.domain.vo.TestDemoVo;
|
import com.ruoyi.demo.domain.vo.TestDemoVo;
|
||||||
@ -36,26 +33,23 @@ public class TestDemoServiceImpl extends ServicePlusImpl<TestDemoMapper, TestDem
|
|||||||
return getVoById(id);
|
return getVoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DataScope(isUser = true)
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<TestDemoVo> queryPageList(TestDemoBo bo, PageQuery pageQuery) {
|
public TableDataInfo<TestDemoVo> queryPageList(TestDemoBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<TestDemo> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<TestDemo> lqw = buildQueryWrapper(bo);
|
||||||
PagePlus<TestDemo, TestDemoVo> result = pageVo(PageUtils.buildPagePlus(pageQuery), lqw);
|
Page<TestDemoVo> result = pageVo(pageQuery.build(), lqw);
|
||||||
return PageUtils.buildDataInfo(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义分页查询
|
* 自定义分页查询
|
||||||
*/
|
*/
|
||||||
@DataScope(isUser = true)
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<TestDemoVo> customPageList(TestDemoBo bo, PageQuery pageQuery) {
|
public TableDataInfo<TestDemoVo> customPageList(TestDemoBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<TestDemo> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<TestDemo> lqw = buildQueryWrapper(bo);
|
||||||
Page<TestDemoVo> result = baseMapper.customPageList(PageUtils.buildPage(pageQuery), lqw);
|
Page<TestDemoVo> result = baseMapper.customPageList(pageQuery.build(), lqw);
|
||||||
return PageUtils.buildDataInfo(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DataScope(isUser = true)
|
|
||||||
@Override
|
@Override
|
||||||
public List<TestDemoVo> queryList(TestDemoBo bo) {
|
public List<TestDemoVo> queryList(TestDemoBo bo) {
|
||||||
return listVo(buildQueryWrapper(bo));
|
return listVo(buildQueryWrapper(bo));
|
||||||
@ -63,14 +57,11 @@ public class TestDemoServiceImpl extends ServicePlusImpl<TestDemoMapper, TestDem
|
|||||||
|
|
||||||
private LambdaQueryWrapper<TestDemo> buildQueryWrapper(TestDemoBo bo) {
|
private LambdaQueryWrapper<TestDemo> buildQueryWrapper(TestDemoBo bo) {
|
||||||
Map<String, Object> params = bo.getParams();
|
Map<String, Object> params = bo.getParams();
|
||||||
Object dataScope = params.get("dataScope");
|
|
||||||
LambdaQueryWrapper<TestDemo> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<TestDemo> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getTestKey()), TestDemo::getTestKey, bo.getTestKey());
|
lqw.like(StringUtils.isNotBlank(bo.getTestKey()), TestDemo::getTestKey, bo.getTestKey());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getValue()), TestDemo::getValue, bo.getValue());
|
lqw.eq(StringUtils.isNotBlank(bo.getValue()), TestDemo::getValue, bo.getValue());
|
||||||
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
||||||
TestDemo::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
|
TestDemo::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
|
||||||
lqw.apply(dataScope != null && StringUtils.isNotBlank(dataScope.toString()),
|
|
||||||
dataScope != null ? dataScope.toString() : null);
|
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package com.ruoyi.demo.service.impl;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.demo.domain.TestTree;
|
import com.ruoyi.demo.domain.TestTree;
|
||||||
@ -23,7 +22,7 @@ import java.util.Map;
|
|||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @date 2021-07-26
|
* @date 2021-07-26
|
||||||
*/
|
*/
|
||||||
//@DataSource(DataSourceType.SLAVE) // 切换从库查询
|
// @DS("slave") // 切换从库查询
|
||||||
@Service
|
@Service
|
||||||
public class TestTreeServiceImpl extends ServicePlusImpl<TestTreeMapper, TestTree, TestTreeVo> implements ITestTreeService {
|
public class TestTreeServiceImpl extends ServicePlusImpl<TestTreeMapper, TestTree, TestTreeVo> implements ITestTreeService {
|
||||||
|
|
||||||
@ -32,8 +31,7 @@ public class TestTreeServiceImpl extends ServicePlusImpl<TestTreeMapper, TestTre
|
|||||||
return getVoById(id);
|
return getVoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @DataSource(DataSourceType.SLAVE) // 切换从库查询
|
// @DS("slave") // 切换从库查询
|
||||||
@DataScope(isUser = true)
|
|
||||||
@Override
|
@Override
|
||||||
public List<TestTreeVo> queryList(TestTreeBo bo) {
|
public List<TestTreeVo> queryList(TestTreeBo bo) {
|
||||||
LambdaQueryWrapper<TestTree> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<TestTree> lqw = buildQueryWrapper(bo);
|
||||||
@ -42,13 +40,10 @@ public class TestTreeServiceImpl extends ServicePlusImpl<TestTreeMapper, TestTre
|
|||||||
|
|
||||||
private LambdaQueryWrapper<TestTree> buildQueryWrapper(TestTreeBo bo) {
|
private LambdaQueryWrapper<TestTree> buildQueryWrapper(TestTreeBo bo) {
|
||||||
Map<String, Object> params = bo.getParams();
|
Map<String, Object> params = bo.getParams();
|
||||||
Object dataScope = params.get("dataScope");
|
|
||||||
LambdaQueryWrapper<TestTree> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<TestTree> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getTreeName()), TestTree::getTreeName, bo.getTreeName());
|
lqw.like(StringUtils.isNotBlank(bo.getTreeName()), TestTree::getTreeName, bo.getTreeName());
|
||||||
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
||||||
TestTree::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
|
TestTree::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
|
||||||
lqw.apply(dataScope != null && StringUtils.isNotBlank(dataScope.toString()),
|
|
||||||
dataScope != null ? dataScope.toString() : null);
|
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -102,6 +102,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<nonFilteredFileExtensions>
|
<nonFilteredFileExtensions>
|
||||||
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
|
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
|
||||||
|
|||||||
@ -46,11 +46,6 @@
|
|||||||
<artifactId>druid-spring-boot-starter</artifactId>
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- dynamic-datasource 多数据源-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- sql性能分析插件 -->
|
<!-- sql性能分析插件 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>p6spy</groupId>
|
<groupId>p6spy</groupId>
|
||||||
|
|||||||
@ -18,9 +18,11 @@ import org.springframework.stereotype.Component;
|
|||||||
* 数据过滤处理
|
* 数据过滤处理
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
|
* @deprecated 3.6.0 移除 {@link com.ruoyi.framework.handler.PlusDataPermissionHandler}
|
||||||
*/
|
*/
|
||||||
@Aspect
|
@Aspect
|
||||||
@Component
|
@Component
|
||||||
|
@Deprecated
|
||||||
public class DataScopeAspect {
|
public class DataScopeAspect {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -18,10 +18,12 @@ import java.util.Objects;
|
|||||||
* 多数据源处理
|
* 多数据源处理
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
|
* @deprecated 3.6.0 移除 使用原生方法处理 功能更全
|
||||||
*/
|
*/
|
||||||
@Aspect
|
@Aspect
|
||||||
@Order(-500)
|
@Order(-500)
|
||||||
@Component
|
@Component
|
||||||
|
@Deprecated
|
||||||
public class DataSourceAspect {
|
public class DataSourceAspect {
|
||||||
|
|
||||||
@Pointcut("@annotation(com.ruoyi.common.annotation.DataSource)"
|
@Pointcut("@annotation(com.ruoyi.common.annotation.DataSource)"
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
import com.ruoyi.common.core.mybatisplus.methods.InsertAll;
|
import com.ruoyi.common.core.mybatisplus.methods.InsertAll;
|
||||||
|
import com.ruoyi.framework.interceptor.PlusDataPermissionInterceptor;
|
||||||
import com.ruoyi.framework.handler.CreateAndUpdateMetaObjectHandler;
|
import com.ruoyi.framework.handler.CreateAndUpdateMetaObjectHandler;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
@ -30,6 +31,8 @@ public class MybatisPlusConfig {
|
|||||||
@Bean
|
@Bean
|
||||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||||
|
// 数据权限处理
|
||||||
|
interceptor.addInnerInterceptor(dataPermissionInterceptor());
|
||||||
// 分页插件
|
// 分页插件
|
||||||
interceptor.addInnerInterceptor(paginationInnerInterceptor());
|
interceptor.addInnerInterceptor(paginationInnerInterceptor());
|
||||||
// 乐观锁插件
|
// 乐观锁插件
|
||||||
@ -37,6 +40,13 @@ public class MybatisPlusConfig {
|
|||||||
return interceptor;
|
return interceptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限拦截器
|
||||||
|
*/
|
||||||
|
public PlusDataPermissionInterceptor dataPermissionInterceptor() {
|
||||||
|
return new PlusDataPermissionInterceptor();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页插件,自动识别数据库类型
|
* 分页插件,自动识别数据库类型
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.framework.config;
|
package com.ruoyi.framework.config;
|
||||||
|
|
||||||
import com.ruoyi.framework.Interceptor.PlusWebInvokeTimeInterceptor;
|
import com.ruoyi.framework.interceptor.PlusWebInvokeTimeInterceptor;
|
||||||
import com.yomahub.tlog.web.interceptor.TLogWebInterceptor;
|
import com.yomahub.tlog.web.interceptor.TLogWebInterceptor;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@ -52,4 +52,4 @@ public class ResourcesConfig implements WebMvcConfigurer {
|
|||||||
// 返回新的CorsFilter
|
// 返回新的CorsFilter
|
||||||
return new CorsFilter(source);
|
return new CorsFilter(source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,134 @@
|
|||||||
|
package com.ruoyi.framework.handler;
|
||||||
|
|
||||||
|
import cn.hutool.core.annotation.AnnotationUtil;
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import cn.hutool.core.util.ClassUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.ruoyi.common.annotation.DataColumn;
|
||||||
|
import com.ruoyi.common.annotation.DataPermission;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.core.service.UserService;
|
||||||
|
import com.ruoyi.common.enums.DataScopeType;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.sf.jsqlparser.JSQLParserException;
|
||||||
|
import net.sf.jsqlparser.expression.Expression;
|
||||||
|
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
|
||||||
|
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
|
||||||
|
import org.springframework.context.expression.BeanFactoryResolver;
|
||||||
|
import org.springframework.expression.BeanResolver;
|
||||||
|
import org.springframework.expression.ExpressionParser;
|
||||||
|
import org.springframework.expression.ParserContext;
|
||||||
|
import org.springframework.expression.common.TemplateParserContext;
|
||||||
|
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||||
|
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限过滤
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class PlusDataPermissionHandler {
|
||||||
|
|
||||||
|
private final ExpressionParser parser = new SpelExpressionParser();
|
||||||
|
private final ParserContext parserContext = new TemplateParserContext();
|
||||||
|
private final BeanResolver beanResolver = new BeanFactoryResolver(SpringUtils.getBeanFactory());
|
||||||
|
|
||||||
|
public Expression getSqlSegment(Expression where, String mappedStatementId, boolean isSelect) {
|
||||||
|
DataColumn[] dataColumns = findAnnotation(mappedStatementId);
|
||||||
|
if (ArrayUtil.isEmpty(dataColumns)) {
|
||||||
|
return where;
|
||||||
|
}
|
||||||
|
SysUser currentUser = SpringUtils.getBean(UserService.class).selectUserById(SecurityUtils.getUserId());
|
||||||
|
// 如果是超级管理员,则不过滤数据
|
||||||
|
if (StringUtils.isNull(currentUser) || currentUser.isAdmin()) {
|
||||||
|
return where;
|
||||||
|
}
|
||||||
|
String dataFilterSql = buildDataFilter(currentUser, dataColumns, isSelect);
|
||||||
|
if (StringUtils.isBlank(dataFilterSql)) {
|
||||||
|
return where;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Expression expression = CCJSqlParserUtil.parseExpression(dataFilterSql);
|
||||||
|
if (ObjectUtil.isNotNull(where)) {
|
||||||
|
return new AndExpression(where, expression);
|
||||||
|
} else {
|
||||||
|
return expression;
|
||||||
|
}
|
||||||
|
} catch (JSQLParserException e) {
|
||||||
|
throw new ServiceException("数据权限解析异常 => " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造数据过滤sql
|
||||||
|
*/
|
||||||
|
private String buildDataFilter(SysUser user, DataColumn[] dataColumns, boolean isSelect) {
|
||||||
|
StringBuilder sqlString = new StringBuilder();
|
||||||
|
|
||||||
|
StandardEvaluationContext context = new StandardEvaluationContext();
|
||||||
|
context.setBeanResolver(beanResolver);
|
||||||
|
context.setVariable("user", user);
|
||||||
|
|
||||||
|
for (DataColumn dataColumn : dataColumns) {
|
||||||
|
// 设置注解变量 key 为表达式变量 value 为变量值
|
||||||
|
context.setVariable(dataColumn.key(), dataColumn.value());
|
||||||
|
for (SysRole role : user.getRoles()) {
|
||||||
|
user.setRoleId(role.getRoleId());
|
||||||
|
|
||||||
|
// 获取角色权限泛型
|
||||||
|
DataScopeType type = DataScopeType.findCode(role.getDataScope());
|
||||||
|
if (ObjectUtil.isNull(type)) {
|
||||||
|
throw new ServiceException("角色数据范围异常 => " + role.getDataScope());
|
||||||
|
}
|
||||||
|
// 全部数据权限直接返回
|
||||||
|
if (type == DataScopeType.ALL) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
// 不包含 key 变量 则不处理
|
||||||
|
if (!StringUtils.contains(type.getSqlTemplate(), "#" + dataColumn.key())) {
|
||||||
|
sqlString.append(type.getElseSql());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 更新或删除需满足所有条件
|
||||||
|
sqlString.append(isSelect ? " OR " : " AND ");
|
||||||
|
// 解析sql模板并填充
|
||||||
|
String sql = parser.parseExpression(type.getSqlTemplate(), parserContext).getValue(context, String.class);
|
||||||
|
sqlString.append(sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(sqlString.toString())) {
|
||||||
|
return sqlString.substring(isSelect ? 4 : 5);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private DataColumn[] findAnnotation(String mappedStatementId) {
|
||||||
|
StringBuilder sb = new StringBuilder(mappedStatementId);
|
||||||
|
int index = sb.lastIndexOf(".");
|
||||||
|
String clazzName = sb.substring(0, index);
|
||||||
|
String methodName = sb.substring(index + 1, sb.length());
|
||||||
|
Class<?> clazz = ClassUtil.loadClass(clazzName);
|
||||||
|
List<Method> methods = Arrays.stream(ClassUtil.getDeclaredMethods(clazz))
|
||||||
|
.filter(method -> method.getName().equals(methodName)).collect(Collectors.toList());
|
||||||
|
DataPermission dataPermission;
|
||||||
|
for (Method method : methods) {
|
||||||
|
if (AnnotationUtil.hasAnnotation(method, DataPermission.class)) {
|
||||||
|
dataPermission = AnnotationUtil.getAnnotation(method, DataPermission.class);
|
||||||
|
return dataPermission.value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,96 @@
|
|||||||
|
package com.ruoyi.framework.interceptor;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
|
||||||
|
import com.baomidou.mybatisplus.extension.parser.JsqlParserSupport;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;
|
||||||
|
import com.ruoyi.framework.handler.PlusDataPermissionHandler;
|
||||||
|
import net.sf.jsqlparser.expression.Expression;
|
||||||
|
import net.sf.jsqlparser.statement.delete.Delete;
|
||||||
|
import net.sf.jsqlparser.statement.select.PlainSelect;
|
||||||
|
import net.sf.jsqlparser.statement.select.Select;
|
||||||
|
import net.sf.jsqlparser.statement.select.SelectBody;
|
||||||
|
import net.sf.jsqlparser.statement.select.SetOperationList;
|
||||||
|
import net.sf.jsqlparser.statement.update.Update;
|
||||||
|
import org.apache.ibatis.executor.Executor;
|
||||||
|
import org.apache.ibatis.executor.statement.StatementHandler;
|
||||||
|
import org.apache.ibatis.mapping.BoundSql;
|
||||||
|
import org.apache.ibatis.mapping.MappedStatement;
|
||||||
|
import org.apache.ibatis.mapping.SqlCommandType;
|
||||||
|
import org.apache.ibatis.session.ResultHandler;
|
||||||
|
import org.apache.ibatis.session.RowBounds;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PlusDataPermissionInterceptor extends JsqlParserSupport implements InnerInterceptor {
|
||||||
|
|
||||||
|
private final PlusDataPermissionHandler dataPermissionHandler = new PlusDataPermissionHandler();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException {
|
||||||
|
if (InterceptorIgnoreHelper.willIgnoreDataPermission(ms.getId())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PluginUtils.MPBoundSql mpBs = PluginUtils.mpBoundSql(boundSql);
|
||||||
|
mpBs.sql(parserSingle(mpBs.sql(), ms.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforePrepare(StatementHandler sh, Connection connection, Integer transactionTimeout) {
|
||||||
|
PluginUtils.MPStatementHandler mpSh = PluginUtils.mpStatementHandler(sh);
|
||||||
|
MappedStatement ms = mpSh.mappedStatement();
|
||||||
|
SqlCommandType sct = ms.getSqlCommandType();
|
||||||
|
if (sct == SqlCommandType.UPDATE || sct == SqlCommandType.DELETE) {
|
||||||
|
if (InterceptorIgnoreHelper.willIgnoreDataPermission(ms.getId())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PluginUtils.MPBoundSql mpBs = mpSh.mPBoundSql();
|
||||||
|
mpBs.sql(parserMulti(mpBs.sql(), ms.getId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void processSelect(Select select, int index, String sql, Object obj) {
|
||||||
|
SelectBody selectBody = select.getSelectBody();
|
||||||
|
if (selectBody instanceof PlainSelect) {
|
||||||
|
this.setWhere((PlainSelect) selectBody, (String) obj);
|
||||||
|
} else if (selectBody instanceof SetOperationList) {
|
||||||
|
SetOperationList setOperationList = (SetOperationList) selectBody;
|
||||||
|
List<SelectBody> selectBodyList = setOperationList.getSelects();
|
||||||
|
selectBodyList.forEach(s -> this.setWhere((PlainSelect) s, (String) obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void processUpdate(Update update, int index, String sql, Object obj) {
|
||||||
|
Expression sqlSegment = dataPermissionHandler.getSqlSegment(update.getWhere(), (String) obj, false);
|
||||||
|
if (null != sqlSegment) {
|
||||||
|
update.setWhere(sqlSegment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void processDelete(Delete delete, int index, String sql, Object obj) {
|
||||||
|
Expression sqlSegment = dataPermissionHandler.getSqlSegment(delete.getWhere(), (String) obj, false);
|
||||||
|
if (null != sqlSegment) {
|
||||||
|
delete.setWhere(sqlSegment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置 where 条件
|
||||||
|
*
|
||||||
|
* @param plainSelect 查询对象
|
||||||
|
* @param mappedStatementId 执行方法id
|
||||||
|
*/
|
||||||
|
protected void setWhere(PlainSelect plainSelect, String mappedStatementId) {
|
||||||
|
Expression sqlSegment = dataPermissionHandler.getSqlSegment(plainSelect.getWhere(), mappedStatementId, true);
|
||||||
|
if (null != sqlSegment) {
|
||||||
|
plainSelect.setWhere(sqlSegment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.Interceptor;
|
package com.ruoyi.framework.interceptor;
|
||||||
|
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import com.alibaba.ttl.TransmittableThreadLocal;
|
import com.alibaba.ttl.TransmittableThreadLocal;
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.generator.mapper;
|
package com.ruoyi.generator.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||||
import com.ruoyi.generator.domain.GenTableColumn;
|
import com.ruoyi.generator.domain.GenTableColumn;
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@InterceptorIgnore(dataPermission = "true")
|
||||||
public interface GenTableColumnMapper extends BaseMapperPlus<GenTableColumn> {
|
public interface GenTableColumnMapper extends BaseMapperPlus<GenTableColumn> {
|
||||||
/**
|
/**
|
||||||
* 根据表名称查询列信息
|
* 根据表名称查询列信息
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.generator.mapper;
|
package com.ruoyi.generator.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||||
import com.ruoyi.generator.domain.GenTable;
|
import com.ruoyi.generator.domain.GenTable;
|
||||||
@ -12,6 +13,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@InterceptorIgnore(dataPermission = "true")
|
||||||
public interface GenTableMapper extends BaseMapperPlus<GenTable> {
|
public interface GenTableMapper extends BaseMapperPlus<GenTable> {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
|||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.utils.JsonUtils;
|
import com.ruoyi.common.utils.JsonUtils;
|
||||||
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.file.FileUtils;
|
import com.ruoyi.common.utils.file.FileUtils;
|
||||||
@ -69,14 +68,14 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<GenTable> selectPageGenTableList(GenTable genTable, PageQuery pageQuery) {
|
public TableDataInfo<GenTable> selectPageGenTableList(GenTable genTable, PageQuery pageQuery) {
|
||||||
Page<GenTable> page = baseMapper.selectPageGenTableList(PageUtils.buildPage(pageQuery), genTable);
|
Page<GenTable> page = baseMapper.selectPageGenTableList(pageQuery.build(), genTable);
|
||||||
return PageUtils.buildDataInfo(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<GenTable> selectPageDbTableList(GenTable genTable, PageQuery pageQuery) {
|
public TableDataInfo<GenTable> selectPageDbTableList(GenTable genTable, PageQuery pageQuery) {
|
||||||
Page<GenTable> page = baseMapper.selectPageDbTableList(PageUtils.buildPage(pageQuery), genTable);
|
Page<GenTable> page = baseMapper.selectPageDbTableList(pageQuery.build(), genTable);
|
||||||
return PageUtils.buildDataInfo(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark" />
|
||||||
<collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" />
|
<collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap type="GenTableColumn" id="GenTableColumnResult">
|
<resultMap type="GenTableColumn" id="GenTableColumnResult">
|
||||||
<id property="columnId" column="column_id" />
|
<id property="columnId" column="column_id" />
|
||||||
<result property="tableId" column="table_id" />
|
<result property="tableId" column="table_id" />
|
||||||
@ -52,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectGenTableVo">
|
<sql id="selectGenTableVo">
|
||||||
select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table
|
select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table
|
||||||
</sql>
|
</sql>
|
||||||
@ -78,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<select id="selectPageDbTableList" parameterType="GenTable" resultMap="GenTableResult">
|
<select id="selectPageDbTableList" parameterType="GenTable" resultMap="GenTableResult">
|
||||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||||
where table_schema = (select database())
|
where table_schema = (select database())
|
||||||
AND table_name NOT LIKE 'qrtz_%' AND table_name NOT LIKE 'gen_%'
|
AND table_name NOT LIKE 'xxl_job_%' AND table_name NOT LIKE 'gen_%'
|
||||||
AND table_name NOT IN (select table_name from gen_table)
|
AND table_name NOT IN (select table_name from gen_table)
|
||||||
<if test="genTable.tableName != null and genTable.tableName != ''">
|
<if test="genTable.tableName != null and genTable.tableName != ''">
|
||||||
AND lower(table_name) like lower(concat('%', #{genTable.tableName}, '%'))
|
AND lower(table_name) like lower(concat('%', #{genTable.tableName}, '%'))
|
||||||
@ -117,7 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">
|
<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">
|
||||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||||
where table_schema = (select database())
|
where table_schema = (select database())
|
||||||
AND table_name NOT LIKE 'qrtz_%' AND table_name NOT LIKE 'gen_%'
|
AND table_name NOT LIKE 'xxl_job_%' AND table_name NOT LIKE 'gen_%'
|
||||||
AND table_name NOT IN (select table_name from gen_table)
|
AND table_name NOT IN (select table_name from gen_table)
|
||||||
<if test="tableName != null and tableName != ''">
|
<if test="tableName != null and tableName != ''">
|
||||||
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
|
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
|
||||||
@ -133,22 +133,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</if>
|
</if>
|
||||||
order by create_time desc
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDbTableListByNames" resultMap="GenTableResult">
|
<select id="selectDbTableListByNames" resultMap="GenTableResult">
|
||||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||||
where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
|
where table_name NOT LIKE 'xxl_job_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
|
||||||
and table_name in
|
and table_name in
|
||||||
<foreach collection="array" item="name" open="(" separator="," close=")">
|
<foreach collection="array" item="name" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
|
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
|
||||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||||
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
|
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
|
||||||
and table_name = #{tableName}
|
and table_name = #{tableName}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
|
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
@ -156,7 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
where t.table_id = #{tableId} order by c.sort
|
where t.table_id = #{tableId} order by c.sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
|
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
@ -164,7 +164,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
where t.table_name = #{tableName} order by c.sort
|
where t.table_name = #{tableName} order by c.sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
|
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark,
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark,
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
@ -173,4 +173,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
order by c.sort
|
order by c.sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -70,7 +70,7 @@ public class ${ClassName}Controller extends BaseController {
|
|||||||
@ApiOperation("导出${functionName}列表")
|
@ApiOperation("导出${functionName}列表")
|
||||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
|
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(@Validated ${ClassName}Bo bo, HttpServletResponse response) {
|
public void export(@Validated ${ClassName}Bo bo, HttpServletResponse response) {
|
||||||
List<${ClassName}Vo> list = i${ClassName}Service.queryList(bo);
|
List<${ClassName}Vo> list = i${ClassName}Service.queryList(bo);
|
||||||
ExcelUtil.exportExcel(list, "${functionName}", ${ClassName}Vo.class, response);
|
ExcelUtil.exportExcel(list, "${functionName}", ${ClassName}Vo.class, response);
|
||||||
|
|||||||
@ -3,8 +3,6 @@ package ${packageName}.service.impl;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
#if($table.crud || $table.sub)
|
#if($table.crud || $table.sub)
|
||||||
import com.ruoyi.common.utils.PageUtils;
|
|
||||||
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.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
#end
|
#end
|
||||||
@ -40,8 +38,8 @@ public class ${ClassName}ServiceImpl extends ServicePlusImpl<${ClassName}Mapper,
|
|||||||
@Override
|
@Override
|
||||||
public TableDataInfo<${ClassName}Vo> queryPageList(${ClassName}Bo bo, PageQuery pageQuery) {
|
public TableDataInfo<${ClassName}Vo> queryPageList(${ClassName}Bo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<${ClassName}> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<${ClassName}> lqw = buildQueryWrapper(bo);
|
||||||
PagePlus<${ClassName}, ${ClassName}Vo> result = pageVo(PageUtils.buildPagePlus(pageQuery), lqw);
|
Page<${ClassName}Vo> result = pageVo(pageQuery.build(), lqw);
|
||||||
return PageUtils.buildDataInfo(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.ruoyi.system.domain;
|
|||||||
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.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import com.ruoyi.common.xss.Xss;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@ -11,6 +12,7 @@ import lombok.experimental.Accessors;
|
|||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告表 sys_notice
|
* 通知公告表 sys_notice
|
||||||
*
|
*
|
||||||
@ -32,6 +34,7 @@ public class SysNotice extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 公告标题
|
* 公告标题
|
||||||
*/
|
*/
|
||||||
|
@Xss(message = "公告标题不能包含脚本字符")
|
||||||
@ApiModelProperty(value = "公告标题")
|
@ApiModelProperty(value = "公告标题")
|
||||||
@NotBlank(message = "公告标题不能为空")
|
@NotBlank(message = "公告标题不能为空")
|
||||||
@Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
|
@Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
|
||||||
|
|||||||
@ -22,7 +22,7 @@ public class SysOssConfig extends BaseEntity {
|
|||||||
* 主建
|
* 主建
|
||||||
*/
|
*/
|
||||||
@TableId(value = "oss_config_id")
|
@TableId(value = "oss_config_id")
|
||||||
private Integer ossConfigId;
|
private Long ossConfigId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置key
|
* 配置key
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import com.ruoyi.common.excel.ExcelResult;
|
|||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
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.ValidatorUtils;
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import com.ruoyi.system.domain.vo.SysUserImportVo;
|
import com.ruoyi.system.domain.vo.SysUserImportVo;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
@ -53,12 +54,14 @@ public class SysUserImportListener extends AnalysisEventListener<SysUserImportVo
|
|||||||
// 验证是否存在这个用户
|
// 验证是否存在这个用户
|
||||||
if (StringUtils.isNull(user)) {
|
if (StringUtils.isNull(user)) {
|
||||||
user = BeanUtil.toBean(userVo, SysUser.class);
|
user = BeanUtil.toBean(userVo, SysUser.class);
|
||||||
|
ValidatorUtils.validate(user);
|
||||||
user.setPassword(password);
|
user.setPassword(password);
|
||||||
user.setCreateBy(operName);
|
user.setCreateBy(operName);
|
||||||
userService.insertUser(user);
|
userService.insertUser(user);
|
||||||
successNum++;
|
successNum++;
|
||||||
successMsg.append("<br/>").append(successNum).append("、账号 ").append(user.getUserName()).append(" 导入成功");
|
successMsg.append("<br/>").append(successNum).append("、账号 ").append(user.getUserName()).append(" 导入成功");
|
||||||
} else if (isUpdateSupport) {
|
} else if (isUpdateSupport) {
|
||||||
|
ValidatorUtils.validate(user);
|
||||||
user.setUpdateBy(operName);
|
user.setUpdateBy(operName);
|
||||||
userService.updateUser(user);
|
userService.updateUser(user);
|
||||||
successNum++;
|
successNum++;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.DataColumn;
|
||||||
|
import com.ruoyi.common.annotation.DataPermission;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@ -19,6 +21,9 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept> {
|
|||||||
* @param dept 部门信息
|
* @param dept 部门信息
|
||||||
* @return 部门信息集合
|
* @return 部门信息集合
|
||||||
*/
|
*/
|
||||||
|
@DataPermission({
|
||||||
|
@DataColumn(key = "deptName", value = "d.dept_id")
|
||||||
|
})
|
||||||
List<SysDept> selectDeptList(SysDept dept);
|
List<SysDept> selectDeptList(SysDept dept);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.common.annotation.DataColumn;
|
||||||
|
import com.ruoyi.common.annotation.DataPermission;
|
||||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@ -14,6 +16,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface SysRoleMapper extends BaseMapperPlus<SysRole> {
|
public interface SysRoleMapper extends BaseMapperPlus<SysRole> {
|
||||||
|
|
||||||
|
@DataPermission({
|
||||||
|
@DataColumn(key = "deptName", value = "d.dept_id")
|
||||||
|
})
|
||||||
Page<SysRole> selectPageRoleList(@Param("page") Page<SysRole> page, @Param("role") SysRole role);
|
Page<SysRole> selectPageRoleList(@Param("page") Page<SysRole> page, @Param("role") SysRole role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,6 +27,9 @@ public interface SysRoleMapper extends BaseMapperPlus<SysRole> {
|
|||||||
* @param role 角色信息
|
* @param role 角色信息
|
||||||
* @return 角色数据集合信息
|
* @return 角色数据集合信息
|
||||||
*/
|
*/
|
||||||
|
@DataPermission({
|
||||||
|
@DataColumn(key = "deptName", value = "d.dept_id")
|
||||||
|
})
|
||||||
List<SysRole> selectRoleList(SysRole role);
|
List<SysRole> selectRoleList(SysRole role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.common.annotation.DataColumn;
|
||||||
|
import com.ruoyi.common.annotation.DataPermission;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@ -14,6 +16,10 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface SysUserMapper extends BaseMapperPlus<SysUser> {
|
public interface SysUserMapper extends BaseMapperPlus<SysUser> {
|
||||||
|
|
||||||
|
@DataPermission({
|
||||||
|
@DataColumn(key = "deptName", value = "d.dept_id"),
|
||||||
|
@DataColumn(key = "userName", value = "u.user_id")
|
||||||
|
})
|
||||||
Page<SysUser> selectPageUserList(@Param("page") Page<SysUser> page, @Param("user") SysUser user);
|
Page<SysUser> selectPageUserList(@Param("page") Page<SysUser> page, @Param("user") SysUser user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,6 +28,10 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser> {
|
|||||||
* @param sysUser 用户信息
|
* @param sysUser 用户信息
|
||||||
* @return 用户信息集合信息
|
* @return 用户信息集合信息
|
||||||
*/
|
*/
|
||||||
|
@DataPermission({
|
||||||
|
@DataColumn(key = "deptName", value = "d.dept_id"),
|
||||||
|
@DataColumn(key = "userName", value = "u.user_id")
|
||||||
|
})
|
||||||
List<SysUser> selectUserList(SysUser sysUser);
|
List<SysUser> selectUserList(SysUser sysUser);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,6 +40,10 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser> {
|
|||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
* @return 用户信息集合信息
|
* @return 用户信息集合信息
|
||||||
*/
|
*/
|
||||||
|
@DataPermission({
|
||||||
|
@DataColumn(key = "deptName", value = "d.dept_id"),
|
||||||
|
@DataColumn(key = "userName", value = "u.user_id")
|
||||||
|
})
|
||||||
Page<SysUser> selectAllocatedList(@Param("page") Page<SysUser> page, @Param("user") SysUser user);
|
Page<SysUser> selectAllocatedList(@Param("page") Page<SysUser> page, @Param("user") SysUser user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,6 +52,10 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser> {
|
|||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
* @return 用户信息集合信息
|
* @return 用户信息集合信息
|
||||||
*/
|
*/
|
||||||
|
@DataPermission({
|
||||||
|
@DataColumn(key = "deptName", value = "d.dept_id"),
|
||||||
|
@DataColumn(key = "userName", value = "u.user_id")
|
||||||
|
})
|
||||||
Page<SysUser> selectUnallocatedList(@Param("page") Page<SysUser> page, @Param("user") SysUser user);
|
Page<SysUser> selectUnallocatedList(@Param("page") Page<SysUser> page, @Param("user") SysUser user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用 数据权限 服务
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public interface SysDataScopeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取角色自定义权限
|
||||||
|
* @param roleId 角色id
|
||||||
|
* @return 部门id组
|
||||||
|
*/
|
||||||
|
String getRoleCustom(Long roleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门及以下权限
|
||||||
|
* @param deptId 部门id
|
||||||
|
* @return 部门id组
|
||||||
|
*/
|
||||||
|
String getDeptAndChild(Long deptId);
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,18 +1,16 @@
|
|||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.common.annotation.DataSource;
|
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.core.service.ConfigService;
|
import com.ruoyi.common.core.service.ConfigService;
|
||||||
import com.ruoyi.common.enums.DataSourceType;
|
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.utils.PageUtils;
|
|
||||||
import com.ruoyi.common.utils.RedisUtils;
|
import com.ruoyi.common.utils.RedisUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.domain.SysConfig;
|
import com.ruoyi.system.domain.SysConfig;
|
||||||
@ -42,8 +40,8 @@ public class SysConfigServiceImpl extends ServicePlusImpl<SysConfigMapper, SysCo
|
|||||||
.like(StringUtils.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey())
|
.like(StringUtils.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey())
|
||||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||||
SysConfig::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
SysConfig::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
||||||
Page<SysConfig> page = page(PageUtils.buildPage(pageQuery), lqw);
|
Page<SysConfig> page = page(pageQuery.build(), lqw);
|
||||||
return PageUtils.buildDataInfo(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,7 +51,7 @@ public class SysConfigServiceImpl extends ServicePlusImpl<SysConfigMapper, SysCo
|
|||||||
* @return 参数配置信息
|
* @return 参数配置信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@DataSource(DataSourceType.MASTER)
|
@DS("master")
|
||||||
public SysConfig selectConfigById(Long configId) {
|
public SysConfig selectConfigById(Long configId) {
|
||||||
return baseMapper.selectById(configId);
|
return baseMapper.selectById(configId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,50 @@
|
|||||||
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
|
import com.ruoyi.system.domain.SysRoleDept;
|
||||||
|
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||||
|
import com.ruoyi.system.mapper.SysRoleDeptMapper;
|
||||||
|
import com.ruoyi.system.service.SysDataScopeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service("sdss")
|
||||||
|
public class SysDataScopeServiceImpl implements SysDataScopeService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysRoleDeptMapper roleDeptMapper;
|
||||||
|
@Autowired
|
||||||
|
private SysDeptMapper deptMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRoleCustom(Long roleId) {
|
||||||
|
List<SysRoleDept> list = roleDeptMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<SysRoleDept>()
|
||||||
|
.select(SysRoleDept::getDeptId)
|
||||||
|
.eq(SysRoleDept::getRoleId, roleId));
|
||||||
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
|
return list.stream().map(rd -> Convert.toStr(rd.getDeptId())).collect(Collectors.joining(","));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDeptAndChild(Long deptId) {
|
||||||
|
List<SysDept> list = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
||||||
|
.select(SysDept::getDeptId)
|
||||||
|
.eq(SysDept::getDeptId, deptId)
|
||||||
|
.or()
|
||||||
|
.apply("find_in_set({0},ancestors)", deptId));
|
||||||
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
|
return list.stream().map(d -> Convert.toStr(d.getDeptId())).collect(Collectors.joining(","));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,10 +1,10 @@
|
|||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.lang.tree.Tree;
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
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.ruoyi.common.annotation.DataScope;
|
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
@ -46,8 +46,9 @@ public class SysDeptServiceImpl extends ServicePlusImpl<SysDeptMapper, SysDept,
|
|||||||
* @return 部门信息集合
|
* @return 部门信息集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "d")
|
|
||||||
public List<SysDept> selectDeptList(SysDept dept) {
|
public List<SysDept> selectDeptList(SysDept dept) {
|
||||||
|
// return baseMapper.selectList();
|
||||||
|
// return baseMapper.selectList(new LambdaQueryWrapper<>());
|
||||||
return baseMapper.selectDeptList(dept);
|
return baseMapper.selectDeptList(dept);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +60,11 @@ public class SysDeptServiceImpl extends ServicePlusImpl<SysDeptMapper, SysDept,
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Tree<Long>> buildDeptTreeSelect(List<SysDept> depts) {
|
public List<Tree<Long>> buildDeptTreeSelect(List<SysDept> depts) {
|
||||||
return TreeBuildUtils.build(depts, (dept, tree) ->
|
if (CollUtil.isEmpty(depts)) {
|
||||||
|
return CollUtil.newArrayList();
|
||||||
|
}
|
||||||
|
Long parentId = depts.get(0).getParentId();
|
||||||
|
return TreeBuildUtils.build(depts, parentId, (dept, tree) ->
|
||||||
tree.setId(dept.getDeptId())
|
tree.setId(dept.getDeptId())
|
||||||
.setParentId(dept.getParentId())
|
.setParentId(dept.getParentId())
|
||||||
.setName(dept.getDeptName())
|
.setName(dept.getDeptName())
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import com.ruoyi.common.core.domain.PageQuery;
|
|||||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.PageUtils;
|
|
||||||
import com.ruoyi.common.utils.RedisUtils;
|
import com.ruoyi.common.utils.RedisUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.mapper.SysDictDataMapper;
|
import com.ruoyi.system.mapper.SysDictDataMapper;
|
||||||
@ -31,8 +30,8 @@ public class SysDictDataServiceImpl extends ServicePlusImpl<SysDictDataMapper, S
|
|||||||
.like(StringUtils.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel())
|
.like(StringUtils.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel())
|
||||||
.eq(StringUtils.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus())
|
.eq(StringUtils.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus())
|
||||||
.orderByAsc(SysDictData::getDictSort);
|
.orderByAsc(SysDictData::getDictSort);
|
||||||
Page<SysDictData> page = page(PageUtils.buildPage(pageQuery), lqw);
|
Page<SysDictData> page = page(pageQuery.build(), lqw);
|
||||||
return PageUtils.buildDataInfo(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
|||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.core.service.DictService;
|
import com.ruoyi.common.core.service.DictService;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.utils.PageUtils;
|
|
||||||
import com.ruoyi.common.utils.RedisUtils;
|
import com.ruoyi.common.utils.RedisUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.mapper.SysDictDataMapper;
|
import com.ruoyi.system.mapper.SysDictDataMapper;
|
||||||
@ -48,8 +47,8 @@ public class SysDictTypeServiceImpl extends ServicePlusImpl<SysDictTypeMapper, S
|
|||||||
.like(StringUtils.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType())
|
.like(StringUtils.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType())
|
||||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||||
SysDictType::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
SysDictType::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
||||||
Page<SysDictType> page = page(PageUtils.buildPage(pageQuery), lqw);
|
Page<SysDictType> page = page(pageQuery.build(), lqw);
|
||||||
return PageUtils.buildDataInfo(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import com.ruoyi.common.core.domain.PageQuery;
|
|||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.core.service.LogininforService;
|
import com.ruoyi.common.core.service.LogininforService;
|
||||||
import com.ruoyi.common.utils.PageUtils;
|
|
||||||
import com.ruoyi.common.utils.ServletUtils;
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.ip.AddressUtils;
|
import com.ruoyi.common.utils.ip.AddressUtils;
|
||||||
@ -100,8 +99,8 @@ public class SysLogininforServiceImpl extends ServicePlusImpl<SysLogininforMappe
|
|||||||
if(StringUtils.isBlank(pageQuery.getOrderByColumn())) {
|
if(StringUtils.isBlank(pageQuery.getOrderByColumn())) {
|
||||||
pageQuery.setOrderByColumn("info_id").setIsAsc("desc");
|
pageQuery.setOrderByColumn("info_id").setIsAsc("desc");
|
||||||
}
|
}
|
||||||
Page<SysLogininfor> page = page(PageUtils.buildPage(pageQuery), lqw);
|
Page<SysLogininfor> page = page(pageQuery.build(), lqw);
|
||||||
return PageUtils.buildDataInfo(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.lang.tree.Tree;
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
@ -157,7 +158,7 @@ public class SysMenuServiceImpl extends ServicePlusImpl<SysMenuMapper, SysMenu,
|
|||||||
router.setPath("/inner");
|
router.setPath("/inner");
|
||||||
List<RouterVo> childrenList = new ArrayList<RouterVo>();
|
List<RouterVo> childrenList = new ArrayList<RouterVo>();
|
||||||
RouterVo children = new RouterVo();
|
RouterVo children = new RouterVo();
|
||||||
String routerPath = StringUtils.replaceEach(menu.getPath(), new String[]{Constants.HTTP, Constants.HTTPS}, new String[]{"", ""});
|
String routerPath = innerLinkReplaceEach(menu.getPath());
|
||||||
children.setPath(routerPath);
|
children.setPath(routerPath);
|
||||||
children.setComponent(UserConstants.INNER_LINK);
|
children.setComponent(UserConstants.INNER_LINK);
|
||||||
children.setName(StringUtils.capitalize(routerPath));
|
children.setName(StringUtils.capitalize(routerPath));
|
||||||
@ -178,7 +179,11 @@ public class SysMenuServiceImpl extends ServicePlusImpl<SysMenuMapper, SysMenu,
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Tree<Long>> buildMenuTreeSelect(List<SysMenu> menus) {
|
public List<Tree<Long>> buildMenuTreeSelect(List<SysMenu> menus) {
|
||||||
return TreeBuildUtils.build(menus, (menu, tree) ->
|
if (CollUtil.isEmpty(menus)) {
|
||||||
|
return CollUtil.newArrayList();
|
||||||
|
}
|
||||||
|
Long parentId = menus.get(0).getParentId();
|
||||||
|
return TreeBuildUtils.build(menus, parentId, (menu, tree) ->
|
||||||
tree.setId(menu.getMenuId())
|
tree.setId(menu.getMenuId())
|
||||||
.setParentId(menu.getParentId())
|
.setParentId(menu.getParentId())
|
||||||
.setName(menu.getMenuName())
|
.setName(menu.getMenuName())
|
||||||
@ -297,7 +302,7 @@ public class SysMenuServiceImpl extends ServicePlusImpl<SysMenuMapper, SysMenu,
|
|||||||
String routerPath = menu.getPath();
|
String routerPath = menu.getPath();
|
||||||
// 内链打开外网方式
|
// 内链打开外网方式
|
||||||
if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) {
|
if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) {
|
||||||
routerPath = StringUtils.replaceEach(routerPath, new String[]{Constants.HTTP, Constants.HTTPS}, new String[]{"", ""});
|
routerPath = innerLinkReplaceEach(routerPath);
|
||||||
}
|
}
|
||||||
// 非外链并且是一级目录(类型为目录)
|
// 非外链并且是一级目录(类型为目录)
|
||||||
if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType())
|
if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType())
|
||||||
@ -415,4 +420,15 @@ public class SysMenuServiceImpl extends ServicePlusImpl<SysMenuMapper, SysMenu,
|
|||||||
private boolean hasChild(List<SysMenu> list, SysMenu t) {
|
private boolean hasChild(List<SysMenu> list, SysMenu t) {
|
||||||
return getChildList(list, t).size() > 0;
|
return getChildList(list, t).size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内链域名特殊字符替换
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String innerLinkReplaceEach(String path)
|
||||||
|
{
|
||||||
|
return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS },
|
||||||
|
new String[] { "", "" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.PageUtils;
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.domain.SysNotice;
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
import com.ruoyi.system.mapper.SysNoticeMapper;
|
import com.ruoyi.system.mapper.SysNoticeMapper;
|
||||||
@ -29,8 +28,8 @@ public class SysNoticeServiceImpl extends ServicePlusImpl<SysNoticeMapper, SysNo
|
|||||||
.like(StringUtils.isNotBlank(notice.getNoticeTitle()), SysNotice::getNoticeTitle, notice.getNoticeTitle())
|
.like(StringUtils.isNotBlank(notice.getNoticeTitle()), SysNotice::getNoticeTitle, notice.getNoticeTitle())
|
||||||
.eq(StringUtils.isNotBlank(notice.getNoticeType()), SysNotice::getNoticeType, notice.getNoticeType())
|
.eq(StringUtils.isNotBlank(notice.getNoticeType()), SysNotice::getNoticeType, notice.getNoticeType())
|
||||||
.like(StringUtils.isNotBlank(notice.getCreateBy()), SysNotice::getCreateBy, notice.getCreateBy());
|
.like(StringUtils.isNotBlank(notice.getCreateBy()), SysNotice::getCreateBy, notice.getCreateBy());
|
||||||
Page<SysNotice> page = page(PageUtils.buildPage(pageQuery), lqw);
|
Page<SysNotice> page = page(pageQuery.build(), lqw);
|
||||||
return PageUtils.buildDataInfo(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import com.ruoyi.common.core.domain.dto.OperLogDTO;
|
|||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.core.service.OperLogService;
|
import com.ruoyi.common.core.service.OperLogService;
|
||||||
import com.ruoyi.common.utils.PageUtils;
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.ip.AddressUtils;
|
import com.ruoyi.common.utils.ip.AddressUtils;
|
||||||
import com.ruoyi.system.domain.SysOperLog;
|
import com.ruoyi.system.domain.SysOperLog;
|
||||||
@ -65,8 +64,8 @@ public class SysOperLogServiceImpl extends ServicePlusImpl<SysOperLogMapper, Sys
|
|||||||
if(StringUtils.isBlank(pageQuery.getOrderByColumn())) {
|
if(StringUtils.isBlank(pageQuery.getOrderByColumn())) {
|
||||||
pageQuery.setOrderByColumn("oper_id").setIsAsc("desc");
|
pageQuery.setOrderByColumn("oper_id").setIsAsc("desc");
|
||||||
}
|
}
|
||||||
Page<SysOperLog> page = page(PageUtils.buildPage(pageQuery), lqw);
|
Page<SysOperLog> page = page(pageQuery.build(), lqw);
|
||||||
return PageUtils.buildDataInfo(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -5,15 +5,14 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
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.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
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.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.utils.JsonUtils;
|
import com.ruoyi.common.utils.JsonUtils;
|
||||||
import com.ruoyi.common.utils.PageUtils;
|
|
||||||
import com.ruoyi.common.utils.RedisUtils;
|
import com.ruoyi.common.utils.RedisUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.oss.constant.OssConstant;
|
import com.ruoyi.oss.constant.OssConstant;
|
||||||
@ -70,8 +69,8 @@ public class SysOssConfigServiceImpl extends ServicePlusImpl<SysOssConfigMapper,
|
|||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysOssConfigVo> queryPageList(SysOssConfigBo bo, PageQuery pageQuery) {
|
public TableDataInfo<SysOssConfigVo> queryPageList(SysOssConfigBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysOssConfig> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<SysOssConfig> lqw = buildQueryWrapper(bo);
|
||||||
PagePlus<SysOssConfig, SysOssConfigVo> result = pageVo(PageUtils.buildPagePlus(pageQuery), lqw);
|
Page<SysOssConfigVo> result = pageVo(pageQuery.build(), lqw);
|
||||||
return PageUtils.buildDataInfo(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,12 +2,11 @@ package com.ruoyi.system.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
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.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.utils.PageUtils;
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.oss.entity.UploadResult;
|
import com.ruoyi.oss.entity.UploadResult;
|
||||||
import com.ruoyi.oss.factory.OssFactory;
|
import com.ruoyi.oss.factory.OssFactory;
|
||||||
@ -36,8 +35,8 @@ public class SysOssServiceImpl extends ServicePlusImpl<SysOssMapper, SysOss, Sys
|
|||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysOssVo> queryPageList(SysOssBo bo, PageQuery pageQuery) {
|
public TableDataInfo<SysOssVo> queryPageList(SysOssBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysOss> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<SysOss> lqw = buildQueryWrapper(bo);
|
||||||
PagePlus<SysOss, SysOssVo> result = pageVo(PageUtils.buildPagePlus(pageQuery), lqw);
|
Page<SysOssVo> result = pageVo(pageQuery.build(), lqw);
|
||||||
return PageUtils.buildDataInfo(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LambdaQueryWrapper<SysOss> buildQueryWrapper(SysOssBo bo) {
|
private LambdaQueryWrapper<SysOss> buildQueryWrapper(SysOssBo bo) {
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import com.ruoyi.common.core.domain.PageQuery;
|
|||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.utils.PageUtils;
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
import com.ruoyi.system.domain.SysUserPost;
|
import com.ruoyi.system.domain.SysUserPost;
|
||||||
@ -37,8 +36,8 @@ public class SysPostServiceImpl extends ServicePlusImpl<SysPostMapper, SysPost,
|
|||||||
.like(StringUtils.isNotBlank(post.getPostCode()), SysPost::getPostCode, post.getPostCode())
|
.like(StringUtils.isNotBlank(post.getPostCode()), SysPost::getPostCode, post.getPostCode())
|
||||||
.eq(StringUtils.isNotBlank(post.getStatus()), SysPost::getStatus, post.getStatus())
|
.eq(StringUtils.isNotBlank(post.getStatus()), SysPost::getStatus, post.getStatus())
|
||||||
.like(StringUtils.isNotBlank(post.getPostName()), SysPost::getPostName, post.getPostName());
|
.like(StringUtils.isNotBlank(post.getPostName()), SysPost::getPostName, post.getPostName());
|
||||||
Page<SysPost> page = page(PageUtils.buildPage(pageQuery), lqw);
|
Page<SysPost> page = page(pageQuery.build(), lqw);
|
||||||
return PageUtils.buildDataInfo(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package com.ruoyi.system.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
@ -10,7 +9,6 @@ import com.ruoyi.common.core.domain.entity.SysUser;
|
|||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
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.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
@ -46,10 +44,9 @@ public class SysRoleServiceImpl extends ServicePlusImpl<SysRoleMapper, SysRole,
|
|||||||
private SysRoleDeptMapper roleDeptMapper;
|
private SysRoleDeptMapper roleDeptMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "d")
|
|
||||||
public TableDataInfo<SysRole> selectPageRoleList(SysRole role, PageQuery pageQuery) {
|
public TableDataInfo<SysRole> selectPageRoleList(SysRole role, PageQuery pageQuery) {
|
||||||
Page<SysRole> page = baseMapper.selectPageRoleList(PageUtils.buildPage(pageQuery), role);
|
Page<SysRole> page = baseMapper.selectPageRoleList(pageQuery.build(), role);
|
||||||
return PageUtils.buildDataInfo(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +56,6 @@ public class SysRoleServiceImpl extends ServicePlusImpl<SysRoleMapper, SysRole,
|
|||||||
* @return 角色数据集合信息
|
* @return 角色数据集合信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "d")
|
|
||||||
public List<SysRole> selectRoleList(SysRole role) {
|
public List<SysRole> selectRoleList(SysRole role) {
|
||||||
return baseMapper.selectRoleList(role);
|
return baseMapper.selectRoleList(role);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
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;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
@ -13,7 +12,6 @@ import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
|||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.core.service.UserService;
|
import com.ruoyi.common.core.service.UserService;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
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.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
@ -54,10 +52,9 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
|
|||||||
private SysUserPostMapper userPostMapper;
|
private SysUserPostMapper userPostMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "d", userAlias = "u", isUser = true)
|
|
||||||
public TableDataInfo<SysUser> selectPageUserList(SysUser user, PageQuery pageQuery) {
|
public TableDataInfo<SysUser> selectPageUserList(SysUser user, PageQuery pageQuery) {
|
||||||
Page<SysUser> page = baseMapper.selectPageUserList(PageUtils.buildPage(pageQuery), user);
|
Page<SysUser> page = baseMapper.selectPageUserList(pageQuery.build(), user);
|
||||||
return PageUtils.buildDataInfo(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,7 +64,6 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
|
|||||||
* @return 用户信息集合信息
|
* @return 用户信息集合信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "d", userAlias = "u", isUser = true)
|
|
||||||
public List<SysUser> selectUserList(SysUser user) {
|
public List<SysUser> selectUserList(SysUser user) {
|
||||||
return baseMapper.selectUserList(user);
|
return baseMapper.selectUserList(user);
|
||||||
}
|
}
|
||||||
@ -79,10 +75,9 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
|
|||||||
* @return 用户信息集合信息
|
* @return 用户信息集合信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "d", userAlias = "u", isUser = true)
|
|
||||||
public TableDataInfo<SysUser> selectAllocatedList(SysUser user, PageQuery pageQuery) {
|
public TableDataInfo<SysUser> selectAllocatedList(SysUser user, PageQuery pageQuery) {
|
||||||
Page<SysUser> page = baseMapper.selectAllocatedList(PageUtils.buildPage(pageQuery), user);
|
Page<SysUser> page = baseMapper.selectAllocatedList(pageQuery.build(), user);
|
||||||
return PageUtils.buildDataInfo(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -92,10 +87,9 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
|
|||||||
* @return 用户信息集合信息
|
* @return 用户信息集合信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "d", userAlias = "u", isUser = true)
|
|
||||||
public TableDataInfo<SysUser> selectUnallocatedList(SysUser user, PageQuery pageQuery) {
|
public TableDataInfo<SysUser> selectUnallocatedList(SysUser user, PageQuery pageQuery) {
|
||||||
Page<SysUser> page = baseMapper.selectUnallocatedList(PageUtils.buildPage(pageQuery), user);
|
Page<SysUser> page = baseMapper.selectUnallocatedList(pageQuery.build(), user);
|
||||||
return PageUtils.buildDataInfo(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -42,17 +42,17 @@
|
|||||||
<if test="status != null and status != ''">
|
<if test="status != null and status != ''">
|
||||||
AND status = #{status}
|
AND status = #{status}
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- <!– 数据范围过滤 –>-->
|
||||||
<if test="params.dataScope != null and params.dataScope != ''">
|
<!-- <if test="params.dataScope != null and params.dataScope != ''">-->
|
||||||
AND ( ${params.dataScope} )
|
<!-- AND ( ${params.dataScope} )-->
|
||||||
</if>
|
<!-- </if>-->
|
||||||
order by d.parent_id, d.order_num
|
order by d.parent_id, d.order_num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeptListByRoleId" resultType="Long">
|
<select id="selectDeptListByRoleId" resultType="Long">
|
||||||
select d.dept_id
|
select d.dept_id
|
||||||
from sys_dept d
|
from sys_dept d
|
||||||
left join sys_role_dept rd on d.dept_id = rd.dept_id
|
left join sys_role_dept rd on d.dept_id = rd.dept_id
|
||||||
where rd.role_id = #{roleId}
|
where rd.role_id = #{roleId}
|
||||||
<if test="deptCheckStrictly">
|
<if test="deptCheckStrictly">
|
||||||
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
|
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
|
||||||
|
|||||||
@ -60,10 +60,10 @@
|
|||||||
<if test="role.params.endTime != null and role.params.endTime != ''"><!-- 结束时间检索 -->
|
<if test="role.params.endTime != null and role.params.endTime != ''"><!-- 结束时间检索 -->
|
||||||
and date_format(r.create_time,'%y%m%d') <= date_format(#{role.params.endTime},'%y%m%d')
|
and date_format(r.create_time,'%y%m%d') <= date_format(#{role.params.endTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- <!– 数据范围过滤 –>-->
|
||||||
<if test="role.params.dataScope != null and role.params.dataScope != ''">
|
<!-- <if test="role.params.dataScope != null and role.params.dataScope != ''">-->
|
||||||
AND ( ${role.params.dataScope} )
|
<!-- AND ( ${role.params.dataScope} )-->
|
||||||
</if>
|
<!-- </if>-->
|
||||||
order by r.role_sort
|
order by r.role_sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -88,10 +88,10 @@
|
|||||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||||
and date_format(r.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
and date_format(r.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- <!– 数据范围过滤 –>-->
|
||||||
<if test="params.dataScope != null and params.dataScope != ''">
|
<!-- <if test="params.dataScope != null and params.dataScope != ''">-->
|
||||||
AND ( ${params.dataScope} )
|
<!-- AND ( ${params.dataScope} )-->
|
||||||
</if>
|
<!-- </if>-->
|
||||||
order by r.role_sort
|
order by r.role_sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@ -108,10 +108,10 @@
|
|||||||
AND (u.dept_id = #{user.deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{user.deptId},
|
AND (u.dept_id = #{user.deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{user.deptId},
|
||||||
ancestors) ))
|
ancestors) ))
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- <!– 数据范围过滤 –>-->
|
||||||
<if test="user.params.dataScope != null and user.params.dataScope != ''">
|
<!-- <if test="user.params.dataScope != null and user.params.dataScope != ''">-->
|
||||||
AND ( ${user.params.dataScope} )
|
<!-- AND ( ${user.params.dataScope} )-->
|
||||||
</if>
|
<!-- </if>-->
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
||||||
@ -142,10 +142,10 @@
|
|||||||
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
|
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
|
||||||
ancestors) ))
|
ancestors) ))
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- <!– 数据范围过滤 –>-->
|
||||||
<if test="params.dataScope != null and params.dataScope != ''">
|
<!-- <if test="params.dataScope != null and params.dataScope != ''">-->
|
||||||
AND ( ${params.dataScope} )
|
<!-- AND ( ${params.dataScope} )-->
|
||||||
</if>
|
<!-- </if>-->
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
||||||
|
|||||||
@ -38,7 +38,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@riophae/vue-treeselect": "0.4.0",
|
"@riophae/vue-treeselect": "0.4.0",
|
||||||
"axios": "0.24.0",
|
"axios": "0.24.0",
|
||||||
"clipboard": "2.0.6",
|
"clipboard": "2.0.8",
|
||||||
"core-js": "3.19.1",
|
"core-js": "3.19.1",
|
||||||
"echarts": "4.9.0",
|
"echarts": "4.9.0",
|
||||||
"element-ui": "2.15.6",
|
"element-ui": "2.15.6",
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<el-form size="small">
|
<el-form size="small">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="1">
|
<el-radio v-model='radioValue' :label="1">
|
||||||
日,允许的通配符[, - * / L M]
|
日,允许的通配符[, - * ? / L W]
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -15,23 +15,23 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="3">
|
<el-radio v-model='radioValue' :label="3">
|
||||||
周期从
|
周期从
|
||||||
<el-input-number v-model='cycle01' :min="0" :max="31" /> -
|
<el-input-number v-model='cycle01' :min="1" :max="30" /> -
|
||||||
<el-input-number v-model='cycle02' :min="0" :max="31" /> 日
|
<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 2" :max="31" /> 日
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="4">
|
<el-radio v-model='radioValue' :label="4">
|
||||||
从
|
从
|
||||||
<el-input-number v-model='average01' :min="0" :max="31" /> 号开始,每
|
<el-input-number v-model='average01' :min="1" :max="30" /> 号开始,每
|
||||||
<el-input-number v-model='average02' :min="0" :max="31" /> 日执行一次
|
<el-input-number v-model='average02' :min="1" :max="31 - average01 || 1" /> 日执行一次
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="5">
|
<el-radio v-model='radioValue' :label="5">
|
||||||
每月
|
每月
|
||||||
<el-input-number v-model='workday' :min="0" :max="31" /> 号最近的那个工作日
|
<el-input-number v-model='workday' :min="1" :max="31" /> 号最近的那个工作日
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -72,31 +72,22 @@ export default {
|
|||||||
// 单选按钮值变化时
|
// 单选按钮值变化时
|
||||||
radioChange() {
|
radioChange() {
|
||||||
('day rachange');
|
('day rachange');
|
||||||
if (this.radioValue === 1) {
|
if (this.radioValue !== 2 && this.cron.week !== '?') {
|
||||||
this.$emit('update', 'day', '*', 'day');
|
this.$emit('update', 'week', '?', 'day')
|
||||||
this.$emit('update', 'week', '?', 'day');
|
|
||||||
this.$emit('update', 'month', '*', 'day');
|
|
||||||
} else {
|
|
||||||
if (this.cron.hour === '*') {
|
|
||||||
this.$emit('update', 'hour', '0', 'day');
|
|
||||||
}
|
|
||||||
if (this.cron.min === '*') {
|
|
||||||
this.$emit('update', 'min', '0', 'day');
|
|
||||||
}
|
|
||||||
if (this.cron.second === '*') {
|
|
||||||
this.$emit('update', 'second', '0', 'day');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (this.radioValue) {
|
switch (this.radioValue) {
|
||||||
|
case 1:
|
||||||
|
this.$emit('update', 'day', '*');
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.$emit('update', 'day', '?');
|
this.$emit('update', 'day', '?');
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.$emit('update', 'day', this.cycle01 + '-' + this.cycle02);
|
this.$emit('update', 'day', this.cycleTotal);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.$emit('update', 'day', this.average01 + '/' + this.average02);
|
this.$emit('update', 'day', this.averageTotal);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
this.$emit('update', 'day', this.workday + 'W');
|
this.$emit('update', 'day', this.workday + 'W');
|
||||||
@ -125,7 +116,7 @@ export default {
|
|||||||
// 最近工作日值变化时
|
// 最近工作日值变化时
|
||||||
workdayChange() {
|
workdayChange() {
|
||||||
if (this.radioValue == '5') {
|
if (this.radioValue == '5') {
|
||||||
this.$emit('update', 'day', this.workday + 'W');
|
this.$emit('update', 'day', this.workdayCheck + 'W');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// checkbox值变化时
|
// checkbox值变化时
|
||||||
@ -133,19 +124,10 @@ export default {
|
|||||||
if (this.radioValue == '7') {
|
if (this.radioValue == '7') {
|
||||||
this.$emit('update', 'day', this.checkboxString);
|
this.$emit('update', 'day', this.checkboxString);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
// 父组件传递的week发生变化触发
|
|
||||||
weekChange() {
|
|
||||||
//判断week值与day不能同时为“?”
|
|
||||||
if (this.cron.week == '?' && this.radioValue == '2') {
|
|
||||||
this.radioValue = '1';
|
|
||||||
} else if (this.cron.week !== '?' && this.radioValue != '2') {
|
|
||||||
this.radioValue = '2';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"radioValue": "radioChange",
|
'radioValue': 'radioChange',
|
||||||
'cycleTotal': 'cycleChange',
|
'cycleTotal': 'cycleChange',
|
||||||
'averageTotal': 'averageChange',
|
'averageTotal': 'averageChange',
|
||||||
'workdayCheck': 'workdayChange',
|
'workdayCheck': 'workdayChange',
|
||||||
@ -154,20 +136,20 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 计算两个周期值
|
// 计算两个周期值
|
||||||
cycleTotal: function () {
|
cycleTotal: function () {
|
||||||
this.cycle01 = this.checkNum(this.cycle01, 1, 31)
|
const cycle01 = this.checkNum(this.cycle01, 1, 30)
|
||||||
this.cycle02 = this.checkNum(this.cycle02, 1, 31)
|
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 31, 31)
|
||||||
return this.cycle01 + '-' + this.cycle02;
|
return cycle01 + '-' + cycle02;
|
||||||
},
|
},
|
||||||
// 计算平均用到的值
|
// 计算平均用到的值
|
||||||
averageTotal: function () {
|
averageTotal: function () {
|
||||||
this.average01 = this.checkNum(this.average01, 1, 31)
|
const average01 = this.checkNum(this.average01, 1, 30)
|
||||||
this.average02 = this.checkNum(this.average02, 1, 31)
|
const average02 = this.checkNum(this.average02, 1, 31 - average01 || 0)
|
||||||
return this.average01 + '/' + this.average02;
|
return average01 + '/' + average02;
|
||||||
},
|
},
|
||||||
// 计算工作日格式
|
// 计算工作日格式
|
||||||
workdayCheck: function () {
|
workdayCheck: function () {
|
||||||
this.workday = this.checkNum(this.workday, 1, 31)
|
const workday = this.checkNum(this.workday, 1, 31)
|
||||||
return this.workday;
|
return workday;
|
||||||
},
|
},
|
||||||
// 计算勾选的checkbox值合集
|
// 计算勾选的checkbox值合集
|
||||||
checkboxString: function () {
|
checkboxString: function () {
|
||||||
|
|||||||
@ -9,16 +9,16 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="2">
|
<el-radio v-model='radioValue' :label="2">
|
||||||
周期从
|
周期从
|
||||||
<el-input-number v-model='cycle01' :min="0" :max="60" /> -
|
<el-input-number v-model='cycle01' :min="0" :max="22" /> -
|
||||||
<el-input-number v-model='cycle02' :min="0" :max="60" /> 小时
|
<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 1" :max="23" /> 小时
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="3">
|
<el-radio v-model='radioValue' :label="3">
|
||||||
从
|
从
|
||||||
<el-input-number v-model='average01' :min="0" :max="60" /> 小时开始,每
|
<el-input-number v-model='average01' :min="0" :max="22" /> 小时开始,每
|
||||||
<el-input-number v-model='average02' :min="0" :max="60" /> 小时执行一次
|
<el-input-number v-model='average02' :min="1" :max="23 - average01 || 0" /> 小时执行一次
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -51,23 +51,15 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 单选按钮值变化时
|
// 单选按钮值变化时
|
||||||
radioChange() {
|
radioChange() {
|
||||||
if (this.radioValue === 1) {
|
|
||||||
this.$emit('update', 'hour', '*', 'hour');
|
|
||||||
this.$emit('update', 'day', '*', 'hour');
|
|
||||||
} else {
|
|
||||||
if (this.cron.min === '*') {
|
|
||||||
this.$emit('update', 'min', '0', 'hour');
|
|
||||||
}
|
|
||||||
if (this.cron.second === '*') {
|
|
||||||
this.$emit('update', 'second', '0', 'hour');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (this.radioValue) {
|
switch (this.radioValue) {
|
||||||
|
case 1:
|
||||||
|
this.$emit('update', 'hour', '*')
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.$emit('update', 'hour', this.cycle01 + '-' + this.cycle02);
|
this.$emit('update', 'hour', this.cycleTotal);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.$emit('update', 'hour', this.average01 + '/' + this.average02);
|
this.$emit('update', 'hour', this.averageTotal);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.$emit('update', 'hour', this.checkboxString);
|
this.$emit('update', 'hour', this.checkboxString);
|
||||||
@ -94,7 +86,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"radioValue": "radioChange",
|
'radioValue': 'radioChange',
|
||||||
'cycleTotal': 'cycleChange',
|
'cycleTotal': 'cycleChange',
|
||||||
'averageTotal': 'averageChange',
|
'averageTotal': 'averageChange',
|
||||||
'checkboxString': 'checkboxChange'
|
'checkboxString': 'checkboxChange'
|
||||||
@ -102,15 +94,15 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 计算两个周期值
|
// 计算两个周期值
|
||||||
cycleTotal: function () {
|
cycleTotal: function () {
|
||||||
this.cycle01 = this.checkNum(this.cycle01, 0, 23)
|
const cycle01 = this.checkNum(this.cycle01, 0, 22)
|
||||||
this.cycle02 = this.checkNum(this.cycle02, 0, 23)
|
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 23)
|
||||||
return this.cycle01 + '-' + this.cycle02;
|
return cycle01 + '-' + cycle02;
|
||||||
},
|
},
|
||||||
// 计算平均用到的值
|
// 计算平均用到的值
|
||||||
averageTotal: function () {
|
averageTotal: function () {
|
||||||
this.average01 = this.checkNum(this.average01, 0, 23)
|
const average01 = this.checkNum(this.average01, 0, 22)
|
||||||
this.average02 = this.checkNum(this.average02, 1, 23)
|
const average02 = this.checkNum(this.average02, 1, 23 - average01 || 0)
|
||||||
return this.average01 + '/' + this.average02;
|
return average01 + '/' + average02;
|
||||||
},
|
},
|
||||||
// 计算勾选的checkbox值合集
|
// 计算勾选的checkbox值合集
|
||||||
checkboxString: function () {
|
checkboxString: function () {
|
||||||
|
|||||||
@ -2,7 +2,12 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-tabs type="border-card">
|
<el-tabs type="border-card">
|
||||||
<el-tab-pane label="秒" v-if="shouldHide('second')">
|
<el-tab-pane label="秒" v-if="shouldHide('second')">
|
||||||
<CrontabSecond @update="updateCrontabValue" :check="checkNumber" ref="cronsecond" />
|
<CrontabSecond
|
||||||
|
@update="updateCrontabValue"
|
||||||
|
:check="checkNumber"
|
||||||
|
:cron="crontabValueObj"
|
||||||
|
ref="cronsecond"
|
||||||
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
<el-tab-pane label="分钟" v-if="shouldHide('min')">
|
<el-tab-pane label="分钟" v-if="shouldHide('min')">
|
||||||
|
|||||||
@ -9,16 +9,16 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="2">
|
<el-radio v-model='radioValue' :label="2">
|
||||||
周期从
|
周期从
|
||||||
<el-input-number v-model='cycle01' :min="0" :max="60" /> -
|
<el-input-number v-model='cycle01' :min="0" :max="58" /> -
|
||||||
<el-input-number v-model='cycle02' :min="0" :max="60" /> 分钟
|
<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 1" :max="59" /> 分钟
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="3">
|
<el-radio v-model='radioValue' :label="3">
|
||||||
从
|
从
|
||||||
<el-input-number v-model='average01' :min="0" :max="60" /> 分钟开始,每
|
<el-input-number v-model='average01' :min="0" :max="58" /> 分钟开始,每
|
||||||
<el-input-number v-model='average02' :min="0" :max="60" /> 分钟执行一次
|
<el-input-number v-model='average02' :min="1" :max="59 - average01 || 0" /> 分钟执行一次
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -52,19 +52,15 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 单选按钮值变化时
|
// 单选按钮值变化时
|
||||||
radioChange() {
|
radioChange() {
|
||||||
if (this.radioValue !== 1 && this.cron.second === '*') {
|
|
||||||
this.$emit('update', 'second', '0', 'min');
|
|
||||||
}
|
|
||||||
switch (this.radioValue) {
|
switch (this.radioValue) {
|
||||||
case 1:
|
case 1:
|
||||||
this.$emit('update', 'min', '*', 'min');
|
this.$emit('update', 'min', '*', 'min');
|
||||||
this.$emit('update', 'hour', '*', 'min');
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.$emit('update', 'min', this.cycle01 + '-' + this.cycle02, 'min');
|
this.$emit('update', 'min', this.cycleTotal, 'min');
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.$emit('update', 'min', this.average01 + '/' + this.average02, 'min');
|
this.$emit('update', 'min', this.averageTotal, 'min');
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.$emit('update', 'min', this.checkboxString, 'min');
|
this.$emit('update', 'min', this.checkboxString, 'min');
|
||||||
@ -92,7 +88,7 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"radioValue": "radioChange",
|
'radioValue': 'radioChange',
|
||||||
'cycleTotal': 'cycleChange',
|
'cycleTotal': 'cycleChange',
|
||||||
'averageTotal': 'averageChange',
|
'averageTotal': 'averageChange',
|
||||||
'checkboxString': 'checkboxChange',
|
'checkboxString': 'checkboxChange',
|
||||||
@ -100,15 +96,15 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 计算两个周期值
|
// 计算两个周期值
|
||||||
cycleTotal: function () {
|
cycleTotal: function () {
|
||||||
this.cycle01 = this.checkNum(this.cycle01, 0, 59)
|
const cycle01 = this.checkNum(this.cycle01, 0, 58)
|
||||||
this.cycle02 = this.checkNum(this.cycle02, 0, 59)
|
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59)
|
||||||
return this.cycle01 + '-' + this.cycle02;
|
return cycle01 + '-' + cycle02;
|
||||||
},
|
},
|
||||||
// 计算平均用到的值
|
// 计算平均用到的值
|
||||||
averageTotal: function () {
|
averageTotal: function () {
|
||||||
this.average01 = this.checkNum(this.average01, 0, 59)
|
const average01 = this.checkNum(this.average01, 0, 58)
|
||||||
this.average02 = this.checkNum(this.average02, 1, 59)
|
const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0)
|
||||||
return this.average01 + '/' + this.average02;
|
return average01 + '/' + average02;
|
||||||
},
|
},
|
||||||
// 计算勾选的checkbox值合集
|
// 计算勾选的checkbox值合集
|
||||||
checkboxString: function () {
|
checkboxString: function () {
|
||||||
|
|||||||
@ -9,16 +9,16 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="2">
|
<el-radio v-model='radioValue' :label="2">
|
||||||
周期从
|
周期从
|
||||||
<el-input-number v-model='cycle01' :min="1" :max="12" /> -
|
<el-input-number v-model='cycle01' :min="1" :max="11" /> -
|
||||||
<el-input-number v-model='cycle02' :min="1" :max="12" /> 月
|
<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 2" :max="12" /> 月
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="3">
|
<el-radio v-model='radioValue' :label="3">
|
||||||
从
|
从
|
||||||
<el-input-number v-model='average01' :min="1" :max="12" /> 月开始,每
|
<el-input-number v-model='average01' :min="1" :max="11" /> 月开始,每
|
||||||
<el-input-number v-model='average02' :min="1" :max="12" /> 月月执行一次
|
<el-input-number v-model='average02' :min="1" :max="12 - average01 || 0" /> 月月执行一次
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -51,29 +51,15 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 单选按钮值变化时
|
// 单选按钮值变化时
|
||||||
radioChange() {
|
radioChange() {
|
||||||
if (this.radioValue === 1) {
|
|
||||||
this.$emit('update', 'month', '*');
|
|
||||||
this.$emit('update', 'year', '*');
|
|
||||||
} else {
|
|
||||||
if (this.cron.day === '*') {
|
|
||||||
this.$emit('update', 'day', '0', 'month');
|
|
||||||
}
|
|
||||||
if (this.cron.hour === '*') {
|
|
||||||
this.$emit('update', 'hour', '0', 'month');
|
|
||||||
}
|
|
||||||
if (this.cron.min === '*') {
|
|
||||||
this.$emit('update', 'min', '0', 'month');
|
|
||||||
}
|
|
||||||
if (this.cron.second === '*') {
|
|
||||||
this.$emit('update', 'second', '0', 'month');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (this.radioValue) {
|
switch (this.radioValue) {
|
||||||
|
case 1:
|
||||||
|
this.$emit('update', 'month', '*');
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.$emit('update', 'month', this.cycle01 + '-' + this.cycle02);
|
this.$emit('update', 'month', this.cycleTotal);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.$emit('update', 'month', this.average01 + '/' + this.average02);
|
this.$emit('update', 'month', this.averageTotal);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.$emit('update', 'month', this.checkboxString);
|
this.$emit('update', 'month', this.checkboxString);
|
||||||
@ -100,7 +86,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"radioValue": "radioChange",
|
'radioValue': 'radioChange',
|
||||||
'cycleTotal': 'cycleChange',
|
'cycleTotal': 'cycleChange',
|
||||||
'averageTotal': 'averageChange',
|
'averageTotal': 'averageChange',
|
||||||
'checkboxString': 'checkboxChange'
|
'checkboxString': 'checkboxChange'
|
||||||
@ -108,15 +94,15 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 计算两个周期值
|
// 计算两个周期值
|
||||||
cycleTotal: function () {
|
cycleTotal: function () {
|
||||||
this.cycle01 = this.checkNum(this.cycle01, 1, 12)
|
const cycle01 = this.checkNum(this.cycle01, 1, 11)
|
||||||
this.cycle02 = this.checkNum(this.cycle02, 1, 12)
|
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 12)
|
||||||
return this.cycle01 + '-' + this.cycle02;
|
return cycle01 + '-' + cycle02;
|
||||||
},
|
},
|
||||||
// 计算平均用到的值
|
// 计算平均用到的值
|
||||||
averageTotal: function () {
|
averageTotal: function () {
|
||||||
this.average01 = this.checkNum(this.average01, 1, 12)
|
const average01 = this.checkNum(this.average01, 1, 11)
|
||||||
this.average02 = this.checkNum(this.average02, 1, 12)
|
const average02 = this.checkNum(this.average02, 1, 12 - average01 || 0)
|
||||||
return this.average01 + '/' + this.average02;
|
return average01 + '/' + average02;
|
||||||
},
|
},
|
||||||
// 计算勾选的checkbox值合集
|
// 计算勾选的checkbox值合集
|
||||||
checkboxString: function () {
|
checkboxString: function () {
|
||||||
|
|||||||
@ -179,7 +179,7 @@ export default {
|
|||||||
// 获取达到条件的日期是星期X
|
// 获取达到条件的日期是星期X
|
||||||
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week');
|
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week');
|
||||||
// 当星期日时
|
// 当星期日时
|
||||||
if (thisWeek == 0) {
|
if (thisWeek == 1) {
|
||||||
// 先找下一个日,并判断是否为月底
|
// 先找下一个日,并判断是否为月底
|
||||||
DD++;
|
DD++;
|
||||||
thisDD = DD < 10 ? '0' + DD : DD;
|
thisDD = DD < 10 ? '0' + DD : DD;
|
||||||
@ -187,7 +187,7 @@ export default {
|
|||||||
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
|
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
|
||||||
DD -= 3;
|
DD -= 3;
|
||||||
}
|
}
|
||||||
} else if (thisWeek == 6) {
|
} else if (thisWeek == 7) {
|
||||||
// 当星期6时只需判断不是1号就可进行操作
|
// 当星期6时只需判断不是1号就可进行操作
|
||||||
if (this.dayRuleSup !== 1) {
|
if (this.dayRuleSup !== 1) {
|
||||||
DD--;
|
DD--;
|
||||||
@ -200,7 +200,7 @@ export default {
|
|||||||
// 获取当前日期是属于星期几
|
// 获取当前日期是属于星期几
|
||||||
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week');
|
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week');
|
||||||
// 校验当前星期是否在星期池(dayRuleSup)中
|
// 校验当前星期是否在星期池(dayRuleSup)中
|
||||||
if (Array.indexOf(this.dayRuleSup, thisWeek) < 0) {
|
if (this.dayRuleSup.indexOf(thisWeek) < 0) {
|
||||||
// 如果到达最大值时
|
// 如果到达最大值时
|
||||||
if (Di == DDate.length - 1) {
|
if (Di == DDate.length - 1) {
|
||||||
resetDay();
|
resetDay();
|
||||||
@ -385,7 +385,7 @@ export default {
|
|||||||
} else if (rule.indexOf('#') >= 0) {
|
} else if (rule.indexOf('#') >= 0) {
|
||||||
this.dayRule = 'assWeek';
|
this.dayRule = 'assWeek';
|
||||||
let matchRule = rule.match(/[0-9]{1}/g);
|
let matchRule = rule.match(/[0-9]{1}/g);
|
||||||
this.dayRuleSup = [Number(matchRule[0]), Number(matchRule[1])];
|
this.dayRuleSup = [Number(matchRule[1]), Number(matchRule[0])];
|
||||||
this.dateArr[3] = [1];
|
this.dateArr[3] = [1];
|
||||||
if (this.dayRuleSup[1] == 7) {
|
if (this.dayRuleSup[1] == 7) {
|
||||||
this.dayRuleSup[1] = 0;
|
this.dayRuleSup[1] = 0;
|
||||||
@ -401,14 +401,6 @@ export default {
|
|||||||
this.dayRule = 'weekDay';
|
this.dayRule = 'weekDay';
|
||||||
this.dayRuleSup = this.getAssignArr(rule)
|
this.dayRuleSup = this.getAssignArr(rule)
|
||||||
}
|
}
|
||||||
// 如果weekDay时将7调整为0【week值0即是星期日】
|
|
||||||
if (this.dayRule == 'weekDay') {
|
|
||||||
for (let i = 0; i < this.dayRuleSup.length; i++) {
|
|
||||||
if (this.dayRuleSup[i] == 7) {
|
|
||||||
this.dayRuleSup[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 获取"日"数组-少量为日期规则
|
// 获取"日"数组-少量为日期规则
|
||||||
@ -543,14 +535,15 @@ export default {
|
|||||||
if (type == undefined) {
|
if (type == undefined) {
|
||||||
return Y + '-' + (M < 10 ? '0' + M : M) + '-' + (D < 10 ? '0' + D : D) + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s);
|
return Y + '-' + (M < 10 ? '0' + M : M) + '-' + (D < 10 ? '0' + D : D) + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s);
|
||||||
} else if (type == 'week') {
|
} else if (type == 'week') {
|
||||||
return week;
|
// 在quartz中 1为星期日
|
||||||
|
return week + 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 检查日期是否存在
|
// 检查日期是否存在
|
||||||
checkDate(value) {
|
checkDate(value) {
|
||||||
let time = new Date(value);
|
let time = new Date(value);
|
||||||
let format = this.formatDate(time)
|
let format = this.formatDate(time)
|
||||||
return value == format ? true : false;
|
return value === format;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
@ -9,16 +9,16 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="2">
|
<el-radio v-model='radioValue' :label="2">
|
||||||
周期从
|
周期从
|
||||||
<el-input-number v-model='cycle01' :min="0" :max="60" /> -
|
<el-input-number v-model='cycle01' :min="0" :max="58" /> -
|
||||||
<el-input-number v-model='cycle02' :min="0" :max="60" /> 秒
|
<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 1" :max="59" /> 秒
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="3">
|
<el-radio v-model='radioValue' :label="3">
|
||||||
从
|
从
|
||||||
<el-input-number v-model='average01' :min="0" :max="60" /> 秒开始,每
|
<el-input-number v-model='average01' :min="0" :max="58" /> 秒开始,每
|
||||||
<el-input-number v-model='average02' :min="0" :max="60" /> 秒执行一次
|
<el-input-number v-model='average02' :min="1" :max="59 - average01 || 0" /> 秒执行一次
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -54,13 +54,12 @@ export default {
|
|||||||
switch (this.radioValue) {
|
switch (this.radioValue) {
|
||||||
case 1:
|
case 1:
|
||||||
this.$emit('update', 'second', '*', 'second');
|
this.$emit('update', 'second', '*', 'second');
|
||||||
this.$emit('update', 'min', '*', 'second');
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.$emit('update', 'second', this.cycle01 + '-' + this.cycle02);
|
this.$emit('update', 'second', this.cycleTotal);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.$emit('update', 'second', this.average01 + '/' + this.average02);
|
this.$emit('update', 'second', this.averageTotal);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.$emit('update', 'second', this.checkboxString);
|
this.$emit('update', 'second', this.checkboxString);
|
||||||
@ -84,25 +83,10 @@ export default {
|
|||||||
if (this.radioValue == '4') {
|
if (this.radioValue == '4') {
|
||||||
this.$emit('update', 'second', this.checkboxString);
|
this.$emit('update', 'second', this.checkboxString);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
othChange() {
|
|
||||||
// 反解析
|
|
||||||
let ins = this.cron.second
|
|
||||||
('反解析 second', ins);
|
|
||||||
if (ins === '*') {
|
|
||||||
this.radioValue = 1;
|
|
||||||
} else if (ins.indexOf('-') > -1) {
|
|
||||||
this.radioValue = 2
|
|
||||||
} else if (ins.indexOf('/') > -1) {
|
|
||||||
this.radioValue = 3
|
|
||||||
} else {
|
|
||||||
this.radioValue = 4
|
|
||||||
this.checkboxList = ins.split(',')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"radioValue": "radioChange",
|
'radioValue': 'radioChange',
|
||||||
'cycleTotal': 'cycleChange',
|
'cycleTotal': 'cycleChange',
|
||||||
'averageTotal': 'averageChange',
|
'averageTotal': 'averageChange',
|
||||||
'checkboxString': 'checkboxChange',
|
'checkboxString': 'checkboxChange',
|
||||||
@ -113,15 +97,15 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 计算两个周期值
|
// 计算两个周期值
|
||||||
cycleTotal: function () {
|
cycleTotal: function () {
|
||||||
this.cycle01 = this.checkNum(this.cycle01, 0, 59)
|
const cycle01 = this.checkNum(this.cycle01, 0, 58)
|
||||||
this.cycle02 = this.checkNum(this.cycle02, 0, 59)
|
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59)
|
||||||
return this.cycle01 + '-' + this.cycle02;
|
return cycle01 + '-' + cycle02;
|
||||||
},
|
},
|
||||||
// 计算平均用到的值
|
// 计算平均用到的值
|
||||||
averageTotal: function () {
|
averageTotal: function () {
|
||||||
this.average01 = this.checkNum(this.average01, 0, 59)
|
const average01 = this.checkNum(this.average01, 0, 58)
|
||||||
this.average02 = this.checkNum(this.average02, 1, 59)
|
const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0)
|
||||||
return this.average01 + '/' + this.average02;
|
return average01 + '/' + average02;
|
||||||
},
|
},
|
||||||
// 计算勾选的checkbox值合集
|
// 计算勾选的checkbox值合集
|
||||||
checkboxString: function () {
|
checkboxString: function () {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<el-form size='small'>
|
<el-form size='small'>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="1">
|
<el-radio v-model='radioValue' :label="1">
|
||||||
周,允许的通配符[, - * / L #]
|
周,允许的通配符[, - * ? / L #]
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -15,8 +15,25 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="3">
|
<el-radio v-model='radioValue' :label="3">
|
||||||
周期从星期
|
周期从星期
|
||||||
<el-input-number v-model='cycle01' :min="1" :max="7" /> -
|
<el-select clearable v-model="cycle01">
|
||||||
<el-input-number v-model='cycle02' :min="1" :max="7" />
|
<el-option
|
||||||
|
v-for="(item,index) of weekList"
|
||||||
|
:key="index"
|
||||||
|
:label="item.value"
|
||||||
|
:value="item.key"
|
||||||
|
:disabled="item.key === 1"
|
||||||
|
>{{item.value}}</el-option>
|
||||||
|
</el-select>
|
||||||
|
-
|
||||||
|
<el-select clearable v-model="cycle02">
|
||||||
|
<el-option
|
||||||
|
v-for="(item,index) of weekList"
|
||||||
|
:key="index"
|
||||||
|
:label="item.value"
|
||||||
|
:value="item.key"
|
||||||
|
:disabled="item.key < cycle01 && item.key !== 1"
|
||||||
|
>{{item.value}}</el-option>
|
||||||
|
</el-select>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -24,14 +41,18 @@
|
|||||||
<el-radio v-model='radioValue' :label="4">
|
<el-radio v-model='radioValue' :label="4">
|
||||||
第
|
第
|
||||||
<el-input-number v-model='average01' :min="1" :max="4" /> 周的星期
|
<el-input-number v-model='average01' :min="1" :max="4" /> 周的星期
|
||||||
<el-input-number v-model='average02' :min="1" :max="7" />
|
<el-select clearable v-model="average02">
|
||||||
|
<el-option v-for="(item,index) of weekList" :key="index" :label="item.value" :value="item.key">{{item.value}}</el-option>
|
||||||
|
</el-select>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="5">
|
<el-radio v-model='radioValue' :label="5">
|
||||||
本月最后一个星期
|
本月最后一个星期
|
||||||
<el-input-number v-model='weekday' :min="1" :max="7" />
|
<el-select clearable v-model="weekday">
|
||||||
|
<el-option v-for="(item,index) of weekList" :key="index" :label="item.value" :value="item.key">{{item.value}}</el-option>
|
||||||
|
</el-select>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -39,7 +60,7 @@
|
|||||||
<el-radio v-model='radioValue' :label="6">
|
<el-radio v-model='radioValue' :label="6">
|
||||||
指定
|
指定
|
||||||
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
|
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
|
||||||
<el-option v-for="(item,index) of weekList" :key="index" :value="index+1">{{item}}</el-option>
|
<el-option v-for="(item,index) of weekList" :key="index" :label="item.value" :value="item.key">{{item.value}}</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -52,13 +73,42 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
radioValue: 2,
|
radioValue: 2,
|
||||||
weekday: 1,
|
weekday: 2,
|
||||||
cycle01: 1,
|
cycle01: 2,
|
||||||
cycle02: 2,
|
cycle02: 3,
|
||||||
average01: 1,
|
average01: 1,
|
||||||
average02: 1,
|
average02: 2,
|
||||||
checkboxList: [],
|
checkboxList: [],
|
||||||
weekList: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
weekList: [
|
||||||
|
{
|
||||||
|
key: 2,
|
||||||
|
value: '星期一'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 3,
|
||||||
|
value: '星期二'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 4,
|
||||||
|
value: '星期三'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 5,
|
||||||
|
value: '星期四'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 6,
|
||||||
|
value: '星期五'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 7,
|
||||||
|
value: '星期六'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 1,
|
||||||
|
value: '星期日'
|
||||||
|
}
|
||||||
|
],
|
||||||
checkNum: this.$options.propsData.check
|
checkNum: this.$options.propsData.check
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -67,45 +117,30 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 单选按钮值变化时
|
// 单选按钮值变化时
|
||||||
radioChange() {
|
radioChange() {
|
||||||
if (this.radioValue === 1) {
|
if (this.radioValue !== 2 && this.cron.day !== '?') {
|
||||||
this.$emit('update', 'week', '*');
|
this.$emit('update', 'day', '?', 'week');
|
||||||
this.$emit('update', 'year', '*');
|
|
||||||
} else {
|
|
||||||
if (this.cron.month === '*') {
|
|
||||||
this.$emit('update', 'month', '0', 'week');
|
|
||||||
}
|
|
||||||
if (this.cron.day === '*') {
|
|
||||||
this.$emit('update', 'day', '0', 'week');
|
|
||||||
}
|
|
||||||
if (this.cron.hour === '*') {
|
|
||||||
this.$emit('update', 'hour', '0', 'week');
|
|
||||||
}
|
|
||||||
if (this.cron.min === '*') {
|
|
||||||
this.$emit('update', 'min', '0', 'week');
|
|
||||||
}
|
|
||||||
if (this.cron.second === '*') {
|
|
||||||
this.$emit('update', 'second', '0', 'week');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
switch (this.radioValue) {
|
switch (this.radioValue) {
|
||||||
|
case 1:
|
||||||
|
this.$emit('update', 'week', '*');
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.$emit('update', 'week', '?');
|
this.$emit('update', 'week', '?');
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.$emit('update', 'week', this.cycle01 + '-' + this.cycle02);
|
this.$emit('update', 'week', this.cycleTotal);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.$emit('update', 'week', this.average01 + '#' + this.average02);
|
this.$emit('update', 'week', this.averageTotal);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
this.$emit('update', 'week', this.weekday + 'L');
|
this.$emit('update', 'week', this.weekdayCheck + 'L');
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
this.$emit('update', 'week', this.checkboxString);
|
this.$emit('update', 'week', this.checkboxString);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 根据互斥事件,更改radio的值
|
|
||||||
|
|
||||||
// 周期两个值变化时
|
// 周期两个值变化时
|
||||||
cycleChange() {
|
cycleChange() {
|
||||||
@ -133,7 +168,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"radioValue": "radioChange",
|
'radioValue': 'radioChange',
|
||||||
'cycleTotal': 'cycleChange',
|
'cycleTotal': 'cycleChange',
|
||||||
'averageTotal': 'averageChange',
|
'averageTotal': 'averageChange',
|
||||||
'weekdayCheck': 'weekdayChange',
|
'weekdayCheck': 'weekdayChange',
|
||||||
@ -150,7 +185,7 @@ export default {
|
|||||||
averageTotal: function () {
|
averageTotal: function () {
|
||||||
this.average01 = this.checkNum(this.average01, 1, 4)
|
this.average01 = this.checkNum(this.average01, 1, 4)
|
||||||
this.average02 = this.checkNum(this.average02, 1, 7)
|
this.average02 = this.checkNum(this.average02, 1, 7)
|
||||||
return this.average01 + '#' + this.average02;
|
return this.average02 + '#' + this.average01;
|
||||||
},
|
},
|
||||||
// 最近的工作日(格式)
|
// 最近的工作日(格式)
|
||||||
weekdayCheck: function () {
|
weekdayCheck: function () {
|
||||||
|
|||||||
@ -15,16 +15,16 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio :label="3" v-model='radioValue'>
|
<el-radio :label="3" v-model='radioValue'>
|
||||||
周期从
|
周期从
|
||||||
<el-input-number v-model='cycle01' :min='fullYear' /> -
|
<el-input-number v-model='cycle01' :min='fullYear' :max="2098" /> -
|
||||||
<el-input-number v-model='cycle02' :min='fullYear' />
|
<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : fullYear + 1" :max="2099" />
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio :label="4" v-model='radioValue'>
|
<el-radio :label="4" v-model='radioValue'>
|
||||||
从
|
从
|
||||||
<el-input-number v-model='average01' :min='fullYear' /> 年开始,每
|
<el-input-number v-model='average01' :min='fullYear' :max="2098"/> 年开始,每
|
||||||
<el-input-number v-model='average02' :min='fullYear' /> 年执行一次
|
<el-input-number v-model='average02' :min="1" :max="2099 - average01 || fullYear" /> 年执行一次
|
||||||
</el-radio>
|
</el-radio>
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -59,21 +59,6 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 单选按钮值变化时
|
// 单选按钮值变化时
|
||||||
radioChange() {
|
radioChange() {
|
||||||
if (this.cron.month === '*') {
|
|
||||||
this.$emit('update', 'month', '0', 'year');
|
|
||||||
}
|
|
||||||
if (this.cron.day === '*') {
|
|
||||||
this.$emit('update', 'day', '0', 'year');
|
|
||||||
}
|
|
||||||
if (this.cron.hour === '*') {
|
|
||||||
this.$emit('update', 'hour', '0', 'year');
|
|
||||||
}
|
|
||||||
if (this.cron.min === '*') {
|
|
||||||
this.$emit('update', 'min', '0', 'year');
|
|
||||||
}
|
|
||||||
if (this.cron.second === '*') {
|
|
||||||
this.$emit('update', 'second', '0', 'year');
|
|
||||||
}
|
|
||||||
switch (this.radioValue) {
|
switch (this.radioValue) {
|
||||||
case 1:
|
case 1:
|
||||||
this.$emit('update', 'year', '');
|
this.$emit('update', 'year', '');
|
||||||
@ -82,10 +67,10 @@ export default {
|
|||||||
this.$emit('update', 'year', '*');
|
this.$emit('update', 'year', '*');
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.$emit('update', 'year', this.cycle01 + '-' + this.cycle02);
|
this.$emit('update', 'year', this.cycleTotal);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.$emit('update', 'year', this.average01 + '/' + this.average02);
|
this.$emit('update', 'year', this.averageTotal);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
this.$emit('update', 'year', this.checkboxString);
|
this.$emit('update', 'year', this.checkboxString);
|
||||||
@ -112,7 +97,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"radioValue": "radioChange",
|
'radioValue': 'radioChange',
|
||||||
'cycleTotal': 'cycleChange',
|
'cycleTotal': 'cycleChange',
|
||||||
'averageTotal': 'averageChange',
|
'averageTotal': 'averageChange',
|
||||||
'checkboxString': 'checkboxChange'
|
'checkboxString': 'checkboxChange'
|
||||||
@ -120,15 +105,15 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 计算两个周期值
|
// 计算两个周期值
|
||||||
cycleTotal: function () {
|
cycleTotal: function () {
|
||||||
this.cycle01 = this.checkNum(this.cycle01, this.fullYear, this.fullYear + 100)
|
const cycle01 = this.checkNum(this.cycle01, this.fullYear, 2098)
|
||||||
this.cycle02 = this.checkNum(this.cycle02, this.fullYear + 1, this.fullYear + 101)
|
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : this.fullYear + 1, 2099)
|
||||||
return this.cycle01 + '-' + this.cycle02;
|
return cycle01 + '-' + cycle02;
|
||||||
},
|
},
|
||||||
// 计算平均用到的值
|
// 计算平均用到的值
|
||||||
averageTotal: function () {
|
averageTotal: function () {
|
||||||
this.average01 = this.checkNum(this.average01, this.fullYear, this.fullYear + 100)
|
const average01 = this.checkNum(this.average01, this.fullYear, 2098)
|
||||||
this.average02 = this.checkNum(this.average02, 1, 10)
|
const average02 = this.checkNum(this.average02, 1, 2099 - average01 || this.fullYear)
|
||||||
return this.average01 + '/' + this.average02;
|
return average01 + '/' + average02;
|
||||||
},
|
},
|
||||||
// 计算勾选的checkbox值合集
|
// 计算勾选的checkbox值合集
|
||||||
checkboxString: function () {
|
checkboxString: function () {
|
||||||
@ -139,6 +124,8 @@ export default {
|
|||||||
mounted: function () {
|
mounted: function () {
|
||||||
// 仅获取当前年份
|
// 仅获取当前年份
|
||||||
this.fullYear = Number(new Date().getFullYear());
|
this.fullYear = Number(new Date().getFullYear());
|
||||||
|
this.cycle01 = this.fullYear
|
||||||
|
this.average01 = this.fullYear
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -3,10 +3,12 @@ import hasPermi from './permission/hasPermi'
|
|||||||
import dialogDrag from './dialog/drag'
|
import dialogDrag from './dialog/drag'
|
||||||
import dialogDragWidth from './dialog/dragWidth'
|
import dialogDragWidth from './dialog/dragWidth'
|
||||||
import dialogDragHeight from './dialog/dragHeight'
|
import dialogDragHeight from './dialog/dragHeight'
|
||||||
|
import clipboard from './module/clipboard'
|
||||||
|
|
||||||
const install = function(Vue) {
|
const install = function(Vue) {
|
||||||
Vue.directive('hasRole', hasRole)
|
Vue.directive('hasRole', hasRole)
|
||||||
Vue.directive('hasPermi', hasPermi)
|
Vue.directive('hasPermi', hasPermi)
|
||||||
|
Vue.directive('clipboard', clipboard)
|
||||||
Vue.directive('dialogDrag', dialogDrag)
|
Vue.directive('dialogDrag', dialogDrag)
|
||||||
Vue.directive('dialogDragWidth', dialogDragWidth)
|
Vue.directive('dialogDragWidth', dialogDragWidth)
|
||||||
Vue.directive('dialogDragHeight', dialogDragHeight)
|
Vue.directive('dialogDragHeight', dialogDragHeight)
|
||||||
|
|||||||
54
ruoyi-ui/src/directive/module/clipboard.js
Normal file
54
ruoyi-ui/src/directive/module/clipboard.js
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/**
|
||||||
|
* v-clipboard 文字复制剪贴
|
||||||
|
* Copyright (c) 2021 ruoyi
|
||||||
|
*/
|
||||||
|
|
||||||
|
import Clipboard from 'clipboard'
|
||||||
|
export default {
|
||||||
|
bind(el, binding, vnode) {
|
||||||
|
switch (binding.arg) {
|
||||||
|
case 'success':
|
||||||
|
el._vClipBoard_success = binding.value;
|
||||||
|
break;
|
||||||
|
case 'error':
|
||||||
|
el._vClipBoard_error = binding.value;
|
||||||
|
break;
|
||||||
|
default: {
|
||||||
|
const clipboard = new Clipboard(el, {
|
||||||
|
text: () => binding.value,
|
||||||
|
action: () => binding.arg === 'cut' ? 'cut' : 'copy'
|
||||||
|
});
|
||||||
|
clipboard.on('success', e => {
|
||||||
|
const callback = el._vClipBoard_success;
|
||||||
|
callback && callback(e);
|
||||||
|
});
|
||||||
|
clipboard.on('error', e => {
|
||||||
|
const callback = el._vClipBoard_error;
|
||||||
|
callback && callback(e);
|
||||||
|
});
|
||||||
|
el._vClipBoard = clipboard;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
update(el, binding) {
|
||||||
|
if (binding.arg === 'success') {
|
||||||
|
el._vClipBoard_success = binding.value;
|
||||||
|
} else if (binding.arg === 'error') {
|
||||||
|
el._vClipBoard_error = binding.value;
|
||||||
|
} else {
|
||||||
|
el._vClipBoard.text = function () { return binding.value; };
|
||||||
|
el._vClipBoard.action = () => binding.arg === 'cut' ? 'cut' : 'copy';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
unbind(el, binding) {
|
||||||
|
if (!el._vClipboard) return
|
||||||
|
if (binding.arg === 'success') {
|
||||||
|
delete el._vClipBoard_success;
|
||||||
|
} else if (binding.arg === 'error') {
|
||||||
|
delete el._vClipBoard_error;
|
||||||
|
} else {
|
||||||
|
el._vClipBoard.destroy();
|
||||||
|
delete el._vClipBoard;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ import axios from 'axios'
|
|||||||
import { Message } from 'element-ui'
|
import { Message } from 'element-ui'
|
||||||
import { saveAs } from 'file-saver'
|
import { saveAs } from 'file-saver'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
|
import errorCode from '@/utils/errorCode'
|
||||||
import { blobValidate } from "@/utils/ruoyi";
|
import { blobValidate } from "@/utils/ruoyi";
|
||||||
|
|
||||||
const baseURL = process.env.VUE_APP_BASE_API
|
const baseURL = process.env.VUE_APP_BASE_API
|
||||||
@ -20,7 +21,7 @@ export default {
|
|||||||
const blob = new Blob([res.data], { type: 'application/octet-stream' })
|
const blob = new Blob([res.data], { type: 'application/octet-stream' })
|
||||||
this.saveAs(blob, decodeURI(res.headers['download-filename']))
|
this.saveAs(blob, decodeURI(res.headers['download-filename']))
|
||||||
} else {
|
} else {
|
||||||
Message.error('无效的会话,或者会话已过期,请重新登录。');
|
this.printErrMsg(res.data);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -37,12 +38,18 @@ export default {
|
|||||||
const blob = new Blob([res.data], { type: 'application/zip' })
|
const blob = new Blob([res.data], { type: 'application/zip' })
|
||||||
this.saveAs(blob, name)
|
this.saveAs(blob, name)
|
||||||
} else {
|
} else {
|
||||||
Message.error('无效的会话,或者会话已过期,请重新登录。');
|
this.printErrMsg(res.data);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
saveAs(text, name, opts) {
|
saveAs(text, name, opts) {
|
||||||
saveAs(text, name, opts);
|
saveAs(text, name, opts);
|
||||||
|
},
|
||||||
|
async printErrMsg(data) {
|
||||||
|
const resText = await data.text();
|
||||||
|
const rspObj = JSON.parse(resText);
|
||||||
|
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
||||||
|
Message.error(errMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -59,6 +59,14 @@ export default {
|
|||||||
type: "warning",
|
type: "warning",
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 提交内容
|
||||||
|
prompt(content) {
|
||||||
|
return MessageBox.prompt(content, "系统提示", {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
},
|
||||||
// 打开遮罩层
|
// 打开遮罩层
|
||||||
loading(content) {
|
loading(content) {
|
||||||
loadingInstance = Loading.service({
|
loadingInstance = Loading.service({
|
||||||
|
|||||||
@ -110,7 +110,10 @@ export function download(url, params, filename) {
|
|||||||
const blob = new Blob([data])
|
const blob = new Blob([data])
|
||||||
saveAs(blob, filename)
|
saveAs(blob, filename)
|
||||||
} else {
|
} else {
|
||||||
Message.error('无效的会话,或者会话已过期,请重新登录。');
|
const resText = await data.text();
|
||||||
|
const rspObj = JSON.parse(resText);
|
||||||
|
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
||||||
|
Message.error(errMsg);
|
||||||
}
|
}
|
||||||
downloadLoadingInstance.close();
|
downloadLoadingInstance.close();
|
||||||
}).catch((r) => {
|
}).catch((r) => {
|
||||||
|
|||||||
@ -111,7 +111,7 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 强退按钮操作 */
|
/** 强退按钮操作 */
|
||||||
handleForceLogout(row) {
|
handleForceLogout(row) {
|
||||||
this.$modal.confirm('是否确认强退名称为"' + row.userName + '"的数据项?').then(function() {
|
this.$modal.confirm('是否确认强退名称为"' + row.userName + '"的用户?').then(function() {
|
||||||
return forceLogout(row.tokenId);
|
return forceLogout(row.tokenId);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8" :offset="2">
|
<el-col :span="8" :offset="2">
|
||||||
<el-form-item label="登录账号" prop="phonenumber">
|
<el-form-item label="登录账号" prop="userName">
|
||||||
<el-input v-model="form.userName" disabled />
|
<el-input v-model="form.userName" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|||||||
@ -596,7 +596,7 @@ export default {
|
|||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
inputPattern: /^.{5,20}$/,
|
inputPattern: /^.{5,20}$/,
|
||||||
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
|
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间"
|
||||||
}).then(({ value }) => {
|
}).then(({ value }) => {
|
||||||
resetUserPwd(row.userId, value).then(response => {
|
resetUserPwd(row.userId, value).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功,新密码是:" + value);
|
this.$modal.msgSuccess("修改成功,新密码是:" + value);
|
||||||
|
|||||||
@ -11,7 +11,6 @@
|
|||||||
<el-input placeholder="请输入" v-model="info.tableComment" />
|
<el-input placeholder="请输入" v-model="info.tableComment" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="实体类名称" prop="className">
|
<el-form-item label="实体类名称" prop="className">
|
||||||
<el-input placeholder="请输入" v-model="info.className" />
|
<el-input placeholder="请输入" v-model="info.className" />
|
||||||
@ -30,9 +29,9 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "BasicInfoForm",
|
|
||||||
props: {
|
props: {
|
||||||
info: {
|
info: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|||||||
@ -124,6 +124,7 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getGenTable, updateGenTable } from "@/api/tool/gen";
|
import { getGenTable, updateGenTable } from "@/api/tool/gen";
|
||||||
import { optionselect as getDictOptionselect } from "@/api/system/dict/type";
|
import { optionselect as getDictOptionselect } from "@/api/system/dict/type";
|
||||||
|
|||||||
@ -11,7 +11,6 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item prop="packageName">
|
<el-form-item prop="packageName">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
@ -213,12 +212,12 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Treeselect from "@riophae/vue-treeselect";
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "BasicInfoForm",
|
|
||||||
components: { Treeselect },
|
components: { Treeselect },
|
||||||
props: {
|
props: {
|
||||||
info: {
|
info: {
|
||||||
|
|||||||
@ -169,7 +169,8 @@
|
|||||||
:name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
|
:name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
|
||||||
:key="key"
|
:key="key"
|
||||||
>
|
>
|
||||||
<pre><code class="hljs" v-html="highlightedCode(value, key)"></code></pre>
|
<el-link :underline="false" icon="el-icon-document-copy" v-clipboard:copy="value" v-clipboard:success="clipboardSuccess" style="float:right">复制</el-link>
|
||||||
|
<pre><code class="hljs" v-html="highlightedCode(value, key)"></code></pre>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -306,6 +307,10 @@ export default {
|
|||||||
const result = hljs.highlight(language, code || "", true);
|
const result = hljs.highlight(language, code || "", true);
|
||||||
return result.value || ' ';
|
return result.value || ' ';
|
||||||
},
|
},
|
||||||
|
/** 复制代码成功 */
|
||||||
|
clipboardSuccess(){
|
||||||
|
this.$modal.msgSuccess("复制成功");
|
||||||
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.tableId);
|
this.ids = selection.map(item => item.tableId);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user