first commit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
# Ss-System 模块
|
||||
|
||||
主要实现系统管理模块的相关功能(实体类、服务类、Mapper类)
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.zxdmy.excite</groupId>
|
||||
<artifactId>shensong</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ss-system</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>ss-system</name>
|
||||
<description>
|
||||
【系统】模块,主要实现与system前缀表的数据库交互Dao和服务类Service。
|
||||
</description>
|
||||
|
||||
<!-- 依赖信息 -->
|
||||
<dependencies>
|
||||
<!-- 这里不仅可以添加官网mvn仓库的依赖,还可以添加其他几项的依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.zxdmy.excite</groupId>
|
||||
<artifactId>ss-common</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.zxdmy.excite.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-12-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SysLogLogin implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 登录用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 登录用户账号
|
||||
*/
|
||||
private String userAccount;
|
||||
|
||||
/**
|
||||
* 登录IP
|
||||
*/
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 浏览器Agent
|
||||
*/
|
||||
private String userAgent;
|
||||
|
||||
/**
|
||||
* 请求数据
|
||||
*/
|
||||
private String reqData;
|
||||
|
||||
/**
|
||||
* 返回数据
|
||||
*/
|
||||
private String resData;
|
||||
|
||||
/**
|
||||
* 耗时
|
||||
*/
|
||||
private Integer timeCost;
|
||||
|
||||
/**
|
||||
* 请求状态:0-失败 | 1-成功
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH:mm:ss", timezone = "GMT+8")
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.zxdmy.excite.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-12-09
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SysLogRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 请求用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 请求IP
|
||||
*/
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 浏览器Agent
|
||||
*/
|
||||
private String userAgent;
|
||||
|
||||
/**
|
||||
* 请求的URI
|
||||
*/
|
||||
private String reqUri;
|
||||
|
||||
/**
|
||||
* 请求方法:GET | POST | DELETE
|
||||
*/
|
||||
private String reqMethod;
|
||||
/**
|
||||
* 请求的函数
|
||||
*/
|
||||
private String reqFunction;
|
||||
|
||||
/**
|
||||
* 请求的数据
|
||||
*/
|
||||
private String reqData;
|
||||
|
||||
/**
|
||||
* 返回的数据
|
||||
*/
|
||||
private String resData;
|
||||
|
||||
/**
|
||||
* 耗时,单位:ms
|
||||
*/
|
||||
private Integer timeCost;
|
||||
|
||||
/**
|
||||
* 耗时,单位:ms
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH:mm:ss", timezone = "GMT+8")
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.zxdmy.excite.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统菜单/权限表
|
||||
* </p>
|
||||
* 不返回为null的字段
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-12
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class SysMenu implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 菜单/权限ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 菜单/权限名称
|
||||
*/
|
||||
@NotBlank(message = "菜单名称不能为空")
|
||||
@JsonProperty("title")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 菜单图标
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 菜单/权限路由:对于后台控制类定义,示例:system/user/get/{id}
|
||||
*/
|
||||
@JsonProperty("href")
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 权限标识符:对于后台控制类定义。示例:system:user:list
|
||||
*/
|
||||
@NotBlank(message = "权限标识不能为空")
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
* 组件路径:对于前端框架定义。示例:system/user/index
|
||||
*/
|
||||
private String component;
|
||||
|
||||
/**
|
||||
* 上级菜单ID
|
||||
*/
|
||||
private Integer parentId;
|
||||
|
||||
/**
|
||||
* 菜单类型:N - 顶部菜单 | C - 目录 | M - 菜单 | B - 按钮
|
||||
*/
|
||||
@NotBlank(message = "菜单类型不能为空")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 排序:数值越大越靠前
|
||||
*/
|
||||
@NotNull(message = "菜单显示顺序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 可编辑:0-禁止编辑 | 1-可编辑
|
||||
*/
|
||||
private Integer editable;
|
||||
|
||||
/**
|
||||
* 可删除:0-禁止删除 | 1-可删除
|
||||
*/
|
||||
private Integer removable;
|
||||
|
||||
/**
|
||||
* 菜单状态:0-封禁 | 1-正常 | 2-正常且禁止封禁
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否删除:0-未删除 | 1-已删除
|
||||
*/
|
||||
@JsonIgnore
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH:mm:ss", timezone = "GMT+8")
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH:mm:ss", timezone = "GMT+8")
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH:mm:ss", timezone = "GMT+8")
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
/**
|
||||
* 子菜单列表
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<SysMenu> child;
|
||||
|
||||
/**
|
||||
* 复选框使用的字段,默认为"0",选中为"1",
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String checkArr = "0";
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.zxdmy.excite.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统角色表
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SysRole implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 角色权限标识符,如:admin、guest
|
||||
*/
|
||||
@NotBlank(message = "权限标识符不能为空")
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排序:数值越大越靠前
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 角色状态:0-封禁 | 1-正常 | 2-正常且禁止封禁
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否删除:0-未删除 | 1-已删除
|
||||
*/
|
||||
@TableLogic
|
||||
@JsonIgnore
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
|
||||
/**
|
||||
* 复选框使用的字段,默认为"0",选中为"1",
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String checkArr = "0";
|
||||
|
||||
@TableField(exist = false)
|
||||
private String parentId = "-1";
|
||||
|
||||
/**
|
||||
* 前端Layui表格中,多选框使用
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@JsonProperty("LAY_CHECKED")
|
||||
private Boolean LAY_CHECKED = false;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.zxdmy.excite.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统角色和菜单/权限关联表
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-16
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SysRoleMenu implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 角色菜单关联ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
private Integer roleId;
|
||||
|
||||
/**
|
||||
* 菜单/权限ID
|
||||
*/
|
||||
private Integer menuId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.zxdmy.excite.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统用户表
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-01
|
||||
*/
|
||||
@Schema(name = "SysUser", description = "系统用户实体")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class SysUser implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@Schema(name = "id",description = "用户主键")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@Schema(name = "username",description = "用户昵称")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
@Schema(name = "avatar",description = "用户头像")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 用户性别(0-未知 | 1-男 | 2-女)
|
||||
*/
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 用户邮箱
|
||||
*/
|
||||
private String loginName;
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 用户密码
|
||||
*/
|
||||
@JsonIgnore
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*/
|
||||
// @JsonIgnore
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 用户备注信息
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 登录IP
|
||||
*/
|
||||
private String loginIp;
|
||||
|
||||
/**
|
||||
* 登录时间
|
||||
*/
|
||||
private LocalDateTime loginDate;
|
||||
|
||||
/**
|
||||
* 是否删除(0-未删除 | 1-已删除)
|
||||
*/
|
||||
@TableLogic
|
||||
@JsonIgnore
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH:mm:ss", timezone = "GMT+8")
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
// @JsonIgnore
|
||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH:mm:ss", timezone = "GMT+8")
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@JsonIgnore
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.zxdmy.excite.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统用户和角色关联表
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SysUserRole implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户角色关联ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
private Integer roleId;
|
||||
|
||||
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package com.zxdmy.excite.system.entity.cloud.account;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 企业表
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudCompany implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 企业名称
|
||||
*/
|
||||
private String companyName;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer companySort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建者ID
|
||||
*/
|
||||
private Integer creatorId;
|
||||
|
||||
/**
|
||||
* 创建者姓名
|
||||
*/
|
||||
private String creatorName;
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
/**
|
||||
* 删除者ID
|
||||
*/
|
||||
private Integer deleteId;
|
||||
|
||||
/**
|
||||
* 删除者姓名
|
||||
*/
|
||||
private String deleteName;
|
||||
|
||||
@TableField(exist=false)
|
||||
private String title;
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package com.zxdmy.excite.system.entity.cloud.account;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudDepartment implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String departmentName;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer departmentSort;
|
||||
|
||||
/**
|
||||
* 上级部门ID
|
||||
*/
|
||||
private Long departmentParentId;
|
||||
|
||||
private Long companyId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建者ID
|
||||
*/
|
||||
private Integer creatorId;
|
||||
|
||||
/**
|
||||
* 创建者姓名
|
||||
*/
|
||||
private String creatorName;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
/**
|
||||
* 删除者ID
|
||||
*/
|
||||
private Integer deleteId;
|
||||
|
||||
/**
|
||||
* 删除者姓名
|
||||
*/
|
||||
private String deleteName;
|
||||
@TableField(exist=false)
|
||||
private String title;
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.zxdmy.excite.system.entity.cloud.account;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门用户ID
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudDepartmentUser implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long departmentId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.zxdmy.excite.system.entity.cloud.collection;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收藏表
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudUserCollection implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 收藏者ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 收藏时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.zxdmy.excite.system.entity.cloud.lately;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 最近文件表
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudUserLately implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 最近打开时间
|
||||
*/
|
||||
private LocalDateTime latelyTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.zxdmy.excite.system.entity.cloud.role;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 云盘权限表
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudRole implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 权限名称
|
||||
*/
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 上传权限
|
||||
*/
|
||||
private Integer roleUpload;
|
||||
|
||||
/**
|
||||
* 下载权限
|
||||
*/
|
||||
private Integer roleDown;
|
||||
private Integer roleDelete;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建者ID
|
||||
*/
|
||||
private Integer creatorId;
|
||||
|
||||
/**
|
||||
* 创建者姓名
|
||||
*/
|
||||
private String creatorName;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
/**
|
||||
* 删除者ID
|
||||
*/
|
||||
private Integer deleteId;
|
||||
|
||||
/**
|
||||
* 删除者姓名
|
||||
*/
|
||||
private String deleteName;
|
||||
|
||||
/**
|
||||
* 复选框使用的字段,默认为"0",选中为"1",
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String checkArr = "0";
|
||||
|
||||
@TableField(exist = false)
|
||||
private String parentId = "-1";
|
||||
|
||||
/**
|
||||
* 前端Layui表格中,多选框使用
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@JsonProperty("LAY_CHECKED")
|
||||
private Boolean LAY_CHECKED = false;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.zxdmy.excite.system.entity.cloud.role;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 云盘权限文件表
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-02-01
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudRoleFile implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 权限ID
|
||||
*/
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 文件目录ID
|
||||
*/
|
||||
private Long fileId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.zxdmy.excite.system.entity.cloud.role;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 云盘权限用户表
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudRoleUser implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 权限ID
|
||||
*/
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.zxdmy.excite.system.entity.cloud.space;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件表
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudFile implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件大小
|
||||
*/
|
||||
private String fileSize;
|
||||
|
||||
/**
|
||||
* 文件格式
|
||||
*/
|
||||
private String fileFormat;
|
||||
|
||||
/**
|
||||
* 文件OSS地址
|
||||
*/
|
||||
private String fileOss;
|
||||
|
||||
/**
|
||||
* 文件封面地址
|
||||
*/
|
||||
private String fileImage;
|
||||
|
||||
/**
|
||||
* 文件排序
|
||||
*/
|
||||
private Integer fileSort;
|
||||
|
||||
/**
|
||||
* 0是文件夹 1是文件
|
||||
*/
|
||||
private Integer fileFolder;
|
||||
|
||||
/**
|
||||
* 父级文件ID
|
||||
*/
|
||||
private Long fileParentId;
|
||||
|
||||
/**
|
||||
* 顶级文件ID
|
||||
*/
|
||||
private Long fileTopId;
|
||||
|
||||
/**
|
||||
* 云盘结构目录
|
||||
*/
|
||||
private String fileFolderPath;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建者ID
|
||||
*/
|
||||
private Integer creatorId;
|
||||
|
||||
/**
|
||||
* 创建者姓名
|
||||
*/
|
||||
private String creatorName;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 更新者ID
|
||||
*/
|
||||
private Integer updaterId;
|
||||
|
||||
/**
|
||||
* 更新者姓名
|
||||
*/
|
||||
private String updaterName;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
/**
|
||||
* 删除者ID
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private Integer deleteId;
|
||||
|
||||
/**
|
||||
* 删除者姓名
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String deleteName;
|
||||
|
||||
private Integer fileTop;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.zxdmy.excite.system.entity.cloud.space;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件用户权限表
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudFileRole implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package com.zxdmy.excite.system.entity.cloud.trace;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件痕迹
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudFileTrace implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 操作名称
|
||||
*/
|
||||
private String traceName;
|
||||
|
||||
/**
|
||||
* 操作者ID
|
||||
*/
|
||||
private Integer traceCreatorId;
|
||||
|
||||
/**
|
||||
* 操作者姓名
|
||||
*/
|
||||
private String traceCreatorName;
|
||||
|
||||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 操作文件ID
|
||||
*/
|
||||
private Long fileId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zxdmy.excite.system.entity.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DepartmentTreeDTO {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
private String title;
|
||||
private String departmentName;
|
||||
private Integer departmentSort;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long departmentParentId;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long companyId;
|
||||
private List<DepartmentTreeDTO> children;
|
||||
private Boolean spread = true; // Layui树节点是否展开
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.zxdmy.excite.system.entity.dto;
|
||||
|
||||
import com.zxdmy.excite.system.entity.SysUser;
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudDepartment;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class DepartmentUserTreeNode {
|
||||
private Long id;
|
||||
private String title;
|
||||
private String type; // 'department' 或 'user'
|
||||
private Integer sort;
|
||||
private Long parentId;
|
||||
private Long departmentId; // 用户所属部门ID
|
||||
private Boolean isLeaf; // 是否为叶子节点(用户节点为true)
|
||||
private Map<String, Object> attributes = new HashMap<>();
|
||||
private List<DepartmentUserTreeNode> children = new ArrayList<>();
|
||||
|
||||
// 部门构造器
|
||||
public DepartmentUserTreeNode(CloudDepartment dept) {
|
||||
this.id = dept.getId();
|
||||
this.title = dept.getDepartmentName();
|
||||
this.type = "department";
|
||||
this.sort = dept.getDepartmentSort();
|
||||
this.parentId = dept.getDepartmentParentId();
|
||||
this.isLeaf = false;
|
||||
this.attributes.put("id", dept.getId());
|
||||
this.attributes.put("departmentName", dept.getDepartmentName());
|
||||
this.attributes.put("sort", dept.getDepartmentSort());
|
||||
this.attributes.put("parentId", dept.getDepartmentParentId());
|
||||
this.attributes.put("companyId", dept.getCompanyId());
|
||||
}
|
||||
|
||||
// 用户构造器
|
||||
public DepartmentUserTreeNode(SysUser user, Long departmentId) {
|
||||
this.id = user.getId().longValue();
|
||||
this.title = user.getUsername();
|
||||
this.type = "user";
|
||||
this.sort = 0;
|
||||
this.parentId = departmentId; // 父节点是部门ID
|
||||
this.departmentId = departmentId;
|
||||
this.isLeaf = true;
|
||||
this.attributes.put("id", user.getId());
|
||||
this.attributes.put("username", user.getUsername());
|
||||
this.attributes.put("departmentId", departmentId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zxdmy.excite.system.entity.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FileTreeDTO {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
private String title;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long fileParentId;
|
||||
private Integer fileSort;
|
||||
private List<FileTreeDTO> children;
|
||||
private Boolean spread = true; // Layui树节点是否展开
|
||||
|
||||
private String checked;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.zxdmy.excite.system.entity.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class RoleTreeDTO {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
private String name;
|
||||
private String parentId = "-1";
|
||||
private String checkArr = "0";
|
||||
private String checked;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.zxdmy.excite.system.entity.req.account;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 企业表
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ReqCompany implements Serializable {
|
||||
private String id;
|
||||
@NotNull(message = "企业名称为空")
|
||||
private String companyName;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.zxdmy.excite.system.entity.req.account;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 企业表
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ReqDepartment implements Serializable {
|
||||
private String id;
|
||||
@NotNull(message = "部门名称为空")
|
||||
private String departmentName;
|
||||
private String companyId;
|
||||
private String departmentParentId;
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.zxdmy.excite.system.entity.req.collection;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收藏表
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ReqCloudUserCollection implements Serializable {
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
private String fileId;
|
||||
|
||||
/**
|
||||
* 收藏者ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 收藏时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.zxdmy.excite.system.entity.req.lately;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 最近文件表
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ReqCloudUserLately implements Serializable {
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
private String fileId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.zxdmy.excite.system.entity.req.role;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 企业表
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ReqRole implements Serializable {
|
||||
private String id;
|
||||
@NotNull(message = "权限名称为空")
|
||||
private String roleName;
|
||||
private Integer roleUpload;
|
||||
private Integer roleDown;
|
||||
private Integer roleDelete;
|
||||
private String[] ids;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.zxdmy.excite.system.entity.req.space;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件表
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-28
|
||||
*/
|
||||
@Data
|
||||
public class ReqCloudFile implements Serializable {
|
||||
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 父级文件ID
|
||||
*/
|
||||
private String fileParentId;
|
||||
|
||||
/**
|
||||
* 顶级文件ID
|
||||
*/
|
||||
private String fileTopId;
|
||||
|
||||
/**
|
||||
* 云盘结构目录
|
||||
*/
|
||||
private String fileFolderPath;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建者ID
|
||||
*/
|
||||
private Integer creatorId;
|
||||
|
||||
/**
|
||||
* 创建者姓名
|
||||
*/
|
||||
private String creatorName;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 更新者ID
|
||||
*/
|
||||
private Integer updaterId;
|
||||
|
||||
/**
|
||||
* 更新者姓名
|
||||
*/
|
||||
private String updaterName;
|
||||
|
||||
private String fileOss;
|
||||
|
||||
private Integer fileFolder;
|
||||
|
||||
private String fileSize;
|
||||
|
||||
private Integer[] ids;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private Integer fileTop;
|
||||
|
||||
|
||||
private List<Long> fileIds;
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.zxdmy.excite.system.entity.req.space;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件用户权限表
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-30
|
||||
*/
|
||||
@Data
|
||||
public class ReqCloudFileRole implements Serializable {
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
private String fileId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.zxdmy.excite.system.entity.req.trace;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件痕迹
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ReqCloudFileTrace implements Serializable {
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 操作名称
|
||||
*/
|
||||
private String traceName;
|
||||
|
||||
/**
|
||||
* 操作者ID
|
||||
*/
|
||||
private Integer traceCreatorId;
|
||||
|
||||
/**
|
||||
* 操作者姓名
|
||||
*/
|
||||
private String traceCreatorName;
|
||||
|
||||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 操作文件ID
|
||||
*/
|
||||
private String fileId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.zxdmy.excite.system.entity.vo.account;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 企业表
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CompanyVo implements Serializable {
|
||||
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 企业名称
|
||||
*/
|
||||
private String companyName;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer companySort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建者ID
|
||||
*/
|
||||
private String creatorId;
|
||||
|
||||
/**
|
||||
* 创建者姓名
|
||||
*/
|
||||
private String creatorName;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 更新者ID
|
||||
*/
|
||||
private String updaterId;
|
||||
|
||||
/**
|
||||
* 更新者姓名
|
||||
*/
|
||||
private String updaterName;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
/**
|
||||
* 删除者ID
|
||||
*/
|
||||
private String deleteId;
|
||||
|
||||
/**
|
||||
* 删除者姓名
|
||||
*/
|
||||
private String deleteName;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.zxdmy.excite.system.entity.vo.account;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 企业表
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class DepartmentVo implements Serializable {
|
||||
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String departmentName;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer departmentSort;
|
||||
|
||||
/**
|
||||
* 上级部门ID
|
||||
*/
|
||||
private String departmentParentId;
|
||||
private String companyId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建者ID
|
||||
*/
|
||||
private Integer creatorId;
|
||||
|
||||
/**
|
||||
* 创建者姓名
|
||||
*/
|
||||
private String creatorName;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
/**
|
||||
* 删除者ID
|
||||
*/
|
||||
private Integer deleteId;
|
||||
|
||||
/**
|
||||
* 删除者姓名
|
||||
*/
|
||||
private String deleteName;
|
||||
|
||||
private String companyName;
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.zxdmy.excite.system.entity.vo.collection;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收藏表
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudUserCollectionVo implements Serializable {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 收藏者ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 收藏时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.zxdmy.excite.system.entity.vo.lately;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 最近文件表
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudUserLatelyVo implements Serializable {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 最近打开时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime latelyTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.zxdmy.excite.system.entity.vo.role;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 云盘权限表
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class RoleVo implements Serializable {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 权限名称
|
||||
*/
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 上传权限
|
||||
*/
|
||||
private Integer roleUpload;
|
||||
|
||||
/**
|
||||
* 下载权限
|
||||
*/
|
||||
private Integer roleDown;
|
||||
|
||||
private Integer roleDelete;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建者ID
|
||||
*/
|
||||
private Integer creatorId;
|
||||
|
||||
/**
|
||||
* 创建者姓名
|
||||
*/
|
||||
private String creatorName;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
/**
|
||||
* 删除者ID
|
||||
*/
|
||||
private Integer deleteId;
|
||||
|
||||
/**
|
||||
* 删除者姓名
|
||||
*/
|
||||
private String deleteName;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.zxdmy.excite.system.entity.vo.space;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件用户权限表
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudFileRoleVo implements Serializable {
|
||||
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
|
||||
private String userName;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.zxdmy.excite.system.entity.vo.space;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件表
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-28
|
||||
*/
|
||||
@Data
|
||||
public class CloudFileVo implements Serializable {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件大小
|
||||
*/
|
||||
private String fileSize;
|
||||
|
||||
/**
|
||||
* 文件格式
|
||||
*/
|
||||
private String fileFormat;
|
||||
|
||||
/**
|
||||
* 文件OSS地址
|
||||
*/
|
||||
private String fileOss;
|
||||
|
||||
/**
|
||||
* 文件封面地址
|
||||
*/
|
||||
private String fileImage;
|
||||
|
||||
/**
|
||||
* 文件排序
|
||||
*/
|
||||
private Integer fileSort;
|
||||
|
||||
/**
|
||||
* 0是文件夹 1是文件
|
||||
*/
|
||||
private Integer fileFolder;
|
||||
|
||||
/**
|
||||
* 父级文件ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long fileParentId;
|
||||
|
||||
/**
|
||||
* 顶级文件ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long fileTopId;
|
||||
|
||||
/**
|
||||
* 云盘结构目录
|
||||
*/
|
||||
private String fileFolderPath;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建者ID
|
||||
*/
|
||||
private Integer creatorId;
|
||||
|
||||
/**
|
||||
* 创建者姓名
|
||||
*/
|
||||
private String creatorName;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 更新者ID
|
||||
*/
|
||||
private Integer updaterId;
|
||||
|
||||
/**
|
||||
* 更新者姓名
|
||||
*/
|
||||
private String updaterName;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
/**
|
||||
* 删除者ID
|
||||
*/
|
||||
private Integer deleteId;
|
||||
|
||||
/**
|
||||
* 删除者姓名
|
||||
*/
|
||||
private String deleteName;
|
||||
|
||||
|
||||
|
||||
private Integer roleUpload;
|
||||
private Integer roleDown;
|
||||
private Integer roleDelete;
|
||||
|
||||
private Integer fileTop;
|
||||
|
||||
private String title;
|
||||
|
||||
private String checked;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.zxdmy.excite.system.entity.vo.space;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件表
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-28
|
||||
*/
|
||||
@Data
|
||||
public class CloudFilleUserVo implements Serializable {
|
||||
|
||||
private List<Integer> ids;
|
||||
private String userId;
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.zxdmy.excite.system.entity.vo.space;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件用户权限表
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudRoleFileVo implements Serializable {
|
||||
|
||||
|
||||
private Long id;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long fileId;
|
||||
|
||||
private Long roleId;
|
||||
|
||||
|
||||
private String fileName;
|
||||
|
||||
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.zxdmy.excite.system.entity.vo.space;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件表
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-28
|
||||
*/
|
||||
@Data
|
||||
public class CloudRoleFolderVo implements Serializable {
|
||||
|
||||
private List<Long> ids;
|
||||
private String roleId;
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.zxdmy.excite.system.entity.vo.trace;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件痕迹
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CloudFileTraceVo implements Serializable {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 操作名称
|
||||
*/
|
||||
private String traceName;
|
||||
|
||||
/**
|
||||
* 操作者ID
|
||||
*/
|
||||
private Integer traceCreatorId;
|
||||
|
||||
/**
|
||||
* 操作者姓名
|
||||
*/
|
||||
private String traceCreatorName;
|
||||
|
||||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 操作文件ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long fileId;
|
||||
|
||||
private String fileOss;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zxdmy.excite.system.mapper;
|
||||
|
||||
import com.zxdmy.excite.system.entity.SysLogLogin;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-12-28
|
||||
*/
|
||||
public interface SysLogLoginMapper extends BaseMapper<SysLogLogin> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zxdmy.excite.system.mapper;
|
||||
|
||||
import com.zxdmy.excite.system.entity.SysLogRequest;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-12-09
|
||||
*/
|
||||
public interface SysLogRequestMapper extends BaseMapper<SysLogRequest> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.zxdmy.excite.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
import com.zxdmy.excite.system.entity.SysMenu;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统菜单/角色表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-12
|
||||
*/
|
||||
@Repository
|
||||
public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||
|
||||
/**
|
||||
* 根据角色ID查询菜单/权限(不含禁用)
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 菜单/权限列表
|
||||
*/
|
||||
List<SysMenu> selectMenusByRoleId(Integer roleId);
|
||||
|
||||
/**
|
||||
* 根据用户的ID查询菜单/权限(不含禁用)
|
||||
*
|
||||
* @param userId 用户的ID
|
||||
* @param isOnlyMenu 是否只包含菜单:1:只返回菜单 | 0:返回包含菜单+按钮
|
||||
* @return 菜单/权限列表
|
||||
*/
|
||||
List<SysMenu> selectMenusByUserId(Integer userId, int isOnlyMenu);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.zxdmy.excite.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zxdmy.excite.system.entity.SysRole;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统角色表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-23
|
||||
*/
|
||||
@Repository
|
||||
public interface SysRoleMapper extends BaseMapper<SysRole> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.zxdmy.excite.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zxdmy.excite.system.entity.SysRoleMenu;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统角色和菜单/权限关联表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-16
|
||||
*/
|
||||
@Repository
|
||||
public interface SysRoleMenuMapper extends BaseMapper<SysRoleMenu> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.zxdmy.excite.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zxdmy.excite.system.entity.SysUser;
|
||||
import com.zxdmy.excite.system.entity.req.account.ReqDepartment;
|
||||
import com.zxdmy.excite.system.entity.vo.account.DepartmentVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统用户表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-01
|
||||
*/
|
||||
@Repository
|
||||
public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
|
||||
/**
|
||||
* 通过角色ID查询拥有此角色的用户列表
|
||||
*
|
||||
* @param roleId 角色列表
|
||||
* @return 拥有此角色的用户列表
|
||||
*/
|
||||
List<SysUser> selectUsersByRoleId(Integer roleId);
|
||||
|
||||
/**
|
||||
* 通过角色ID查询不拥有此角色的用户列表
|
||||
*
|
||||
* @param roleId 角色列表
|
||||
* @return 不拥有此角色的用户列表
|
||||
*/
|
||||
List<SysUser> selectUsersByRoleIdNotIn(Integer roleId);
|
||||
|
||||
List<SysUser> selectUsersByCloudUploadRoleId(@Param("roleId") String roleId);
|
||||
List<SysUser> selectUsersByCloudUploadRoleIdNotIn(@Param("roleId") String roleId);
|
||||
|
||||
ArrayList<SysUser> queryByPage(@Param("page")Integer pageNo, @Param("size")Integer pageSize, @Param("username") String username,@Param("phone") String phone,@Param("departmentId") String departmentId);
|
||||
Integer queryByPageCount(@Param("username") String username,@Param("phone") String phone,@Param("departmentId") String departmentId);
|
||||
|
||||
|
||||
List<SysUser> selectByIds(@Param("ids") List<Integer> userIds);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.zxdmy.excite.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zxdmy.excite.system.entity.SysUserRole;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统用户和角色关联表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-23
|
||||
*/
|
||||
@Repository
|
||||
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.zxdmy.excite.system.mapper.cloud.account;
|
||||
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudCompany;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudDepartment;
|
||||
import com.zxdmy.excite.system.entity.req.account.ReqCompany;
|
||||
import com.zxdmy.excite.system.entity.vo.account.CompanyVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 企业表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-24z
|
||||
*/
|
||||
@Mapper
|
||||
public interface CloudCompanyMapper extends BaseMapper<CloudCompany> {
|
||||
|
||||
ArrayList<CompanyVo> queryByPage(@Param("page")Integer pageNo, @Param("size")Integer pageSize, @Param("data") ReqCompany data);
|
||||
Integer queryByPageCount(@Param("data") ReqCompany data);
|
||||
CompanyVo getData(@Param("data") ReqCompany data);
|
||||
List<CompanyVo> queryByData();
|
||||
List<CloudCompany> getList();
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.zxdmy.excite.system.mapper.cloud.account;
|
||||
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudDepartment;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zxdmy.excite.system.entity.req.account.ReqDepartment;
|
||||
import com.zxdmy.excite.system.entity.vo.account.DepartmentVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-24
|
||||
*/
|
||||
@Mapper
|
||||
public interface CloudDepartmentMapper extends BaseMapper<CloudDepartment> {
|
||||
ArrayList<DepartmentVo> queryByPage(@Param("page")Integer pageNo, @Param("size")Integer pageSize, @Param("data") ReqDepartment data);
|
||||
Integer queryByPageCount(@Param("data") ReqDepartment data);
|
||||
DepartmentVo getData(@Param("data") ReqDepartment data);
|
||||
List<CloudDepartment> getList(@Param("id") Long id);
|
||||
|
||||
List<CloudDepartment> selectByCompanyId(@Param("companyId") Long companyId);
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.zxdmy.excite.system.mapper.cloud.account;
|
||||
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudDepartmentUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门用户ID Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Mapper
|
||||
public interface CloudDepartmentUserMapper extends BaseMapper<CloudDepartmentUser> {
|
||||
List<CloudDepartmentUser> selectByCompanyId(@Param("companyId") Long companyId);
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.zxdmy.excite.system.mapper.cloud.collection;
|
||||
|
||||
import com.zxdmy.excite.system.entity.cloud.collection.CloudUserCollection;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zxdmy.excite.system.entity.req.account.ReqCompany;
|
||||
import com.zxdmy.excite.system.entity.req.collection.ReqCloudUserCollection;
|
||||
import com.zxdmy.excite.system.entity.req.space.ReqCloudFile;
|
||||
import com.zxdmy.excite.system.entity.vo.account.CompanyVo;
|
||||
import com.zxdmy.excite.system.entity.vo.collection.CloudUserCollectionVo;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收藏表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Mapper
|
||||
public interface CloudUserCollectionMapper extends BaseMapper<CloudUserCollection> {
|
||||
|
||||
ArrayList<CloudFileVo> queryByPage(@Param("page")Integer pageNo, @Param("size")Integer pageSize, @Param("data") ReqCloudUserCollection data);
|
||||
|
||||
Integer queryByPageCount(@Param("data") ReqCloudUserCollection data);
|
||||
|
||||
CloudUserCollectionVo getData(@Param("data") ReqCloudUserCollection data);
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.zxdmy.excite.system.mapper.cloud.lately;
|
||||
|
||||
import com.zxdmy.excite.system.entity.cloud.lately.CloudUserLately;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zxdmy.excite.system.entity.req.lately.ReqCloudUserLately;
|
||||
import com.zxdmy.excite.system.entity.vo.lately.CloudUserLatelyVo;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 最近文件表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Mapper
|
||||
public interface CloudUserLatelyMapper extends BaseMapper<CloudUserLately> {
|
||||
|
||||
ArrayList<CloudFileVo> queryByPage(@Param("page")Integer pageNo, @Param("size")Integer pageSize, @Param("data") ReqCloudUserLately data);
|
||||
|
||||
Integer queryByPageCount(@Param("data") ReqCloudUserLately data);
|
||||
|
||||
CloudUserLatelyVo getData(@Param("data") ReqCloudUserLately data);
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.zxdmy.excite.system.mapper.cloud.role;
|
||||
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRoleFile;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 云盘权限文件表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-02-01
|
||||
*/
|
||||
@Mapper
|
||||
public interface CloudRoleFileMapper extends BaseMapper<CloudRoleFile> {
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.zxdmy.excite.system.mapper.cloud.role;
|
||||
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRole;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zxdmy.excite.system.entity.req.role.ReqRole;
|
||||
import com.zxdmy.excite.system.entity.vo.role.RoleVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 云盘权限表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Mapper
|
||||
public interface CloudRoleMapper extends BaseMapper<CloudRole> {
|
||||
|
||||
ArrayList<RoleVo> queryByPage(@Param("page")Integer pageNo, @Param("size")Integer pageSize, @Param("data") ReqRole data);
|
||||
Integer queryByPageCount(@Param("data") ReqRole data);
|
||||
RoleVo getData(@Param("data") ReqRole data);
|
||||
List<RoleVo> queryByData();
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.zxdmy.excite.system.mapper.cloud.role;
|
||||
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRoleUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 云盘权限用户表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Mapper
|
||||
public interface CloudRoleUserMapper extends BaseMapper<CloudRoleUser> {
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.zxdmy.excite.system.mapper.cloud.space;
|
||||
|
||||
import com.zxdmy.excite.system.entity.cloud.space.CloudFile;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zxdmy.excite.system.entity.req.account.ReqCompany;
|
||||
import com.zxdmy.excite.system.entity.req.space.ReqCloudFile;
|
||||
import com.zxdmy.excite.system.entity.vo.account.CompanyVo;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-28
|
||||
*/
|
||||
@Mapper
|
||||
public interface CloudFileMapper extends BaseMapper<CloudFile> {
|
||||
|
||||
ArrayList<CloudFileVo> queryByPage(@Param("page")Integer pageNo, @Param("size")Integer pageSize, @Param("data") ReqCloudFile data);
|
||||
|
||||
Integer queryByPageCount(@Param("data") ReqCloudFile data);
|
||||
|
||||
ArrayList<CloudFileVo> queryByRecyclePage(@Param("page")Integer pageNo, @Param("size")Integer pageSize, @Param("data") ReqCloudFile data);
|
||||
Integer queryByRecyclePageCount(@Param("data") ReqCloudFile data);
|
||||
|
||||
CloudFileVo getData(@Param("data") ReqCloudFile data);
|
||||
|
||||
ArrayList<CloudFileVo> queryByIndexPage(@Param("page")Integer pageNo, @Param("size")Integer pageSize, @Param("data") ReqCloudFile data);
|
||||
|
||||
Integer queryByIndexPageCount(@Param("data") ReqCloudFile data);
|
||||
List<CloudFileVo> queryFileByData(@Param("data") ReqCloudFile data);
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.zxdmy.excite.system.mapper.cloud.space;
|
||||
|
||||
import com.zxdmy.excite.system.entity.SysUser;
|
||||
import com.zxdmy.excite.system.entity.cloud.space.CloudFileRole;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zxdmy.excite.system.entity.req.space.ReqCloudFile;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileRoleVo;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileVo;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudRoleFileVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件用户权限表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-30
|
||||
*/
|
||||
@Mapper
|
||||
public interface CloudFileRoleMapper extends BaseMapper<CloudFileRole> {
|
||||
List<CloudFileRoleVo> getFileRole(@Param("id") String id);
|
||||
List<CloudRoleFileVo> getRoleFile(@Param("id") String id);
|
||||
List<CloudRoleFileVo> getRoleFileCheck(@Param("id") String id);
|
||||
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.zxdmy.excite.system.mapper.cloud.trace;
|
||||
|
||||
import com.zxdmy.excite.system.entity.cloud.trace.CloudFileTrace;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zxdmy.excite.system.entity.req.lately.ReqCloudUserLately;
|
||||
import com.zxdmy.excite.system.entity.req.trace.ReqCloudFileTrace;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileVo;
|
||||
import com.zxdmy.excite.system.entity.vo.trace.CloudFileTraceVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件痕迹 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Mapper
|
||||
public interface CloudFileTraceMapper extends BaseMapper<CloudFileTrace> {
|
||||
|
||||
ArrayList<CloudFileTraceVo> queryByPage(@Param("page")Integer pageNo, @Param("size")Integer pageSize, @Param("data") ReqCloudFileTrace data);
|
||||
|
||||
Integer queryByPageCount(@Param("data") ReqCloudFileTrace data);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zxdmy.excite.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zxdmy.excite.system.entity.SysLogLogin;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-12-28
|
||||
*/
|
||||
public interface ISysLogLoginService extends IService<SysLogLogin> {
|
||||
|
||||
Page<SysLogLogin> getPage(Integer current, Integer size,String userId, String ip,String startDate, String endDate);
|
||||
|
||||
int deleteLog(Integer[] logIds);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zxdmy.excite.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zxdmy.excite.system.entity.SysLogRequest;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-12-09
|
||||
*/
|
||||
public interface ISysLogRequestService extends IService<SysLogRequest> {
|
||||
|
||||
Page<SysLogRequest> getPage(Integer current, Integer size, String userId, String startDate, String endDate);
|
||||
|
||||
int deleteLog(Integer[] logIds);
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.zxdmy.excite.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zxdmy.excite.system.entity.SysMenu;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统菜单/权限表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-12
|
||||
*/
|
||||
public interface ISysMenuService extends IService<SysMenu> {
|
||||
|
||||
|
||||
/**
|
||||
* 添加或更新一个菜单/权限
|
||||
* 使用接口:新增接口、编辑接口
|
||||
*
|
||||
* @param menu 菜单/权限 实体
|
||||
* @return 影响的行数 0-失败 | 1-成功
|
||||
*/
|
||||
public int saveMenu(SysMenu menu);
|
||||
|
||||
/**
|
||||
* 修改菜单的状态
|
||||
* 使用接口:修改菜单状态接口
|
||||
*
|
||||
* @param newStatus 新状态
|
||||
* @return 影响的行数 0-失败 | 1-成功
|
||||
*/
|
||||
public int[] changeStatus(int newStatus, Integer[] menuIds);
|
||||
|
||||
/**
|
||||
* 获取一个菜单/权限
|
||||
* 使用接口:编辑接口(读取当前编辑的菜单详情)
|
||||
*
|
||||
* @param id 菜单/权限的ID
|
||||
* @return 菜单实体
|
||||
*/
|
||||
public SysMenu getMenu(Integer id);
|
||||
|
||||
/**
|
||||
* 获取菜单/权限列表
|
||||
*
|
||||
* @param isAll True:返回全部 | false:只返回目录+菜单
|
||||
* @return 菜单实体列表
|
||||
*/
|
||||
public List<SysMenu> getMenuList(Boolean isAll);
|
||||
|
||||
/**
|
||||
* 删除一个菜单/权限
|
||||
*
|
||||
* @param id 菜单/权限的ID
|
||||
* @return 影响的行数 0-失败 | 1-成功
|
||||
*/
|
||||
public int deleteMenu(Integer id);
|
||||
|
||||
/**
|
||||
* 通过角色ID查询全部菜单列表
|
||||
* 使用接口:角色管理---编辑角色,用于加载当前角色已经选中的菜单权限
|
||||
*
|
||||
* @param roleId 角色ID。若为0,表示不指定角色ID。
|
||||
* @return 全部菜单列表
|
||||
*/
|
||||
public List<SysMenu> getMenuListForRole(int roleId);
|
||||
|
||||
|
||||
/**
|
||||
* 通过用户的ID获取权限列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param userId 用户ID * @param isOnlyMenu 是否只获取菜单(不含按钮)
|
||||
* @return 菜单/权限列表
|
||||
*/
|
||||
public List<SysMenu> getMenuListByUserId(Integer userId, boolean isOnlyMenu);
|
||||
|
||||
/**
|
||||
* 通过角色的ID查询该角色拥有的菜单/权限
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 菜单/权限列表
|
||||
*/
|
||||
public List<SysMenu> getMenuListByRoleId(Integer roleId);
|
||||
|
||||
|
||||
/**
|
||||
* 认证框架使用:权限管理模块使用到的获取权限列表
|
||||
*
|
||||
* @return 菜单权限列表
|
||||
*/
|
||||
public List<SysMenu> getMenuListForSaToken();
|
||||
|
||||
/**
|
||||
* 认证框架使用:通过用户ID获取该用户所拥有的权限
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 菜单权限列表
|
||||
*/
|
||||
public List<SysMenu> getMenuListByUserIdForSaToken(Integer userId);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.zxdmy.excite.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zxdmy.excite.system.entity.SysRoleMenu;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统角色和菜单/权限关联表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-16
|
||||
*/
|
||||
public interface ISysRoleMenuService extends IService<SysRoleMenu> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.zxdmy.excite.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zxdmy.excite.system.entity.SysRole;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统角色表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-23
|
||||
*/
|
||||
public interface ISysRoleService extends IService<SysRole> {
|
||||
|
||||
/**
|
||||
* 接口:添加|更新角色
|
||||
*
|
||||
* @param role 角色实体,ID为空表示添加
|
||||
* @param menusIds 为当前角色添加的菜单/权限ID列表
|
||||
* @return 影响的行数 0 - 失败 | >0 - 成功
|
||||
*/
|
||||
public int saveRole(SysRole role, Integer[] menusIds);
|
||||
|
||||
/**
|
||||
* 接口:根据ID查询某个角色详情
|
||||
*
|
||||
* @param id 角色的ID
|
||||
* @return 角色实体
|
||||
*/
|
||||
public SysRole getRole(Integer id);
|
||||
|
||||
/**
|
||||
* 接口:查询状态正常的角色列表
|
||||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
public List<SysRole> getListByUserId(Integer userId);
|
||||
|
||||
/**
|
||||
* 接口:分页查询接口列表
|
||||
*
|
||||
* @param current 当前页
|
||||
* @param size 页大小
|
||||
* @param name 检索:名称
|
||||
* @param permission 检索:权限字符
|
||||
* @return 结果页面
|
||||
*/
|
||||
public Page<SysRole> getPage(Integer current, Integer size, String name, String permission);
|
||||
|
||||
/**
|
||||
* 接口:修改角色状态
|
||||
*
|
||||
* @param newStatus 新状态
|
||||
* @param roleIds 角色ID列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int[] changeStatus(Integer newStatus, Integer[] roleIds);
|
||||
|
||||
/**
|
||||
* 接口:删除角色
|
||||
*
|
||||
* @param roleIds 角色ID数组
|
||||
* @return 删除结果:0:成功个数 1:删除失败个数 2:因已分配用户,禁止删除数
|
||||
*/
|
||||
public int[] deleteRoleById(Integer[] roleIds);
|
||||
|
||||
|
||||
/**
|
||||
* 接口:将指定角色,授权分配给系列用户
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 用户ID列表
|
||||
* @return 授权结果
|
||||
*/
|
||||
public boolean authRoleForUsers(Integer roleId, Integer[] userIds);
|
||||
|
||||
/**
|
||||
* 接口:取消指定角色已授权的系列用户
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 用户ID列表
|
||||
* @return 取消授权结果
|
||||
*/
|
||||
public int[] revokeRoleForUsers(Integer roleId, Integer[] userIds);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.zxdmy.excite.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zxdmy.excite.system.entity.SysUserRole;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统用户和角色关联表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-23
|
||||
*/
|
||||
public interface ISysUserRoleService extends IService<SysUserRole> {
|
||||
|
||||
/**
|
||||
* 通过角色ID获取用户角色关联列表
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 用户角色关联列表
|
||||
*/
|
||||
public List<SysUserRole> getListByRoleId(Integer roleId);
|
||||
|
||||
/**
|
||||
* 通过用户ID获取用户角色关联列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户角色关联列表
|
||||
*/
|
||||
public List<SysUserRole> getListByUserId(Integer userId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.zxdmy.excite.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.system.entity.SysUser;
|
||||
import com.zxdmy.excite.system.entity.req.account.ReqDepartment;
|
||||
import com.zxdmy.excite.system.entity.vo.account.DepartmentVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统用户表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-01
|
||||
*/
|
||||
public interface ISysUserService extends IService<SysUser> {
|
||||
|
||||
/**
|
||||
* 登录服务
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @return SysUser:登录成功 | null:登录失败
|
||||
*/
|
||||
public SysUser login(String username, String password);
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*
|
||||
* @param current 当前页
|
||||
* @param size 当前页大小
|
||||
* @param username 检索用户名
|
||||
* @param account 检索邮箱/手机号
|
||||
* @return 用户页面信息
|
||||
*/
|
||||
public Page<SysUser> getPage(Integer current, Integer size, String username, String account);
|
||||
|
||||
PageList<SysUser> queryByPage(Integer current, Integer size, String username, String phone,String departmentId);
|
||||
|
||||
/**
|
||||
* 保存用户:添加 | 更新
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @param roleIds 角色ID列表
|
||||
* @return 修改的行数 >0:成功 | <=0:失败
|
||||
*/
|
||||
public int save(SysUser user, Integer[] roleIds);
|
||||
|
||||
public int saveData(SysUser user, Integer[] roleIds,String[] roleIds1,String departmentId);
|
||||
/**
|
||||
* 接口:修改用户状态
|
||||
*
|
||||
* @param newStatus 新状态
|
||||
* @param userIds 用户ID列表
|
||||
* @return 修改结果数组 0:成功个数 1:失败个数
|
||||
*/
|
||||
public int[] changeStatus(Integer newStatus, Integer[] userIds);
|
||||
|
||||
/**
|
||||
* 接口:给用户分配角色
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param roleIds 角色ID数组
|
||||
* @return 修改结果数组 0:分配个数 1:失败个数
|
||||
*/
|
||||
public boolean setRoleForUser(Integer userId, Integer[] roleIds);
|
||||
|
||||
public boolean setCloudRoleForUser(String userId, String[] roleIds);
|
||||
|
||||
/**
|
||||
* 接口:根据ID删除用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 删除结果:>0 表示成功
|
||||
*/
|
||||
int[] deleteUserById(Integer[] userId);
|
||||
|
||||
/**
|
||||
* 接口:通过角色ID查询用户列表
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 用户列表
|
||||
*/
|
||||
List<SysUser> getUserListByRoleId(Integer roleId);
|
||||
|
||||
/**
|
||||
* 接口:通过角色ID查询不包含此角色的用户列表
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 不包含此角色的用户列表
|
||||
*/
|
||||
List<SysUser> getUserListByRoleIdNotIn(Integer roleId);
|
||||
|
||||
List<SysUser> selectUsersByCloudUploadRoleId(String roleId);
|
||||
List<SysUser> selectUsersByCloudUploadRoleIdNotIn(String roleId);
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.zxdmy.excite.system.service.cloud.account;
|
||||
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudCompany;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudDepartment;
|
||||
import com.zxdmy.excite.system.entity.req.account.ReqCompany;
|
||||
import com.zxdmy.excite.system.entity.vo.account.CompanyVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 企业表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-24
|
||||
*/
|
||||
public interface ICloudCompanyService extends IService<CloudCompany> {
|
||||
PageList<CompanyVo> queryByPage(Integer current, Integer size, ReqCompany data);
|
||||
CompanyVo getByData(ReqCompany data);
|
||||
int saveData(ReqCompany data);
|
||||
int updateData(ReqCompany data);
|
||||
int deleteById(String id);
|
||||
List<CompanyVo> queryByData();
|
||||
List<CloudCompany> getList();
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.zxdmy.excite.system.service.cloud.account;
|
||||
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudDepartment;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zxdmy.excite.system.entity.dto.DepartmentUserTreeNode;
|
||||
import com.zxdmy.excite.system.entity.req.account.ReqDepartment;
|
||||
import com.zxdmy.excite.system.entity.vo.account.DepartmentVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-24
|
||||
*/
|
||||
public interface ICloudDepartmentService extends IService<CloudDepartment> {
|
||||
|
||||
PageList<DepartmentVo> queryByPage(Integer current, Integer size, ReqDepartment data);
|
||||
DepartmentVo getByData(ReqDepartment data);
|
||||
int saveData(ReqDepartment data);
|
||||
int updateData(ReqDepartment data);
|
||||
int deleteById(String id);
|
||||
List<CloudDepartment> getList(Long id);
|
||||
int changeDepartment(String userId, String departmentId);
|
||||
|
||||
public List<DepartmentUserTreeNode> buildDepartmentUserTree(Long companyId);
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.zxdmy.excite.system.service.cloud.account;
|
||||
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudDepartmentUser;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门用户ID 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
public interface ICloudDepartmentUserService extends IService<CloudDepartmentUser> {
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.zxdmy.excite.system.service.cloud.collection;
|
||||
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.system.entity.cloud.collection.CloudUserCollection;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zxdmy.excite.system.entity.req.account.ReqCompany;
|
||||
import com.zxdmy.excite.system.entity.req.collection.ReqCloudUserCollection;
|
||||
import com.zxdmy.excite.system.entity.req.space.ReqCloudFile;
|
||||
import com.zxdmy.excite.system.entity.vo.account.CompanyVo;
|
||||
import com.zxdmy.excite.system.entity.vo.collection.CloudUserCollectionVo;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收藏表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
public interface ICloudUserCollectionService extends IService<CloudUserCollection> {
|
||||
|
||||
PageList<CloudFileVo> queryByPage(Integer current, Integer size, ReqCloudUserCollection data);
|
||||
|
||||
CloudUserCollectionVo getByData(ReqCloudUserCollection data);
|
||||
|
||||
int saveData(ReqCloudUserCollection data);
|
||||
int deleteById(String id);
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.zxdmy.excite.system.service.cloud.lately;
|
||||
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.system.entity.cloud.lately.CloudUserLately;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zxdmy.excite.system.entity.req.collection.ReqCloudUserCollection;
|
||||
import com.zxdmy.excite.system.entity.req.lately.ReqCloudUserLately;
|
||||
import com.zxdmy.excite.system.entity.vo.collection.CloudUserCollectionVo;
|
||||
import com.zxdmy.excite.system.entity.vo.lately.CloudUserLatelyVo;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 最近文件表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
public interface ICloudUserLatelyService extends IService<CloudUserLately> {
|
||||
|
||||
PageList<CloudFileVo> queryByPage(Integer current, Integer size, ReqCloudUserLately data);
|
||||
CloudUserLatelyVo getByData(ReqCloudUserLately data);
|
||||
int saveData(ReqCloudUserLately data);
|
||||
int deleteById(String id);
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.zxdmy.excite.system.service.cloud.role;
|
||||
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRoleFile;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 云盘权限文件表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-02-01
|
||||
*/
|
||||
public interface ICloudRoleFileService extends IService<CloudRoleFile> {
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.zxdmy.excite.system.service.cloud.role;
|
||||
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.system.entity.SysRole;
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRole;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zxdmy.excite.system.entity.req.role.ReqRole;
|
||||
import com.zxdmy.excite.system.entity.vo.role.RoleVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 云盘权限表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
public interface ICloudRoleService extends IService<CloudRole> {
|
||||
|
||||
PageList<RoleVo> queryByPage(Integer current, Integer size, ReqRole data);
|
||||
RoleVo getByData(ReqRole data);
|
||||
int saveData(ReqRole data);
|
||||
int updateData(ReqRole data);
|
||||
int deleteById(String id);
|
||||
public int[] changeUploadStatus(Integer newStatus, String[] ids);
|
||||
public int[] changeDownStatus(Integer newStatus, String[] ids);
|
||||
public int[] changeDeleteStatus(Integer newStatus, String[] ids);
|
||||
public boolean authRoleForUsers(String roleId, String[] userIds);
|
||||
public int[] revokeRoleForUsers(String roleId, String[] userIds);
|
||||
|
||||
public List<CloudRole> getListByUserId(Integer userId);
|
||||
List<RoleVo> queryByData();
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.zxdmy.excite.system.service.cloud.role;
|
||||
|
||||
import com.zxdmy.excite.system.entity.SysUserRole;
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRole;
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRoleUser;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 云盘权限用户表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
public interface ICloudRoleUserService extends IService<CloudRoleUser> {
|
||||
|
||||
public List<CloudRoleUser> getListByUserId(Integer userId);
|
||||
|
||||
CloudRole getCloudShareRole(Integer id);
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.zxdmy.excite.system.service.cloud.space;
|
||||
|
||||
import com.zxdmy.excite.system.entity.SysUser;
|
||||
import com.zxdmy.excite.system.entity.cloud.space.CloudFileRole;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zxdmy.excite.system.entity.req.space.ReqCloudFileRole;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileRoleVo;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudRoleFileVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件用户权限表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-30
|
||||
*/
|
||||
public interface ICloudFileRoleService extends IService<CloudFileRole> {
|
||||
|
||||
List<CloudFileRoleVo> getFileRole(String id);
|
||||
List<CloudRoleFileVo> getRoleFile(String id);
|
||||
List<CloudRoleFileVo> getRoleFileCheck(String id);
|
||||
|
||||
CloudFileRole getData(ReqCloudFileRole data);
|
||||
List<CloudFileRole> getFileRoleByUseId(Integer id);
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.zxdmy.excite.system.service.cloud.space;
|
||||
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.system.entity.cloud.space.CloudFile;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zxdmy.excite.system.entity.req.account.ReqCompany;
|
||||
import com.zxdmy.excite.system.entity.req.space.ReqCloudFile;
|
||||
import com.zxdmy.excite.system.entity.vo.account.CompanyVo;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-28
|
||||
*/
|
||||
public interface ICloudFileService extends IService<CloudFile> {
|
||||
|
||||
PageList<CloudFileVo> queryByPage(Integer current, Integer size, ReqCloudFile data);
|
||||
|
||||
PageList<CloudFileVo> queryByRecyclePage(Integer current, Integer size, ReqCloudFile data);
|
||||
|
||||
CloudFileVo getByData(ReqCloudFile data);
|
||||
|
||||
int saveData(ReqCloudFile data);
|
||||
int saveFileData(ReqCloudFile data);
|
||||
int updateFileData(ReqCloudFile data);
|
||||
int updateData(ReqCloudFile data);
|
||||
int recover(String id);
|
||||
int deleteById(String id);
|
||||
|
||||
public int[] changeDeleteStatus(Integer newStatus, String[] ids);
|
||||
|
||||
PageList<CloudFileVo> queryByIndexPage(Integer current, Integer size, ReqCloudFile data);
|
||||
|
||||
|
||||
List<CloudFileVo> queryFileByData(ReqCloudFile data);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.zxdmy.excite.system.service.cloud.trace;
|
||||
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.system.entity.cloud.trace.CloudFileTrace;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zxdmy.excite.system.entity.req.lately.ReqCloudUserLately;
|
||||
import com.zxdmy.excite.system.entity.req.trace.ReqCloudFileTrace;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileVo;
|
||||
import com.zxdmy.excite.system.entity.vo.trace.CloudFileTraceVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件痕迹 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
public interface ICloudFileTraceService extends IService<CloudFileTrace> {
|
||||
PageList<CloudFileTraceVo> queryByPage(Integer current, Integer size, ReqCloudFileTrace data);
|
||||
int saveData(ReqCloudFileTrace data);
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.zxdmy.excite.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zxdmy.excite.system.entity.SysLogLogin;
|
||||
import com.zxdmy.excite.system.entity.SysLogRequest;
|
||||
import com.zxdmy.excite.system.mapper.SysLogLoginMapper;
|
||||
import com.zxdmy.excite.system.service.ISysLogLoginService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-12-28
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SysLogLoginServiceImpl extends ServiceImpl<SysLogLoginMapper, SysLogLogin> implements ISysLogLoginService {
|
||||
|
||||
|
||||
SysLogLoginMapper loginMapper;
|
||||
|
||||
@Override
|
||||
public Page<SysLogLogin> getPage(Integer current, Integer size, String userId, String ip, String startDate, String endDate) {
|
||||
// 页码信息
|
||||
current = null == current ? 1 : current;
|
||||
size = null == size ? 10 : size;
|
||||
QueryWrapper<SysLogLogin> wrapper = new QueryWrapper<>();
|
||||
// 检索请求用户
|
||||
wrapper.like(userId != null && !"".equals(userId), "user_id", userId)
|
||||
// 检索IP
|
||||
.like(ip != null && !"".equals(ip), "ip", ip)
|
||||
// 检索起始时间
|
||||
.ge(startDate != null && !"".equals(startDate), "create_time", startDate)
|
||||
// 检索终止时间
|
||||
.le(endDate != null && !"".equals(endDate), "create_time", endDate)
|
||||
.orderByDesc("id");
|
||||
return loginMapper.selectPage(new Page<>(current, size), wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteLog(Integer[] logIds) {
|
||||
return loginMapper.deleteBatchIds(Arrays.asList(logIds));
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.zxdmy.excite.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zxdmy.excite.system.entity.SysLogRequest;
|
||||
import com.zxdmy.excite.system.entity.SysMenu;
|
||||
import com.zxdmy.excite.system.mapper.SysLogRequestMapper;
|
||||
import com.zxdmy.excite.system.service.ISysLogRequestService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-12-09
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SysLogRequestServiceImpl extends ServiceImpl<SysLogRequestMapper, SysLogRequest> implements ISysLogRequestService {
|
||||
|
||||
SysLogRequestMapper logRequestMapper;
|
||||
|
||||
@Override
|
||||
public Page<SysLogRequest> getPage(Integer current, Integer size, String userId, String startDate, String endDate) {
|
||||
// 页码信息
|
||||
current = null == current ? 1 : current;
|
||||
size = null == size ? 10 : size;
|
||||
// 检索信息
|
||||
QueryWrapper<SysLogRequest> wrapper = new QueryWrapper<>();
|
||||
// 检索请求用户
|
||||
wrapper.like(userId != null && !"".equals(userId), "user_id", userId)
|
||||
// 检索起始时间
|
||||
.ge(startDate != null && !"".equals(startDate), "create_time", startDate)
|
||||
// 检索终止时间
|
||||
.le(endDate != null && !"".equals(endDate), "create_time", endDate)
|
||||
.orderByDesc("id");
|
||||
return logRequestMapper.selectPage(new Page<>(current, size), wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteLog(Integer[] logIds) {
|
||||
return logRequestMapper.deleteBatchIds(Arrays.asList(logIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,389 @@
|
||||
package com.zxdmy.excite.system.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import com.zxdmy.excite.common.config.ExciteConfig;
|
||||
import com.zxdmy.excite.common.enums.SystemCode;
|
||||
|
||||
import com.zxdmy.excite.common.exception.ServiceException;
|
||||
import com.zxdmy.excite.common.service.RedisService;
|
||||
import com.zxdmy.excite.system.entity.SysMenu;
|
||||
import com.zxdmy.excite.system.entity.SysRoleMenu;
|
||||
import com.zxdmy.excite.system.mapper.SysMenuMapper;
|
||||
import com.zxdmy.excite.system.mapper.SysRoleMenuMapper;
|
||||
import com.zxdmy.excite.system.service.ISysMenuService;
|
||||
|
||||
import com.zxdmy.excite.system.utils.AuthUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统菜单/权限表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-12
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements ISysMenuService {
|
||||
|
||||
|
||||
SysMenuMapper menuMapper;
|
||||
|
||||
SysRoleMenuMapper roleMenuMapper;
|
||||
|
||||
RedisService redisService;
|
||||
|
||||
ExciteConfig exciteConfig;
|
||||
|
||||
/**
|
||||
* 获取一个菜单/权限
|
||||
* 使用接口:编辑接口(读取当前编辑的菜单详情)
|
||||
*
|
||||
* @param id 菜单/权限的ID
|
||||
* @return 菜单实体
|
||||
*/
|
||||
@Override
|
||||
public SysMenu getMenu(Integer id) {
|
||||
if (null == id) {
|
||||
throw new ServiceException("服务错误:菜单/权限的ID不能为null");
|
||||
}
|
||||
QueryWrapper<SysMenu> wrapper = new QueryWrapper<>();
|
||||
// 根据ID查询status正常的菜单
|
||||
wrapper.eq("id", id).ne("status", SystemCode.STATUS_N.getCode());
|
||||
return menuMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加或更新一个菜单/权限
|
||||
* 使用接口:新增接口、编辑接口
|
||||
*
|
||||
* @param menu 菜单/权限 实体
|
||||
* @return 影响的行数 0-失败 | 1-成功
|
||||
*/
|
||||
@Override
|
||||
public int saveMenu(SysMenu menu) {
|
||||
if (null == menu) {
|
||||
throw new ServiceException("服务错误:菜单/权限为空");
|
||||
}
|
||||
// 根据ID判断是否是新增,ID为空是新增,否则是更新
|
||||
boolean isAdd = null == menu.getId();
|
||||
// 如果是顶级菜单:上级菜单为-1,请求路径为""
|
||||
if ("N".equals(menu.getType())) {
|
||||
menu.setParentId(-1);
|
||||
menu.setPath("");
|
||||
}
|
||||
// 如果是目录:请求路径设置为空字符串(非NULL)
|
||||
else if ("C".equals(menu.getType())) {
|
||||
menu.setPath("");
|
||||
}
|
||||
// 初始化:标签
|
||||
if (!"fa ".equals(menu.getIcon().substring(0, 3)))
|
||||
menu.setIcon("fa " + menu.getIcon());
|
||||
// 如果未输入排序,则填充默认顺序:50
|
||||
if (null == menu.getSort()) {
|
||||
menu.setSort(SystemCode.SORT_DEFAULT.getCode());
|
||||
}
|
||||
// 设置时间信息
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
int result = 0;
|
||||
// 新增
|
||||
if (isAdd) {
|
||||
menu.setCreateTime(localDateTime);
|
||||
// 设置初始状态:正常
|
||||
if (null == menu.getStatus()) {
|
||||
menu.setStatus(SystemCode.STATUS_Y.getCode());
|
||||
}
|
||||
if (null == menu.getEditable()) {
|
||||
menu.setEditable(SystemCode.EDITABLE_Y.getCode());
|
||||
}
|
||||
if (null == menu.getRemovable()) {
|
||||
menu.setRemovable(SystemCode.REMOVABLE_Y.getCode());
|
||||
}
|
||||
result = menuMapper.insert(menu);
|
||||
// 清除缓存
|
||||
AuthUtils.clearSystemMenuListCache(result != 0);
|
||||
}
|
||||
// 修改
|
||||
else {
|
||||
menu.setUpdateTime(localDateTime);
|
||||
QueryWrapper<SysMenu> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("id", menu.getId())
|
||||
.eq("editable", SystemCode.EDITABLE_Y.getCode())
|
||||
.ne("status", SystemCode.STATUS_N.getCode());
|
||||
result = menuMapper.update(menu, wrapper);
|
||||
// 清除缓存
|
||||
AuthUtils.clearSystemMenuListCache(result != 0);
|
||||
AuthUtils.clearUserMenuListCache(result != 0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单的状态
|
||||
* 使用接口:修改菜单状态接口
|
||||
*
|
||||
* @return 影响的行数 0-失败 | 1-成功
|
||||
*/
|
||||
@Override
|
||||
public int[] changeStatus(int newStatus, Integer[] menuIds) {
|
||||
int[] result = new int[2];
|
||||
for (Integer menuId : menuIds) {
|
||||
SysMenu menu = new SysMenu();
|
||||
QueryWrapper<SysMenu> wrapper = new QueryWrapper<>();
|
||||
menu.setId(menuId);
|
||||
menu.setStatus(newStatus);
|
||||
wrapper.eq("id", menuId)
|
||||
.ne("status", SystemCode.STATUS_Y_BLOCK.getCode());
|
||||
if (menuMapper.update(menu, wrapper) > 0)
|
||||
result[0]++;
|
||||
else result[1]++;
|
||||
}
|
||||
// 清除缓存
|
||||
AuthUtils.clearUserMenuListCache(result[0] != 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单/权限列表
|
||||
* 使用接口:
|
||||
*
|
||||
* @param isAll True:返回全部 | false:只返回目录+菜单
|
||||
* @return 菜单实体列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenu> getMenuList(Boolean isAll) {
|
||||
QueryWrapper<SysMenu> wrapper = new QueryWrapper<>();
|
||||
// 查询状态status正常(0)的菜单
|
||||
wrapper.ne(!isAll, "status", SystemCode.STATUS_N.getCode())
|
||||
// 非只查询菜单,则【排除】类型(type)是按钮(B)的权限
|
||||
.ne(!isAll, "type", "B")
|
||||
// 排序
|
||||
.orderByDesc("sort");
|
||||
return menuMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一个菜单/权限
|
||||
* 使用接口:删除菜单
|
||||
*
|
||||
* @param id 菜单/权限的ID
|
||||
* @return 影响的行数 0-失败 | 1-成功
|
||||
*/
|
||||
@Override
|
||||
public int deleteMenu(Integer id) {
|
||||
if (id == null) {
|
||||
throw new ServiceException("服务错误:菜单/权限的ID不能为null");
|
||||
}
|
||||
// 这里注意:menu表和roleMenu表未设置关联,所以可以先删除菜单,再删除关联。
|
||||
// 如果二者设置了外键关联,则流程是:判断menu可删除-->删除roleMenu关联-->删除menu
|
||||
// 只有removable=1的菜单才可以删除
|
||||
QueryWrapper<SysMenu> wrapper2 = new QueryWrapper<>();
|
||||
wrapper2.eq("id", id)
|
||||
.ne("status", SystemCode.STATUS_N.getCode())
|
||||
.eq("removable", SystemCode.REMOVABLE_Y.getCode());
|
||||
int result = menuMapper.delete(wrapper2);
|
||||
// 当删除一个菜单后,需要从【角色-权限关联表】中删除含有该菜单的记录
|
||||
if (result > 0) {
|
||||
QueryWrapper<SysRoleMenu> wrapper1 = new QueryWrapper<>();
|
||||
wrapper1.eq("menu_id", id);
|
||||
roleMenuMapper.delete(wrapper1);
|
||||
}
|
||||
// 清除缓存
|
||||
AuthUtils.clearSystemMenuListCache(result != 0);
|
||||
AuthUtils.clearUserMenuListCache(result != 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 外部接口:通过角色ID查询菜单
|
||||
*
|
||||
* @param roleId 角色ID。若为0,表示不指定角色ID。
|
||||
* @return 菜单列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenu> getMenuListForRole(int roleId) {
|
||||
// 获取全部的菜单
|
||||
QueryWrapper<SysMenu> sysMenuQueryWrapper = new QueryWrapper<>();
|
||||
sysMenuQueryWrapper.ne("status", SystemCode.STATUS_N.getCode())
|
||||
.orderByDesc("sort");
|
||||
List<SysMenu> menuList = menuMapper.selectList(sysMenuQueryWrapper);
|
||||
// 如果为roleId=0,表示获取全部正常的菜单
|
||||
if (0 == roleId) {
|
||||
return menuList;
|
||||
}
|
||||
// 否则,获取全部菜单后,将该角色拥有的菜单的CheckArr字段标记为1
|
||||
else {
|
||||
// 获取当前角色拥有的权限
|
||||
QueryWrapper<SysRoleMenu> roleMenuQueryWrapper = new QueryWrapper<>();
|
||||
roleMenuQueryWrapper.eq("role_id", roleId);
|
||||
List<Integer> roleMenuList = roleMenuMapper.selectList(roleMenuQueryWrapper).stream().map(SysRoleMenu::getMenuId).collect(Collectors.toList());
|
||||
// 使用lambda表达式,直接在菜单列表上修改checkArr字段
|
||||
return menuList.stream().peek(menu -> {
|
||||
if (roleMenuList.contains(menu.getId()))
|
||||
menu.setCheckArr("1");
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 接口实现:通过用户ID查询该用户所拥有的菜单(不含角色、菜单被禁用的菜单权限)
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param isOnlyMenu 是否只获取菜单(不含按钮)
|
||||
* @return 菜单列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenu> getMenuListByUserId(Integer userId, boolean isOnlyMenu) {
|
||||
// 只获取菜单列表
|
||||
if (isOnlyMenu) {
|
||||
return menuMapper.selectMenusByUserId(userId, 1);
|
||||
}
|
||||
// 获取菜单+权限列表
|
||||
else {
|
||||
return menuMapper.selectMenusByUserId(userId, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口实现:通过角色的ID查询该角色拥有的菜单/权限(不含菜单被禁用的菜单权限)
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 菜单/权限列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenu> getMenuListByRoleId(Integer roleId) {
|
||||
return menuMapper.selectMenusByRoleId(roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 内部调用:获取所有的菜单/权限列表,为权限认证框架使用
|
||||
*
|
||||
* @return 菜单实体列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenu> getMenuListForSaToken() {
|
||||
// 首先尝试从缓存中读取数据
|
||||
List<SysMenu> menuList = AuthUtils.getSystemMenuListCache(true);
|
||||
// 如果未命中缓存:从缓存读取
|
||||
if (null == menuList) {
|
||||
menuList = menuMapper.selectList(null);
|
||||
// 同时尝试写入缓存
|
||||
AuthUtils.setSystemMenuListCache(null != menuList, menuList);
|
||||
}
|
||||
return menuList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 内部调用:获取指定用户的菜单/权限列表,为权限认证框架使用
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 菜单权限列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenu> getMenuListByUserIdForSaToken(Integer userId) {
|
||||
// 先尝试从缓存读取
|
||||
List<SysMenu> menuList = AuthUtils.getUserMenuListCache(true, userId);
|
||||
// 如果为空,则从数据库读取
|
||||
if (null == menuList) {
|
||||
menuList = this.getMenuListByUserId(userId, false);
|
||||
// 同时尝试写入缓存
|
||||
AuthUtils.setUserMenuListCache(null != menuList, userId, menuList);
|
||||
}
|
||||
return menuList;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 将最新的全部菜单列表保存至Redis数据库
|
||||
// * 因为:对菜单基础信息进行增、改、删等操作后,如果开启Redis缓存,需要将Redis中的数据进行更新
|
||||
// *
|
||||
// * @param result 执行增改删的结果
|
||||
// */
|
||||
// private List<SysMenu> saveAllMenu2Redis(int result) {
|
||||
// // 如果开启Redis,并且Redis服务正常
|
||||
// if (result > 0 && exciteConfig.getAllowRedis()) {
|
||||
// QueryWrapper<SysMenu> wrapper = new QueryWrapper<>();
|
||||
// // 查询全部菜单(无论禁用与否)
|
||||
// wrapper.orderByDesc("sort");
|
||||
// List<SysMenu> menuList = menuMapper.selectList(wrapper);
|
||||
// if (null != menuList) {
|
||||
// redisService.set("menu:allMenuList", (Serializable) menuList);
|
||||
// }
|
||||
// // 同时删除全部Redis中保存的用户
|
||||
// Set<Integer> userSet = (Set<Integer>) redisService.get("menu:userList");
|
||||
// if (userSet != null) {
|
||||
// for (Integer userId : userSet) {
|
||||
// redisService.remove("menu:userMenuList:" + userId);
|
||||
// }
|
||||
// redisService.remove("menu:userList");
|
||||
// }
|
||||
// return menuList;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 从Redis数据库中读取全部的菜单信息
|
||||
// *
|
||||
// * @return 菜单列表
|
||||
// */
|
||||
// private List<SysMenu> getAllMenu4Redis() {
|
||||
// // 如果开启Redis,则从redis中读取
|
||||
// if (exciteConfig.getAllowRedis()) {
|
||||
// // redis中没有:存入并返回
|
||||
// if (!redisService.hasKey("menu:allMenuList")) {
|
||||
// return this.saveAllMenu2Redis(1);
|
||||
// }
|
||||
// // redis中有:返回
|
||||
// return (List<SysMenu>) redisService.get("menu:allMenuList");
|
||||
// }
|
||||
// // 未开启redis,返回
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 私有方法:从redis中读取 保存当前用户的权限菜单列表至redis
|
||||
// * 同时将已经保存至redis的用户集合更新
|
||||
// *
|
||||
// * @param userId 用户ID
|
||||
// * @return 当前用户的权限列表
|
||||
// */
|
||||
// private List<SysMenu> getUserMenu4Redis(Integer userId) {
|
||||
// // 如果开启Redis,则从redis中读取
|
||||
// if (exciteConfig.getAllowRedis()) {
|
||||
// // redis中没有:
|
||||
// if (!redisService.hasKey("menu:userMenuList:" + userId)) {
|
||||
// // 存入并返回
|
||||
// List<SysMenu> menuList = menuMapper.selectMenusByUserId(userId, 0);
|
||||
// if (null != menuList) {
|
||||
// redisService.set("menu:userMenuList:" + userId, (Serializable) menuList);
|
||||
// Set<Integer> userSet = new HashSet<>();
|
||||
// // 同时把该用户的ID存入Redis
|
||||
// if (redisService.hasKey("menu:userList")) {
|
||||
// userSet = (Set<Integer>) redisService.get("menu:userList");
|
||||
// }
|
||||
// userSet.add(userId);
|
||||
// redisService.set("menu:userList", (Serializable) userSet);
|
||||
// }
|
||||
// return menuList;
|
||||
// }
|
||||
// // redis中有:返回
|
||||
// return (List<SysMenu>) redisService.get("menu:userMenuList:" + userId);
|
||||
// }
|
||||
// // 未开启redis,返回空
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.zxdmy.excite.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zxdmy.excite.system.entity.SysRoleMenu;
|
||||
import com.zxdmy.excite.system.mapper.SysRoleMenuMapper;
|
||||
import com.zxdmy.excite.system.service.ISysRoleMenuService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统角色和菜单/权限关联表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-16
|
||||
*/
|
||||
@Service
|
||||
public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRoleMenu> implements ISysRoleMenuService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,361 @@
|
||||
package com.zxdmy.excite.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zxdmy.excite.common.config.ExciteConfig;
|
||||
import com.zxdmy.excite.common.enums.SystemCode;
|
||||
import com.zxdmy.excite.common.exception.ServiceException;
|
||||
import com.zxdmy.excite.common.service.RedisService;
|
||||
import com.zxdmy.excite.system.entity.SysMenu;
|
||||
import com.zxdmy.excite.system.entity.SysRole;
|
||||
import com.zxdmy.excite.system.entity.SysRoleMenu;
|
||||
import com.zxdmy.excite.system.entity.SysUserRole;
|
||||
import com.zxdmy.excite.system.mapper.SysRoleMapper;
|
||||
import com.zxdmy.excite.system.service.ISysRoleMenuService;
|
||||
import com.zxdmy.excite.system.service.ISysRoleService;
|
||||
import com.zxdmy.excite.system.service.ISysUserRoleService;
|
||||
|
||||
|
||||
import com.zxdmy.excite.system.utils.AuthUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统角色表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-23
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {
|
||||
|
||||
SysRoleMapper roleMapper;
|
||||
|
||||
ISysRoleMenuService roleMenuService;
|
||||
|
||||
ISysUserRoleService userRoleService;
|
||||
|
||||
RedisService redisService;
|
||||
|
||||
ExciteConfig exciteConfig;
|
||||
|
||||
/**
|
||||
* 接口实现:添加|更新角色
|
||||
*
|
||||
* @param role 角色实体,ID为空表示添加
|
||||
* @param menusIds 为当前角色添加的菜单/权限ID列表
|
||||
* @return 影响的行数 0 - 失败 | >0 - 成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public int saveRole(SysRole role, Integer[] menusIds) {
|
||||
if (null == role) {
|
||||
throw new ServiceException("角色实体不能为null");
|
||||
}
|
||||
// 初始化:角色状态
|
||||
if (null == role.getStatus()) {
|
||||
role.setStatus(SystemCode.STATUS_Y.getCode());
|
||||
}
|
||||
// 初始化:角色顺序
|
||||
if (null == role.getSort()) {
|
||||
role.setStatus(SystemCode.SORT_DEFAULT.getCode());
|
||||
}
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
int result = 0;
|
||||
// 新增
|
||||
if (null == role.getId()) {
|
||||
role.setCreateTime(localDateTime);
|
||||
role.setIsDelete(SystemCode.DELETE_N.getCode());
|
||||
// 先插入角色,以便获取角色的ID
|
||||
result = roleMapper.insert(role);
|
||||
if (result > 0) {
|
||||
// 插入权限关联列表
|
||||
insertRoleMenu(role.getId(), menusIds);
|
||||
}
|
||||
}
|
||||
// 更新
|
||||
else {
|
||||
role.setUpdateTime(localDateTime);
|
||||
// 将新菜单插入
|
||||
result = roleMapper.updateById(role);
|
||||
if (result > 0) {
|
||||
// 先从关联表中删除旧数据
|
||||
QueryWrapper<SysRoleMenu> wrapper1 = new QueryWrapper<>();
|
||||
wrapper1.eq("role_id", role.getId());
|
||||
roleMenuService.remove(wrapper1);
|
||||
// 再添加新数据
|
||||
insertRoleMenu(role.getId(), menusIds);
|
||||
}
|
||||
// 清除缓存
|
||||
AuthUtils.clearUserMenuListCache(result != 0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口实现:根据ID查询某个角色详情
|
||||
*
|
||||
* @param id 角色的ID
|
||||
* @return 角色实体
|
||||
*/
|
||||
@Override
|
||||
public SysRole getRole(Integer id) {
|
||||
if (null == id) {
|
||||
throw new ServiceException("角色ID不能为null");
|
||||
}
|
||||
// 根据ID查询status正常的角色
|
||||
QueryWrapper<SysRole> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("id", id).ne("status", SystemCode.STATUS_N.getCode());
|
||||
return roleMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口实现:根据用户ID,查询状态正常的角色列表,其中该用户拥有的角色的checkArr字段为1
|
||||
*
|
||||
* @param userId 用户的ID
|
||||
* @return 角色列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysRole> getListByUserId(Integer userId) {
|
||||
// 查询status正常的角色
|
||||
QueryWrapper<SysRole> wrapper = new QueryWrapper<>();
|
||||
wrapper.ne("status", SystemCode.STATUS_N.getCode());
|
||||
wrapper.ne("id", 10000);
|
||||
// 如果userId为0,则表示获取全部角色
|
||||
if (userId == 0) {
|
||||
return roleMapper.selectList(wrapper);
|
||||
}
|
||||
// 否则,获取角色后,将该用户已分配的角色checkArr设置为1
|
||||
else {
|
||||
// 获取全部正常角色
|
||||
List<SysRole> roleList = roleMapper.selectList(wrapper);
|
||||
// 获取当前用户拥有的角色ID列表
|
||||
List<Integer> userRoleList = userRoleService.getListByUserId(userId).stream().map(SysUserRole::getRoleId).collect(Collectors.toList());
|
||||
// 使用lambda表达式,直接在角色列表上修改checkArr字段
|
||||
return roleList.stream().peek(
|
||||
role -> {
|
||||
if (userRoleList.contains(role.getId())) {
|
||||
role.setCheckArr("1");
|
||||
role.setLAY_CHECKED(true);
|
||||
}
|
||||
}
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口实现:分页查询接口列表
|
||||
*
|
||||
* @param current 当前页
|
||||
* @param size 页大小
|
||||
* @param name 检索:名称
|
||||
* @param permission 检索:权限字符
|
||||
* @return 结果页面
|
||||
*/
|
||||
@Override
|
||||
public Page<SysRole> getPage(Integer current, Integer size, String name, String permission) {
|
||||
current = null == current ? 1 : current;
|
||||
size = null == size ? 10 : size;
|
||||
QueryWrapper<SysRole> wrapper = new QueryWrapper<>();
|
||||
wrapper.like(null != name && !"".equals(name), "name", name)
|
||||
.like(null != permission && !"".equals(permission), "permission", permission);
|
||||
return roleMapper.selectPage(new Page<>(current, size), wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口实现:改变角色状态
|
||||
*
|
||||
* @param newStatus 新状态
|
||||
* @param roleIds 角色ID列表
|
||||
* @return 结果数组
|
||||
*/
|
||||
@Override
|
||||
public int[] changeStatus(Integer newStatus, Integer[] roleIds) {
|
||||
if (null == newStatus || null == roleIds) {
|
||||
throw new ServiceException("新状态或角色ID不能为空");
|
||||
}
|
||||
int[] result = new int[2];
|
||||
for (Integer roleId : roleIds) {
|
||||
SysRole role = new SysRole();
|
||||
QueryWrapper<SysRole> wrapper = new QueryWrapper<>();
|
||||
role.setId(roleId);
|
||||
role.setStatus(newStatus);
|
||||
wrapper.eq("id", roleId)
|
||||
.ne("status", SystemCode.STATUS_Y_BLOCK.getCode());
|
||||
if (roleMapper.update(role, wrapper) > 0)
|
||||
result[0]++;
|
||||
else result[1]++;
|
||||
}
|
||||
// 清除缓存
|
||||
AuthUtils.clearUserMenuListCache(result[0] != 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口实现:通过ID删除角色(注意:已经分配给用户的角色,不允许删除!)
|
||||
*
|
||||
* @param roleIds 角色ID
|
||||
* @return 删除结果:0:成功个数 1:删除失败个数 2:因已分配用户,禁止删除数
|
||||
*/
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public int[] deleteRoleById(Integer[] roleIds) {
|
||||
if (null == roleIds || roleIds.length == 0) {
|
||||
throw new ServiceException("删除的角色ID不能为空!");
|
||||
}
|
||||
int[] result = new int[3];
|
||||
for (int roleId : roleIds) {
|
||||
// 已经分配用户的角色,不允许删除!
|
||||
QueryWrapper<SysUserRole> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("role_id", roleId);
|
||||
if (userRoleService.count(queryWrapper) > 0) {
|
||||
// throw new ServiceException("当前角色已分配给用户,禁止删除!");
|
||||
result[2]++;
|
||||
} else {
|
||||
// 删除 用户-角色关联表 中的数据
|
||||
QueryWrapper<SysUserRole> userRoleQueryWrapper = new QueryWrapper<>();
|
||||
userRoleQueryWrapper.eq("role_id", roleId);
|
||||
userRoleService.remove(userRoleQueryWrapper);
|
||||
// 删除 角色-权限关联表 中的数据
|
||||
QueryWrapper<SysRoleMenu> roleMenuQueryWrapper = new QueryWrapper<>();
|
||||
roleMenuQueryWrapper.eq("role_id", roleId);
|
||||
roleMenuService.remove(roleMenuQueryWrapper);
|
||||
// 删除该角色
|
||||
if (roleMapper.deleteById(roleId) > 0) {
|
||||
result[0]++;
|
||||
} else {
|
||||
result[1]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口:将指定角色,授权分配给系列用户
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 用户ID列表
|
||||
* @return 授权结果
|
||||
*/
|
||||
@Override
|
||||
public boolean authRoleForUsers(Integer roleId, Integer[] userIds) {
|
||||
// 如果用户列表为空,则直接返回真即可
|
||||
if (null == userIds || userIds.length == 0) {
|
||||
return true;
|
||||
}
|
||||
// 存储列表
|
||||
List<SysUserRole> userRoleList = new ArrayList<>();
|
||||
for (Integer userId : userIds) {
|
||||
// 构造数据,并添加至列表
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setRoleId(roleId);
|
||||
userRole.setUserId(userId);
|
||||
userRoleList.add(userRole);
|
||||
}
|
||||
// 执行插入
|
||||
if (userRoleService.saveBatch(userRoleList)) {
|
||||
// 清除缓存
|
||||
AuthUtils.clearUserMenuListCacheById(true, userIds);
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口:取消指定角色已授权的系列用户
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 用户ID列表
|
||||
* @return 取消授权结果
|
||||
*/
|
||||
@Override
|
||||
public int[] revokeRoleForUsers(Integer roleId, Integer[] userIds) {
|
||||
if (null == userIds || userIds.length == 0) {
|
||||
return new int[]{0, 0};
|
||||
}
|
||||
int[] result = new int[2];
|
||||
// 遍历用户列表,逐个删除
|
||||
for (Integer userId : userIds) {
|
||||
QueryWrapper<SysUserRole> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("role_id", roleId).eq("user_id", userId);
|
||||
// TODO 完善:超级管理员不允许取消授权!
|
||||
if (userRoleService.remove(wrapper)) {
|
||||
result[0]++;
|
||||
} else
|
||||
result[1]++;
|
||||
}
|
||||
// 删除缓存
|
||||
AuthUtils.clearUserMenuListCacheById(result[0] != 0, userIds);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 私有方法:将指定角色拥有的菜单/权限,写入角色-菜单关联表
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param menusIds 菜单ID
|
||||
*/
|
||||
private void insertRoleMenu(Integer roleId, Integer[] menusIds) {
|
||||
List<SysRoleMenu> roleMenuList = new ArrayList<>();
|
||||
for (Integer menuId : menusIds) {
|
||||
SysRoleMenu roleMenu = new SysRoleMenu();
|
||||
roleMenu.setRoleId(roleId);
|
||||
roleMenu.setMenuId(menuId);
|
||||
roleMenuList.add(roleMenu);
|
||||
}
|
||||
// 如果权限列表不为空
|
||||
if (roleMenuList.size() > 0) {
|
||||
// 批量插入
|
||||
roleMenuService.saveBatch(roleMenuList);
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 私有方法:删除 已缓存的用户列表和权限表 的缓存(详情请见 权限缓存策略)
|
||||
// * 前提条件:result > 0 & 开启redis
|
||||
// *
|
||||
// * @param result 条件:>0 才执行
|
||||
// */
|
||||
// private void deleteRedisUserMenuCache(int result) {
|
||||
// if (exciteConfig.getAllowRedis() && result > 0) {
|
||||
// // 获取已缓存的用户列表
|
||||
// Set<Integer> userSet = (Set<Integer>) redisService.get("menu:userList");
|
||||
// // 统统清空
|
||||
// if (userSet != null) {
|
||||
// for (Integer userId : userSet) {
|
||||
// redisService.remove("menu:userMenuList:" + userId);
|
||||
// }
|
||||
// redisService.remove("menu:userList");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 私有方法:删除指定用户的缓存权限信息
|
||||
// *
|
||||
// * @param result 条件
|
||||
// * @param userIds 用户ID
|
||||
// */
|
||||
// private void deleteUserMenuCache(int result, Integer[] userIds) {
|
||||
// if (result > 0 && exciteConfig.getAllowRedis()) {
|
||||
// for (int userId : userIds) {
|
||||
// redisService.remove("menu:userMenuList:" + userId);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.zxdmy.excite.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zxdmy.excite.system.entity.SysUserRole;
|
||||
import com.zxdmy.excite.system.mapper.SysUserRoleMapper;
|
||||
import com.zxdmy.excite.system.service.ISysUserRoleService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统用户和角色关联表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-23
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements ISysUserRoleService {
|
||||
|
||||
SysUserRoleMapper userRoleMapper;
|
||||
|
||||
/**
|
||||
* 通过角色ID获取用户角色关联列表
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 用户角色关联列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysUserRole> getListByRoleId(Integer roleId) {
|
||||
QueryWrapper<SysUserRole> wrapper1 = new QueryWrapper<>();
|
||||
wrapper1.eq("role_id", roleId);
|
||||
return userRoleMapper.selectList(wrapper1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户ID获取用户角色关联列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户角色关联列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysUserRole> getListByUserId(Integer userId) {
|
||||
QueryWrapper<SysUserRole> wrapper1 = new QueryWrapper<>();
|
||||
wrapper1.eq("user_id", userId);
|
||||
return userRoleMapper.selectList(wrapper1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,543 @@
|
||||
package com.zxdmy.excite.system.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zxdmy.excite.common.config.ExciteConfig;
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.common.enums.SystemCode;
|
||||
import com.zxdmy.excite.common.exception.ServiceException;
|
||||
import com.zxdmy.excite.common.service.RedisService;
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudDepartmentUser;
|
||||
import com.zxdmy.excite.system.entity.SysRole;
|
||||
import com.zxdmy.excite.system.entity.SysUser;
|
||||
import com.zxdmy.excite.system.entity.SysUserRole;
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRole;
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRoleFile;
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRoleUser;
|
||||
import com.zxdmy.excite.system.entity.cloud.space.CloudFileRole;
|
||||
import com.zxdmy.excite.system.mapper.SysUserMapper;
|
||||
import com.zxdmy.excite.system.mapper.cloud.account.CloudDepartmentUserMapper;
|
||||
import com.zxdmy.excite.system.mapper.cloud.role.CloudRoleFileMapper;
|
||||
import com.zxdmy.excite.system.service.ISysRoleService;
|
||||
import com.zxdmy.excite.system.service.ISysUserRoleService;
|
||||
import com.zxdmy.excite.system.service.ISysUserService;
|
||||
import com.zxdmy.excite.system.service.cloud.role.ICloudRoleService;
|
||||
import com.zxdmy.excite.system.service.cloud.role.ICloudRoleUserService;
|
||||
import com.zxdmy.excite.system.service.cloud.space.ICloudFileRoleService;
|
||||
import com.zxdmy.excite.system.utils.AuthUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统用户表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2021-09-01
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {
|
||||
|
||||
SysUserMapper userMapper;
|
||||
|
||||
ISysUserRoleService userRoleService;
|
||||
ICloudFileRoleService iCloudFileRoleService;
|
||||
ISysRoleService roleService;
|
||||
|
||||
RedisService redisService;
|
||||
|
||||
ExciteConfig exciteConfig;
|
||||
|
||||
CloudDepartmentUserMapper cloudDepartmentUserMapper;
|
||||
ICloudRoleService iCloudRoleService;
|
||||
ICloudRoleUserService iCloudRoleUserService;
|
||||
CloudRoleFileMapper cloudRoleFileMapper;
|
||||
/**
|
||||
* 登录服务
|
||||
*
|
||||
* @param username 用户名,邮箱或者手机号
|
||||
* @param password 密码
|
||||
* @return SysUser:登录成功 | null:登录失败
|
||||
*/
|
||||
@Override
|
||||
public SysUser login(String username, String password) {
|
||||
QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
|
||||
// 这里用了 Hutool 的验证工具Validator
|
||||
if (Validator.isMobile(username)) {
|
||||
wrapper.eq("phone", username).eq("password", password);
|
||||
} else {
|
||||
wrapper.eq("login_name", username).eq("password", password);
|
||||
|
||||
}
|
||||
return userMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*
|
||||
* @param current 当前页
|
||||
* @param size 当前页大小
|
||||
* @param username 检索用户名
|
||||
* @param account 检索邮箱/手机号
|
||||
* @return 用户页面信息
|
||||
*/
|
||||
@Override
|
||||
public Page<SysUser> getPage(Integer current, Integer size, String username, String account) {
|
||||
size = null == size ? 1 : size;
|
||||
current = null == current ? 10 : current;
|
||||
QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
|
||||
wrapper.like(null != username && !"".equals(username), "username", username).ne("id",10000)
|
||||
.and(null != account && !"".equals(account), new Consumer<QueryWrapper<SysUser>>() {
|
||||
@Override
|
||||
public void accept(QueryWrapper<SysUser> sysUserQueryWrapper) {
|
||||
sysUserQueryWrapper
|
||||
.like("login_name", account)
|
||||
.or()
|
||||
.like("phone", account);
|
||||
}
|
||||
});
|
||||
return userMapper.selectPage(new Page<>(current, size), wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageList<SysUser> queryByPage(Integer page, Integer limit,String username, String phone, String departmentId) {
|
||||
Integer pages = limit * (page - 1);
|
||||
ArrayList<SysUser> list = userMapper.queryByPage(pages, limit,username,phone,departmentId);
|
||||
Integer count = userMapper.queryByPageCount(username,phone,departmentId);
|
||||
return new PageList<SysUser>(list,page,limit,count);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存用户:添加 | 更新
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @param roleIds 角色ID列表
|
||||
* @return 修改的行数 >0:成功 | <=0:失败
|
||||
*/
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public int save(SysUser user, Integer[] roleIds) {
|
||||
// 新添加的用户,邮箱号和手机号,不能重复!只有输入的数据,有手机或邮箱的时候,才核实!
|
||||
if (StrUtil.isNotEmpty(user.getPhone()) || StrUtil.isNotEmpty(user.getLoginName())) {
|
||||
QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
|
||||
wrapper.ne(null != user.getId(), "id", user.getId())
|
||||
.and(wrapper1 -> wrapper1.eq(StrUtil.isNotEmpty(user.getLoginName()), "login_name", user.getLoginName())
|
||||
.or(StrUtil.isNotEmpty(user.getPhone()))
|
||||
.eq(StrUtil.isNotEmpty(user.getPhone()), "phone", user.getPhone())
|
||||
);
|
||||
if (this.list(wrapper).size() != 0)
|
||||
throw new ServiceException("输入的账号或者手机号已存在,请修改!");
|
||||
}
|
||||
int result = 0;
|
||||
// 新建用户:其ID为空
|
||||
if (null == user.getId()) {
|
||||
// 初始化部分信息
|
||||
if (null == user.getStatus())
|
||||
user.setStatus(SystemCode.STATUS_Y.getCode());
|
||||
// 未删除状态
|
||||
user.setIsDelete(SystemCode.DELETE_N.getCode());
|
||||
// 创建时间
|
||||
user.setCreateTime(LocalDateTime.now());
|
||||
// 执行新建
|
||||
result = userMapper.insert(user);
|
||||
// 如果当前新用户分配的角色ID不为空
|
||||
if (null != roleIds)
|
||||
// 插入角色
|
||||
this.insertUserRole(user.getId(), roleIds);
|
||||
}
|
||||
// 更新信息用户:其ID不为空
|
||||
else {
|
||||
user.setUpdateTime(LocalDateTime.now());
|
||||
// 先更新用户的基本
|
||||
result = userMapper.updateById(user);
|
||||
|
||||
// 本系统中:更新用户信息,不涉及到角色分配!
|
||||
// 如果也可以在【用户编辑】页面修改用户的权限,则执行如下操作:
|
||||
// // 先把该用户已有的角色关联信息删除
|
||||
// QueryWrapper<SysUserRole> userRoleQueryWrapper = new QueryWrapper<>();
|
||||
// userRoleQueryWrapper.eq("user_id", user.getId());
|
||||
// userRoleService.remove(userRoleQueryWrapper);
|
||||
// // 如果角色为空,表示取消用户的全部权限
|
||||
// // 如果当前新用户分配的角色ID不为空,则为该用户修改角色
|
||||
// if (null != roleIds && roleIds.length == 0) {
|
||||
// this.insertUserRole(user.getId(), roleIds);
|
||||
// }
|
||||
// // 清除缓存
|
||||
// AuthUtils.clearUserMenuListCacheById(result != 0, user.getId());
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public int saveData(SysUser user, Integer[] roleIds,String[] roleIds1,String departmentId) {
|
||||
// 新添加的用户,邮箱号和手机号,不能重复!只有输入的数据,有手机或邮箱的时候,才核实!
|
||||
if (StrUtil.isNotEmpty(user.getPhone()) || StrUtil.isNotEmpty(user.getLoginName())) {
|
||||
QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
|
||||
wrapper.ne(null != user.getId(), "id", user.getId())
|
||||
.and(wrapper1 -> wrapper1.eq(StrUtil.isNotEmpty(user.getLoginName()), "login_name", user.getLoginName())
|
||||
.or(StrUtil.isNotEmpty(user.getPhone()))
|
||||
.eq(StrUtil.isNotEmpty(user.getPhone()), "phone", user.getPhone())
|
||||
);
|
||||
if (this.list(wrapper).size() != 0)
|
||||
throw new ServiceException("输入的账号或者手机号已存在,请修改!");
|
||||
}
|
||||
int result = 0;
|
||||
// 新建用户:其ID为空
|
||||
if (null == user.getId()) {
|
||||
// 初始化部分信息
|
||||
if (null == user.getStatus())
|
||||
user.setStatus(SystemCode.STATUS_Y.getCode());
|
||||
// 未删除状态
|
||||
user.setIsDelete(SystemCode.DELETE_N.getCode());
|
||||
// 创建时间
|
||||
user.setCreateTime(LocalDateTime.now());
|
||||
// 执行新建
|
||||
|
||||
|
||||
|
||||
|
||||
result = userMapper.insert(user);
|
||||
|
||||
if (null!=departmentId) {
|
||||
CloudDepartmentUser cloudDepartmentUser = new CloudDepartmentUser();
|
||||
cloudDepartmentUser.setUserId(user.getId());
|
||||
cloudDepartmentUser.setDepartmentId(Long.valueOf(departmentId));
|
||||
cloudDepartmentUserMapper.insert(cloudDepartmentUser);
|
||||
}
|
||||
|
||||
|
||||
// 如果当前新用户分配的角色ID不为空
|
||||
if (null != roleIds)
|
||||
// 插入角色
|
||||
this.insertUserRole(user.getId(), roleIds);
|
||||
this.insertFileRole(user.getId(), roleIds1);
|
||||
|
||||
}
|
||||
// 更新信息用户:其ID不为空
|
||||
else {
|
||||
user.setUpdateTime(LocalDateTime.now());
|
||||
// 先更新用户的基本
|
||||
result = userMapper.updateById(user);
|
||||
|
||||
// 本系统中:更新用户信息,不涉及到角色分配!
|
||||
// 如果也可以在【用户编辑】页面修改用户的权限,则执行如下操作:
|
||||
// // 先把该用户已有的角色关联信息删除
|
||||
// QueryWrapper<SysUserRole> userRoleQueryWrapper = new QueryWrapper<>();
|
||||
// userRoleQueryWrapper.eq("user_id", user.getId());
|
||||
// userRoleService.remove(userRoleQueryWrapper);
|
||||
// // 如果角色为空,表示取消用户的全部权限
|
||||
// // 如果当前新用户分配的角色ID不为空,则为该用户修改角色
|
||||
// if (null != roleIds && roleIds.length == 0) {
|
||||
// this.insertUserRole(user.getId(), roleIds);
|
||||
// }
|
||||
// // 清除缓存
|
||||
// AuthUtils.clearUserMenuListCacheById(result != 0, user.getId());
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 接口:修改用户状态
|
||||
*
|
||||
* @param newStatus 新状态
|
||||
* @param userIds 用户ID列表
|
||||
* @return 修改结果数组 0:成功个数 1:失败个数
|
||||
*/
|
||||
@Override
|
||||
public int[] changeStatus(Integer newStatus, Integer[] userIds) {
|
||||
/// 信息不能为空
|
||||
if (null == newStatus || null == userIds) {
|
||||
throw new ServiceException("新状态或用户ID不能为空");
|
||||
}
|
||||
// 新状态只能为 0 | 1
|
||||
if (newStatus == 0 || newStatus == 1) {
|
||||
int[] result = new int[2];
|
||||
// 遍历用户列表
|
||||
for (int userId : userIds) {
|
||||
// 已登录并且修改的用户ID是当前登录用户,禁止操作(跳过)
|
||||
if(StpUtil.isLogin() && (StpUtil.getLoginId().toString().equals(String.valueOf(userId)))){
|
||||
result[1]++;
|
||||
}else{
|
||||
// 定义用户信息
|
||||
SysUser user = new SysUser();
|
||||
user.setId(userId);
|
||||
user.setStatus(newStatus);
|
||||
// 执行修改(其中锁定,即状态为2的用户禁止修改)
|
||||
QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("id", userId)
|
||||
.ne("status", SystemCode.STATUS_Y_BLOCK.getCode());
|
||||
// 修改成功
|
||||
if (userMapper.update(user, wrapper) > 0) {
|
||||
result[0]++;
|
||||
// 清除该用户的权限缓存
|
||||
AuthUtils.clearUserMenuListCacheById(true, userId);
|
||||
} else result[1]++;
|
||||
}
|
||||
}
|
||||
// 返回结果
|
||||
return result;
|
||||
} else {
|
||||
throw new ServiceException("新状态只能为0或1!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口:给用户分配角色
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param roleIds 角色ID数组
|
||||
* @return 修改结果数组 0:分配个数 1:失败个数
|
||||
*/
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public boolean setRoleForUser(Integer userId, Integer[] roleIds) {
|
||||
// 从 用户-角色关联表 中,删除包含该用户的关联信息
|
||||
QueryWrapper<SysUserRole> userRoleQueryWrapper = new QueryWrapper<>();
|
||||
userRoleQueryWrapper.eq("user_id", userId);
|
||||
userRoleService.remove(userRoleQueryWrapper);
|
||||
// 记录结果
|
||||
boolean result;
|
||||
// 如果角色列表为null,或长度为 0,则表示清除该用户的全部角色,也就没必要插入了
|
||||
if (null == roleIds || roleIds.length == 0) {
|
||||
result = true;
|
||||
}
|
||||
// 不为空,执行授权,插入,并返回结果
|
||||
else {
|
||||
result = this.insertUserRole(userId, roleIds);
|
||||
}
|
||||
// 清理缓存
|
||||
AuthUtils.clearUserMenuListCacheById(result, userId);
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public boolean setCloudRoleForUser(String userId, String[] roleIds) {
|
||||
// 从 用户-角色关联表 中,删除包含该用户的关联信息
|
||||
QueryWrapper<CloudRoleUser> userRoleQueryWrapper = new QueryWrapper<>();
|
||||
userRoleQueryWrapper.eq("user_id", userId);
|
||||
iCloudRoleUserService.remove(userRoleQueryWrapper);
|
||||
// 记录结果
|
||||
boolean result;
|
||||
// 如果角色列表为null,或长度为 0,则表示清除该用户的全部角色,也就没必要插入了
|
||||
if (null == roleIds || roleIds.length == 0) {
|
||||
result = true;
|
||||
}
|
||||
// 不为空,执行授权,插入,并返回结果
|
||||
else {
|
||||
result = this.insertUserCloudRole(userId, roleIds);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 接口:根据ID删除用户
|
||||
*
|
||||
* @param userIds 用户ID
|
||||
* @return 删除结果:>0 表示成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public int[] deleteUserById(Integer[] userIds) {
|
||||
if (null == userIds || userIds.length == 0) {
|
||||
throw new SecurityException("用户ID不能为空!");
|
||||
}
|
||||
int[] result = new int[2];
|
||||
// 遍历用户
|
||||
for (int userId : userIds) {
|
||||
// TMD 不能删除自己!!!
|
||||
if (userId != StpUtil.getLoginIdAsInt()) {
|
||||
QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("id", userId).ne("status", SystemCode.STATUS_Y_BLOCK.getCode());
|
||||
// 如果用户删除成功
|
||||
if (userMapper.delete(wrapper) > 0) {
|
||||
// 从 用户-角色关联表 中,删除包含该用户的关联信息
|
||||
QueryWrapper<SysUserRole> userRoleQueryWrapper = new QueryWrapper<>();
|
||||
userRoleQueryWrapper.eq("user_id", userId);
|
||||
userRoleService.remove(userRoleQueryWrapper);
|
||||
|
||||
|
||||
|
||||
QueryWrapper<CloudDepartmentUser> cloudDepartmentUserQueryWrapper = new QueryWrapper<>();
|
||||
cloudDepartmentUserQueryWrapper.eq("user_id", userId);
|
||||
cloudDepartmentUserMapper.delete(cloudDepartmentUserQueryWrapper);
|
||||
|
||||
|
||||
QueryWrapper<CloudFileRole> cloudFileRoleQueryWrapper = new QueryWrapper<>();
|
||||
cloudFileRoleQueryWrapper.eq("user_id", userId);
|
||||
iCloudFileRoleService.remove(cloudFileRoleQueryWrapper);
|
||||
|
||||
|
||||
QueryWrapper<CloudRoleUser> cloudRoleUserQueryWrapper = new QueryWrapper<>();
|
||||
cloudRoleUserQueryWrapper.eq("user_id", userId);
|
||||
iCloudRoleUserService.remove(cloudRoleUserQueryWrapper);
|
||||
|
||||
// 删除成功结果自增
|
||||
result[0]++;
|
||||
// 清除缓存
|
||||
AuthUtils.clearUserMenuListCacheById(true, userId);
|
||||
} else {
|
||||
result[1]++;
|
||||
}
|
||||
} else {
|
||||
result[1]++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口:通过角色ID查询用户列表
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 用户列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> getUserListByRoleId(Integer roleId) {
|
||||
return userMapper.selectUsersByRoleId(roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口:通过角色ID查询不包含此角色的用户列表
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 不包含此角色的用户列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> getUserListByRoleIdNotIn(Integer roleId) {
|
||||
return userMapper.selectUsersByRoleIdNotIn(roleId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<SysUser> selectUsersByCloudUploadRoleId(String roleId) {
|
||||
return userMapper.selectUsersByCloudUploadRoleId(roleId);
|
||||
}
|
||||
@Override
|
||||
public List<SysUser> selectUsersByCloudUploadRoleIdNotIn(String roleId) {
|
||||
return userMapper.selectUsersByCloudUploadRoleIdNotIn(roleId);
|
||||
}
|
||||
/**
|
||||
* 私有方法:更新用户-角色关联信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param roleIds 角色ID数组
|
||||
*/
|
||||
private boolean insertUserRole(Integer userId, Integer[] roleIds) {
|
||||
// 如果角色列表为空,直接返回真
|
||||
if (null == roleIds || roleIds.length == 0) {
|
||||
return true;
|
||||
}
|
||||
// 获取所有状态正常的角色集合
|
||||
QueryWrapper<SysRole> wrapper = new QueryWrapper<>();
|
||||
wrapper.ne("status", SystemCode.STATUS_N);
|
||||
Set<Integer> roleSet = roleService.list(wrapper).stream().map(SysRole::getId).collect(Collectors.toSet());
|
||||
// 存储列表
|
||||
List<SysUserRole> userRoleList = new ArrayList<>();
|
||||
for (Integer roleId : roleIds) {
|
||||
// 只有符合条件的角色,才能添加
|
||||
if (roleSet.contains(roleId)) {
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setRoleId(roleId);
|
||||
userRole.setUserId(userId);
|
||||
userRoleList.add(userRole);
|
||||
}
|
||||
}
|
||||
if (userRoleList.size() > 0) {
|
||||
return userRoleService.saveBatch(userRoleList);
|
||||
} else return false;
|
||||
}
|
||||
private boolean insertFileRole(Integer userId, String[] roleIds) {
|
||||
// 如果角色列表为空,直接返回真
|
||||
if (null == roleIds || roleIds.length == 0) {
|
||||
return true;
|
||||
}
|
||||
// 获取所有状态正常的角色集合
|
||||
QueryWrapper<CloudRole> wrapper = new QueryWrapper<>();
|
||||
wrapper.isNull("delete_time");
|
||||
Set<Long> roleSet = iCloudRoleService.list(wrapper).stream().map(CloudRole::getId).collect(Collectors.toSet());
|
||||
// 存储列表
|
||||
|
||||
List<CloudRoleUser> userRoleList = new ArrayList<>();
|
||||
for (String roleId : roleIds) {
|
||||
// 只有符合条件的角色,才能添加
|
||||
if (String.valueOf(roleSet).contains(roleId)) {
|
||||
CloudRoleUser userRole = new CloudRoleUser();
|
||||
userRole.setRoleId(Long.valueOf(roleId));
|
||||
userRole.setUserId(userId);
|
||||
userRoleList.add(userRole);
|
||||
|
||||
QueryWrapper<CloudRoleFile> wrapper1 = new QueryWrapper<>();
|
||||
wrapper1.eq("role_id",roleId);
|
||||
List<CloudRoleFile> fileList = cloudRoleFileMapper.selectList(wrapper1);
|
||||
List<CloudFileRole> fileRoleList = new ArrayList<>();
|
||||
for (CloudRoleFile cloudRoleFile:fileList) {
|
||||
CloudFileRole cloudFileRole = new CloudFileRole();
|
||||
cloudFileRole.setFileId(cloudRoleFile.getFileId());
|
||||
cloudFileRole.setUserId(userId);
|
||||
fileRoleList.add(cloudFileRole);
|
||||
}
|
||||
iCloudFileRoleService.saveBatch(fileRoleList);
|
||||
}
|
||||
}
|
||||
if (userRoleList.size() > 0) {
|
||||
return iCloudRoleUserService.saveBatch(userRoleList);
|
||||
} else return false;
|
||||
}
|
||||
|
||||
|
||||
private boolean insertUserCloudRole(String userId, String[] roleIds) {
|
||||
// 如果角色列表为空,直接返回真
|
||||
if (null == roleIds || roleIds.length == 0) {
|
||||
return true;
|
||||
}
|
||||
// 获取所有状态正常的角色集合
|
||||
QueryWrapper<CloudRole> wrapper = new QueryWrapper<>();
|
||||
wrapper.isNull("delete_time");
|
||||
Set<Long> roleSet = iCloudRoleService.list(wrapper).stream().map(CloudRole::getId).collect(Collectors.toSet());
|
||||
// 存储列表
|
||||
List<CloudRoleUser> userRoleList = new ArrayList<>();
|
||||
for (String roleId : roleIds) {
|
||||
// 只有符合条件的角色,才能添加
|
||||
if (roleSet.contains(roleId)) {
|
||||
CloudRoleUser userRole = new CloudRoleUser();
|
||||
userRole.setRoleId(Long.valueOf(roleId));
|
||||
userRole.setUserId(Integer.valueOf(userId));
|
||||
userRoleList.add(userRole);
|
||||
}
|
||||
}
|
||||
if (userRoleList.size() > 0) {
|
||||
return iCloudRoleUserService.saveBatch(userRoleList);
|
||||
} else return false;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 删除指定用户的缓存权限信息
|
||||
// *
|
||||
// * @param result 条件:>0 才执行
|
||||
// * @param userId 用户ID
|
||||
// */
|
||||
// private void deleteUserMenuCache(int result, int userId) {
|
||||
// if (result > 0 && exciteConfig.getAllowRedis()) {
|
||||
// redisService.remove("menu:userMenuList:" + userId);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package com.zxdmy.excite.system.service.impl.cloud.account;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.common.exception.ServiceException;
|
||||
import com.zxdmy.excite.system.entity.SysRoleMenu;
|
||||
import com.zxdmy.excite.system.entity.SysUser;
|
||||
import com.zxdmy.excite.system.entity.SysUserRole;
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudCompany;
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudDepartment;
|
||||
import com.zxdmy.excite.system.entity.req.account.ReqCompany;
|
||||
import com.zxdmy.excite.system.entity.vo.account.CompanyVo;
|
||||
import com.zxdmy.excite.system.mapper.SysUserMapper;
|
||||
import com.zxdmy.excite.system.mapper.cloud.account.CloudCompanyMapper;
|
||||
import com.zxdmy.excite.system.service.cloud.account.ICloudCompanyService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 企业表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-24
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CloudCompanyServiceImpl extends ServiceImpl<CloudCompanyMapper, CloudCompany> implements ICloudCompanyService {
|
||||
private CloudCompanyMapper cloudCompanyMapper;
|
||||
private SysUserMapper sysUserMapper;
|
||||
@Override
|
||||
public PageList<CompanyVo> queryByPage(Integer page, Integer limit, ReqCompany data) {
|
||||
Integer pages = limit * (page - 1);
|
||||
ArrayList<CompanyVo> list = cloudCompanyMapper.queryByPage(pages, limit,data);
|
||||
Integer count = cloudCompanyMapper.queryByPageCount(data);
|
||||
return new PageList<CompanyVo>(list,page,limit,count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompanyVo getByData(ReqCompany data) {
|
||||
return cloudCompanyMapper.getData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveData(ReqCompany data) {
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
CloudCompany saveData = new CloudCompany();
|
||||
saveData.setCompanyName(data.getCompanyName());
|
||||
SysUser sysUser = sysUserMapper.selectById(StpUtil.getLoginIdAsInt());
|
||||
saveData.setCompanySort(0);
|
||||
saveData.setCreatorId(sysUser.getId());
|
||||
saveData.setCreatorName(sysUser.getUsername());
|
||||
saveData.setCreateTime(localDateTime);
|
||||
if(cloudCompanyMapper.insert(saveData)==1){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateData(ReqCompany data) {
|
||||
CloudCompany updateData = new CloudCompany();
|
||||
updateData.setId(Long.valueOf(data.getId()));
|
||||
updateData.setCompanyName(data.getCompanyName());
|
||||
if(cloudCompanyMapper.updateById(updateData)==1){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteById(String id) {
|
||||
if (null == id) {
|
||||
throw new ServiceException("删除的ID不能为空!");
|
||||
}
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
SysUser sysUser = sysUserMapper.selectById(StpUtil.getLoginIdAsInt());
|
||||
CloudCompany data = cloudCompanyMapper.selectById(id);
|
||||
if(null!=data){
|
||||
data.setDeleteId(sysUser.getId());
|
||||
data.setDeleteName(sysUser.getUsername());
|
||||
data.setDeleteTime(localDateTime);
|
||||
return cloudCompanyMapper.updateById(data);
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompanyVo> queryByData() {
|
||||
return cloudCompanyMapper.queryByData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CloudCompany> getList() {
|
||||
return cloudCompanyMapper.getList();
|
||||
}
|
||||
}
|
||||
+245
@@ -0,0 +1,245 @@
|
||||
package com.zxdmy.excite.system.service.impl.cloud.account;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.common.exception.ServiceException;
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudDepartmentUser;
|
||||
import com.zxdmy.excite.system.entity.SysUser;
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudCompany;
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudDepartment;
|
||||
import com.zxdmy.excite.system.entity.dto.DepartmentUserTreeNode;
|
||||
import com.zxdmy.excite.system.entity.req.account.ReqDepartment;
|
||||
import com.zxdmy.excite.system.entity.vo.account.DepartmentVo;
|
||||
import com.zxdmy.excite.system.mapper.SysUserMapper;
|
||||
import com.zxdmy.excite.system.mapper.cloud.account.CloudCompanyMapper;
|
||||
import com.zxdmy.excite.system.mapper.cloud.account.CloudDepartmentMapper;
|
||||
import com.zxdmy.excite.system.mapper.cloud.account.CloudDepartmentUserMapper;
|
||||
import com.zxdmy.excite.system.service.cloud.account.ICloudDepartmentService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.xml.transform.Result;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-24
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CloudDepartmentServiceImpl extends ServiceImpl<CloudDepartmentMapper, CloudDepartment> implements ICloudDepartmentService {
|
||||
|
||||
private CloudDepartmentMapper cloudDepartmentMapper;
|
||||
private CloudCompanyMapper cloudCompanyMapper;
|
||||
private SysUserMapper sysUserMapper;
|
||||
private CloudDepartmentUserMapper cloudDepartmentUserMapper;
|
||||
@Override
|
||||
public PageList<DepartmentVo> queryByPage(Integer page, Integer limit, ReqDepartment data) {
|
||||
Integer pages = limit * (page - 1);
|
||||
ArrayList<DepartmentVo> list = cloudDepartmentMapper.queryByPage(pages, limit,data);
|
||||
Integer count = cloudDepartmentMapper.queryByPageCount(data);
|
||||
return new PageList<DepartmentVo>(list,page,limit,count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DepartmentVo getByData(ReqDepartment data) {
|
||||
return cloudDepartmentMapper.getData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveData(ReqDepartment data) {
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
CloudDepartment saveData = new CloudDepartment();
|
||||
|
||||
|
||||
QueryWrapper<CloudCompany> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("id",data.getId());
|
||||
Integer company = cloudCompanyMapper.selectCount(wrapper);
|
||||
if(company>0){
|
||||
saveData.setDepartmentParentId(Long.valueOf("0"));
|
||||
saveData.setCompanyId(Long.valueOf(data.getId()));
|
||||
}else{
|
||||
saveData.setDepartmentParentId(Long.valueOf(data.getId()));
|
||||
saveData.setCompanyId(Long.valueOf(data.getCompanyId()));
|
||||
}
|
||||
saveData.setDepartmentName(data.getDepartmentName());
|
||||
SysUser sysUser = sysUserMapper.selectById(StpUtil.getLoginIdAsInt());
|
||||
saveData.setDepartmentSort(0);
|
||||
saveData.setCreatorId(sysUser.getId());
|
||||
saveData.setCreatorName(sysUser.getUsername());
|
||||
saveData.setCreateTime(localDateTime);
|
||||
if(cloudDepartmentMapper.insert(saveData)==1){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateData(ReqDepartment data) {
|
||||
CloudDepartment updateData = new CloudDepartment();
|
||||
updateData.setId(Long.valueOf(data.getId()));
|
||||
updateData.setDepartmentName(data.getDepartmentName());
|
||||
if(cloudDepartmentMapper.updateById(updateData)==1){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteById(String id) {
|
||||
if (null == id) {
|
||||
throw new ServiceException("删除的ID不能为空!");
|
||||
}
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
SysUser sysUser = sysUserMapper.selectById(StpUtil.getLoginIdAsInt());
|
||||
CloudDepartment data = cloudDepartmentMapper.selectById(id);
|
||||
if(null!=data){
|
||||
data.setDeleteId(sysUser.getId());
|
||||
data.setDeleteName(sysUser.getUsername());
|
||||
data.setDeleteTime(localDateTime);
|
||||
return cloudDepartmentMapper.updateById(data);
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int changeDepartment(String userId, String departmentId) {
|
||||
QueryWrapper<CloudDepartmentUser> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id",userId);
|
||||
List<CloudDepartmentUser> list = cloudDepartmentUserMapper.selectList(queryWrapper);
|
||||
if (list.size()>0) {
|
||||
CloudDepartmentUser cloudDepartmentUser = cloudDepartmentUserMapper.selectById(list.get(0).getId());
|
||||
cloudDepartmentUser.setDepartmentId(Long.valueOf(departmentId));
|
||||
return cloudDepartmentUserMapper.updateById(cloudDepartmentUser);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public List<CloudDepartment> getList(Long id) {
|
||||
return cloudDepartmentMapper.getList(id);
|
||||
}
|
||||
|
||||
|
||||
public List<DepartmentUserTreeNode> buildDepartmentUserTree(Long companyId) {
|
||||
// 1. 查询所有部门
|
||||
List<CloudDepartment> departments = cloudDepartmentMapper.selectByCompanyId(companyId);
|
||||
|
||||
// 2. 查询所有部门-用户关系
|
||||
List<CloudDepartmentUser> departmentUsers = cloudDepartmentUserMapper.selectByCompanyId(companyId);
|
||||
|
||||
// 3. 按部门分组用户关系
|
||||
Map<Long, List<CloudDepartmentUser>> deptUserMap = departmentUsers.stream()
|
||||
.collect(Collectors.groupingBy(CloudDepartmentUser::getDepartmentId));
|
||||
|
||||
// 4. 查询所有用户信息
|
||||
List<Integer> userIds = departmentUsers.stream()
|
||||
.map(CloudDepartmentUser::getUserId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Map<Integer, SysUser> userMap = new HashMap<>();
|
||||
if (!userIds.isEmpty()) {
|
||||
List<SysUser> users = sysUserMapper.selectByIds(userIds);
|
||||
users.forEach(user -> userMap.put(user.getId(), user));
|
||||
}
|
||||
|
||||
// 5. 构建部门树节点映射
|
||||
Map<Long, DepartmentUserTreeNode> deptNodeMap = new HashMap<>();
|
||||
for (CloudDepartment dept : departments) {
|
||||
DepartmentUserTreeNode node = new DepartmentUserTreeNode(dept);
|
||||
deptNodeMap.put(dept.getId(), node);
|
||||
}
|
||||
|
||||
// 6. 将用户添加到部门节点
|
||||
for (Map.Entry<Long, List<CloudDepartmentUser>> entry : deptUserMap.entrySet()) {
|
||||
Long deptId = entry.getKey();
|
||||
DepartmentUserTreeNode deptNode = deptNodeMap.get(deptId);
|
||||
if (deptNode != null) {
|
||||
for (CloudDepartmentUser du : entry.getValue()) {
|
||||
SysUser user = userMap.get(du.getUserId());
|
||||
if (user != null) {
|
||||
DepartmentUserTreeNode userNode = new DepartmentUserTreeNode(user, deptId);
|
||||
deptNode.getChildren().add(userNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 7. 构建树形结构
|
||||
List<DepartmentUserTreeNode> tree = new ArrayList<>();
|
||||
for (DepartmentUserTreeNode node : deptNodeMap.values()) {
|
||||
if (node.getParentId() == 0) {
|
||||
// 根节点
|
||||
tree.add(node);
|
||||
buildTreeRecursive(node, deptNodeMap);
|
||||
}
|
||||
}
|
||||
|
||||
// 8. 排序
|
||||
sortTreeNodes(tree);
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
private void buildTreeRecursive(DepartmentUserTreeNode parentNode,
|
||||
Map<Long, DepartmentUserTreeNode> deptNodeMap) {
|
||||
// 添加子部门
|
||||
List<DepartmentUserTreeNode> children = new ArrayList<>();
|
||||
for (DepartmentUserTreeNode node : deptNodeMap.values()) {
|
||||
if (node.getType().equals("department") &&
|
||||
parentNode.getId().equals(node.getParentId())) {
|
||||
children.add(node);
|
||||
buildTreeRecursive(node, deptNodeMap);
|
||||
}
|
||||
}
|
||||
|
||||
// 合并已有的用户节点
|
||||
if (!parentNode.getChildren().isEmpty()) {
|
||||
// 只保留用户节点,部门节点在children中添加
|
||||
List<DepartmentUserTreeNode> userNodes = parentNode.getChildren().stream()
|
||||
.filter(n -> n.getType().equals("user"))
|
||||
.collect(Collectors.toList());
|
||||
children.addAll(userNodes);
|
||||
}
|
||||
|
||||
parentNode.setChildren(children);
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序:部门按sort排序,用户按name排序
|
||||
*/
|
||||
private void sortTreeNodes(List<DepartmentUserTreeNode> nodes) {
|
||||
if (nodes == null || nodes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nodes.sort((n1, n2) -> {
|
||||
if (n1.getType().equals("department") && n2.getType().equals("department")) {
|
||||
return Integer.compare(n1.getSort(), n2.getSort());
|
||||
} else if (n1.getType().equals("user") && n2.getType().equals("user")) {
|
||||
return n1.getTitle().compareTo(n2.getTitle());
|
||||
} else {
|
||||
// 部门在前,用户在后
|
||||
return n1.getType().equals("department") ? -1 : 1;
|
||||
}
|
||||
});
|
||||
|
||||
for (DepartmentUserTreeNode node : nodes) {
|
||||
if (node.getType().equals("department") && !node.getChildren().isEmpty()) {
|
||||
sortTreeNodes(node.getChildren());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.zxdmy.excite.system.service.impl.cloud.account;
|
||||
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudDepartmentUser;
|
||||
import com.zxdmy.excite.system.mapper.cloud.account.CloudDepartmentUserMapper;
|
||||
import com.zxdmy.excite.system.service.cloud.account.ICloudDepartmentUserService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门用户ID 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Service
|
||||
public class CloudDepartmentUserServiceImpl extends ServiceImpl<CloudDepartmentUserMapper, CloudDepartmentUser> implements ICloudDepartmentUserService {
|
||||
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.zxdmy.excite.system.service.impl.cloud.collection;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.common.exception.ServiceException;
|
||||
import com.zxdmy.excite.system.entity.SysUser;
|
||||
import com.zxdmy.excite.system.entity.cloud.account.CloudCompany;
|
||||
import com.zxdmy.excite.system.entity.cloud.collection.CloudUserCollection;
|
||||
import com.zxdmy.excite.system.entity.req.account.ReqCompany;
|
||||
import com.zxdmy.excite.system.entity.req.collection.ReqCloudUserCollection;
|
||||
import com.zxdmy.excite.system.entity.req.space.ReqCloudFile;
|
||||
import com.zxdmy.excite.system.entity.vo.account.CompanyVo;
|
||||
import com.zxdmy.excite.system.entity.vo.collection.CloudUserCollectionVo;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileVo;
|
||||
import com.zxdmy.excite.system.mapper.SysUserMapper;
|
||||
import com.zxdmy.excite.system.mapper.cloud.collection.CloudUserCollectionMapper;
|
||||
import com.zxdmy.excite.system.service.cloud.collection.ICloudUserCollectionService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收藏表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CloudUserCollectionServiceImpl extends ServiceImpl<CloudUserCollectionMapper, CloudUserCollection> implements ICloudUserCollectionService {
|
||||
CloudUserCollectionMapper cloudUserCollectionMapper;
|
||||
SysUserMapper sysUserMapper;
|
||||
@Override
|
||||
public PageList<CloudFileVo> queryByPage(Integer page, Integer limit, ReqCloudUserCollection data) {
|
||||
Integer pages = limit * (page - 1);
|
||||
ArrayList<CloudFileVo> list = cloudUserCollectionMapper.queryByPage(pages, limit,data);
|
||||
Integer count = cloudUserCollectionMapper.queryByPageCount(data);
|
||||
return new PageList<CloudFileVo>(list,page,limit,count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloudUserCollectionVo getByData(ReqCloudUserCollection data) {
|
||||
return cloudUserCollectionMapper.getData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveData(ReqCloudUserCollection data) {
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
CloudUserCollection saveData = new CloudUserCollection();
|
||||
SysUser sysUser = sysUserMapper.selectById(StpUtil.getLoginIdAsInt());
|
||||
saveData.setFileId(Long.valueOf(data.getFileId()));
|
||||
saveData.setUserId(sysUser.getId());
|
||||
saveData.setCreateTime(localDateTime);
|
||||
if(cloudUserCollectionMapper.insert(saveData)==1){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteById(String id) {
|
||||
if (null == id) {
|
||||
throw new ServiceException("删除的ID不能为空!");
|
||||
}
|
||||
QueryWrapper<CloudUserCollection> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("file_id",id);
|
||||
wrapper.eq("user_id",StpUtil.getLoginIdAsInt());
|
||||
List<CloudUserCollection> list = cloudUserCollectionMapper.selectList(wrapper);
|
||||
if(list.size()>0){
|
||||
return cloudUserCollectionMapper.deleteById(list.get(0).getId());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
package com.zxdmy.excite.system.service.impl.cloud.lately;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.common.exception.ServiceException;
|
||||
import com.zxdmy.excite.system.entity.SysUser;
|
||||
import com.zxdmy.excite.system.entity.cloud.collection.CloudUserCollection;
|
||||
import com.zxdmy.excite.system.entity.cloud.lately.CloudUserLately;
|
||||
import com.zxdmy.excite.system.entity.cloud.space.CloudFile;
|
||||
import com.zxdmy.excite.system.entity.req.collection.ReqCloudUserCollection;
|
||||
import com.zxdmy.excite.system.entity.req.lately.ReqCloudUserLately;
|
||||
import com.zxdmy.excite.system.entity.req.trace.ReqCloudFileTrace;
|
||||
import com.zxdmy.excite.system.entity.vo.collection.CloudUserCollectionVo;
|
||||
import com.zxdmy.excite.system.entity.vo.lately.CloudUserLatelyVo;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileVo;
|
||||
import com.zxdmy.excite.system.mapper.SysUserMapper;
|
||||
import com.zxdmy.excite.system.mapper.cloud.lately.CloudUserLatelyMapper;
|
||||
import com.zxdmy.excite.system.mapper.cloud.space.CloudFileMapper;
|
||||
import com.zxdmy.excite.system.service.cloud.lately.ICloudUserLatelyService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zxdmy.excite.system.service.cloud.trace.ICloudFileTraceService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 最近文件表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CloudUserLatelyServiceImpl extends ServiceImpl<CloudUserLatelyMapper, CloudUserLately> implements ICloudUserLatelyService {
|
||||
CloudUserLatelyMapper cloudUserLatelyMapper;
|
||||
SysUserMapper sysUserMapper;
|
||||
CloudFileMapper cloudFileMapper;
|
||||
ICloudFileTraceService iCloudFileTraceService;
|
||||
@Override
|
||||
public PageList<CloudFileVo> queryByPage(Integer page, Integer limit, ReqCloudUserLately data) {
|
||||
Integer pages = limit * (page - 1);
|
||||
ArrayList<CloudFileVo> list = cloudUserLatelyMapper.queryByPage(pages, limit,data);
|
||||
Integer count = cloudUserLatelyMapper.queryByPageCount(data);
|
||||
return new PageList<CloudFileVo>(list,page,limit,count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloudUserLatelyVo getByData(ReqCloudUserLately data) {
|
||||
return cloudUserLatelyMapper.getData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveData(ReqCloudUserLately data) {
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
CloudUserLately saveData = new CloudUserLately();
|
||||
SysUser sysUser = sysUserMapper.selectById(StpUtil.getLoginIdAsInt());
|
||||
saveData.setFileId(Long.valueOf(data.getFileId()));
|
||||
saveData.setUserId(sysUser.getId());
|
||||
saveData.setCreateTime(localDateTime);
|
||||
saveData.setLatelyTime(localDateTime);
|
||||
if(cloudUserLatelyMapper.insert(saveData)==1){
|
||||
|
||||
CloudFile cloudFile = cloudFileMapper.selectById(data.getFileId());
|
||||
|
||||
ReqCloudFileTrace reqCloudFileTrace = new ReqCloudFileTrace();
|
||||
reqCloudFileTrace.setFileId(data.getFileId());
|
||||
reqCloudFileTrace.setTraceName("查看了 "+cloudFile.getFileName()+" 文件");
|
||||
iCloudFileTraceService.saveData(reqCloudFileTrace);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteById(String id) {
|
||||
if (null == id) {
|
||||
throw new ServiceException("删除的ID不能为空!");
|
||||
}
|
||||
QueryWrapper<CloudUserLately> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("file_id",id);
|
||||
wrapper.eq("user_id",StpUtil.getLoginIdAsInt());
|
||||
List<CloudUserLately> list = cloudUserLatelyMapper.selectList(wrapper);
|
||||
if(list.size()>0){
|
||||
return cloudUserLatelyMapper.deleteById(list.get(0).getId());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.zxdmy.excite.system.service.impl.cloud.role;
|
||||
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRoleFile;
|
||||
import com.zxdmy.excite.system.mapper.cloud.role.CloudRoleFileMapper;
|
||||
import com.zxdmy.excite.system.service.cloud.role.ICloudRoleFileService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 云盘权限文件表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-02-01
|
||||
*/
|
||||
@Service
|
||||
public class CloudRoleFileServiceImpl extends ServiceImpl<CloudRoleFileMapper, CloudRoleFile> implements ICloudRoleFileService {
|
||||
|
||||
}
|
||||
+300
@@ -0,0 +1,300 @@
|
||||
package com.zxdmy.excite.system.service.impl.cloud.role;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.common.enums.SystemCode;
|
||||
import com.zxdmy.excite.common.exception.ServiceException;
|
||||
import com.zxdmy.excite.system.entity.SysRole;
|
||||
import com.zxdmy.excite.system.entity.SysUser;
|
||||
import com.zxdmy.excite.system.entity.SysUserRole;
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRole;
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRoleFile;
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRoleUser;
|
||||
import com.zxdmy.excite.system.entity.cloud.space.CloudFileRole;
|
||||
import com.zxdmy.excite.system.entity.req.role.ReqRole;
|
||||
import com.zxdmy.excite.system.entity.vo.role.RoleVo;
|
||||
import com.zxdmy.excite.system.mapper.SysUserMapper;
|
||||
import com.zxdmy.excite.system.mapper.cloud.role.CloudRoleFileMapper;
|
||||
import com.zxdmy.excite.system.mapper.cloud.role.CloudRoleMapper;
|
||||
import com.zxdmy.excite.system.service.cloud.role.ICloudRoleService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zxdmy.excite.system.service.cloud.role.ICloudRoleUserService;
|
||||
import com.zxdmy.excite.system.service.cloud.space.ICloudFileRoleService;
|
||||
import com.zxdmy.excite.system.utils.AuthUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 云盘权限表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CloudRoleServiceImpl extends ServiceImpl<CloudRoleMapper, CloudRole> implements ICloudRoleService {
|
||||
private CloudRoleMapper cloudRoleMapper;
|
||||
private SysUserMapper sysUserMapper;
|
||||
private ICloudRoleUserService iCloudRoleUserService;
|
||||
private CloudRoleFileMapper cloudRoleFileMapper;
|
||||
private ICloudFileRoleService iCloudFileRoleService;
|
||||
|
||||
@Override
|
||||
public PageList<RoleVo> queryByPage(Integer page, Integer limit, ReqRole data) {
|
||||
Integer pages = limit * (page - 1);
|
||||
ArrayList<RoleVo> list = cloudRoleMapper.queryByPage(pages, limit,data);
|
||||
Integer count = cloudRoleMapper.queryByPageCount(data);
|
||||
return new PageList<RoleVo>(list,page,limit,count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleVo getByData(ReqRole data) {
|
||||
return cloudRoleMapper.getData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveData(ReqRole data) {
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
CloudRole saveData = new CloudRole();
|
||||
saveData.setRoleName(data.getRoleName());
|
||||
SysUser sysUser = sysUserMapper.selectById(StpUtil.getLoginIdAsInt());
|
||||
saveData.setRoleDown(data.getRoleDown());
|
||||
saveData.setRoleUpload(data.getRoleUpload());
|
||||
saveData.setCreatorId(sysUser.getId());
|
||||
saveData.setCreatorName(sysUser.getUsername());
|
||||
saveData.setCreateTime(localDateTime);
|
||||
if(cloudRoleMapper.insert(saveData)==1){
|
||||
|
||||
for (String fileId:data.getIds()) {
|
||||
CloudRoleFile cloudRoleFile = new CloudRoleFile();
|
||||
cloudRoleFile.setFileId(Long.valueOf(fileId));
|
||||
cloudRoleFile.setRoleId(saveData.getId());
|
||||
cloudRoleFileMapper.insert(cloudRoleFile);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateData(ReqRole data) {
|
||||
CloudRole updateData = new CloudRole();
|
||||
updateData.setId(Long.valueOf(data.getId()));
|
||||
updateData.setRoleName(data.getRoleName());
|
||||
updateData.setRoleDown(data.getRoleDown());
|
||||
updateData.setRoleUpload(data.getRoleUpload());
|
||||
if(cloudRoleMapper.updateById(updateData)==1){
|
||||
|
||||
QueryWrapper<CloudRoleFile> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("role_id",updateData.getId());
|
||||
List<CloudRoleFile> list = cloudRoleFileMapper.selectList(wrapper);
|
||||
for (CloudRoleFile cloudRoleFile:list) {
|
||||
cloudRoleFileMapper.deleteById(cloudRoleFile.getId());
|
||||
}
|
||||
|
||||
|
||||
for (String fileId:data.getIds()) {
|
||||
CloudRoleFile cloudRoleFile = new CloudRoleFile();
|
||||
cloudRoleFile.setFileId(Long.valueOf(fileId));
|
||||
cloudRoleFile.setRoleId(updateData.getId());
|
||||
cloudRoleFileMapper.insert(cloudRoleFile);
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteById(String id) {
|
||||
if (null == id) {
|
||||
throw new ServiceException("删除的ID不能为空!");
|
||||
}
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
SysUser sysUser = sysUserMapper.selectById(StpUtil.getLoginIdAsInt());
|
||||
CloudRole data = cloudRoleMapper.selectById(id);
|
||||
if(null!=data){
|
||||
data.setDeleteId(sysUser.getId());
|
||||
data.setDeleteName(sysUser.getUsername());
|
||||
data.setDeleteTime(localDateTime);
|
||||
return cloudRoleMapper.updateById(data);
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RoleVo> queryByData() {
|
||||
return cloudRoleMapper.queryByData();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int[] changeUploadStatus(Integer newStatus, String[] ids) {
|
||||
/// 信息不能为空
|
||||
if (null == newStatus || null == ids) {
|
||||
throw new ServiceException("新状态或ID不能为空");
|
||||
}
|
||||
// 新状态只能为 0 | 1
|
||||
if (newStatus == 0 || newStatus == 1) {
|
||||
int[] result = new int[2];
|
||||
for (String id : ids) {
|
||||
CloudRole data = cloudRoleMapper.selectById(id);
|
||||
data.setRoleUpload(newStatus);
|
||||
if (cloudRoleMapper.updateById(data) > 0) {
|
||||
result[0]++;
|
||||
} else result[1]++;
|
||||
}
|
||||
// 返回结果
|
||||
return result;
|
||||
} else {
|
||||
throw new ServiceException("新状态只能为0或1!");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int[] changeDownStatus(Integer newStatus, String[] ids) {
|
||||
/// 信息不能为空
|
||||
if (null == newStatus || null == ids) {
|
||||
throw new ServiceException("新状态或ID不能为空");
|
||||
}
|
||||
// 新状态只能为 0 | 1
|
||||
if (newStatus == 0 || newStatus == 1) {
|
||||
int[] result = new int[2];
|
||||
for (String id : ids) {
|
||||
CloudRole data = cloudRoleMapper.selectById(id);
|
||||
data.setRoleDown(newStatus);
|
||||
if (cloudRoleMapper.updateById(data) > 0) {
|
||||
result[0]++;
|
||||
} else result[1]++;
|
||||
}
|
||||
// 返回结果
|
||||
return result;
|
||||
} else {
|
||||
throw new ServiceException("新状态只能为0或1!");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int[] changeDeleteStatus(Integer newStatus, String[] ids) {
|
||||
/// 信息不能为空
|
||||
if (null == newStatus || null == ids) {
|
||||
throw new ServiceException("新状态或ID不能为空");
|
||||
}
|
||||
// 新状态只能为 0 | 1
|
||||
if (newStatus == 0 || newStatus == 1) {
|
||||
int[] result = new int[2];
|
||||
for (String id : ids) {
|
||||
CloudRole data = cloudRoleMapper.selectById(id);
|
||||
data.setRoleDelete(newStatus);
|
||||
if (cloudRoleMapper.updateById(data) > 0) {
|
||||
result[0]++;
|
||||
} else result[1]++;
|
||||
}
|
||||
// 返回结果
|
||||
return result;
|
||||
} else {
|
||||
throw new ServiceException("新状态只能为0或1!");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean authRoleForUsers(String roleId, String[] userIds) {
|
||||
// 如果用户列表为空,则直接返回真即可
|
||||
if (null == userIds || userIds.length == 0) {
|
||||
return true;
|
||||
}
|
||||
// 存储列表
|
||||
List<CloudRoleUser> userRoleList = new ArrayList<>();
|
||||
for (String userId : userIds) {
|
||||
// 构造数据,并添加至列表
|
||||
CloudRoleUser userRole = new CloudRoleUser();
|
||||
userRole.setRoleId(Long.valueOf(roleId));
|
||||
userRole.setUserId(Integer.valueOf(userId));
|
||||
userRoleList.add(userRole);
|
||||
|
||||
QueryWrapper<CloudRoleFile> wrapper1 = new QueryWrapper<>();
|
||||
wrapper1.eq("role_id",roleId);
|
||||
List<CloudRoleFile> fileList = cloudRoleFileMapper.selectList(wrapper1);
|
||||
List<CloudFileRole> fileRoleList = new ArrayList<>();
|
||||
for (CloudRoleFile cloudRoleFile:fileList) {
|
||||
CloudFileRole cloudFileRole = new CloudFileRole();
|
||||
cloudFileRole.setFileId(cloudRoleFile.getFileId());
|
||||
cloudFileRole.setUserId(Integer.valueOf(userId));
|
||||
fileRoleList.add(cloudFileRole);
|
||||
}
|
||||
iCloudFileRoleService.saveBatch(fileRoleList);
|
||||
}
|
||||
// 执行插入
|
||||
if (iCloudRoleUserService.saveBatch(userRoleList)) {
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] revokeRoleForUsers(String roleId, String[] userIds) {
|
||||
if (null == userIds || userIds.length == 0) {
|
||||
return new int[]{0, 0};
|
||||
}
|
||||
int[] result = new int[2];
|
||||
// 遍历用户列表,逐个删除
|
||||
for (String userId : userIds) {
|
||||
QueryWrapper<CloudRoleUser> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("role_id", roleId).eq("user_id", userId);
|
||||
// TODO 完善:超级管理员不允许取消授权!
|
||||
if (iCloudRoleUserService.remove(wrapper)) {
|
||||
|
||||
QueryWrapper<CloudRoleFile> wrapper1 = new QueryWrapper<>();
|
||||
wrapper1.eq("role_id",roleId);
|
||||
List<CloudRoleFile> fileList = cloudRoleFileMapper.selectList(wrapper1);
|
||||
for (CloudRoleFile cloudRoleFile:fileList) {
|
||||
|
||||
QueryWrapper<CloudFileRole> wrapper2 = new QueryWrapper<>();
|
||||
wrapper2.eq("file_id", cloudRoleFile.getFileId());
|
||||
wrapper2.eq("user_id", userId);
|
||||
iCloudFileRoleService.remove(wrapper2);
|
||||
}
|
||||
|
||||
result[0]++;
|
||||
} else
|
||||
result[1]++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CloudRole> getListByUserId(Integer userId) {
|
||||
// 查询status正常的角色
|
||||
QueryWrapper<CloudRole> wrapper = new QueryWrapper<>();
|
||||
wrapper.isNull("delete_time");
|
||||
// 如果userId为0,则表示获取全部角色
|
||||
if (userId == 0) {
|
||||
return cloudRoleMapper.selectList(wrapper);
|
||||
}
|
||||
// 否则,获取角色后,将该用户已分配的角色checkArr设置为1
|
||||
else {
|
||||
// 获取全部正常角色
|
||||
List<CloudRole> roleList = cloudRoleMapper.selectList(wrapper);
|
||||
// 获取当前用户拥有的角色ID列表
|
||||
List<Long> userRoleList = iCloudRoleUserService.getListByUserId(userId).stream().map(CloudRoleUser::getRoleId).collect(Collectors.toList());
|
||||
// 使用lambda表达式,直接在角色列表上修改checkArr字段
|
||||
return roleList.stream().peek(
|
||||
role -> {
|
||||
if (userRoleList.contains(role.getId())) {
|
||||
role.setCheckArr("1");
|
||||
role.setLAY_CHECKED(true);
|
||||
}
|
||||
}
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.zxdmy.excite.system.service.impl.cloud.role;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zxdmy.excite.system.entity.SysUserRole;
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRole;
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRoleUser;
|
||||
import com.zxdmy.excite.system.mapper.cloud.role.CloudRoleMapper;
|
||||
import com.zxdmy.excite.system.mapper.cloud.role.CloudRoleUserMapper;
|
||||
import com.zxdmy.excite.system.service.ISysUserRoleService;
|
||||
import com.zxdmy.excite.system.service.cloud.role.ICloudRoleUserService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zxdmy.excite.system.utils.AuthUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 云盘权限用户表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CloudRoleUserServiceImpl extends ServiceImpl<CloudRoleUserMapper, CloudRoleUser> implements ICloudRoleUserService {
|
||||
CloudRoleUserMapper cloudRoleUserMapper;
|
||||
CloudRoleMapper cloudRoleMapper;
|
||||
@Override
|
||||
public List<CloudRoleUser> getListByUserId(Integer userId) {
|
||||
QueryWrapper<CloudRoleUser> wrapper1 = new QueryWrapper<>();
|
||||
wrapper1.eq("user_id", userId);
|
||||
return cloudRoleUserMapper.selectList(wrapper1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloudRole getCloudShareRole(Integer id) {
|
||||
QueryWrapper<CloudRoleUser> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("user_id",id);
|
||||
List<CloudRoleUser> roleList = cloudRoleUserMapper.selectList(wrapper);
|
||||
CloudRole data = new CloudRole();
|
||||
data.setRoleUpload(0);
|
||||
data.setRoleDown(0);
|
||||
data.setRoleDelete(0);
|
||||
for (CloudRoleUser cloudRoleUser:roleList) {
|
||||
CloudRole cloudRole = cloudRoleMapper.selectById(cloudRoleUser.getRoleId());
|
||||
if(null!=cloudRole.getRoleUpload() && cloudRole.getRoleUpload()==1){
|
||||
data.setRoleUpload(1);
|
||||
}
|
||||
if(null!=cloudRole.getRoleDown() && cloudRole.getRoleDown()==1){
|
||||
data.setRoleDown(1);
|
||||
}
|
||||
if(null!=cloudRole.getRoleDelete() && cloudRole.getRoleDelete()==1){
|
||||
data.setRoleDelete(1);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.zxdmy.excite.system.service.impl.cloud.space;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zxdmy.excite.system.entity.SysUser;
|
||||
import com.zxdmy.excite.system.entity.cloud.space.CloudFileRole;
|
||||
import com.zxdmy.excite.system.entity.req.space.ReqCloudFileRole;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileRoleVo;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudRoleFileVo;
|
||||
import com.zxdmy.excite.system.mapper.cloud.space.CloudFileRoleMapper;
|
||||
import com.zxdmy.excite.system.service.cloud.space.ICloudFileRoleService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件用户权限表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-30
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CloudFileRoleServiceImpl extends ServiceImpl<CloudFileRoleMapper, CloudFileRole> implements ICloudFileRoleService {
|
||||
CloudFileRoleMapper cloudFileRoleMapper;
|
||||
@Override
|
||||
public List<CloudFileRoleVo> getFileRole(String id) {
|
||||
return cloudFileRoleMapper.getFileRole(id);
|
||||
}
|
||||
@Override
|
||||
public List<CloudRoleFileVo> getRoleFile(String id) {
|
||||
return cloudFileRoleMapper.getRoleFile(id);
|
||||
}
|
||||
@Override
|
||||
public List<CloudRoleFileVo> getRoleFileCheck(String id) {
|
||||
return cloudFileRoleMapper.getRoleFileCheck(id);
|
||||
}
|
||||
@Override
|
||||
public CloudFileRole getData(ReqCloudFileRole data) {
|
||||
QueryWrapper<CloudFileRole> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("user_id",data.getUserId());
|
||||
wrapper.eq("file_id",data.getFileId());
|
||||
List<CloudFileRole> cloudFileRole = cloudFileRoleMapper.selectList(wrapper);
|
||||
if(cloudFileRole.size()>0){
|
||||
return cloudFileRole.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CloudFileRole> getFileRoleByUseId(Integer id) {
|
||||
QueryWrapper<CloudFileRole> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("user_id",id);
|
||||
List<CloudFileRole> cloudFileRole = cloudFileRoleMapper.selectList(wrapper);
|
||||
return cloudFileRole;
|
||||
}
|
||||
}
|
||||
+290
@@ -0,0 +1,290 @@
|
||||
package com.zxdmy.excite.system.service.impl.cloud.space;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.common.enums.CloudCode;
|
||||
import com.zxdmy.excite.common.enums.SystemCode;
|
||||
import com.zxdmy.excite.common.exception.ServiceException;
|
||||
import com.zxdmy.excite.system.entity.SysUser;
|
||||
import com.zxdmy.excite.system.entity.cloud.role.CloudRole;
|
||||
import com.zxdmy.excite.system.entity.cloud.space.CloudFile;
|
||||
import com.zxdmy.excite.system.entity.cloud.space.CloudFileRole;
|
||||
import com.zxdmy.excite.system.entity.req.space.ReqCloudFile;
|
||||
import com.zxdmy.excite.system.entity.req.trace.ReqCloudFileTrace;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileRoleVo;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileVo;
|
||||
import com.zxdmy.excite.system.mapper.SysUserMapper;
|
||||
import com.zxdmy.excite.system.mapper.cloud.space.CloudFileMapper;
|
||||
import com.zxdmy.excite.system.mapper.cloud.space.CloudFileRoleMapper;
|
||||
import com.zxdmy.excite.system.service.cloud.space.ICloudFileService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zxdmy.excite.system.service.cloud.trace.ICloudFileTraceService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author ss
|
||||
* @since 2026-01-28
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CloudFileServiceImpl extends ServiceImpl<CloudFileMapper, CloudFile> implements ICloudFileService {
|
||||
|
||||
private CloudFileMapper cloudFileMapper;
|
||||
private SysUserMapper sysUserMapper;
|
||||
private CloudFileRoleMapper cloudFileRoleMapper;
|
||||
private ICloudFileTraceService iCloudFileTraceService;
|
||||
|
||||
@Override
|
||||
public PageList<CloudFileVo> queryByPage(Integer page, Integer limit, ReqCloudFile data) {
|
||||
Integer pages = limit * (page - 1);
|
||||
ArrayList<CloudFileVo> list = cloudFileMapper.queryByPage(pages, limit,data);
|
||||
Integer count = cloudFileMapper.queryByPageCount(data);
|
||||
return new PageList<CloudFileVo>(list,page,limit,count);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageList<CloudFileVo> queryByRecyclePage(Integer page, Integer limit, ReqCloudFile data) {
|
||||
Integer pages = limit * (page - 1);
|
||||
ArrayList<CloudFileVo> list = cloudFileMapper.queryByRecyclePage(pages, limit,data);
|
||||
Integer count = cloudFileMapper.queryByRecyclePageCount(data);
|
||||
return new PageList<CloudFileVo>(list,page,limit,count);
|
||||
}
|
||||
@Override
|
||||
public CloudFileVo getByData(ReqCloudFile data) {
|
||||
return cloudFileMapper.getData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveData(ReqCloudFile data) {
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
CloudFile saveData = new CloudFile();
|
||||
saveData.setFileName(data.getFileName());
|
||||
saveData.setFileFormat(CloudCode.FOLDER_NAME.getCode());
|
||||
saveData.setFileFolder(Integer.valueOf(SystemCode.FOLDER_Y.getCode()));
|
||||
saveData.setFileImage(CloudCode.FOLDER_IMAGE.getCode());
|
||||
saveData.setFileSort(0);
|
||||
|
||||
if(data.getFileParentId().equals("0")){
|
||||
saveData.setFileTopId(Long.valueOf("0"));
|
||||
saveData.setFileParentId(Long.valueOf("0"));
|
||||
}else{
|
||||
saveData.setFileTopId(Long.valueOf(data.getFileParentId()));
|
||||
saveData.setFileParentId(Long.valueOf(data.getFileParentId()));
|
||||
}
|
||||
SysUser sysUser = sysUserMapper.selectById(StpUtil.getLoginIdAsInt());
|
||||
saveData.setCreatorId(sysUser.getId());
|
||||
saveData.setCreatorName(sysUser.getUsername());
|
||||
saveData.setCreateTime(localDateTime);
|
||||
if(cloudFileMapper.insert(saveData)==1){
|
||||
for (Integer userId:data.getIds()) {
|
||||
CloudFileRole cloudFileRole = new CloudFileRole();
|
||||
cloudFileRole.setFileId(saveData.getId());
|
||||
cloudFileRole.setUserId(userId);
|
||||
cloudFileRoleMapper.insert(cloudFileRole);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int saveFileData(ReqCloudFile data) {
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
CloudFile saveData = new CloudFile();
|
||||
String[] file = data.getFileName().split("\\.");
|
||||
String fileName = null;
|
||||
String format = null;
|
||||
if(file.length>0) {
|
||||
fileName = file[0].toString();
|
||||
format = file[1].toString();
|
||||
saveData.setFileName(fileName);
|
||||
saveData.setFileFormat(format);
|
||||
|
||||
}
|
||||
saveData.setFileTop(0);
|
||||
saveData.setFileName(fileName);
|
||||
saveData.setFileFormat(format);
|
||||
saveData.setFileFolder(Integer.valueOf(SystemCode.FOLDER_N.getCode()));
|
||||
saveData.setFileImage(CloudCode.PDF_IMAGE.getCode());
|
||||
saveData.setFileSort(0);
|
||||
saveData.setFileSize(data.getFileSize());
|
||||
saveData.setFileOss(data.getFileOss());
|
||||
if(data.getFileParentId().equals("0")){
|
||||
saveData.setFileTopId(Long.valueOf("0"));
|
||||
saveData.setFileParentId(Long.valueOf("0"));
|
||||
}else{
|
||||
saveData.setFileTopId(Long.valueOf(data.getFileParentId()));
|
||||
saveData.setFileParentId(Long.valueOf(data.getFileParentId()));
|
||||
}
|
||||
SysUser sysUser = sysUserMapper.selectById(StpUtil.getLoginIdAsInt());
|
||||
saveData.setCreatorId(sysUser.getId());
|
||||
saveData.setCreatorName(sysUser.getUsername());
|
||||
saveData.setCreateTime(localDateTime);
|
||||
if(cloudFileMapper.insert(saveData)==1){
|
||||
|
||||
|
||||
ReqCloudFileTrace reqCloudFileTrace = new ReqCloudFileTrace();
|
||||
reqCloudFileTrace.setFileId(saveData.getId().toString());
|
||||
reqCloudFileTrace.setTraceName("上传了 "+fileName+" 文件");
|
||||
iCloudFileTraceService.saveData(reqCloudFileTrace);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateFileData(ReqCloudFile data) {
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
CloudFile saveData = cloudFileMapper.selectById(data.getId());
|
||||
saveData.setFileOss(data.getFileOss());
|
||||
saveData.setFileSize(data.getFileSize());
|
||||
SysUser sysUser = sysUserMapper.selectById(StpUtil.getLoginIdAsInt());
|
||||
saveData.setUpdaterId(sysUser.getId());
|
||||
saveData.setUpdaterName(sysUser.getUsername());
|
||||
saveData.setUpdateTime(localDateTime);
|
||||
if(cloudFileMapper.updateById(saveData)==1){
|
||||
|
||||
ReqCloudFileTrace reqCloudFileTrace = new ReqCloudFileTrace();
|
||||
reqCloudFileTrace.setFileId(saveData.getId().toString());
|
||||
reqCloudFileTrace.setTraceName("替换了 "+saveData.getFileName()+" 文件");
|
||||
iCloudFileTraceService.saveData(reqCloudFileTrace);
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int updateData(ReqCloudFile data) {
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
|
||||
CloudFile updateData = new CloudFile();
|
||||
updateData.setId(Long.valueOf(data.getId()));
|
||||
updateData.setFileName(data.getFileName());
|
||||
|
||||
|
||||
SysUser sysUser = sysUserMapper.selectById(StpUtil.getLoginIdAsInt());
|
||||
updateData.setUpdateTime(localDateTime);
|
||||
updateData.setUpdaterId(sysUser.getId());
|
||||
updateData.setUpdaterName(sysUser.getUsername());
|
||||
if(cloudFileMapper.updateById(updateData)==1){
|
||||
|
||||
List<CloudFileRoleVo> roleList = cloudFileRoleMapper.getFileRole(data.getId());
|
||||
for (CloudFileRoleVo cloudFileRoleVo:roleList) {
|
||||
cloudFileRoleMapper.deleteById(cloudFileRoleVo.getId());
|
||||
}
|
||||
|
||||
if(null!=data.getIds()){
|
||||
for (Integer userId:data.getIds()) {
|
||||
CloudFileRole cloudFileRole = new CloudFileRole();
|
||||
cloudFileRole.setFileId(updateData.getId());
|
||||
cloudFileRole.setUserId(userId);
|
||||
cloudFileRoleMapper.insert(cloudFileRole);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int recover(String id) {
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
|
||||
CloudFile updateData = cloudFileMapper.selectById(id);
|
||||
updateData.setDeleteId(null);
|
||||
updateData.setDeleteName(null);
|
||||
updateData.setDeleteTime(null);
|
||||
|
||||
SysUser sysUser = sysUserMapper.selectById(StpUtil.getLoginIdAsInt());
|
||||
updateData.setUpdateTime(localDateTime);
|
||||
updateData.setUpdaterId(sysUser.getId());
|
||||
updateData.setUpdaterName(sysUser.getUsername());
|
||||
if(cloudFileMapper.updateById(updateData)==1){
|
||||
|
||||
ReqCloudFileTrace reqCloudFileTrace = new ReqCloudFileTrace();
|
||||
reqCloudFileTrace.setFileId(id);
|
||||
reqCloudFileTrace.setTraceName("恢复了 "+updateData.getFileName()+" 文件");
|
||||
iCloudFileTraceService.saveData(reqCloudFileTrace);
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int deleteById(String id) {
|
||||
if (null == id) {
|
||||
throw new ServiceException("删除的ID不能为空!");
|
||||
}
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
SysUser sysUser = sysUserMapper.selectById(StpUtil.getLoginIdAsInt());
|
||||
CloudFile data = cloudFileMapper.selectById(id);
|
||||
if(null!=data){
|
||||
data.setDeleteId(sysUser.getId());
|
||||
data.setDeleteName(sysUser.getUsername());
|
||||
data.setDeleteTime(localDateTime);
|
||||
|
||||
|
||||
ReqCloudFileTrace reqCloudFileTrace = new ReqCloudFileTrace();
|
||||
reqCloudFileTrace.setFileId(id);
|
||||
reqCloudFileTrace.setTraceName("删除了 "+data.getFileName()+" 文件");
|
||||
iCloudFileTraceService.saveData(reqCloudFileTrace);
|
||||
return cloudFileMapper.updateById(data);
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] changeDeleteStatus(Integer newStatus, String[] ids) {
|
||||
/// 信息不能为空
|
||||
if (null == newStatus || null == ids) {
|
||||
throw new ServiceException("新状态或ID不能为空");
|
||||
}
|
||||
// 新状态只能为 0 | 1
|
||||
if (newStatus == 0 || newStatus == 1) {
|
||||
int[] result = new int[2];
|
||||
for (String id : ids) {
|
||||
CloudFile data = cloudFileMapper.selectById(id);
|
||||
data.setFileTop(newStatus);
|
||||
if (cloudFileMapper.updateById(data) > 0) {
|
||||
result[0]++;
|
||||
} else result[1]++;
|
||||
}
|
||||
// 返回结果
|
||||
return result;
|
||||
} else {
|
||||
throw new ServiceException("新状态只能为0或1!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageList<CloudFileVo> queryByIndexPage(Integer page, Integer limit, ReqCloudFile data) {
|
||||
Integer pages = limit * (page - 1);
|
||||
ArrayList<CloudFileVo> list = cloudFileMapper.queryByIndexPage(pages, limit,data);
|
||||
Integer count = cloudFileMapper.queryByIndexPageCount(data);
|
||||
return new PageList<CloudFileVo>(list,page,limit,count);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<CloudFileVo> queryFileByData(ReqCloudFile data) {
|
||||
return cloudFileMapper.queryFileByData(data);
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package com.zxdmy.excite.system.service.impl.cloud.trace;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.zxdmy.excite.common.entity.PageList;
|
||||
import com.zxdmy.excite.system.entity.SysUser;
|
||||
import com.zxdmy.excite.system.entity.cloud.lately.CloudUserLately;
|
||||
import com.zxdmy.excite.system.entity.cloud.trace.CloudFileTrace;
|
||||
import com.zxdmy.excite.system.entity.req.lately.ReqCloudUserLately;
|
||||
import com.zxdmy.excite.system.entity.req.trace.ReqCloudFileTrace;
|
||||
import com.zxdmy.excite.system.entity.vo.space.CloudFileVo;
|
||||
import com.zxdmy.excite.system.entity.vo.trace.CloudFileTraceVo;
|
||||
import com.zxdmy.excite.system.mapper.SysUserMapper;
|
||||
import com.zxdmy.excite.system.mapper.cloud.trace.CloudFileTraceMapper;
|
||||
import com.zxdmy.excite.system.service.cloud.trace.ICloudFileTraceService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件痕迹 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CloudFileTraceServiceImpl extends ServiceImpl<CloudFileTraceMapper, CloudFileTrace> implements ICloudFileTraceService {
|
||||
CloudFileTraceMapper cloudFileTraceMapper;
|
||||
SysUserMapper sysUserMapper;
|
||||
|
||||
@Override
|
||||
public PageList<CloudFileTraceVo> queryByPage(Integer page, Integer limit, ReqCloudFileTrace data) {
|
||||
Integer pages = limit * (page - 1);
|
||||
ArrayList<CloudFileTraceVo> list = cloudFileTraceMapper.queryByPage(pages, limit,data);
|
||||
Integer count = cloudFileTraceMapper.queryByPageCount(data);
|
||||
return new PageList<CloudFileTraceVo>(list,page,limit,count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveData(ReqCloudFileTrace data) {
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
CloudFileTrace saveData = new CloudFileTrace();
|
||||
SysUser sysUser = sysUserMapper.selectById(StpUtil.getLoginIdAsInt());
|
||||
saveData.setTraceName(data.getTraceName());
|
||||
saveData.setFileId(Long.valueOf(data.getFileId()));
|
||||
saveData.setTraceCreatorId(sysUser.getId());
|
||||
saveData.setTraceCreatorName(sysUser.getUsername());
|
||||
saveData.setCreateTime(localDateTime);
|
||||
if(cloudFileTraceMapper.insert(saveData)==1){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.zxdmy.excite.system.utils;
|
||||
|
||||
import com.zxdmy.excite.common.config.ExciteConfig;
|
||||
import com.zxdmy.excite.common.service.RedisService;
|
||||
import com.zxdmy.excite.system.entity.SysMenu;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 授权工具类(权限清理工具)
|
||||
*
|
||||
* @author 沈松
|
||||
* @since 2022/1/20 17:34
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class AuthUtils {
|
||||
|
||||
private RedisService redisService1;
|
||||
|
||||
private ExciteConfig exciteConfig1;
|
||||
|
||||
private static RedisService redisService;
|
||||
|
||||
private static ExciteConfig exciteConfig;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
redisService = redisService1;
|
||||
exciteConfig = exciteConfig1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统权限列表 默认 KEY
|
||||
*/
|
||||
private static final String SYSTEM_MENUS_KEY = "menu:systemMenuList";
|
||||
|
||||
/**
|
||||
* 用户权限列表 默认 KEY的 前缀
|
||||
*/
|
||||
private static final String USER_MENU_KEY = "menu:userMenuList:";
|
||||
|
||||
|
||||
/**
|
||||
* 保存【系统权限列表】至缓存
|
||||
*
|
||||
* @param isSuccess 执行条件
|
||||
* @param menuList 菜单列表
|
||||
*/
|
||||
public static void setSystemMenuListCache(boolean isSuccess, List<SysMenu> menuList) {
|
||||
if (exciteConfig.getAllowRedis() && isSuccess) {
|
||||
redisService.set(SYSTEM_MENUS_KEY, (Serializable) menuList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存【用户权限列表】至缓存
|
||||
*
|
||||
* @param isSuccess 执行条件
|
||||
* @param userId 用户ID
|
||||
* @param menuList 权限列表
|
||||
*/
|
||||
public static void setUserMenuListCache(boolean isSuccess, Integer userId, List<SysMenu> menuList) {
|
||||
if (exciteConfig.getAllowRedis() && isSuccess) {
|
||||
redisService.set(USER_MENU_KEY + userId, (Serializable) menuList, 7200L);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从缓存读取【系统权限列表】
|
||||
*
|
||||
* @param isSuccess 执行条件
|
||||
* @return 结果:null | List<SysMenu>
|
||||
*/
|
||||
public static List<SysMenu> getSystemMenuListCache(boolean isSuccess) {
|
||||
if (exciteConfig.getAllowRedis() && isSuccess) {
|
||||
return (List<SysMenu>) redisService.get(SYSTEM_MENUS_KEY);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从缓存读取【用户权限列表】
|
||||
*
|
||||
* @param isSuccess 执行条件
|
||||
* @param userId 用户ID
|
||||
* @return 结果:null | List<SysMenu>
|
||||
*/
|
||||
public static List<SysMenu> getUserMenuListCache(boolean isSuccess, Integer userId) {
|
||||
if (exciteConfig.getAllowRedis() && isSuccess) {
|
||||
return (List<SysMenu>) redisService.get(USER_MENU_KEY + userId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除【系统权限列表】的缓存
|
||||
*
|
||||
* @param isSuccess 执行条件,为真则执行
|
||||
*/
|
||||
public static void clearSystemMenuListCache(boolean isSuccess) {
|
||||
if (exciteConfig.getAllowRedis() && isSuccess) {
|
||||
redisService.remove(SYSTEM_MENUS_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除全部【用户权限列表】的缓存
|
||||
*
|
||||
* @param isSuccess 执行条件,为真则执行
|
||||
*/
|
||||
public static void clearUserMenuListCache(boolean isSuccess) {
|
||||
if (exciteConfig.getAllowRedis() && isSuccess) {
|
||||
redisService.removeByPrefix(USER_MENU_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除指定【用户权限列表】的缓存
|
||||
*
|
||||
* @param isSuccess 执行条件,为真则执行
|
||||
* @param userId 要清除的用户ID
|
||||
*/
|
||||
public static void clearUserMenuListCacheById(boolean isSuccess, Integer userId) {
|
||||
if (exciteConfig.getAllowRedis() && isSuccess) {
|
||||
redisService.remove(USER_MENU_KEY + userId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除指定【用户权限列表】的缓存(批量删除)
|
||||
*
|
||||
* @param isSuccess 执行条件,为真则执行
|
||||
* @param userIds 要清除的用户ID列表
|
||||
*/
|
||||
public static void clearUserMenuListCacheById(boolean isSuccess, Integer[] userIds) {
|
||||
if (exciteConfig.getAllowRedis() && isSuccess && userIds.length > 0) {
|
||||
for (int userId : userIds) {
|
||||
redisService.remove(USER_MENU_KEY + userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zxdmy.excite.system.mapper.SysLogLoginMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.zxdmy.excite.system.entity.SysLogLogin">
|
||||
<id column="id" property="id" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="user_account" property="userAccount" />
|
||||
<result column="ip" property="ip" />
|
||||
<result column="user_agent" property="userAgent" />
|
||||
<result column="req_data" property="reqData" />
|
||||
<result column="res_data" property="resData" />
|
||||
<result column="time_cost" property="timeCost" />
|
||||
<result column="status" property="status" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="delete_time" property="deleteTime" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, user_id, user_account, ip, user_agent, req_data, res_data, time_cost, status, create_time, update_time, delete_time
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zxdmy.excite.system.mapper.SysLogRequestMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.zxdmy.excite.system.entity.SysLogRequest">
|
||||
<id column="id" property="id"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="ip" property="ip"/>
|
||||
<result column="user_agent" property="userAgent"/>
|
||||
<result column="req_uri" property="reqUri"/>
|
||||
<result column="req_method" property="reqMethod"/>
|
||||
<result column="req_function" property="reqFunction"/>
|
||||
<result column="req_data" property="reqData"/>
|
||||
<result column="res_data" property="resData"/>
|
||||
<result column="time_cost" property="timeCost"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="delete_time" property="deleteTime"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
, user_id, ip, user_agent, req_uri, req_method, req_function, req_data, res_data, time_cost, status, create_time, update_time, delete_time
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user