Compare commits

...

16 Commits

Author SHA1 Message Date
lsym004933
183b8ddc01 refactor(admin): 更新字典数据DTO和VO的注解以及分页处理逻辑
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2026-01-17 14:41:32 +08:00
lsym004933
c3b925cc13 refactor(codegen): 更新Swagger注解版本
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2026-01-17 13:54:59 +08:00
lsym004933
5730ae5046 refactor(core): 统一实体类引用并优化依赖配置 2026-01-13 19:58:25 +08:00
39c20b61e0 Merge pull request '更新 .drone.yml' (#1) from auth into master
Reviewed-on: home/fateverse#1
2026-01-13 11:50:32 +08:00
ca88112af9 更新 .drone.yml
Some checks reported errors
continuous-integration/drone Build encountered an error
continuous-integration/drone/pr Build encountered an error
2026-01-13 11:49:53 +08:00
705cfdaa5c 更新 .drone.yml
Some checks reported errors
continuous-integration/drone Build encountered an error
2026-01-13 11:46:29 +08:00
94438d1271 feat : 部门重构完成 2025-03-09 15:25:24 +08:00
clay
425dd27bfd Merge pull request 'feat : 模拟执行报错' (#138) from clay into master
Reviewed-on: http://git.feashow.cn/clay/fateverse/pulls/138
2024-09-18 21:09:07 +00:00
clay
6290495df4 feat : 模拟执行报错 2024-09-19 05:08:45 +08:00
clay
845b8f8a4d Merge pull request 'feat : 模拟执行报错' (#136) from clay into master
Reviewed-on: http://git.feashow.cn/clay/fateverse/pulls/136
2024-09-18 20:30:58 +00:00
clay
cfddc12cc9 feat : 模拟执行报错 2024-09-19 04:30:26 +08:00
clay
bcd9e88a09 Merge pull request 'clay' (#134) from clay into master
Reviewed-on: http://git.feashow.cn/clay/fateverse/pulls/134
2024-09-18 20:26:31 +00:00
clay
f4b8484139 Merge remote-tracking branch 'origin/master' 2024-09-19 04:26:02 +08:00
clay
b4ee809710 feat : 模拟执行报错 2024-09-19 04:25:51 +08:00
clay
9c0e7e7390 Merge pull request 'feat : 模拟执行报错' (#122) from clay into master
Reviewed-on: http://git.feashow.cn/clay/fateverse/pulls/122
2024-08-27 07:57:47 +00:00
clay
a7a68ecb03 feat : 模拟执行报错 2024-08-27 15:56:42 +08:00
159 changed files with 1478 additions and 1356 deletions

View File

@@ -1,9 +1,7 @@
kind: pipeline
type: docker
name: fateverse
platform:
os: linux
arch: arm64
steps:
@@ -12,19 +10,15 @@ steps:
volumes: # 将容器内目录挂载到宿主机仓库需要开启Trusted设置
- name: maven-cache
path: /root/.m2 # 将maven下载依赖的目录挂载出来防止重复下载
- name: maven-build
path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
- name: skywalking-agent
path: /app/build/skywalking-agent
- name: settings
path: /usr/share/maven/conf/settings.xml
commands: # 定义在Docker容器中执行的shell命令
- sed -i 's/$DRONE_COMMIT_BRANCH/'"$DRONE_COMMIT_BRANCH"'/' start.sh
- bash maven.sh
- name: build-docker # 制作docker镜像
image: docker # 使用官方docker镜像
image: registry.cn-chengdu.aliyuncs.com/claywang/docker:20.10.1 # 使用官方docker镜像
volumes: # 将容器内目录挂载到宿主机
- name: maven-build
path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
- name: docker
path: /var/run/docker.sock # 挂载宿主机的docker
environment: # 获取到密文的docker用户名和密码
@@ -55,27 +49,22 @@ steps:
- name: deploy # rancher运行
image: bitnami/kubectl:1.26.13-debian-11-r1 #阿里云的kubectl镜像,里面包含kubectl命令行工具
image: registry.cn-chengdu.aliyuncs.com/claywang/kubectl #阿里云的kubectl镜像,里面包含kubectl命令行工具
volumes: # 将容器内目录挂载到宿主机
- name: maven-build
path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
- name: config
path: /app/config # 将kubectl 配置文件挂载出来
commands: # 定义在Docker容器中执行的shell命令
- cd /app/build/$DRONE_COMMIT_BRANCH
# 通过kubectl指令运行deployment.yml,并指定授权文件kubectl_conf.yml
- kubectl apply -f deployment.yml -n fateverse --kubeconfig=/app/config/base-taishan-kubectl.yml
- kubectl apply -f deployment.yml -n master --kubeconfig=/app/config/kubectl.yml
volumes:
- name: maven-build
- name: settings
host:
path: /home/build/fateverse
- name: skywalking-agent
host:
path: /home/build/skywalking-agent
- name: config # k8s对接的配置文件
path: /home/kubect/settings.xml
- name: config
host:
path: /home/kubect
- name: maven-cache
@@ -84,6 +73,8 @@ volumes:
- name: docker
host:
path: /var/run/docker.sock
# 定义触发条件
trigger:
branch:

View File

@@ -2,7 +2,7 @@ package cn.fateverse.admin.dto;
import cn.fateverse.admin.entity.Config;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@@ -20,41 +20,41 @@ public class ConfigDto {
/**
* 参数主键
*/
@ApiModelProperty("参数主键")
@Schema(description = "参数主键")
private Integer configId;
/**
* 参数名称
*/
@NotNull(message = "参数名称不能为空!")
@ApiModelProperty("参数名称")
@Schema(description = "参数名称")
private String configName;
/**
* 参数键名
*/
@NotNull(message = "参数键名不能为空!")
@ApiModelProperty("参数键名")
@Schema(description = "参数键名")
private String configKey;
/**
* 参数键值
*/
@NotNull(message = "参数键值不能为空!")
@ApiModelProperty("参数键值")
@Schema(description = "参数键值")
private String configValue;
/**
* 系统内置1是 0否
*/
@NotNull(message = "是否系统内置不能为空!")
@ApiModelProperty("系统内置1是 0否")
@Schema(description = "系统内置1是 0否")
private Integer configType;
/**
* 备注
*/
@ApiModelProperty("备注")
@Schema(description = "备注")
private String remark;
public Config toConfig() {

View File

@@ -1,7 +1,7 @@
package cn.fateverse.admin.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@@ -20,51 +20,51 @@ public class DictDataDto {
/**
* 字典排序
*/
@ApiModelProperty("字典排序")
@Schema(description = "字典排序")
@NotNull(message = "状态不能为空!")
private Integer dictSort;
/**
* 字典标签
*/
@ApiModelProperty("字典标签")
@Schema(description = "字典标签")
@NotNull(message = "字典标签不能为空!")
private String dictLabel;
/**
* 字典键值
*/
@ApiModelProperty("字典键值")
@Schema(description = "字典键值")
@NotNull(message = "字典键值不能为空!")
private String dictValue;
/**
* 字典类型
*/
@ApiModelProperty("字典类型")
@Schema(description = "字典类型")
@NotNull(message = "字典类型不能为空!")
private String dictType;
/**
* 样式属性(其他样式扩展)
*/
@ApiModelProperty("样式属性(其他样式扩展)")
@Schema(description = "样式属性(其他样式扩展)")
private Boolean isType;
/**
* 表格回显样式
*/
@ApiModelProperty("表格回显样式")
@Schema(description = "表格回显样式")
private String listClass;
/**
* 字典显示主题(ui框架时)or文字颜色(自定义颜色时)
*/
@ApiModelProperty("字典显示主题(ui框架时)or文字颜色(自定义颜色时)")
@Schema(description = "字典显示主题(ui框架时)or文字颜色(自定义颜色时)")
private String theme;
/**
* 是否默认Y是 N否
*/
@ApiModelProperty("是否默认Y是 N否")
@Schema(description = "是否默认Y是 N否")
private Integer isDefault;
/**
* 状态1正常 0停用
*/
@ApiModelProperty(value = "状态1正常 0停用",required = true)
@Schema(description = "状态1正常 0停用",required = true)
@NotNull(message = "状态不能为空!")
private String state;
}

View File

@@ -1,7 +1,7 @@
package cn.fateverse.admin.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@@ -17,24 +17,24 @@ public class DictTypeDto {
/**
* 字典主键
*/
@ApiModelProperty("字典主键")
@Schema(description = "字典主键")
private Long dictId;
/**
* 字典名称
*/
@ApiModelProperty("字典名称")
@Schema(description = "字典名称")
@NotNull(message = "字典名称不能为空!")
private String dictName;
/**
* 字典类型
*/
@ApiModelProperty("字典类型")
@Schema(description = "字典类型")
@NotNull(message = "字典类型不能为空!")
private String dictType;
/**
* 字典状态1正常 0停用
*/
@ApiModelProperty("字典状态")
@Schema(description = "字典状态")
@NotNull(message = "字典状态不能为空!")
private String state;

View File

@@ -1,6 +1,6 @@
package cn.fateverse.admin.dto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@@ -14,13 +14,13 @@ public class IpBackDto {
/**
* 主键id
*/
@ApiModelProperty("主键id")
@Schema(description = "主键id")
private Long id;
/**
* ip地址
*/
@NotBlank(message = "ip地址不能为空")
@ApiModelProperty("ip地址")
@Schema(description = "ip地址")
private String ipAddr;
}

View File

@@ -1,7 +1,7 @@
package cn.fateverse.admin.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@@ -21,7 +21,7 @@ public class MenuDto implements Serializable {
/**
* 菜单ID
*/
@ApiModelProperty("菜单ID")
@Schema(description = "菜单ID")
private Long menuId;
/**
@@ -29,86 +29,86 @@ public class MenuDto implements Serializable {
*/
@NotBlank(message = "菜单名称不能为空")
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
@ApiModelProperty("菜单名称")
@Schema(description = "菜单名称")
private String menuName;
/**
* 父菜单ID
*/
@ApiModelProperty("父菜单ID")
@Schema(description = "父菜单ID")
private Long parentId;
/**
* 显示顺序
*/
@ApiModelProperty("显示顺序")
@Schema(description = "显示顺序")
@NotNull(message = "显示顺序不能为空")
private Integer orderNum;
/**
* 路由地址
*/
@ApiModelProperty("路由地址")
@Schema(description = "路由地址")
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
private String path;
@ApiModelProperty("路径参数")
@Schema(description = "路径参数")
private String pathParams;
/**
* 组件路径
*/
@ApiModelProperty("组件路径")
@Schema(description = "组件路径")
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
private String component;
/**
* 是否为外链0是 1否
*/
@ApiModelProperty("是否为外链0是 1否")
@Schema(description = "是否为外链0是 1否")
private Boolean isFrame;
/**
* 是否缓存0缓存 1不缓存
*/
@ApiModelProperty("是否缓存0缓存 1不缓存")
@Schema(description = "是否缓存0缓存 1不缓存")
private Boolean isCache;
@ApiModelProperty("不重定向")
@Schema(description = "不重定向")
private Boolean noRedirect;
@ApiModelProperty("面包屑")
@Schema(description = "面包屑")
private Boolean breadcrumb;
/**
* 类型D目录 M菜单 B按钮
*/
@ApiModelProperty("类型D目录 M菜单 B按钮")
@Schema(description = "类型D目录 M菜单 B按钮")
@NotBlank(message = "菜单类型不能为空")
private String menuType;
/**
* 显示状态0显示 1隐藏
*/
@ApiModelProperty("显示状态0显示 1隐藏")
@Schema(description = "显示状态0显示 1隐藏")
private String visible;
/**
* 菜单状态0显示 1隐藏
*/
@ApiModelProperty("菜单状态0显示 1隐藏")
@Schema(description = "菜单状态0显示 1隐藏")
private String state;
/**
* 权限字符串
*/
@ApiModelProperty("权限字符串")
@Schema(description = "权限字符串")
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
private String perms;
/**
* 菜单图标
*/
@ApiModelProperty("菜单图标")
@Schema(description = "菜单图标")
private String icon;
}

View File

@@ -1,7 +1,7 @@
package cn.fateverse.admin.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@@ -17,30 +17,30 @@ public class PostDto {
/**
* 岗位ID
*/
@ApiModelProperty("岗位ID")
@Schema(description = "岗位ID")
private Long postId;
/**
* 岗位编码
*/
@ApiModelProperty("岗位编码")
@Schema(description = "岗位编码")
@NotNull(message = "岗位编码不能为空!")
private String postCode;
/**
* 岗位名称
*/
@ApiModelProperty("岗位名称")
@Schema(description = "岗位名称")
@NotNull(message = "岗位名称不能为空!")
private String postName;
/**
* 显示顺序
*/
@ApiModelProperty("显示顺序")
@Schema(description = "显示顺序")
@NotNull(message = "显示顺序不能为空!")
private Integer postSort;
/**
* 状态1正常 0停用
*/
@ApiModelProperty("状态1正常 0停用")
@Schema(description = "状态1正常 0停用")
@NotNull(message = "状态不能为空!")
private String state;

View File

@@ -1,8 +1,8 @@
package cn.fateverse.admin.dto;
import cn.fateverse.admin.entity.Role;
import cn.fateverse.common.core.entity.Role;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -24,53 +24,53 @@ public class RoleDto {
/**
* 角色ID
*/
@ApiModelProperty("角色id")
@Schema(description = "角色id")
private Long roleId;
/**
* 角色名称
*/
@ApiModelProperty("角色名称")
@Schema(description = "角色名称")
@NotBlank(message = "角色名称不能为空!")
private String roleName;
/**
* 角色关键词
*/
@ApiModelProperty("角色关键词")
@Schema(description = "角色关键词")
@NotBlank(message = "角色关键词不能为空!")
private String roleKey;
/**
* 角色排序
*/
@ApiModelProperty("角色排序")
@Schema(description = "角色排序")
@NotNull(message = "角色排序不能为空!")
private Integer roleSort;
/**
* 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限
*/
@ApiModelProperty("数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限")
@Schema(description = "数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限")
private String dataScope;
/**
* 角色状态1正常 0停用
*/
@ApiModelProperty("角色状态1正常 0停用")
@Schema(description = "角色状态1正常 0停用")
@NotBlank(message = "角色状态不能为空!")
private String state;
/**
* 菜单组
*/
@ApiModelProperty("菜单组")
@Schema(description = "菜单组")
private Set<Long> menuIds;
/**
* 部门组(数据权限)
*/
@ApiModelProperty("部门组(数据权限)")
@Schema(description = "部门组(数据权限)")
private Long[] deptIds;
public Role toRole() {

View File

@@ -1,8 +1,8 @@
package cn.fateverse.admin.dto;
import cn.fateverse.admin.entity.UserBase;
import cn.fateverse.common.core.entity.UserBase;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.Email;
@@ -74,12 +74,12 @@ public class UserDto{
/**
* 岗位ids
*/
@ApiModelProperty("岗位ids")
@Schema(description = "岗位ids")
private List<Long> postIds;
/**
* 角色ids
*/
@ApiModelProperty("角色ids")
@Schema(description = "角色ids")
private List<Long> roleIds;

View File

@@ -1,6 +1,6 @@
package cn.fateverse.admin.dubbo;
import cn.fateverse.admin.entity.User;
import cn.fateverse.common.core.entity.User;
import cn.fateverse.admin.vo.UserVo;
import java.util.List;

View File

@@ -3,7 +3,7 @@ package cn.fateverse.admin.entity;
import cn.fateverse.common.core.annotaion.EnableAutoField;
import cn.fateverse.common.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@@ -20,24 +20,24 @@ public class DictType extends BaseEntity {
/**
* 字典主键
*/
@ApiModelProperty("字典主键")
@Schema(description = "字典主键")
private Long dictId;
/**
* 字典名称
*/
@ApiModelProperty("字典名称")
@Schema(description = "字典名称")
@NotNull(message = "字典名称不能为空!")
private String dictName;
/**
* 字典类型
*/
@ApiModelProperty("字典类型")
@Schema(description = "字典类型")
@NotNull(message = "字典类型不能为空!")
private String dictType;
/**
* 字典状态1正常 0停用
*/
@ApiModelProperty("字典状态")
@Schema(description = "字典状态")
@NotNull(message = "字典状态不能为空!")
private String state;

View File

@@ -1,7 +1,7 @@
package cn.fateverse.admin.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
@@ -19,45 +19,45 @@ public class OnlineUser {
/**
* 会话id
*/
@ApiModelProperty("会话id")
@Schema(description = "会话id")
private String tokenId;
/**
* 用户名
*/
@ApiModelProperty("用户名")
@Schema(description = "用户名")
private String username;
/**
* 部门名称
*/
@ApiModelProperty("部门名称")
@Schema(description = "部门名称")
private String deptName;
/**
* 登录ip
*/
@ApiModelProperty("登录ip")
@Schema(description = "登录ip")
private String ipAddr;
/**
* 登录地点
*/
@ApiModelProperty("登录地点")
@Schema(description = "登录地点")
private String loginLocation;
/**
* 浏览器类型
*/
@ApiModelProperty("浏览器类型")
@Schema(description = "浏览器类型")
private String browser;
/**
* 操作系统
*/
@ApiModelProperty("操作系统")
@Schema(description = "操作系统")
private String os;
/**
* 登录时间
*/
@ApiModelProperty("登录时间")
@Schema(description = "登录时间")
private Date loginTime;

View File

@@ -1,7 +1,7 @@
package cn.fateverse.admin.query;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -21,18 +21,18 @@ public class ConfigQuery {
/**
* 参数名称
*/
@ApiModelProperty("参数名称")
@Schema(description = "参数名称")
private String configName;
/**
* 参数键名
*/
@ApiModelProperty("参数键名")
@Schema(description = "参数键名")
private String configKey;
/**
* 系统内置1是 0否
*/
@ApiModelProperty("系统内置1是 0否")
@Schema(description = "系统内置1是 0否")
private Integer configType;
}

View File

@@ -1,6 +1,6 @@
package cn.fateverse.admin.query;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@@ -13,16 +13,16 @@ public class DictDataQuery {
/**
* 字典类型
*/
@ApiModelProperty(value = "字典名称",required = true)
@Schema(description = "字典名称",required = true)
private String dictType;
/**
* 字典标签
*/
@ApiModelProperty("字典标签")
@Schema(description = "字典标签")
private String dictLabel;
/**
* 状态1正常 0停用
*/
@ApiModelProperty("帐号状态1正常 0停用")
@Schema(description = "帐号状态1正常 0停用")
private String state;
}

View File

@@ -1,7 +1,7 @@
package cn.fateverse.admin.query;
import cn.fateverse.common.core.entity.QueryTime;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@@ -14,18 +14,18 @@ public class DictTypeQuery extends QueryTime {
/**
* 字典名称
*/
@ApiModelProperty("字典名称")
@Schema(description = "字典名称")
private String dictName;
/**
* 字典类型
*/
@ApiModelProperty("字典类型")
@Schema(description = "字典类型")
private String dictType;
/**
* 帐号状态1正常 0停用
*/
@ApiModelProperty("帐号状态1正常 0停用")
@Schema(description = "帐号状态1正常 0停用")
private String state;
}

View File

@@ -1,7 +1,7 @@
package cn.fateverse.admin.query;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@@ -12,12 +12,12 @@ import lombok.Data;
@ApiModel("接口开关Query")
public class MappingSwitchQuery {
@ApiModelProperty("应用名称")
@Schema(description = "应用名称")
private String applicationName;
@ApiModelProperty("类别名称")
@Schema(description = "类别名称")
private String className;
@ApiModelProperty("方法名称")
@Schema(description = "方法名称")
private String methodName;
}

View File

@@ -1,6 +1,6 @@
package cn.fateverse.admin.query;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -17,18 +17,18 @@ public class PostQuery {
/**
* 岗位编码
*/
@ApiModelProperty("岗位编码")
@Schema(description = "岗位编码")
private String postCode;
/**
* 岗位名称
*/
@ApiModelProperty("岗位名称")
@Schema(description = "岗位名称")
private String postName;
/**
* 状态1正常 0停用
*/
@ApiModelProperty("状态1正常 0停用")
@Schema(description = "状态1正常 0停用")
private String state;
}

View File

@@ -2,7 +2,7 @@ package cn.fateverse.admin.query;
import cn.fateverse.common.core.entity.QueryTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@@ -15,17 +15,17 @@ public class RoleQuery extends QueryTime {
/**
* 权限字符
*/
@ApiModelProperty("角色名称")
@Schema(description = "角色名称")
private String roleName;
/**
* 权限字符
*/
@ApiModelProperty("权限字符")
@Schema(description = "权限字符")
private String roleKey;
/**
* 帐号状态1正常 0停用
*/
@ApiModelProperty("帐号状态1正常 0停用")
@Schema(description = "帐号状态1正常 0停用")
private String state;
}

View File

@@ -2,7 +2,7 @@ package cn.fateverse.admin.query;
import cn.fateverse.common.core.entity.QueryTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@@ -16,25 +16,25 @@ public class UserQuery extends QueryTime {
/**
* 部门ID
*/
@ApiModelProperty("部门ID")
@Schema(description = "部门ID")
private Long deptId;
/**
* 用户账号
*/
@ApiModelProperty("用户账号")
@Schema(description = "用户账号")
private String userName;
/**
* 手机号码
*/
@ApiModelProperty("手机号码")
@Schema(description = "手机号码")
private String phoneNumber;
/**
* 帐号状态1正常 0停用
*/
@ApiModelProperty("帐号状态1正常 0停用")
@Schema(description = "帐号状态1正常 0停用")
private String state;

View File

@@ -3,7 +3,7 @@ package cn.fateverse.admin.vo;
import cn.fateverse.admin.entity.Config;
import cn.fateverse.common.core.annotaion.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -25,41 +25,41 @@ public class ConfigVo {
/**
* 参数主键
*/
@ApiModelProperty("参数主键")
@Schema(description = "参数主键")
private Integer configId;
/**
* 参数名称
*/
@ApiModelProperty("参数名称")
@Schema(description = "参数名称")
@Excel("参数名称")
private String configName;
/**
* 参数键名
*/
@ApiModelProperty("参数键名")
@Schema(description = "参数键名")
@Excel("参数键名")
private String configKey;
/**
* 参数键值
*/
@ApiModelProperty("参数键值")
@Schema(description = "参数键值")
@Excel("参数键值")
private String configValue;
/**
* 系统内置1是 0否
*/
@ApiModelProperty("系统内置1是 0否")
@Schema(description = "系统内置1是 0否")
@Excel("系统内置1是 0否")
private Integer configType;
/**
* 备注
*/
@ApiModelProperty("备注")
@Schema(description = "备注")
@Excel("备注")
private String remark;

View File

@@ -6,7 +6,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
import java.time.LocalDateTime;
import java.util.List;
/**
@@ -66,7 +66,7 @@ public class DeptVo implements Serializable {
/**
* 创建时间
*/
private Date createTime;
private LocalDateTime createTime;
/**
* 子节点

View File

@@ -2,7 +2,7 @@ package cn.fateverse.admin.vo;
import cn.fateverse.admin.entity.DictData;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -23,34 +23,34 @@ public class DictDataSimpVo {
/**
* 字典标签
*/
@ApiModelProperty("字典标签")
@Schema(description = "字典标签")
@NotNull(message = "字典标签不能为空!")
private String label;
/**
* 字典键值
*/
@ApiModelProperty("字典键值")
@Schema(description = "字典键值")
@NotNull(message = "字典键值不能为空!")
private String value;
/**
* 样式属性(其他样式扩展)
*/
@ApiModelProperty("样式属性(其他样式扩展)")
@Schema(description = "样式属性(其他样式扩展)")
private Boolean isType;
/**
* 表格回显样式
*/
@ApiModelProperty("表格回显样式")
@Schema(description = "表格回显样式")
private String listClass;
/**
* 字典显示主题(ui框架时)or文字颜色(自定义颜色时)
*/
@ApiModelProperty("字典显示主题(ui框架时)or文字颜色(自定义颜色时)")
@Schema(description = "字典显示主题(ui框架时)or文字颜色(自定义颜色时)")
private String theme;
/**
* 是否默认Y是 N否
*/
@ApiModelProperty("是否默认Y是 N否")
@Schema(description = "是否默认Y是 N否")
private Integer isDefault;

View File

@@ -1,12 +1,13 @@
package cn.fateverse.admin.vo;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
@@ -28,52 +29,52 @@ public class DictDataVo implements Serializable {
/**
* 字典排序
*/
@ApiModelProperty("字典排序")
@Schema(description = "字典排序")
private Integer dictSort;
/**
* 字典标签
*/
@ApiModelProperty("字典标签")
@Schema(description = "字典标签")
private String dictLabel;
/**
* 字典键值
*/
@ApiModelProperty("字典键值")
@Schema(description = "字典键值")
private String dictValue;
/**
* 字典类型
*/
@ApiModelProperty("字典类型")
@Schema(description = "字典类型")
private String dictType;
/**
* 样式属性(其他样式扩展)
*/
@ApiModelProperty("样式属性(其他样式扩展)")
@Schema(description = "样式属性(其他样式扩展)")
private Boolean isType;
/**
* 表格回显样式
*/
@ApiModelProperty("表格回显样式")
@Schema(description = "表格回显样式")
private String listClass;
/**
* 字典显示主题(ui框架时)or文字颜色(自定义颜色时)
*/
@ApiModelProperty("字典显示主题(ui框架时)or文字颜色(自定义颜色时)")
@Schema(description = "字典显示主题(ui框架时)or文字颜色(自定义颜色时)")
private String theme;
/**
* 是否默认Y是 N否
*/
@ApiModelProperty("是否默认Y是 N否")
@Schema(description = "是否默认Y是 N否")
private Integer isDefault;
/**
* 状态1正常 0停用
*/
@ApiModelProperty(value = "状态1正常 0停用")
@Schema(description = "状态1正常 0停用")
private String state;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

View File

@@ -2,7 +2,7 @@ package cn.fateverse.admin.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
@@ -19,29 +19,29 @@ public class DictTypeVo {
/**
* 字典id
*/
@ApiModelProperty("字典id")
@Schema(description = "字典id")
private Long dictId;
/**
* 字典名称
*/
@ApiModelProperty("字典名称")
@Schema(description = "字典名称")
private String dictName;
/**
* 字典类型
*/
@ApiModelProperty("字典类型")
@Schema(description = "字典类型")
private String dictType;
/**
* 帐号状态1正常 0停用
*/
@ApiModelProperty("帐号状态1正常 0停用")
@Schema(description = "帐号状态1正常 0停用")
private String state;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
@Schema(description = "创建时间")
private LocalDateTime createTime;

View File

@@ -3,13 +3,13 @@ package cn.fateverse.admin.vo;
import cn.fateverse.admin.entity.IpBack;
import cn.fateverse.common.core.annotaion.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.time.LocalDateTime;
/**
* @author Clay
@@ -24,19 +24,19 @@ public class IpBackVo {
/**
* 主键id
*/
@ApiModelProperty("主键id")
@Schema(description = "主键id")
@Excel("id")
private Long id;
/**
* ip地址
*/
@ApiModelProperty("ip地址")
@Schema(description = "ip地址")
@Excel("ip地址")
private String ipAddr;
/**
* ip类型 ipv4 ipv6
*/
@ApiModelProperty("ip类型 ipv4 ipv6")
@Schema(description = "ip类型 ipv4 ipv6")
@Excel("ip类型 ipv4 ipv6")
private String type;
/**
@@ -45,9 +45,9 @@ public class IpBackVo {
@Excel("备注信息")
private String remark;
@ApiModelProperty("创建时间")
@Schema(description = "创建时间")
@Excel("创建时间")
private Date createTime;
private LocalDateTime createTime;
public static IpBackVo toIpBackVo(IpBack ipBack) {
return IpBackVo.builder()

View File

@@ -1,7 +1,7 @@
package cn.fateverse.admin.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -25,48 +25,48 @@ public class MenuSimpVo {
/**
* 菜单ID
*/
@ApiModelProperty("菜单ID")
@Schema(description = "菜单ID")
private Long menuId;
/**
* 菜单名称
*/
@ApiModelProperty("菜单名称")
@Schema(description = "菜单名称")
private String menuName;
/**
* 菜单图标
*/
@ApiModelProperty("菜单图标")
@Schema(description = "菜单图标")
private String icon;
/**
* 显示顺序
*/
@ApiModelProperty("显示顺序")
@Schema(description = "显示顺序")
private Integer orderNum;
@ApiModelProperty("显示顺序")
@Schema(description = "显示顺序")
private String menuType;
/**
* 权限字符串
*/
@ApiModelProperty("权限字符串")
@Schema(description = "权限字符串")
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
private String perms;
/**
* 组件路径
*/
@ApiModelProperty("组件路径")
@Schema(description = "组件路径")
private String component;
/**
* 菜单状态0显示 1隐藏
*/
@ApiModelProperty("菜单状态0显示 1隐藏")
@Schema(description = "菜单状态0显示 1隐藏")
private String state;
/**

View File

@@ -1,7 +1,7 @@
package cn.fateverse.admin.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@@ -18,87 +18,87 @@ public class MenuVo implements Serializable {
/**
* 菜单ID
*/
@ApiModelProperty("菜单ID")
@Schema(description = "菜单ID")
private Long menuId;
/**
* 菜单名称
*/
@ApiModelProperty("菜单名称")
@Schema(description = "菜单名称")
private String menuName;
/**
* 父菜单ID
*/
@ApiModelProperty("父菜单ID")
@Schema(description = "父菜单ID")
private Long parentId;
/**
* 显示顺序
*/
@ApiModelProperty("显示顺序")
@Schema(description = "显示顺序")
private Integer orderNum;
/**
* 路由地址
*/
@ApiModelProperty("路由地址")
@Schema(description = "路由地址")
private String path;
@ApiModelProperty("路径参数")
@Schema(description = "路径参数")
private String pathParams;
/**
* 组件路径
*/
@ApiModelProperty("组件路径")
@Schema(description = "组件路径")
private String component;
/**
* 是否为外链0是 1否
*/
@ApiModelProperty("是否为外链0是 1否")
@Schema(description = "是否为外链0是 1否")
private Boolean isFrame;
/**
* 是否缓存0缓存 1不缓存
*/
@ApiModelProperty("是否缓存0缓存 1不缓存")
@Schema(description = "是否缓存0缓存 1不缓存")
private Boolean isCache;
@ApiModelProperty("不重定向")
@Schema(description = "不重定向")
private Boolean noRedirect;
@ApiModelProperty("面包屑")
@Schema(description = "面包屑")
private Boolean breadcrumb;
/**
* 类型D目录 M菜单 B按钮
*/
@ApiModelProperty("类型D目录 M菜单 B按钮")
@Schema(description = "类型D目录 M菜单 B按钮")
private String menuType;
/**
* 显示状态0显示 1隐藏
*/
@ApiModelProperty("显示状态0显示 1隐藏")
@Schema(description = "显示状态0显示 1隐藏")
private String visible;
/**
* 菜单状态0显示 1隐藏
*/
@ApiModelProperty("菜单状态0显示 1隐藏")
@Schema(description = "菜单状态0显示 1隐藏")
private String state;
/**
* 权限字符串
*/
@ApiModelProperty("权限字符串")
@Schema(description = "权限字符串")
private String perms;
/**
* 菜单图标
*/
@ApiModelProperty("菜单图标")
@Schema(description = "菜单图标")
private String icon;
}

View File

@@ -2,7 +2,7 @@ package cn.fateverse.admin.vo;
import cn.fateverse.common.core.entity.OptionTree;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
@@ -18,9 +18,9 @@ import java.util.Set;
@ApiModel("角色修改时菜单返回实体")
public class OptionMenuVo {
@ApiModelProperty("已选择的")
@Schema(description = "已选择的")
private Set<Long> checked;
@ApiModelProperty("菜单选择option")
@Schema(description = "菜单选择option")
private List<OptionTree> menuOption;
}

View File

@@ -3,11 +3,12 @@ package cn.fateverse.admin.vo;
import cn.fateverse.admin.entity.Post;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.Date;
/**
@@ -22,30 +23,30 @@ public class PostVo {
/**
* 岗位ID
*/
@ApiModelProperty("岗位ID")
@Schema(description = "岗位ID")
private Long postId;
/**
* 岗位编码
*/
@ApiModelProperty("岗位编码")
@Schema(description = "岗位编码")
@NotNull(message = "岗位编码不能为空!")
private String postCode;
/**
* 岗位名称
*/
@ApiModelProperty("岗位名称")
@Schema(description = "岗位名称")
@NotNull(message = "岗位名称不能为空!")
private String postName;
/**
* 显示顺序
*/
@ApiModelProperty("显示顺序")
@Schema(description = "显示顺序")
@NotNull(message = "显示顺序不能为空!")
private Integer postSort;
/**
* 状态1正常 0停用
*/
@ApiModelProperty("状态1正常 0停用")
@Schema(description = "状态1正常 0停用")
@NotNull(message = "状态不能为空!")
private String state;
@@ -53,7 +54,7 @@ public class PostVo {
* 创建时间
*/
@JsonFormat(locale = "zh",timezone = "GMT+8",pattern = "yyyy-MM-dd")
private Date createTime;
private LocalDateTime createTime;
public static PostVo toPostVo(Post post){
return PostVo.builder()

View File

@@ -1,13 +1,14 @@
package cn.fateverse.admin.vo;
import cn.fateverse.admin.entity.Role;
import cn.fateverse.common.core.entity.Role;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.Set;
@@ -22,46 +23,46 @@ import java.util.Set;
@NoArgsConstructor
public class RoleVo {
@ApiModelProperty("角色id")
@Schema(description = "角色id")
private Long roleId;
@ApiModelProperty("角色名称")
@Schema(description = "角色名称")
private String roleName;
@ApiModelProperty("角色权限字符串")
@Schema(description = "角色权限字符串")
private String roleKey;
@ApiModelProperty("角色排序")
@Schema(description = "角色排序")
private Integer roleSort;
/**
* 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限
*/
@ApiModelProperty("数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限")
@Schema(description = "数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限")
private String dataScope;
/**
* 角色状态1正常 0停用
*/
@ApiModelProperty("角色状态1正常 0停用")
@Schema(description = "角色状态1正常 0停用")
private String state;
/**
* 菜单组
*/
@ApiModelProperty("菜单组")
@Schema(description = "菜单组")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Set<Long> menuIds;
/**
* 部门组(数据权限)
*/
@ApiModelProperty("部门组(数据权限)")
@Schema(description = "部门组(数据权限)")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Long[] deptIds;
private Date createTime;
private Date updateTime;
private LocalDateTime createTime;
private LocalDateTime updateTime;
public static RoleVo toRoleVo(Role role){
return RoleVo.builder()

View File

@@ -1,7 +1,7 @@
package cn.fateverse.admin.vo;
import cn.fateverse.admin.entity.Role;
import cn.fateverse.admin.entity.Dept;
import cn.fateverse.common.core.entity.Dept;
import cn.fateverse.common.core.entity.Role;
import lombok.Builder;
import lombok.Data;

View File

@@ -1,9 +1,9 @@
package cn.fateverse.admin.vo;
import cn.fateverse.admin.entity.User;
import cn.fateverse.common.core.entity.Option;
import cn.fateverse.common.core.entity.User;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
@@ -17,18 +17,18 @@ import java.util.List;
@Builder
@ApiModel("用户详细信息")
public class UserDetailVo {
@ApiModelProperty("用户基本细腻系")
@Schema(description = "用户基本细腻系")
private User user;
@ApiModelProperty("用户所在的岗位")
@Schema(description = "用户所在的岗位")
private List<Long> postIds;
@ApiModelProperty("岗位option选择数组")
@Schema(description = "岗位option选择数组")
private List<Option> postList;
@ApiModelProperty("用户所拥有的的角色信息")
@Schema(description = "用户所拥有的的角色信息")
private List<Long> roleIds;
@ApiModelProperty("角色option选择数组")
@Schema(description = "角色option选择数组")
private List<Option> roleList;
}

View File

@@ -1,13 +1,11 @@
package cn.fateverse.admin.vo;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.regex.Pattern;
/**
* @author Clay
@@ -20,13 +18,13 @@ public class UserVo implements Serializable {
/**
* 用户ID
*/
@ApiModelProperty("用户ID")
@Schema(description = "用户ID")
private Long userId;
/**
* 部门名称
*/
@ApiModelProperty("部门名称")
@Schema(description = "部门名称")
private String deptName;
private Long leaderDeptId;
@@ -36,7 +34,7 @@ public class UserVo implements Serializable {
/**
* 用户账号
*/
@ApiModelProperty("用户账号")
@Schema(description = "用户账号")
private String userName;
private String avatar;
@@ -50,33 +48,25 @@ public class UserVo implements Serializable {
/**
* 用户昵称
*/
@ApiModelProperty("用户昵称")
@Schema(description = "用户昵称")
private String nickName;
/**
* 手机号码
*/
@ApiModelProperty("手机号码")
@Schema(description = "手机号码")
private String phoneNumber;
/**
* 帐号状态1正常 0停用
*/
@ApiModelProperty("帐号状态1正常 0停用")
@Schema(description = "帐号状态1正常 0停用")
private String state;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
@Schema(description = "创建时间")
private Date createTime;
public boolean checkEmail(){
if (StrUtil.isEmpty(email)){
return false;
}
Pattern pattern =Pattern.compile("^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
return pattern.matcher(email).matches();
}
}

View File

@@ -24,7 +24,7 @@
</dependency>
<dependency>
<groupId>cn.fateverse</groupId>
<artifactId>common-mybatis</artifactId>
<artifactId>common-mybatis-puls</artifactId>
</dependency>
<dependency>
<groupId>cn.fateverse</groupId>
@@ -52,6 +52,10 @@
<groupId>cn.fateverse</groupId>
<artifactId>common-decrypt</artifactId>
</dependency>
<dependency>
<groupId>cn.fateverse</groupId>
<artifactId>admin-api</artifactId>
</dependency>
</dependencies>
<build>

View File

@@ -10,6 +10,7 @@ import cn.fateverse.common.core.utils.ObjectUtils;
import cn.fateverse.common.excel.utils.ExcelUtil;
import cn.fateverse.common.log.annotation.Log;
import cn.fateverse.common.log.enums.BusinessType;
import cn.fateverse.common.security.utils.SecurityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;

View File

@@ -1,17 +1,16 @@
package cn.fateverse.admin.controller;
import cn.fateverse.admin.dto.DeptDto;
import cn.fateverse.admin.facade.DeptFacade;
import cn.fateverse.admin.vo.DeptVo;
import cn.fateverse.admin.service.DeptService;
import cn.fateverse.common.core.constant.UserConstants;
import cn.fateverse.admin.entity.Dept;
import cn.fateverse.common.core.entity.OptionTree;
import cn.fateverse.common.core.exception.CustomException;
import cn.fateverse.common.core.result.Result;
import cn.fateverse.common.log.annotation.Log;
import cn.fateverse.common.log.enums.BusinessType;
import io.swagger.annotations.*;
import org.springframework.beans.BeanUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -25,14 +24,10 @@ import java.util.List;
@Api(tags = "部门接口")
@RestController
@RequestMapping("/dept")
@RequiredArgsConstructor
public class DeptController {
private final DeptService deptService;
public DeptController(DeptService deptService) {
this.deptService = deptService;
}
private final DeptFacade deptFacade;
@ApiOperation("获取列表信息")
@@ -41,7 +36,7 @@ public class DeptController {
public Result<List<DeptVo>> list(
@ApiParam(name="deptName",value="部门名称") String deptName,
@ApiParam(name="state",value="状态(1: 正常 0 : 停用)") Integer state){
List<DeptVo> deptVoList = deptService.searchTree(deptName, state);
List<DeptVo> deptVoList = deptFacade.searchTree(deptName, state);
return Result.ok(deptVoList);
}
@@ -51,23 +46,21 @@ public class DeptController {
public Result<DeptVo> info(
@ApiParam(name="deptId",value="部门id")
@PathVariable Long deptId){
checkDeptId(deptId);
DeptVo deptVo = deptService.searchById(deptId);
DeptVo deptVo = deptFacade.searchById(deptId);
return Result.ok(deptVo);
}
@ApiOperation("获取树形接口的option")
@GetMapping("/option")
public Result<List<OptionTree>> option(){
List<OptionTree> optionTreeList = deptService.searchTreeOption();
List<OptionTree> optionTreeList = deptFacade.searchTreeOption();
return Result.ok(optionTreeList);
}
@ApiOperation("获取修改时的部门列表")
@GetMapping("/option/exclude/{deptId}")
public Result<List<OptionTree>> exclude(@PathVariable Long deptId){
checkDeptId(deptId);
List<OptionTree> deptVoList = deptService.searchExcludeTree(deptId);
List<OptionTree> deptVoList = deptFacade.searchExcludeTree(deptId);
return Result.ok(deptVoList);
}
@@ -76,12 +69,7 @@ public class DeptController {
@PreAuthorize("@ss.hasPermission('admin:dept:add')")
@Log(title = "新增部门",businessType = BusinessType.INSERT)
public Result<Void> add(@RequestBody @Validated DeptDto deptDto){
Dept dept = new Dept();
BeanUtils.copyProperties(deptDto,dept);
if (UserConstants.DEPT_DISABLE.equals(deptService.checkNameUnique(dept))){
return Result.error("新增部门: "+ dept.getDeptName() +"'失败,部门名称以存在!");
}
deptService.save(dept);
deptFacade.save(deptDto);
return Result.ok();
}
@@ -90,15 +78,7 @@ public class DeptController {
@PreAuthorize("@ss.hasPermission('admin:dept:edit')")
@Log(title = "修改部门",businessType = BusinessType.UPDATE)
public Result<Void> edit(@RequestBody @Validated DeptDto deptDto){
Dept dept = new Dept();
BeanUtils.copyProperties(deptDto,dept);
if (UserConstants.DEPT_DISABLE.equals(deptService.checkNameUnique(dept))){
return Result.error("修改部门: "+ dept.getDeptName() +"'失败,部门名称以存在!");
}else if (dept.getDeptId().equals(dept.getParentId())){
return Result.error("修改部门: "+ dept.getDeptName() +"'失败,上级部门不能为自己!");
}
checkDeptId(dept.getDeptId());
deptService.edit(dept);
deptFacade.edit(deptDto);
return Result.ok();
}
@@ -108,26 +88,11 @@ public class DeptController {
@PreAuthorize("@ss.hasPermission('admin:dept:del')")
@Log(title = "删除部门",businessType = BusinessType.DELETE)
public Result<Void> delete(@PathVariable Long deptId){
checkDeptId(deptId);
if (deptService.hasChildById(deptId)){
return Result.error("存在下级部门,不允许删除");
}else if (deptService.checkExistUser(deptId)){
return Result.error("该部门下存在用户,不允许删除");
}
deptService.remove(deptId);
deptFacade.remove(deptId);
return Result.ok();
}
/**
* 检查部门id是都为空
*/
private void checkDeptId(Long deptId){
if (null == deptId){
throw new CustomException("部门id不能为空!");
}
}

View File

@@ -1,8 +1,8 @@
package cn.fateverse.admin.controller;
import cn.fateverse.admin.dto.RoleDto;
import cn.fateverse.admin.entity.Role;
import cn.fateverse.admin.entity.User;
import cn.fateverse.common.core.entity.Role;
import cn.fateverse.common.core.entity.User;
import cn.fateverse.admin.query.RoleQuery;
import cn.fateverse.admin.vo.RoleVo;
import cn.fateverse.common.core.entity.IdWrapper;
@@ -16,7 +16,7 @@ import cn.fateverse.common.core.result.Result;
import cn.fateverse.common.core.result.page.TableDataInfo;
import cn.fateverse.common.core.utils.LongUtils;
import cn.fateverse.common.core.utils.ObjectUtils;
import cn.fateverse.common.security.entity.LoginUser;
import cn.fateverse.common.core.entity.LoginUser;
import cn.fateverse.common.security.service.TokenService;
import cn.fateverse.common.security.utils.SecurityUtils;
import cn.fateverse.common.log.annotation.Log;

View File

@@ -0,0 +1,13 @@
package cn.fateverse.admin.convert;
import cn.fateverse.admin.dto.DeptDto;
import cn.fateverse.admin.vo.DeptVo;
import cn.fateverse.common.core.convert.BaseConvertDefine;
import cn.fateverse.common.core.entity.Dept;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface DeptConvert extends BaseConvertDefine<DeptDto, Dept, DeptVo> {
DeptConvert INSTANCE = Mappers.getMapper(DeptConvert.class);
}

View File

@@ -1,7 +1,8 @@
package cn.fateverse.admin.dubbo;
import cn.fateverse.admin.service.DeptService;
import cn.fateverse.admin.facade.DeptFacade;
import cn.fateverse.admin.vo.DeptVo;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import java.util.List;
@@ -11,18 +12,15 @@ import java.util.List;
* @date 2023-02-20
*/
@DubboService
@RequiredArgsConstructor
public class DubboDeptServiceImpl implements DubboDeptService {
private final DeptService deptService;
public DubboDeptServiceImpl(DeptService deptService) {
this.deptService = deptService;
}
private final DeptFacade deptFacade;
@Override
public List<DeptVo> searchDeptByDeptId(List<Long> deptIds) {
return deptService.searchByIds(deptIds);
return deptFacade.searchByIds(deptIds);
}
}

View File

@@ -1,6 +1,6 @@
package cn.fateverse.admin.dubbo;
import cn.fateverse.admin.entity.Role;
import cn.fateverse.common.core.entity.Role;
import cn.fateverse.admin.mapper.RoleMapper;
import cn.fateverse.admin.query.RoleQuery;
import org.apache.dubbo.config.annotation.DubboService;

View File

@@ -1,9 +1,10 @@
package cn.fateverse.admin.dubbo;
import cn.fateverse.admin.entity.User;
import cn.fateverse.admin.service.UserService;
import cn.fateverse.admin.vo.UserVo;
import cn.fateverse.common.core.entity.User;
import cn.fateverse.common.core.exception.CustomException;
import cn.fateverse.common.security.dubbo.DubboUserSearchService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
@@ -15,7 +16,7 @@ import java.util.List;
*/
@Slf4j
@DubboService
public class DubboUserServiceImpl implements DubboUserService {
public class DubboUserServiceImpl implements DubboUserService, DubboUserSearchService {
private final UserService userService;

View File

@@ -1,7 +1,7 @@
package cn.fateverse.admin.entity.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.fateverse.common.decrypt.annotation.EncryptField;
import lombok.Data;
@@ -19,7 +19,7 @@ public class MappingSwitchDto {
* key作为唯一编号
*/
@NotBlank(message = "唯一编号不能为空")
@ApiModelProperty("唯一编号不能为空")
@Schema(description = "唯一编号不能为空")
@EncryptField
private String key;
@@ -27,7 +27,7 @@ public class MappingSwitchDto {
* 当前方法的状态,true为正常放行,false为关闭
*/
@NotNull(message = "状态不能为空")
@ApiModelProperty("当前方法的状态,true为正常放行,false为关闭")
@Schema(description = "当前方法的状态,true为正常放行,false为关闭")
private Boolean state;
}

View File

@@ -3,7 +3,7 @@ package cn.fateverse.admin.entity.vo;
import cn.fateverse.common.decrypt.annotation.EncryptField;
import cn.fateverse.common.security.entity.MappingSwitchInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
@@ -24,66 +24,66 @@ public class MappingSwitchVo {
* key作为唯一编号
*/
@EncryptField
@ApiModelProperty("key作为唯一编号")
@Schema(description = "key作为唯一编号")
private String key;
/**
* 应用名称
*/
@ApiModelProperty("应用名称")
@Schema(description = "应用名称")
private String applicationName;
/**
* 类名
*/
@ApiModelProperty("类名")
@Schema(description = "类名")
private String className;
/**
* 方法名称
*/
@ApiModelProperty("方法名称")
@Schema(description = "方法名称")
private String methodName;
/**
* 描述MappingSwitch注解的value可以为空
*/
@ApiModelProperty("描述MappingSwitch注解的value可以为空")
@Schema(description = "描述MappingSwitch注解的value可以为空")
private String description;
/**
* HandlerMethod中的uri
*/
@ApiModelProperty("HandlerMethod中的uri")
@Schema(description = "HandlerMethod中的uri")
private Set<String> uris;
/**
* 当前开关类型
*/
@ApiModelProperty("当前开关类型")
@Schema(description = "当前开关类型")
private String type;
/**
* 当前方法请求类型
*/
@ApiModelProperty("当前方法请求类型")
@Schema(description = "当前方法请求类型")
private Set<String> httpMethods;
/**
* 当前方法的状态,true为正常放行,false为关闭
*/
@ApiModelProperty("当前方法的状态,true为正常放行,false为关闭")
@Schema(description = "当前方法的状态,true为正常放行,false为关闭")
private Boolean state;
/**
* 操作时间
*/
@ApiModelProperty("变更时间")
@Schema(description = "变更时间")
private Date operTime;
/**
* 操作人员
*/
@ApiModelProperty("操作人员")
@Schema(description = "操作人员")
private String operName;
public static MappingSwitchVo toMappingSwitchVo(MappingSwitchInfo mappingSwitchInfo) {

View File

@@ -0,0 +1,178 @@
package cn.fateverse.admin.facade;
import cn.fateverse.admin.convert.DeptConvert;
import cn.fateverse.admin.dto.DeptDto;
import cn.fateverse.admin.service.DeptService;
import cn.fateverse.admin.service.UserService;
import cn.fateverse.admin.vo.DeptVo;
import cn.fateverse.common.core.constant.BaseConstant;
import cn.fateverse.common.core.constant.UserConstants;
import cn.fateverse.common.core.entity.Dept;
import cn.fateverse.common.core.entity.OptionTree;
import cn.fateverse.common.core.utils.AssertUtil;
import cn.fateverse.common.core.utils.convert.TreeUtil;
import cn.hutool.core.collection.CollUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Service
@RequiredArgsConstructor
public class DeptFacade {
private final DeptService deptService;
private final UserService userService;
/**
* 查询树形结构信息
*
* @param deptName 部门名称
* @param state 状态
* @return {@link List }<{@link DeptVo }>
*/
public List<DeptVo> searchTree(String deptName, Integer state) {
List<Dept> deptList = deptService.list(deptName, state);
return TreeUtil.build(deptList, DeptVo.class, (config) -> {
config.setIdField("deptId");
config.setExclude("phone");
});
}
/**
* 按id查询
*
* @param deptId 部门id
* @return {@link DeptVo }
*/
public DeptVo searchById(Long deptId) {
Dept dept = deptService.getById(deptId);
return DeptConvert.INSTANCE.entityToVo(dept);
}
/**
* 获取部门选择的树形结构
*
* @return {@link List }<{@link OptionTree }> 部门树形选择对象
*/
public List<OptionTree> searchTreeOption() {
List<Dept> deptList = deptService.list(null, null);
return TreeUtil.build(deptList, OptionTree.class, (config) -> {
config.setIdField("deptId");
config.setOption("deptId", "deptName");
});
}
/**
* 搜索排除树
*
* @param deptId 部门id
* @return {@link List }<{@link OptionTree }>
*/
public List<OptionTree> searchExcludeTree(Long deptId) {
Dept dept = deptService.getById(deptId);
if (BaseConstant.ZERO.equals(dept.getParentId())) {
return List.of();
}
List<Dept> deptList = deptService.searchExcludeTree(deptId);
return TreeUtil.build(deptList, OptionTree.class, (config) -> {
config.setIdField("deptId");
config.setOption("deptId", "deptName");
});
}
/**
* 保存
*
* @param deptDto 部门dto
*/
@Transactional(rollbackFor = Exception.class)
public void save(DeptDto deptDto) {
Dept dept = DeptConvert.INSTANCE.dtoToEntity(deptDto);
deptService.checkNameUnique(dept);
deptService.save(dept);
}
/**
* 编辑
*
* @param deptDto 部门dto
*/
@Transactional(rollbackFor = Exception.class)
public void edit(DeptDto deptDto) {
Dept dept = DeptConvert.INSTANCE.dtoToEntity(deptDto);
deptService.checkNameUnique(dept);
AssertUtil.isTrue(!dept.getDeptId().equals(dept.getParentId()), "修改部门: {} '失败,上级部门不能为自己!", dept.getDeptName());
Dept newParentDept = deptService.getById(dept.getParentId());
Dept oldDept = deptService.getById(dept.getDeptId());
if (null != newParentDept && null != oldDept) {
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
String oldAncestors = oldDept.getAncestors();
dept.setAncestors(newAncestors);
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
}
if (null != newParentDept && UserConstants.DEPT_DISABLE.equals(newParentDept.getState())) {
updateParentDept(dept);
}
deptService.save(dept);
}
/**
* 更新字元素的ancestors
*
* @param deptId
* @param newAncestors
* @param odlAncestors
*/
public void updateDeptChildren(Long deptId, String newAncestors, String odlAncestors) {
List<Dept> children = deptService.selectChildrenById(deptId);
List<Dept> newChildren = children.stream().peek(child -> {
child.setAncestors(child.getAncestors().replace(odlAncestors, newAncestors));
}).collect(Collectors.toList());
if (CollUtil.isNotEmpty(newChildren)) {
deptService.updateBatchById(newChildren);
}
}
/**
* 更新父级部门的状态
*
* @param dept
*/
public void updateParentDept(Dept dept) {
Dept parent = deptService.getById(dept.getParentId());
parent.setState(dept.getState());
deptService.updateById(parent);
}
/**
* 删除
*
* @param deptId 部门id
*/
@Transactional(rollbackFor = Exception.class)
public void remove(Long deptId) {
AssertUtil.isTrue(!deptService.hasChildById(deptId), "存在下级部门,不允许删除");
AssertUtil.isTrue(!userService.checkExistUser(deptId), "该部门下存在用户,不允许删除");
deptService.removeById(deptId);
}
/**
* 按id搜索
*
* @param deptIds 部门id
* @return {@link List }<{@link DeptVo }>
*/
public List<DeptVo> searchByIds(List<Long> deptIds) {
List<Dept> deptList = deptService.searchByIds(deptIds);
return DeptConvert.INSTANCE.entityToVOList(deptList);
}
}

View File

@@ -1,137 +1,25 @@
package cn.fateverse.admin.mapper;
import cn.fateverse.admin.entity.Dept;
import org.apache.ibatis.annotations.Param;
import cn.fateverse.common.core.entity.Dept;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import java.util.Set;
/**
* @author Clay
* @date 2022/11/2
*/
public interface DeptMapper {
public interface DeptMapper extends BaseMapper<Dept> {
/**
* 查询部门列表
*
* @param deptName 部门名称
* @param state 部门状态
* @return 部门集合
*/
List<Dept> selectList(@Param("deptName") String deptName, @Param("state") Integer state);
/**
* 通过id查询部门信息
*
* @param deptId 部门id
* @return 返回对象
*/
Dept selectById(Long deptId);
/**
* 获取排除自身的部门列表
*
* @param deptId 部门id
* @return 部门集合
*/
List<Dept> selectExclude(Long deptId);
/**
* 查询所有的子节点
*
* @param deptId 部门id
* @return 部门集合
*/
List<Dept> selectChildrenById(Long deptId);
/**
* 校验部门名称是否唯一
*
* @param deptName 部门名称
* @param parentId 父部门ID
* @return 结果
*/
Dept selectByDeptNameAndParentId(@Param("deptName") String deptName, @Param("parentId") Long parentId);
/**
* 根据父id查询部门信息
*
* @param parentId 父级部门id
* @return 部门集合
*/
List<Dept> selectListByDeptParentId(Long parentId);
/**
* 通过parentId查询子列表
*
* @param parentId 父级id
* @return 部门名称集合
*/
Set<String> selectDeptNameListByParentId(Long parentId);
/**
* 查找是否存在子节点
*
* @param deptId 部门id
* @return 数量
*/
int selectChildCountByDeptId(Long deptId);
/**
* 查询部门是否存在用户
*
* @param deptId 部门id
* @return 数量
*/
int selectExistUserCount(Long deptId);
/**
* 根据ids获取到部门
*
* @param deptIds 部门id列表
* @return 部门集合对象
*/
List<Dept> selectByIds(List<Long> deptIds);
/**
* 新增部门
*
* @param dept 部门对象
* @return 影响条数
*/
int insert(Dept dept);
/**
* 更新部门信息
*
* @param dept 部门对象
* @return 影响条数
*/
int update(Dept dept);
/**
* 修改部门的状态;
*
* @param dept 部门对象
* @return 影响条数
*/
int updateState(Dept dept);
/**
* 批量修改子元素之前的关系
*
* @param depts 子元素
* @return 结果
*/
int updateChildren(@Param("depts") List<Dept> depts);
/**
* 删除部门
*
* @param deptId 部门id
* @return 运行结构
*/
int delete(Long deptId);
}

View File

@@ -1,6 +1,6 @@
package cn.fateverse.admin.mapper;
import cn.fateverse.admin.entity.Role;
import cn.fateverse.common.core.entity.Role;
import cn.fateverse.admin.query.RoleQuery;
import org.apache.ibatis.annotations.Param;

View File

@@ -1,9 +1,12 @@
package cn.fateverse.admin.mapper;
import cn.fateverse.admin.entity.User;
import cn.fateverse.admin.entity.UserBase;
import cn.fateverse.admin.query.UserQuery;
import cn.fateverse.admin.vo.UserVo;
import cn.fateverse.common.core.entity.User;
import cn.fateverse.common.core.entity.UserBase;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -12,7 +15,7 @@ import java.util.List;
* @author Clay
* @date 2022/10/30
*/
public interface UserMapper {
public interface UserMapper extends BaseMapper<UserBase> {
/**
* 通过用户名查询用户
@@ -43,7 +46,7 @@ public interface UserMapper {
* @param roleId 角色id
* @return 表格数据信息
*/
List<UserVo> selectUserListByExcludeRoleId(@Param("roleId") Long roleId, @Param("userName") String userName, @Param("phoneNumber") String phoneNumber);
IPage<UserVo> selectUserListByExcludeRoleId(@Param("page") IPage<UserVo> page, @Param("roleId") Long roleId, @Param("userName") String userName, @Param("phoneNumber") String phoneNumber);
/**
@@ -54,7 +57,7 @@ public interface UserMapper {
* @param phoneNumber 手机号码
* @return 用户列表
*/
List<UserVo> selectUserListByExcludePostId(@Param("postId") Long postId, @Param("userName") String userName, @Param("phoneNumber") String phoneNumber);
IPage<UserVo> selectUserListByExcludePostId(@Param("page") IPage<UserVo> page, @Param("postId") Long postId, @Param("userName") String userName, @Param("phoneNumber") String phoneNumber);
/**

View File

@@ -1,8 +1,7 @@
package cn.fateverse.admin.service;
import cn.fateverse.admin.vo.DeptVo;
import cn.fateverse.admin.entity.Dept;
import cn.fateverse.common.core.entity.OptionTree;
import cn.fateverse.common.core.entity.Dept;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
@@ -10,24 +9,16 @@ import java.util.List;
* @author Clay
* @date 2022/11/2
*/
public interface DeptService {
public interface DeptService extends IService<Dept> {
/**
* 查询部门树形结构数据
*
* @param deptName 部门名称
* @param state 部门状态
* @param state 部门状态
* @return 部门集合
*/
List<DeptVo> searchTree(String deptName, Integer state);
/**
* 部门id查询部门信息
*
* @param deptId 部门id
* @return 返回对象
*/
DeptVo searchById(Long deptId);
List<Dept> list(String deptName, Integer state);
/**
* 获取排除自身的部门树形结构
@@ -35,14 +26,7 @@ public interface DeptService {
* @param deptId 部门id
* @return 部门树形选择对象
*/
List<OptionTree> searchExcludeTree(Long deptId);
/**
* 获取部门选择的树形结构
*
* @return 部门树形选择对象
*/
List<OptionTree> searchTreeOption();
List<Dept> searchExcludeTree(Long deptId);
/**
* 通过ids获取到部门数据
@@ -50,15 +34,14 @@ public interface DeptService {
* @param deptIds 部门id列表
* @return 部门集合对象
*/
List<DeptVo> searchByIds(List<Long> deptIds);
List<Dept> searchByIds(List<Long> deptIds);
/**
* 校验部门名称是否唯一
*
* @param dept 部门对象
* @return 结果
*/
String checkNameUnique(Dept dept);
void checkNameUnique(Dept dept);
/**
* 是否存在部门子节点
@@ -69,34 +52,11 @@ public interface DeptService {
boolean hasChildById(Long deptId);
/**
* 查询部门是否存在用户
*
* @param deptId 部门ID
* @return 结果 true 存在 false 不存在
*/
boolean checkExistUser(Long deptId);
/**
* 新增部门
*
* @param dept 部门对象
* @return 影响条数
*/
int save(Dept dept);
/**
* 更新部门信息
*
* @param dept 部门对象
* @return 影响条数
*/
int edit(Dept dept);
/**
* 删除部门
* 按id选择子代
*
* @param deptId 部门id
* @return 影响条数
* @return {@link List }<{@link Dept }>
*/
int remove(Long deptId);
List<Dept> selectChildrenById(Long deptId);
}

View File

@@ -1,12 +1,14 @@
package cn.fateverse.admin.service;
import cn.fateverse.admin.dto.UserDto;
import cn.fateverse.admin.entity.User;
import cn.fateverse.admin.query.UserQuery;
import cn.fateverse.admin.vo.UserChooseVo;
import cn.fateverse.admin.vo.UserDetailVo;
import cn.fateverse.admin.vo.UserVo;
import cn.fateverse.common.core.entity.User;
import cn.fateverse.common.core.entity.UserBase;
import cn.fateverse.common.core.result.page.TableDataInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
@@ -14,7 +16,7 @@ import java.util.List;
* @author Clay
* @date 2022/10/30
*/
public interface UserService {
public interface UserService extends IService<UserBase> {
/**
* 通过用户名查询用户信息
@@ -263,4 +265,12 @@ public interface UserService {
* @return
*/
List<Long> searchAllUserIds();
/**
* 检查现有用户
*
* @param deptId 部门id
* @return boolean
*/
boolean checkExistUser(Long deptId);
}

View File

@@ -1,23 +1,17 @@
package cn.fateverse.admin.service.impl;
import cn.fateverse.admin.vo.DeptVo;
import cn.fateverse.admin.mapper.DeptMapper;
import cn.fateverse.admin.service.DeptService;
import cn.fateverse.common.core.constant.UserConstants;
import cn.fateverse.admin.entity.Dept;
import cn.fateverse.common.core.entity.OptionTree;
import cn.fateverse.common.core.exception.CustomException;
import cn.fateverse.common.core.entity.Dept;
import cn.fateverse.common.core.utils.AssertUtil;
import cn.fateverse.common.core.utils.LongUtils;
import cn.fateverse.common.core.utils.ObjectUtils;
import cn.fateverse.common.core.utils.convert.TreeUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
import java.util.List;
/**
* @author Clay
@@ -25,157 +19,58 @@ import java.util.stream.Collectors;
*/
@Slf4j
@Service
public class DeptServiceImpl implements DeptService {
public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept>
implements DeptService {
private final DeptMapper deptMapper;
public DeptServiceImpl(DeptMapper deptMapper) {
this.deptMapper = deptMapper;
@Override
public List<Dept> list(String deptName, Integer state) {
return this.lambdaQuery()
.like(StrUtil.isNotBlank(deptName), Dept::getDeptName, deptName)
.like(ObjectUtil.isNotNull(state), Dept::getState, state)
.list();
}
@Override
public List<DeptVo> searchTree(String deptName, Integer state) {
List<Dept> deptList = deptMapper.selectList(deptName, state);
return TreeUtil.build(deptList, DeptVo.class, (config) -> {
config.setIdField("deptId");
config.setExclude("phone");
});
public List<Dept> searchExcludeTree(Long deptId) {
return this.lambdaQuery()
.ne(Dept::getDeptId, deptId)
.ne(Dept::getParentId, deptId)
.list();
}
@Override
public List<Dept> searchByIds(List<Long> deptIds) {
return this.lambdaQuery()
.in(Dept::getDeptId, deptIds)
.list();
}
@Override
public DeptVo searchById(Long deptId) {
Dept dept = deptMapper.selectById(deptId);
DeptVo deptVo = new DeptVo();
BeanUtils.copyProperties(dept, deptVo);
return deptVo;
}
@Override
public List<OptionTree> searchExcludeTree(Long deptId) {
Dept dept = deptMapper.selectById(deptId);
if (0L == dept.getParentId()) {
return new ArrayList<>();
}
List<Dept> deptList = deptMapper.selectExclude(deptId);
return TreeUtil.build(deptList, OptionTree.class, (config) -> {
config.setIdField("deptId");
config.setOption("deptId", "deptName");
});
}
@Override
public List<OptionTree> searchTreeOption() {
List<Dept> deptList = deptMapper.selectList(null, null);
return TreeUtil.build(deptList, OptionTree.class, (config) -> {
config.setIdField("deptId");
config.setOption("deptId", "deptName");
});
}
@Override
public List<DeptVo> searchByIds(List<Long> deptIds) {
List<Dept> deptList = deptMapper.selectByIds(deptIds);
return deptList.stream().map(dept ->
DeptVo.builder()
.deptId(dept.getDeptId())
.parentId(dept.getParentId())
.deptName(dept.getDeptName())
.email(dept.getEmail())
.orderNum(dept.getOrderNum())
.leader(dept.getLeader())
.leaderId(dept.getLeaderId())
.phone(dept.getPhone())
.state(dept.getState())
.createTime(dept.getCreateTime())
.build()
).collect(Collectors.toList());
}
@Override
public String checkNameUnique(Dept dept) {
public void checkNameUnique(Dept dept) {
Long deptId = LongUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
Dept info = deptMapper.selectByDeptNameAndParentId(dept.getDeptName(), deptId);
if (!ObjectUtils.isEmpty(info) && !info.getDeptId().equals(deptId)) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
Dept info = this.lambdaQuery()
.eq(Dept::getDeptName, dept.getDeptName())
.eq(Dept::getParentId, deptId)
.last("limit 1")
.one();
AssertUtil.isTrue(ObjectUtil.isNotNull(info) && !dept.getDeptId().equals(info.getDeptId()), "新增部门: {}'失败,部门名称以存在!", dept.getDeptName());
}
@Override
public boolean hasChildById(Long deptId) {
return deptMapper.selectChildCountByDeptId(deptId) > 0;
}
@Override
public boolean checkExistUser(Long deptId) {
return deptMapper.selectExistUserCount(deptId) > 0;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int save(Dept dept) {
Set<String> deptNameSet = deptMapper.selectDeptNameListByParentId(dept.getParentId());
Dept info = deptMapper.selectById(dept.getParentId());
if (deptNameSet.contains(dept.getDeptName())) {
throw new CustomException(info.getDeptName() + "下已经存在" + dept.getDeptName() + "部门");
}
if (UserConstants.DEPT_DISABLE.equals(info.getState())) {
throw new CustomException("上级部门停用,不允许添加");
}
dept.setAncestors(info.getAncestors() + "," + info.getDeptId());
return deptMapper.insert(dept);
return this.lambdaQuery()
.eq(Dept::getParentId, deptId)
.eq(Dept::getDelFlag, 0)
.exists();
}
@Override
@Transactional(rollbackFor = Exception.class)
public int edit(Dept dept) {
Dept newParentDept = deptMapper.selectById(dept.getParentId());
Dept oldDept = deptMapper.selectById(dept.getDeptId());
if (null != newParentDept && null != oldDept) {
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
String oldAncestors = oldDept.getAncestors();
dept.setAncestors(newAncestors);
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
}
if (null != newParentDept && UserConstants.DEPT_DISABLE.equals(newParentDept.getState())) {
updateParentDept(dept);
}
return deptMapper.update(dept);
}
@Override
@Transactional(rollbackFor = Exception.class)
public int remove(Long deptId) {
return deptMapper.delete(deptId);
}
/**
* 更新父级部门的状态
*
* @param dept
*/
public void updateParentDept(Dept dept) {
dept = deptMapper.selectById(dept.getDeptId());
deptMapper.updateState(dept);
}
/**
* 更新字元素的ancestors
*
* @param deptId
* @param newAncestors
* @param odlAncestors
*/
public void updateDeptChildren(Long deptId, String newAncestors, String odlAncestors) {
List<Dept> children = deptMapper.selectChildrenById(deptId);
List<Dept> newChildren = children.stream().peek(child -> {
child.setAncestors(child.getAncestors().replace(odlAncestors, newAncestors));
}).collect(Collectors.toList());
if (newChildren.size() > 0) {
deptMapper.updateChildren(newChildren);
}
public List<Dept> selectChildrenById(Long deptId) {
return this.lambdaQuery()
.eq(Dept::getParentId, deptId)
.list();
}
}

View File

@@ -9,7 +9,6 @@ import cn.fateverse.admin.mapper.DictDataMapper;
import cn.fateverse.admin.service.DictCacheService;
import cn.fateverse.admin.service.DictDataService;
import cn.fateverse.common.core.entity.Option;
import cn.fateverse.common.core.exception.CustomException;
import cn.fateverse.common.core.result.page.TableDataInfo;
import cn.fateverse.common.mybatis.utils.PageUtils;
import lombok.extern.slf4j.Slf4j;

View File

@@ -1,7 +1,7 @@
package cn.fateverse.admin.service.impl;
import cn.fateverse.admin.dto.MenuDto;
import cn.fateverse.admin.entity.User;
import cn.fateverse.common.core.entity.User;
import cn.fateverse.admin.vo.MenuSimpVo;
import cn.fateverse.admin.vo.MenuVo;
import cn.fateverse.admin.vo.OptionMenuVo;
@@ -78,11 +78,11 @@ public class MenuServiceImpl implements MenuService {
@Override
public List<MenuSimpVo> searchTree(String menuName, String state) {
List<Menu> menuList = null;
User user = Objects.requireNonNull(SecurityUtils.getLoginUser()).getUser();
if (User.isAdmin(user.getUserId())) {
Long userId = Objects.requireNonNull(SecurityUtils.getUserId());
if (User.isAdmin(userId)) {
menuList = menuMapper.selectList(menuName, state, null, false);
} else {
menuList = menuMapper.selectListByUserId(user.getUserId(), menuName, state, null, false);
menuList = menuMapper.selectListByUserId(userId, menuName, state, null, false);
}
return TreeUtil.build(menuList, MenuSimpVo.class, (config) -> {
config.setIdField("menuId");
@@ -101,12 +101,12 @@ public class MenuServiceImpl implements MenuService {
@Override
public List<OptionTree> searchTreeOption(Long excludeId) {
User user = Objects.requireNonNull(SecurityUtils.getLoginUser()).getUser();
Long userId = Objects.requireNonNull(SecurityUtils.getUserId());
List<Menu> menuList = null;
if (User.isAdmin(user.getUserId())) {
if (User.isAdmin(userId)) {
menuList = menuMapper.selectList(null, null, excludeId, true);
} else {
menuList = menuMapper.selectListByUserId(user.getUserId(), null, null, excludeId, true);
menuList = menuMapper.selectListByUserId(userId, null, null, excludeId, true);
}
return TreeUtil.build(menuList, OptionTree.class, (config) -> {
config.setIdField("menuId");
@@ -121,12 +121,12 @@ public class MenuServiceImpl implements MenuService {
if (null == roleId || roleId.equals(0L)) {
checkedSet = menuMapper.selectCheckedMenuIdByRoleId(roleId);
}
User user = Objects.requireNonNull(SecurityUtils.getLoginUser()).getUser();
Long userId = Objects.requireNonNull(SecurityUtils.getUserId());
List<Menu> menuList = null;
if (User.isAdmin(user.getUserId())) {
if (User.isAdmin(userId)) {
menuList = menuMapper.selectList(null, null, null, true);
} else {
menuList = menuMapper.selectListByUserId(user.getUserId(), null, null, null, true);
menuList = menuMapper.selectListByUserId(userId, null, null, null, true);
}
return OptionMenuVo.builder()
.checked(checkedSet)

View File

@@ -8,7 +8,7 @@ import cn.hutool.core.util.StrUtil;
import cn.fateverse.admin.entity.OnlineUser;
import cn.fateverse.admin.service.OnlineUserService;
import cn.fateverse.common.core.constant.CacheConstants;
import cn.fateverse.common.security.entity.LoginUser;
import cn.fateverse.common.core.entity.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.RedisTemplate;

View File

@@ -1,7 +1,7 @@
package cn.fateverse.admin.service.impl;
import cn.fateverse.admin.dto.RoleDto;
import cn.fateverse.admin.entity.Role;
import cn.fateverse.common.core.entity.Role;
import cn.fateverse.admin.query.RoleQuery;
import cn.fateverse.admin.vo.RoleVo;
import cn.fateverse.admin.entity.RoleMenu;

View File

@@ -1,22 +1,30 @@
package cn.fateverse.admin.service.impl;
import cn.fateverse.admin.dto.UserDto;
import cn.fateverse.admin.entity.*;
import cn.fateverse.admin.entity.UserPost;
import cn.fateverse.admin.entity.UserRole;
import cn.fateverse.admin.mapper.*;
import cn.fateverse.admin.query.RoleQuery;
import cn.fateverse.admin.query.UserQuery;
import cn.fateverse.admin.service.UserService;
import cn.fateverse.admin.vo.UserChooseVo;
import cn.fateverse.admin.vo.UserDetailVo;
import cn.fateverse.admin.vo.UserVo;
import cn.hutool.core.util.StrUtil;
import cn.fateverse.admin.entity.User;
import cn.fateverse.admin.service.UserService;
import cn.fateverse.common.core.entity.Dept;
import cn.fateverse.common.core.entity.Role;
import cn.fateverse.common.core.entity.User;
import cn.fateverse.common.core.entity.UserBase;
import cn.fateverse.common.core.exception.CustomException;
import cn.fateverse.common.core.result.page.TableDataInfo;
import cn.fateverse.common.core.utils.LongUtils;
import cn.fateverse.common.core.utils.ObjectUtils;
import cn.fateverse.common.mybatis.utils.PageUtils;
import cn.fateverse.common.mybatisplus.utils.PageUtils;
import cn.fateverse.common.security.utils.SecurityUtils;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -33,28 +41,16 @@ import java.util.stream.Collectors;
*/
@Slf4j
@Service
public class UserServiceImpl implements UserService {
@RequiredArgsConstructor
public class UserServiceImpl extends ServiceImpl<UserMapper, UserBase>
implements UserService {
private final UserMapper userMapper;
private final UserRoleMapper userRoleMapper;
private final UserPostMapper userPostMapper;
private final RoleMapper roleMapper;
private final DeptMapper deptMapper;
public UserServiceImpl(UserMapper userMapper,
UserRoleMapper userRoleMapper,
UserPostMapper userPostMapper,
RoleMapper roleMapper, DeptMapper deptMapper) {
this.userMapper = userMapper;
this.userRoleMapper = userRoleMapper;
this.userPostMapper = userPostMapper;
this.roleMapper = roleMapper;
this.deptMapper = deptMapper;
}
@Override
public User searchByUserName(String username) {
@@ -155,14 +151,12 @@ public class UserServiceImpl implements UserService {
@Override
public TableDataInfo<UserVo> searchUserListByExcludeRoleId(Long roleId, String userName, String phoneNumber) {
PageUtils.startPage();
List<UserVo> list = userMapper.selectUserListByExcludeRoleId(roleId, userName, phoneNumber);
Long total = PageUtils.getTotal(list);
return PageUtils.convertDataTable(list, total);
Page<UserVo> page = PageUtils.getPage();
IPage<UserVo> mapperPage = userMapper.selectUserListByExcludeRoleId(page, roleId, userName, phoneNumber);
return PageUtils.convertDataTable(mapperPage);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void bindRole(List<Long> userIds, Long roleId) {
@@ -193,10 +187,9 @@ public class UserServiceImpl implements UserService {
@Override
public TableDataInfo<UserVo> searchUserListByExcludePostId(Long postId, String userName, String phoneNumber) {
PageUtils.startPage();
List<UserVo> list = userMapper.selectUserListByExcludePostId(postId, userName, phoneNumber);
Long total = PageUtils.getTotal(list);
return PageUtils.convertDataTable(list, total);
IPage<UserVo> page = PageUtils.getPage();
IPage<UserVo> mapperPage = userMapper.selectUserListByExcludePostId(page, postId, userName, phoneNumber);
return PageUtils.convertDataTable(mapperPage);
}
@@ -262,15 +255,16 @@ public class UserServiceImpl implements UserService {
@Override
public TableDataInfo<UserVo> searchUserListByExcludeDeptId(Long deptId, String userName, String phoneNumber) {
PageUtils.startPage();
Dept dept = deptMapper.selectById(deptId);
if (null == dept) {
throw new CustomException("当前部门不存在");
}
// dept.getAncestors()
List<UserVo> list = userMapper.searchUserListByExcludeDeptId(deptId, userName, phoneNumber);
Long total = PageUtils.getTotal(list);
return PageUtils.convertDataTable(list, total);
// PageUtils.startPage();
// Dept dept = deptMapper.selectById(deptId);
// if (null == dept) {
// throw new CustomException("当前部门不存在");
// }
//// dept.getAncestors()
// List<UserVo> list = userMapper.searchUserListByExcludeDeptId(deptId, userName, phoneNumber);
// Long total = PageUtils.getTotal(list);
// return PageUtils.convertDataTable(list, total);
return PageUtils.emptyTable();
}
@Override
@@ -322,14 +316,17 @@ public class UserServiceImpl implements UserService {
}
@Override
public List<Long> searchAllUserIds() {
return userMapper.selectAllUserIds();
}
@Override
public boolean checkExistUser(Long deptId) {
return this.lambdaQuery()
.eq(UserBase::getDeptId, deptId)
.exists();
}
/**
* 批量处理用户与角色之间的对应关系
@@ -416,4 +413,6 @@ public class UserServiceImpl implements UserService {
}
}

View File

@@ -23,161 +23,10 @@
from sys_dept
</sql>
<select id="selectList" resultType="cn.fateverse.admin.entity.Dept">
<include refid="selectSql"/>
<where>
<if test="deptName != null and deptName != ''"> and dept_name like concat('%',#{deptName},'%')</if>
<if test="state != null"> and `state` = #{state}</if>
</where>
order by parent_id, order_num
</select>
<select id="selectById" resultType="cn.fateverse.admin.entity.Dept">
select d.dept_id,
d.parent_id,
d.ancestors,
d.dept_name,
d.order_num,
d.leader,
d.leader_id,
d.phone,
d.email,
d.state,
d.del_flag,
d.create_by,
d.create_time,
d.update_by,
d.update_time
from sys_dept d
left join sys_dept p on p.dept_id = d.parent_id
where d.dept_id = #{deptId}
</select>
<select id="selectExclude" resultType="cn.fateverse.admin.entity.Dept">
<include refid="selectSql"/>
where dept_id != #{deptId} and parent_id != #{deptId}
</select>
<select id="selectChildrenById" parameterType="Long" resultType="cn.fateverse.admin.entity.Dept">
<include refid="selectSql"/>
where find_in_set(#{deptId}, ancestors)
</select>
<select id="selectByDeptNameAndParentId" resultType="cn.fateverse.admin.entity.Dept">
<include refid="selectSql"/>
where dept_name = #{deptName} and parent_id = #{parentId} limit 1
</select>
<select id="selectListByDeptParentId" resultType="cn.fateverse.admin.entity.Dept">
<select id="selectListByDeptParentId" resultType="cn.fateverse.common.core.entity.Dept">
<include refid="selectSql"/>
where parent_id = #{parentId}
</select>
<select id="selectChildCountByDeptId" resultType="java.lang.Integer">
select count(1)
from sys_dept
where parent_id = #{deptId}
and del_flag = '0'
limit 1
</select>
<select id="selectExistUserCount" resultType="java.lang.Integer">
select count(1)
from sys_user
where dept_id = #{deptId}
and del_flag = '0'
limit 1
</select>
<select id="selectDeptNameListByParentId" resultType="java.lang.String">
select dept_name from sys_dept where parent_id = #{parentId}
</select>
<select id="selectByIds" resultType="cn.fateverse.admin.entity.Dept">
<include refid="selectSql"/>
where dept_id in
<foreach collection="list" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</select>
<insert id="insert">
insert into sys_dept
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null and orderNum != ''">order_num,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="leaderId != null ">leader_id,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="state != null">state,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="leaderId != null ">#{leaderId},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="state != null">#{state},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="update">
update sys_dept
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="leaderId != null">leader_id = #{leaderId},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="state != null">state = #{state},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</set>
where dept_id = #{deptId}
</update>
<update id="updateChildren" parameterType="java.util.List">
update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index"
separator=" " open="case dept_id" close="end">
when #{item.deptId} then #{item.ancestors}
</foreach>
where dept_id in
<foreach collection="depts" item="item" index="index"
separator="," open="(" close=")">
#{item.deptId}
</foreach>
</update>
<update id="updateState">
update sys_dept
<set>
<if test="state != null and state != ''">state = #{state},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</set>
where dept_id in (${ancestors})
</update>
<delete id="delete">
delete
from sys_dept
where dept_id = #{deptId}
</delete>
</mapper>

View File

@@ -21,7 +21,7 @@
from sys_role
</sql>
<select id="selectList" resultType="cn.fateverse.admin.entity.Role">
<select id="selectList" resultType="cn.fateverse.common.core.entity.Role">
<include refid="selectSql"/>
<where>
<if test="roleName != null and roleName != ''"> and role_name like concat('%',#{roleName} ,'%')</if>
@@ -35,7 +35,7 @@
</if>
</where>
</select>
<select id="selectById" resultType="cn.fateverse.admin.entity.Role">
<select id="selectById" resultType="cn.fateverse.common.core.entity.Role">
<include refid="selectSql"/>
where role_id = #{roleId}
</select>
@@ -46,16 +46,16 @@
where r.role_id = #{roleId}
limit 1
</select>
<select id="selectByRoleName" resultType="cn.fateverse.admin.entity.Role">
<select id="selectByRoleName" resultType="cn.fateverse.common.core.entity.Role">
<include refid="selectSql"/>
where role_name = #{roleName} limit 0,1
</select>
<select id="selectByRoleKey" resultType="cn.fateverse.admin.entity.Role">
<select id="selectByRoleKey" resultType="cn.fateverse.common.core.entity.Role">
<include refid="selectSql"/>
where role_key = #{roleKey} limit 0,1
</select>
<select id="selectByIds" resultType="cn.fateverse.admin.entity.Role">
<select id="selectByIds" resultType="cn.fateverse.common.core.entity.Role">
<include refid="selectSql"/>
where role_id in
<foreach collection="list" open="(" separator="," close=")" item="roleId">
@@ -63,7 +63,7 @@
</foreach>
</select>
<select id="selectListByMenuId" resultType="cn.fateverse.admin.entity.Role">
<select id="selectListByMenuId" resultType="cn.fateverse.common.core.entity.Role">
<include refid="selectSql"/>
<where>
<if test="roleName != null and roleName != ''">and role_name like concat('%',#{roleName} ,'%')</if>
@@ -72,7 +72,7 @@
</where>
</select>
<select id="searchListExcludeMenuId" resultType="cn.fateverse.admin.entity.Role">
<select id="searchListExcludeMenuId" resultType="cn.fateverse.common.core.entity.Role">
<include refid="selectSql"/>
<where>
<if test="roleName != null and roleName != ''">and role_name like concat('%',#{roleName} ,'%')</if>

View File

@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.fateverse.admin.mapper.UserMapper">
<resultMap type="cn.fateverse.admin.entity.User" id="UserResult">
<resultMap type="cn.fateverse.common.core.entity.User" id="UserResult">
<id property="userId" column="user_id"/>
<result property="deptId" column="dept_id"/>
<result property="userName" column="user_name"/>
@@ -26,11 +26,11 @@
<result property="userType" column="user_type"/>
<result property="openId" column="open_id"/>
<result property="unionId" column="union_id"/>
<association property="dept" column="dept_id" javaType="cn.fateverse.admin.entity.Dept" resultMap="deptResult"/>
<association property="dept" column="dept_id" javaType="cn.fateverse.common.core.entity.Dept" resultMap="deptResult"/>
<collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
</resultMap>
<resultMap id="deptResult" type="cn.fateverse.admin.entity.Dept">
<resultMap id="deptResult" type="cn.fateverse.common.core.entity.Dept">
<id property="deptId" column="dept_id"/>
<result property="parentId" column="parent_id"/>
<result property="deptName" column="dept_name"/>
@@ -41,7 +41,7 @@
<result property="state" column="dept_state"/>
</resultMap>
<resultMap id="RoleResult" type="cn.fateverse.admin.entity.Role">
<resultMap id="RoleResult" type="cn.fateverse.common.core.entity.Role">
<id property="roleId" column="role_id"/>
<result property="roleName" column="role_name"/>
<result property="roleKey" column="role_key"/>
@@ -218,17 +218,17 @@
</where>
</select>
<select id="selectUserInfoByUserName" resultType="cn.fateverse.admin.entity.User">
<select id="selectUserInfoByUserName" resultType="cn.fateverse.common.core.entity.User">
<include refid="selectUser"/>
where user_name = #{userName}
</select>
<select id="selectByPhoneNum" resultType="cn.fateverse.admin.entity.User">
<select id="selectByPhoneNum" resultType="cn.fateverse.common.core.entity.User">
<include refid="selectUser"/>
where phone_number = #{phoneNumber}
</select>
<select id="selectByEmail" resultType="cn.fateverse.admin.entity.User">
<select id="selectByEmail" resultType="cn.fateverse.common.core.entity.User">
<include refid="selectUser"/>
where email = #{email} limit 0,1
</select>
@@ -260,7 +260,7 @@
</select>
<insert id="insert" parameterType="cn.fateverse.admin.entity.UserBase" useGeneratedKeys="true" keyProperty="userId"
<insert id="insert" parameterType="cn.fateverse.common.core.entity.UserBase" useGeneratedKeys="true" keyProperty="userId"
keyColumn="user_id">
insert into sys_user
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@@ -50,6 +50,11 @@
<groupId>cn.fateverse</groupId>
<artifactId>common-file</artifactId>
</dependency>
<dependency>
<groupId>cn.fateverse</groupId>
<artifactId>admin-api</artifactId>
</dependency>
</dependencies>

View File

@@ -1,7 +1,7 @@
package cn.fateverse.auth.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@@ -16,26 +16,26 @@ public class LoginBody {
/**
* 用户名
*/
@ApiModelProperty("用户名")
@Schema(description = "用户名")
@NotBlank(message = "用户名不能为空")
private String username;
/**
* 用户密码
*/
@ApiModelProperty("用户密码")
@Schema(description = "用户密码")
@NotBlank(message = "密码不能为空")
private String password;
/**
* 验证码uuid
*/
@ApiModelProperty("验证码uuid")
@Schema(description = "验证码uuid")
@NotBlank(message = "验证码uuid")
private String uuid;
/**
* 验证码
*/
@ApiModelProperty("验证码")
@Schema(description = "验证码")
@NotBlank(message = "验证码不能为空")
private String code;

View File

@@ -1,6 +1,6 @@
package cn.fateverse.auth.entity;
import cn.fateverse.admin.entity.User;
import cn.fateverse.common.core.entity.User;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

View File

@@ -1,11 +1,11 @@
package cn.fateverse.auth.service;
import cn.fateverse.admin.dubbo.DubboUserService;
import cn.fateverse.common.core.entity.User;
import cn.fateverse.common.core.enums.UserState;
import cn.fateverse.common.core.exception.CustomException;
import cn.fateverse.common.core.utils.ObjectUtils;
import cn.fateverse.common.security.entity.LoginUser;
import cn.fateverse.admin.entity.User;
import cn.fateverse.common.core.entity.LoginUser;
import cn.fateverse.common.security.dubbo.DubboUserSearchService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.security.core.userdetails.UserDetails;
@@ -22,7 +22,7 @@ import org.springframework.stereotype.Component;
public class UserDetailsServiceImpl implements UserDetailsService {
@DubboReference
private DubboUserService userService;
private DubboUserSearchService userService;
@Override

View File

@@ -1,21 +1,21 @@
package cn.fateverse.auth.service.impl;
import cn.fateverse.auth.entity.UserInfo;
import cn.fateverse.common.core.entity.Role;
import cn.fateverse.common.core.entity.User;
import cn.hutool.core.date.DateUtil;
import cn.fateverse.admin.dubbo.DubboMenuService;
import cn.fateverse.admin.dubbo.DubboUserService;
import cn.fateverse.admin.vo.RouterVo;
import cn.fateverse.auth.entity.LoginBody;
import cn.fateverse.auth.service.LoginService;
import cn.fateverse.admin.entity.Role;
import cn.fateverse.admin.entity.User;
import cn.fateverse.common.core.constant.CacheConstants;
import cn.fateverse.common.core.constant.DateConstants;
import cn.fateverse.common.core.exception.CustomException;
import cn.fateverse.common.core.exception.UserPasswordNotMatchException;
import cn.fateverse.common.core.utils.SpringContextHolder;
import cn.fateverse.common.core.utils.uuid.IdUtils;
import cn.fateverse.common.security.entity.LoginUser;
import cn.fateverse.common.core.entity.LoginUser;
import cn.fateverse.common.security.service.TokenService;
import cn.fateverse.common.security.utils.SecurityUtils;
import cn.fateverse.auth.event.LoginInfoEvent;

View File

@@ -1,8 +1,8 @@
package cn.fateverse.auth.service.impl;
import cn.fateverse.admin.dubbo.DubboMenuService;
import cn.fateverse.admin.entity.User;
import cn.fateverse.common.security.entity.LoginUser;
import cn.fateverse.common.core.entity.LoginUser;
import cn.fateverse.common.core.entity.User;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;

View File

@@ -1,7 +1,7 @@
package cn.fateverse.code.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@@ -15,41 +15,41 @@ public class ApiClass {
/**
* 类id
*/
@ApiModelProperty("类id")
@Schema(description = "类id")
private String classId;
/**
* 模块id
*/
@ApiModelProperty("模块id")
@Schema(description = "模块id")
private String moduleId;
/**
* 类名
*/
@ApiModelProperty("类名")
@Schema(description = "类名")
private String className;
/**
* 类描述
*/
@ApiModelProperty("类描述")
@Schema(description = "类描述")
private String classDescribe;
/**
* 包名
*/
@ApiModelProperty("包名")
@Schema(description = "包名")
private String packageName;
/**
* 作者
*/
@ApiModelProperty("作者")
@Schema(description = "作者")
private String author;
/**
* 电子邮件
*/
@ApiModelProperty("电子邮件")
@Schema(description = "电子邮件")
private String email;
/**
* 前缀
*/
@ApiModelProperty("前缀")
@Schema(description = "前缀")
private String prefix;
}

View File

@@ -1,7 +1,7 @@
package cn.fateverse.code.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@@ -15,52 +15,52 @@ public class InterTable {
/**
* id
*/
@ApiModelProperty("id")
@Schema(description = "id")
private String interId;
/**
* 模块id
*/
@ApiModelProperty("模块id")
@Schema(description = "模块id")
private String moduleId;
/**
* 类id
*/
@ApiModelProperty("类id")
@Schema(description = "类id")
private String classId;
/**
* 接口名称
*/
@ApiModelProperty("接口名称")
@Schema(description = "接口名称")
private String itName;
/**
* 描述
*/
@ApiModelProperty("描述")
@Schema(description = "描述")
private String itDescribe;
/**
* 是否设置许可
*/
@ApiModelProperty("是否设置许可")
@Schema(description = "是否设置许可")
private String isPermission;
/**
* 请求路径
*/
@ApiModelProperty("请求路径")
@Schema(description = "请求路径")
private String reqUrl;
/**
* 请求方式
*/
@ApiModelProperty("请求方式")
@Schema(description = "请求方式")
private String method;
/**
* 是否生成
*/
@ApiModelProperty("是否生成")
@Schema(description = "是否生成")
private String isGenerate;
/**
* 类型(1,工作台,2流程)
*/
@ApiModelProperty("类型(1,工作台,2流程)")
@Schema(description = "类型(1,工作台,2流程)")
private String type;

View File

@@ -2,7 +2,7 @@ package cn.fateverse.code.entity;
import cn.fateverse.common.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@@ -17,16 +17,16 @@ public class Module extends BaseEntity {
/**
* 模块id
*/
@ApiModelProperty("模块id")
@Schema(description = "模块id")
private Long modeId;
/**
* 模块名称
*/
@ApiModelProperty("模块名称")
@Schema(description = "模块名称")
private String modeName;
/**
* 模块描述
*/
@ApiModelProperty("模块描述")
@Schema(description = "模块描述")
private String modeDescribe;
}

View File

@@ -2,7 +2,7 @@ package cn.fateverse.code.entity;
import cn.fateverse.common.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@@ -16,66 +16,66 @@ public class RelTable extends BaseEntity {
/**
* 关联表id
*/
@ApiModelProperty("关联表id")
@Schema(description = "关联表id")
private Long relTableId;
/**
* 主表id
*/
@ApiModelProperty("主表id")
@Schema(description = "主表id")
private Long tableId;
/**
* 关联子表表名
*/
@ApiModelProperty("关联子表表名")
@Schema(description = "关联子表表名")
private String relName;
/**
* 子表简称
*/
@ApiModelProperty("子表简称")
@Schema(description = "子表简称")
private String relAs;
/**
* 父表名称
*/
@ApiModelProperty("父表名称")
@Schema(description = "父表名称")
private String tableName;
/**
* 父表名简称
*/
@ApiModelProperty("父表名简称")
@Schema(description = "父表名简称")
private String tableAs;
/**
* 表描述
*/
@ApiModelProperty("表描述")
@Schema(description = "表描述")
private String relComment;
/**
* 关联子表的字段
*/
@ApiModelProperty("关联子表的字段")
@Schema(description = "关联子表的字段")
private String relColumn;
/**
* 关联父表字段
*/
@ApiModelProperty("关联父表字段")
@Schema(description = "关联父表字段")
private String tableColumn;
/**
* 实体类名称(子表)
*/
@ApiModelProperty("实体类名称(子表)")
@Schema(description = "实体类名称(子表)")
private String relClass;
/**
* 实体类名称(子表)小写
*/
@ApiModelProperty("实体类名称(子表)小写")
@Schema(description = "实体类名称(子表)小写")
private String relClassLower;
/**
* 关联类型
*/
@ApiModelProperty("关联类型")
@Schema(description = "关联类型")
private String queryType;
/**
* 排序
*/
@ApiModelProperty("排序")
@Schema(description = "排序")
private String sort;
}

View File

@@ -2,7 +2,7 @@ package cn.fateverse.code.entity;
import cn.fateverse.common.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@@ -16,67 +16,67 @@ public class RelTableColumn extends BaseEntity {
/**
* 子表字段id
*/
@ApiModelProperty("子表字段id")
@Schema(description = "子表字段id")
private Long relColumnId;
/**
* 归属表编号
*/
@ApiModelProperty("归属表编号")
@Schema(description = "归属表编号")
private Long relTableId;
/**
* 列名称
*/
@ApiModelProperty("列名称")
@Schema(description = "列名称")
private String columnName;
/**
* 列描述
*/
@ApiModelProperty("列描述")
@Schema(description = "列描述")
private String columnComment;
/**
* 列类型
*/
@ApiModelProperty("列类型")
@Schema(description = "列类型")
private String columnType;
/**
* JAVA类型
*/
@ApiModelProperty("JAVA类型")
@Schema(description = "JAVA类型")
private String javaType;
/**
* JAVA字段名
*/
@ApiModelProperty("JAVA字段名")
@Schema(description = "JAVA字段名")
private String javaField;
/**
* 是否列表字段1是
*/
@ApiModelProperty("是否列表字段1是")
@Schema(description = "是否列表字段1是")
private String isList;
/**
* 是否查询字段1是
*/
@ApiModelProperty("是否查询字段1是")
@Schema(description = "是否查询字段1是")
private String isQuery;
/**
* 查询方式(等于、不等于、大于、小于、范围)
*/
@ApiModelProperty("查询方式(等于、不等于、大于、小于、范围)")
@Schema(description = "查询方式(等于、不等于、大于、小于、范围)")
private String queryType;
/**
* 显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)
*/
@ApiModelProperty("显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)")
@Schema(description = "显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)")
private String htmlType;
/**
* 字典类型
*/
@ApiModelProperty("字典类型")
@Schema(description = "字典类型")
private String dictType;
/**
* 排序
*/
@ApiModelProperty("排序")
@Schema(description = "排序")
private String sort;
}

View File

@@ -6,7 +6,7 @@ import cn.fateverse.code.enums.DynamicSourceEnum;
import cn.fateverse.code.enums.FrontTemplateEnum;
import cn.fateverse.common.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -26,101 +26,101 @@ public class Table extends BaseEntity {
/**
* 编号
*/
@ApiModelProperty("编号")
@Schema(description = "编号")
private Long tableId;
private Long parentMenuId;
/**
* 数据源id
*/
@ApiModelProperty("数据源id")
@Schema(description = "数据源id")
private Long dataSourceId;
@ApiModelProperty("数据源类型")
@Schema(description = "数据源类型")
private DynamicSourceEnum dataSourceType;
/**
* 表名称
*/
@ApiModelProperty("表名称")
@Schema(description = "表名称")
private String tableName;
/**
* 表描述
*/
@ApiModelProperty("表描述")
@Schema(description = "表描述")
private String tableComment;
/**
* 关联子表的表名
*/
@ApiModelProperty("关联子表的表名")
@Schema(description = "关联子表的表名")
private String subTableName;
/**
* 子表关联的外键名
*/
@ApiModelProperty("子表关联的外键名")
@Schema(description = "子表关联的外键名")
private String subTableFkName;
/**
* 实体类名称
*/
@ApiModelProperty("实体类名称")
@Schema(description = "实体类名称")
private String className;
/**
* 使用的模板crud单表操作 tree树表操作
*/
@ApiModelProperty("使用的模板")
@Schema(description = "使用的模板")
private String tplCategory;
/**
* 生成包路径
*/
@ApiModelProperty("生成包路径")
@Schema(description = "生成包路径")
private String packageName;
/**
* 生成模块名
*/
@ApiModelProperty("生成模块名")
@Schema(description = "生成模块名")
private String moduleName;
/**
* 生成服务名
*/
@ApiModelProperty("生成服务名")
@Schema(description = "生成服务名")
private String serviceName;
/**
* 生成业务名
*/
@ApiModelProperty("生成业务名")
@Schema(description = "生成业务名")
private String businessName;
/**
* 生成功能名
*/
@ApiModelProperty("生成功能名")
@Schema(description = "生成功能名")
private String functionName;
/**
* 生成功能作者
*/
@ApiModelProperty("生成功能作者")
@Schema(description = "生成功能作者")
private String functionAuthor;
@ApiModelProperty("后端模板 0: mybatis 1: mybatispuls ")
@Schema(description = "后端模板 0: mybatis 1: mybatispuls ")
private BackTemplateEnum backTemplate;
@ApiModelProperty("前端模板 0: vue 1: react")
@Schema(description = "前端模板 0: vue 1: react")
private FrontTemplateEnum frontTemplate;
/**
* 其它生成选项
*/
@ApiModelProperty("其它生成选项")
@Schema(description = "其它生成选项")
private String options;

View File

@@ -5,7 +5,7 @@ import cn.fateverse.common.core.annotaion.EnableAutoField;
import cn.fateverse.common.core.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.ObjectUtils;
@@ -22,108 +22,108 @@ public class TableColumn extends BaseEntity {
/**
* 编号
*/
@ApiModelProperty("编号")
@Schema(description = "编号")
private Long columnId;
/**
* 归属表编号
*/
@ApiModelProperty("归属表编号")
@Schema(description = "归属表编号")
private Long tableId;
/**
* 列名称
*/
@ApiModelProperty("列名称")
@Schema(description = "列名称")
private String columnName;
/**
* 列描述
*/
@ApiModelProperty("列描述")
@Schema(description = "列描述")
private String columnComment;
/**
* 列类型
*/
@ApiModelProperty("列类型")
@Schema(description = "列类型")
private String columnType;
@ApiModelProperty("列长度")
@Schema(description = "列长度")
private Integer columnLength;
@ApiModelProperty("列精度")
@Schema(description = "列精度")
private Integer columnScale;
/**
* JAVA类型
*/
@ApiModelProperty("JAVA类型")
@Schema(description = "JAVA类型")
private String javaType;
/**
* JAVA字段名
*/
@ApiModelProperty("JAVA字段名")
@Schema(description = "JAVA字段名")
private String javaField;
/**
* 是否主键1是
*/
@ApiModelProperty("是否主键1是")
@Schema(description = "是否主键1是")
private String isPk;
/**
* 是否自增1是
*/
@ApiModelProperty("是否自增1是")
@Schema(description = "是否自增1是")
private String isIncrement;
/**
* 是否必填1是
*/
@ApiModelProperty("是否必填1是")
@Schema(description = "是否必填1是")
private String isRequired;
/**
* 是否为插入字段1是
*/
@ApiModelProperty("是否为插入字段1是")
@Schema(description = "是否为插入字段1是")
private String isInsert;
/**
* 是否编辑字段1是
*/
@ApiModelProperty("是否编辑字段1是")
@Schema(description = "是否编辑字段1是")
private String isEdit;
/**
* 是否列表字段1是
*/
@ApiModelProperty("是否列表字段1是")
@Schema(description = "是否列表字段1是")
private String isList;
/**
* 是否查询字段1是
*/
@ApiModelProperty("是否查询字段1是")
@Schema(description = "是否查询字段1是")
private String isQuery;
/**
* 是否正则(1 否)
*/
@ApiModelProperty("是否正则(1 否)")
@Schema(description = "是否正则(1 否)")
private Long isRegular;
/**
* 正则表达式内容
*/
@ApiModelProperty("正则表达式内容")
@Schema(description = "正则表达式内容")
private String regular;
/**
* 查询方式(等于、不等于、大于、小于、范围)
*/
@ApiModelProperty("查询方式(等于、不等于、大于、小于、范围)")
@Schema(description = "查询方式(等于、不等于、大于、小于、范围)")
private String queryType;
/**
* 显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)
*/
@ApiModelProperty("显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)")
@Schema(description = "显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)")
private String htmlType;
/**
* 字典类型
*/
@ApiModelProperty("字典类型")
@Schema(description = "字典类型")
private String dictType;
/**
* 排序
*/
@ApiModelProperty("排序")
@Schema(description = "排序")
private String sort;
/**

View File

@@ -3,7 +3,7 @@ package cn.fateverse.code.entity.dto;
import cn.fateverse.code.entity.CodeDataSource;
import cn.fateverse.code.enums.DynamicSourceEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -29,64 +29,64 @@ public class DataSourceDto {
/**
* 数据源id
*/
@ApiModelProperty("数据源id")
@Schema(description = "数据源id")
private Long dsId;
/**
* 数据源名称
*/
@ApiModelProperty("数据源名称")
@Schema(description = "数据源名称")
@NotBlank(message = "数据源名称不能为空")
private String dsName;
/**
* 数据源用户名
*/
@ApiModelProperty("数据源用户名")
@Schema(description = "数据源用户名")
@NotBlank(message = "数据源用户名")
private String username;
/**
* 数据源密码
*/
@ApiModelProperty("数据源密码")
@Schema(description = "数据源密码")
private String password;
/**
* 数据源主机
*/
@ApiModelProperty("数据源主机")
@Schema(description = "数据源主机")
private String host;
/**
* 数据源主机端口
*/
@ApiModelProperty("数据源主机端口")
@Schema(description = "数据源主机端口")
private Integer port;
/**
* 数据源类型
*/
@ApiModelProperty("数据源类型")
@Schema(description = "数据源类型")
@NotNull(message = "数据源类型不能为空")
private DynamicSourceEnum type;
/**
* 数据库名称
*/
@ApiModelProperty("数据库名称")
@Schema(description = "数据库名称")
private String dbName;
/**
* 数据库连接地址
*/
@ApiModelProperty("数据库连接地址")
@Schema(description = "数据库连接地址")
private String jdbcUrl;
/**
* 数据源类型 (1:主机 2:jdbc连接url)
*/
@ApiModelProperty("数据源类型 (1:主机 2:jdbc连接url)")
@Schema(description = "数据源类型 (1:主机 2:jdbc连接url)")
@Max(value = 2, message = "参数不合法")
@Min(value = 1, message = "参数不合法")
private Integer confType;

View File

@@ -2,7 +2,7 @@ package cn.fateverse.code.entity.dto;
import cn.fateverse.code.entity.Regular;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@@ -21,34 +21,34 @@ public class RegularDto {
/**
* id
*/
@ApiModelProperty("id")
@Schema(description = "id")
private Long id;
/**
* 正则名称
*/
@ApiModelProperty("正则名称")
@Schema(description = "正则名称")
@NotBlank(message = "正则名称不能为空!")
private String name;
/**
* 正则内容
*/
@ApiModelProperty("正则内容")
@Schema(description = "正则内容")
@NotBlank(message = "正则内容不能为空!")
private String regular;
/**
* 验证内容
*/
@ApiModelProperty("验证内容")
@Schema(description = "验证内容")
@NotBlank(message = "验证内容不能为空!")
private String validation;
/**
* 是否启用 1:启动 2:关闭
*/
@ApiModelProperty("是否启用 1:启动 0:关闭")
@Schema(description = "是否启用 1:启动 0:关闭")
@NotNull(message = "是否启用不能为空!")
private String enable;

View File

@@ -1,6 +1,6 @@
package cn.fateverse.code.entity.query;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -13,7 +13,7 @@ public class DataSourceQuery {
/**
* 数据源名称
*/
@ApiModelProperty("数据源名称")
@Schema(description = "数据源名称")
private String dsName;
}

View File

@@ -1,7 +1,7 @@
package cn.fateverse.code.entity.query;
import cn.fateverse.common.core.entity.QueryTime;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -23,13 +23,13 @@ public class DynamicTable extends QueryTime {
/**
* 表名称
*/
@ApiModelProperty("表名称")
@Schema(description = "表名称")
private String tableName;
/**
* 表注释
*/
@ApiModelProperty("表注释")
@Schema(description = "表注释")
private String tableComment;
private Date createTime;

View File

@@ -1,7 +1,7 @@
package cn.fateverse.code.entity.query;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -21,18 +21,18 @@ public class RegularQuery {
/**
* 正则名称
*/
@ApiModelProperty("正则名称")
@Schema(description = "正则名称")
private String name;
/**
* 正则内容
*/
@ApiModelProperty("正则内容")
@Schema(description = "正则内容")
private String regular;
/**
* 是否启用 1:启动 2:关闭
*/
@ApiModelProperty("是否启用 1:启动 0:关闭")
@Schema(description = "是否启用 1:启动 0:关闭")
private Integer enable;
}

View File

@@ -2,7 +2,7 @@ package cn.fateverse.code.entity.query;
import cn.fateverse.common.core.entity.QueryTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -22,21 +22,21 @@ public class TableQuery extends QueryTime {
/**
* 数据源id
*/
@ApiModelProperty("数据源id")
@Schema(description = "数据源id")
private Long dataSourceId;
/**
* 表名称
*/
@ApiModelProperty("表名称")
@Schema(description = "表名称")
private String tableName;
/**
* 表描述
*/
@ApiModelProperty("表描述")
@Schema(description = "表描述")
private String tableComment;
@ApiModelProperty("数据类型")
@Schema(description = "数据类型")
private String dataSourceType;
}

View File

@@ -3,7 +3,7 @@ package cn.fateverse.code.entity.vo;
import cn.fateverse.code.entity.CodeDataSource;
import cn.fateverse.common.core.annotaion.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -28,68 +28,68 @@ public class DataSourceVo implements Serializable {
/**
* 数据源id
*/
@ApiModelProperty("数据源id")
@Schema(description = "数据源id")
private Long dsId;
/**
* 数据源名称
*/
@ApiModelProperty("数据源名称")
@Schema(description = "数据源名称")
@Excel("数据源名称")
private String dsName;
/**
* 数据源用户名
*/
@ApiModelProperty("数据源用户名")
@Schema(description = "数据源用户名")
@Excel("数据源用户名")
private String username;
/**
* 数据源密码
*/
@ApiModelProperty("数据源密码")
@Schema(description = "数据源密码")
@Excel("数据源密码")
private String password;
/**
* 数据源主机
*/
@ApiModelProperty("数据源主机")
@Schema(description = "数据源主机")
@Excel("数据源主机")
private String host;
/**
* 数据源主机端口
*/
@ApiModelProperty("数据源主机端口")
@Schema(description = "数据源主机端口")
@Excel("数据源主机端口")
private Integer port;
/**
* 数据源类型
*/
@ApiModelProperty("数据源类型")
@Schema(description = "数据源类型")
@Excel("数据源类型")
private String dsType;
/**
* 数据库名称
*/
@ApiModelProperty("数据库名称")
@Schema(description = "数据库名称")
@Excel("数据库名称")
private String dbName;
/**
* 数据库连接地址
*/
@ApiModelProperty("数据库连接地址")
@Schema(description = "数据库连接地址")
@Excel("数据库连接地址")
private String jdbcUrl;
/**
* 数据源类型 (1:主机 2:jdbc连接url)
*/
@ApiModelProperty("数据源类型 (1:主机 2:jdbc连接url)")
@Schema(description = "数据源类型 (1:主机 2:jdbc连接url)")
@Max(value = 2, message = "参数不合法")
@Min(value = 1, message = "参数不合法")
@Excel("数据源类型")

View File

@@ -3,7 +3,7 @@ package cn.fateverse.code.entity.vo;
import cn.fateverse.code.entity.Regular;
import cn.fateverse.common.core.annotaion.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -27,33 +27,33 @@ public class RegularVo {
/**
* id
*/
@ApiModelProperty("id")
@Schema(description = "id")
private Long id;
/**
* 正则名称
*/
@ApiModelProperty("正则名称")
@Schema(description = "正则名称")
@Excel("正则名称")
private String name;
/**
* 正则内容
*/
@ApiModelProperty("正则内容")
@Schema(description = "正则内容")
@Excel("正则内容")
private String regular;
/**
* 验证内容
*/
@ApiModelProperty("验证内容")
@Schema(description = "验证内容")
private String validation;
/**
* 是否启用 1:启动 2:关闭
*/
@ApiModelProperty("是否启用 1:启动 2:关闭")
@Schema(description = "是否启用 1:启动 2:关闭")
@Excel(value = "是否启用",dictType = "regular_enable")
private String enable;

View File

@@ -2,7 +2,7 @@ package cn.fateverse.code.entity.vo;
import cn.fateverse.common.core.annotaion.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -24,34 +24,34 @@ public class TableVo {
/**
* 编号
*/
@ApiModelProperty("编号")
@Schema(description = "编号")
@Excel("编号")
private Long tableId;
/**
* 数据源id
*/
@ApiModelProperty("数据源id")
@Schema(description = "数据源id")
@Excel("数据源id")
private Long dataSourceId;
/**
* 表名称
*/
@ApiModelProperty("表名称")
@Schema(description = "表名称")
@Excel("表名称")
private String tableName;
/**
* 表描述
*/
@ApiModelProperty("表描述")
@Schema(description = "表描述")
@Excel("表描述")
private String tableComment;
/**
* 实体类名称
*/
@ApiModelProperty("实体类名称")
@Schema(description = "实体类名称")
@Excel("实体类名称")
private String className;

View File

@@ -2,7 +2,7 @@ package ${packageName}.entity.dto;
import ${packageName}.entity.${ClassName};
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
#if($table.isRequired())
import javax.validation.constraints.NotNull;
@@ -28,7 +28,7 @@ public class ${ClassName}Dto {
/**
* ${pkColumn.columnComment}
*/
@ApiModelProperty("${pkColumn.columnComment}")
@Schema(description = "${pkColumn.columnComment}")
private $pkColumn.javaType $pkColumn.javaField;
#foreach ($column in $columns)
#if($column.from())
@@ -42,7 +42,7 @@ public class ${ClassName}Dto {
#if($column.isRegular())
@Pattern(regexp = "${column.regular}",message = "${column.columnComment}格式错误!")
#end
@ApiModelProperty("${column.columnComment}")
@Schema(description = "${column.columnComment}")
private $column.javaType $column.javaField;
#end
#end

View File

@@ -1,7 +1,7 @@
package ${packageName}.entity.query;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -29,7 +29,7 @@ public class ${ClassName}Query {
/**
* $column.columnComment
*/
@ApiModelProperty("${column.columnComment}")
@Schema(description = "${column.columnComment}")
#if($column.javaType.equals("Date"))
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
#end
@@ -39,7 +39,7 @@ public class ${ClassName}Query {
/**
* $column.columnComment 开始
*/
@ApiModelProperty("${column.columnComment}开始")
@Schema(description = "${column.columnComment}开始")
#if($column.javaType.equals("Date"))
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
#end
@@ -48,7 +48,7 @@ public class ${ClassName}Query {
/**
* $column.columnComment 结束
*/
@ApiModelProperty("${column.columnComment}结束")
@Schema(description = "${column.columnComment}结束")
#if($column.javaType.equals("Date"))
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
#end

View File

@@ -3,7 +3,7 @@ package ${packageName}.entity.vo;
import ${packageName}.entity.${ClassName};
import cn.fateverse.common.core.annotaion.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -29,7 +29,7 @@ public class ${ClassName}Vo {
/**
* ${pkColumn.columnComment}
*/
@ApiModelProperty("${pkColumn.columnComment}")
@Schema(description = "${pkColumn.columnComment}")
private $pkColumn.javaType $pkColumn.javaField;
#foreach ($column in $columns)
#if($column.list())
@@ -37,7 +37,7 @@ public class ${ClassName}Vo {
/**
* $column.columnComment
*/
@ApiModelProperty("${column.columnComment}")
@Schema(description = "${column.columnComment}")
@Excel("${column.columnComment}")
private $column.javaType $column.javaField;
#end

View File

@@ -10,7 +10,7 @@ import ${packageName}.service.${ClassName}Service;
import cn.fateverse.common.core.entity.Option;
#end
import cn.fateverse.common.core.result.page.TableDataInfo;
import cn.fateverse.common.mybatisplus.utils.PageUtils;
import cn.fateverse.common.mybatisplus.utils.PageConditionUtil;
import cn.fateverse.common.security.utils.SecurityUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

View File

@@ -44,7 +44,9 @@ public class ConsoleCapture {
public interface Task {
Object execute() throws Exception;
}

View File

@@ -100,7 +100,8 @@ public class JavaCodeEngine {
// 设置安全检查器
System.setSecurityManager(securityManager);
// 执行方法并返回结果
return ConsoleCapture.capture(() -> method.invoke(null, args));
return new EngineResult(method.invoke(null, args), null);
// return ConsoleCapture.capture(() -> method.invoke(null, args));
} catch (CustomException e) {
EngineResult result = new EngineResult();
result.setSuccess(Boolean.FALSE);
@@ -279,7 +280,7 @@ public class JavaCodeEngine {
}
public void remove(){
public void remove() {
clazz = null;
classLoader = null;
}

View File

@@ -4,7 +4,6 @@ import cn.fateverse.common.code.console.ConsoleCapture;
import cn.fateverse.common.code.lock.SegmentLock;
import cn.fateverse.common.code.model.EngineResult;
import cn.fateverse.common.core.exception.CustomException;
import com.alibaba.fastjson2.JSON;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;

View File

@@ -66,6 +66,10 @@
<version>${guava.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,67 @@
package cn.fateverse.common.core.bo;
import cn.hutool.core.util.ObjectUtil;
import lombok.Data;
import java.util.Optional;
@Data
public abstract class BaseQueryBO {
/**
* 创建时间
*/
private DateIntervalBO createTimeInterval;
/**
* 更新时间
*/
private DateIntervalBO updateTimeInterval;
/**
* 创建用户名称
*/
private String createUserName;
/**
* 更新用户名称
*/
private String updateUserName;
/**
* 获取创建时间间隔
*
* @return 基准日期间隔
*/
public DateIntervalBO getCreateTimeInterval() {
return Optional.ofNullable(createTimeInterval).orElse(new DateIntervalBO());
}
/**
* 获取更新时间间隔
*
* @return 基准日期间隔
*/
public DateIntervalBO getUpdateTimeInterval() {
return Optional.ofNullable(updateTimeInterval).orElse(new DateIntervalBO());
}
/**
* 创建时间 区间非空校验
*
* @return boolean true = 起止非空
*/
public boolean createTimeBetweenIsNotEmpty() {
return Optional.ofNullable(createTimeInterval).map(item -> ObjectUtil.isAllNotEmpty(item.getStartTime(), item.getEndTime())).orElse(false);
}
/**
* 更新时间 区间非空校验
*
* @return boolean true = 起止非空
*/
public boolean updateTimeBetweenIsNotEmpty() {
return Optional.ofNullable(updateTimeInterval).map(item -> ObjectUtil.isAllNotEmpty(item.getStartTime(), item.getEndTime())).orElse(false);
}
}

View File

@@ -0,0 +1,30 @@
package cn.fateverse.common.core.bo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
/**
* 基准日期间隔
*
* @author ZhangQiang
* @date 2024/09/26
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DateIntervalBO {
/**
* 开始时间
*/
private LocalDateTime startTime;
/**
* 结束时间
*/
private LocalDateTime endTime;
}

View File

@@ -0,0 +1,6 @@
package cn.fateverse.common.core.constant;
public interface BaseConstant {
Long ZERO = 0L;
}

View File

@@ -5,24 +5,24 @@ package cn.fateverse.common.core.constant;
* @author Clay
* @date 2022/11/9
*/
public class CacheConstants {
public interface CacheConstants {
/**
* 验证码 redis key
*/
public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
String CAPTCHA_CODE_KEY = "captcha_codes:";
/**
* 路由缓存地址
*/
public static final String ROUTE_CACHE_KEY = "router:key:";
String ROUTE_CACHE_KEY = "router:key:";
/**
* 登录用户 redis key
*/
public static final String LOGIN_TOKEN_KEY = "login_info:";
String LOGIN_TOKEN_KEY = "login_info:";
/**
* 字典类型 redis key
*/
public static final String DICT_KEY = "dict:";
String DICT_KEY = "dict:";

View File

@@ -5,34 +5,34 @@ package cn.fateverse.common.core.constant;
*
* @author Clay
*/
public class Constants {
public interface Constants {
/**
* 令牌前缀
*/
public static final String TOKEN_PREFIX = "Bearer ";
String TOKEN_PREFIX = "Bearer ";
/**
* http请求
*/
public static final String HTTP = "http://";
String HTTP = "http://";
/**
* https请求
*/
public static final String HTTPS = "https://";
String HTTPS = "https://";
/**
* 令牌前缀
*/
public static final String LOGIN_USER_KEY = "login_user_key";
String LOGIN_USER_KEY = "login_user_key";
/**
* 验证码有效期(分钟)
*/
public static final long CAPTCHA_EXPIRATION = 2;
long CAPTCHA_EXPIRATION = 2;
public static final String UTF8 = "UTF-8";
String UTF8 = "UTF-8";
}

View File

@@ -4,17 +4,17 @@ package cn.fateverse.common.core.constant;
* @author Clay
* @date 2023-05-25
*/
public class DateConstants {
public interface DateConstants {
public static String YYYY = "yyyy";
String YYYY = "yyyy";
public static String YYYY_MM = "yyyy-MM";
String YYYY_MM = "yyyy-MM";
public static String YYYY_MM_DD = "yyyy-MM-dd";
String YYYY_MM_DD = "yyyy-MM-dd";
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
}

View File

@@ -5,44 +5,44 @@ package cn.fateverse.common.core.constant;
*
* @author Clay
*/
public class UserConstants {
public interface UserConstants {
/**
* 平台内系统用户的唯一标志
*/
public static final String SYS_USER = "SYS_USER";
String SYS_USER = "SYS_USER";
/**
* 匿名用户
*/
public static final String ANONYMOUS_USER = "anonymousUser";
String ANONYMOUS_USER = "anonymousUser";
/**
* 正常状态
*/
public static final String NORMAL = "0";
String NORMAL = "0";
/**
* 异常状态
*/
public static final String EXCEPTION = "1";
String EXCEPTION = "1";
/**
* 部门停用状态
*/
public static final String DEPT_DISABLE = "1";
String DEPT_DISABLE = "1";
/**
* Layout组件标识
*/
public final static String LAYOUT = "Layout";
String LAYOUT = "Layout";
/**
* 校验返回结果码
*/
public final static String UNIQUE = "0";
String UNIQUE = "0";
public final static String NOT_UNIQUE = "1";
String NOT_UNIQUE = "1";
}

View File

@@ -0,0 +1,60 @@
package cn.fateverse.common.core.convert;
import cn.hutool.core.collection.CollUtil;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* 基本转换定义
*
* @author Clay
* @date 2024/09/29
*/
public interface BaseConvertDefine<DTO, Entity, VO> {
/**
* 实体到视图对象
*
* @param entity 实体
* @return {@link VO}
*/
VO entityToVo(Entity entity);
/**
* 业务对象到实体
*
* @param DTO 业务对象
* @return {@link Entity}
*/
Entity dtoToEntity(DTO DTO);
/**
* 从实体到视图对象
*
* @param list 列表
* @return {@link List}<{@link VO}>
*/
default List<VO> entityToVOList(List<Entity> list) {
if (CollUtil.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(this::entityToVo).collect(Collectors.toList());
}
/**
* 业务对象到实体列表
*
* @param list 列表
* @return {@link List}<{@link Entity}>
*/
default List<Entity> dtoToEntityList(List<DTO> list) {
if (CollUtil.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(this::dtoToEntity).collect(Collectors.toList());
}
}

View File

@@ -4,15 +4,17 @@ import cn.fateverse.common.core.annotaion.AutoTime;
import cn.fateverse.common.core.annotaion.AutoUser;
import cn.fateverse.common.core.enums.MethodEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.time.LocalDateTime;
/**
* @author Clay
* @date 2022/10/30
*/
public class BaseEntity implements Serializable {
@Data
public abstract class BaseEntity implements Serializable {
/**
* 创建者
@@ -25,7 +27,7 @@ public class BaseEntity implements Serializable {
*/
@AutoTime(method = MethodEnum.INSERT)
@JsonFormat(locale = "zh",timezone = "GMT+8",pattern = "yyyy-MM-dd")
private Date createTime;
private LocalDateTime createTime;
/**
* 更新者
@@ -38,7 +40,7 @@ public class BaseEntity implements Serializable {
*/
@AutoTime(method = MethodEnum.UPDATE)
@JsonFormat(locale = "zh",timezone = "GMT+8",pattern = "yyyy-MM-dd")
private Date updateTime;
private LocalDateTime updateTime;
/**
@@ -46,44 +48,4 @@ public class BaseEntity implements Serializable {
*/
private String remark;
public Object getCreateBy() {
return createBy;
}
public void setCreateBy(Object createBy) {
this.createBy = createBy;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Object getUpdateBy() {
return updateBy;
}
public void setUpdateBy(Object updateBy) {
this.updateBy = updateBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

View File

@@ -1,8 +1,8 @@
package cn.fateverse.admin.entity;
package cn.fateverse.common.core.entity;
import cn.fateverse.common.core.annotaion.EnableAutoField;
import cn.fateverse.common.core.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
@@ -16,6 +16,7 @@ import javax.validation.constraints.Pattern;
* @date 2022/10/30
*/
@Data
@EqualsAndHashCode(callSuper = true)
@EnableAutoField
public class Dept extends BaseEntity {

View File

@@ -1,6 +1,5 @@
package cn.fateverse.common.security.entity;
package cn.fateverse.common.core.entity;
import cn.fateverse.admin.entity.User;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -29,7 +28,6 @@ public class LoginUser implements UserDetails {
*/
private Long loginTime;
/**
* 过期时间
*/
@@ -119,6 +117,7 @@ public class LoginUser implements UserDetails {
public boolean isCredentialsNonExpired() {
return true;
}
/**
* 是否可用 ,禁用的用户不能身份验证
*

View File

@@ -1,7 +1,6 @@
package cn.fateverse.admin.entity;
package cn.fateverse.common.core.entity;
import cn.fateverse.common.core.annotaion.EnableAutoField;
import cn.fateverse.common.core.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Builder;

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