Commit 679c7247 authored by huyuchen's avatar huyuchen

Merge branch 'MVP1.5.8' into develop

# Conflicts:
#	yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmpContractAlertServiceImpl.java
#	yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TPaymentInfoServiceImpl.java
parents 9438684b d9931267
apiVersion: apps/v1 # 指定api版本,此值必须在kubectl api-versions中
kind: Deployment # 指定创建资源的角色/类型
metadata: # 资源的元数据/属性
name: yifu-permission # 资源的名字,在同一个namespace中必须唯一
namespace: qas-mvp # 部署在哪个namespace中
spec: # 资源规范字段
selector: # 选择器
matchLabels: # 匹配标签
app: yifu-permission
replicas: 1 # 声明副本数目
#revisionHistoryLimit: 3 # 保留历史版本
#strategy: # 策略
# rollingUpdate: # 滚动更新
# maxSurge: 30% # 最大额外可以存在的副本数,可以为百分比,也可以为整数
# maxUnavailable: 30% # 示在更新过程中能够进入不可用状态的 Pod 的最大值,可以为百分比,也可以为整数
# type: RollingUpdate # 滚动更新策略
template: # 模版
metadata: # 模版
labels: # 设定资源的标签
app: yifu-permission
annotations:
dapr.io/enabled: "true" #设定此参数为 true 注入Dapr sidecar到pod
dapr.io/app-id: "yifu-permission" #应用程序唯一 ID。 用于服务发现、状态封装 和 发布/订阅 消费者ID
dapr.io/app-port: "5027" #这个参数告诉Dapr你的应用程序正在监听哪个端口。
#dapr.io/log-level: "debug" #为 Dapr sidecar设置日志级别。 允许的值是debug,info,warn,error。 默认是 info
#dapr.io/log-as-json: "false" #将此参数设置为true以JSON格式输出日志。 默认值为 false.
#dapr.io/config: file #告诉 Dapr 要使用哪个配置 CRD
dapr.io/app-protocol: "http" #告诉 Dapr 你的应用程序正在使用哪种协议。 有效选项是 http and grpc。 Default is http
#dapr.io/app-max-concurrency: "20" #限制应用程序的并发量。 有效的数值是大于 0
#dapr.io/app-ssl: "false" #告诉Dapr通过不安全的SSL连接调用应用程序。 同时适用于HTTP和gRPC。 Traffic between your app and the Dapr sidecar is encrypted with a certificate issued by a non-trusted certificate authority, which is considered insecure. 默认值为 false.
dapr.io/metrics-port: "9090" #设置 sidecar 度量服务器的端口。 默认值为 9090
#dapr.io/sidecar-cpu-limit: 2 #Dapr sidecar可以使用的最大CPU数量。 默认情况下未设置
#dapr.io/sidecar-memory-limit: "800Mi" #Dapr sidecar可以使用的最大内存量。默认情况下未设置 请参阅 https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/ 的有效值。
#dapr.io/sidecar-cpu-request: 1 #Dapr sidecar要求的 CPU 数量
#dapr.io/sidecar-memory-request #Dapr sidecar 请求的内存数量
dapr.io/http-max-request-size: "100" #增加http和grpc服务器请求正文参数的最大大小,单位为MB,以处理大文件的上传。 默认值为 4 MB
dapr.io/http-read-buffer-size: "16" #Dapr has a default limit of 4KB for the http header read buffer size. When sending http headers that are bigger than the default 4KB, you can increase this value. Otherwise, you may encounter a Too big request header
dapr.io/sidecar-listen-addresses: "0.0.0.0"
# 更多dapr配置请参考 https://www.bookstack.cn/read/dapr-1.5-zh/cc77b74e2cc2f4d4.md
spec: # 资源规范字段
nodeSelector: # node 选择器
node-type: worker # node标签
kubernetes.io/hostname: yfmaster1
containers: # 容器
- name: yifu-permission # 容器的名字
#image: 192.168.1.110:5500/qas-mvp/yifu-permission-biz:1.0.0 # 容器镜像地址
image: hub.worfu.com/qas-mvp/yifu-permission-biz:1.0.0 #临时地址
imagePullPolicy: Always # 每次Pod启动拉取镜像策略,三个选择 Always、Never、IfNotPresent
# Always,每次都检查;Never,每次都不检查(不管本地是否有);IfNotPresent,如果本地有就不检查,如果没有就拉取(手动测试时,
# 已经打好镜像存在docker容器中时,使用存在不检查级别,
# 默认为每次都检查,然后会进行拉取新镜像,因镜像仓库不存在,导致部署失败)
ports:
- containerPort: 5027 # 容器端口
env: # 启动环境配置信息 active and timeZone set
- name: SPRING_PROFILES_ACTIVE
value: test
- name: TZ
value: Asia/Shanghai
resources: #资源配置限制
limits: # 最大使用
memory: "4096Mi"
#cpu: 300m # CPU,1核心 = 1000m
requests: # 容器运行时,最低资源需求,也就是说最少需要多少资源容器才能正常运行
#cpu: 100m
memory: "500Mi"
#livenessProbe: # pod 内部健康检查的设置
# httpGet: # 通过httpget检查健康,返回200-399之间,则认为容器正常
# path: /healthCheck # URI地址
# port: 8080 # 端口
# scheme: HTTP # 协议
# # host: 127.0.0.1 # 主机地址
# initialDelaySeconds: 30 # 表明第一次检测在容器启动后多长时间后开始
# timeoutSeconds: 5 # 检测的超时时间
# periodSeconds: 30 # 检查间隔时间
# successThreshold: 1 # 成功门槛
# failureThreshold: 5 # 失败门槛,连接失败5次,pod杀掉,重启一个新的pod
# readinessProbe: # Pod 准备服务健康检查设置
# httpGet:
# path: /healthCheck
# port: 8080
# scheme: HTTP
# initialDelaySeconds: 30
# timeoutSeconds: 5
# periodSeconds: 10
# successThreshold: 1
# failureThreshold: 5
#也可以用这种方法
#exec: 执行命令的方法进行监测,如果其退出码不为0,则认为容器正常
# command:
# - cat
# - /tmp/health
#也可以用这种方法
#tcpSocket: # 通过tcpSocket检查健康
# port: number
#ports:
# - name: http # 名称
# containerPort: 8080 # 容器开发对外的端口
# protocol: TCP # 协议
imagePullSecrets: # 镜像仓库拉取密钥
- name: login
#affinity: # 亲和性调试
# nodeAffinity: # 节点亲和力
# requiredDuringSchedulingIgnoredDuringExecution: # pod 必须部署到满足条件的节点上
# nodeSelectorTerms: # 节点满足任何一个条件就可以
# - matchExpressions: # 有多个选项,则只有同时满足这些逻辑选项的节点才能运行 pod
# - key: beta.kubernetes.io/arch
# operator: In
# values:
# - amd64
\ No newline at end of file
apiVersion: v1 # 指定api版本,此值必须在kubectl api-versions中
kind: Service # 指定创建资源的角色/类型
metadata: # 资源的元数据/属性
labels: # 设定资源的标签
app: yifu-permission # 资源的名字,在同一个namespace中必须唯一
name: yifu-permission # 资源的名字,在同一个namespace中必须唯一
namespace: qas-mvp # 部署在哪个namespace中
spec: # 资源规范字段
ports:
- port: 5027 # service 端口
protocol: TCP # 协议
targetPort: 5027 # 容器暴露的端口
name: http-permission # 端口名称
- port: 3500 # service 端口
protocol: TCP # 协议
targetPort: 3500 # 容器暴露的端口
name: http-permission-dapr
selector: # 选择器
app: yifu-permission # 资源名称
type: ClusterIP # ClusterIP 类型
\ No newline at end of file
apiVersion: apps/v1 # 指定api版本,此值必须在kubectl api-versions中
kind: Deployment # 指定创建资源的角色/类型
metadata: # 资源的元数据/属性
name: yifu-permission # 资源的名字,在同一个namespace中必须唯一
namespace: prd-mvp # 部署在哪个namespace中
spec: # 资源规范字段
selector: # 选择器
matchLabels: # 匹配标签
app: yifu-permission
replicas: 1 # 声明副本数目
#revisionHistoryLimit: 3 # 保留历史版本
#strategy: # 策略
# rollingUpdate: # 滚动更新
# maxSurge: 30% # 最大额外可以存在的副本数,可以为百分比,也可以为整数
# maxUnavailable: 30% # 示在更新过程中能够进入不可用状态的 Pod 的最大值,可以为百分比,也可以为整数
# type: RollingUpdate # 滚动更新策略
template: # 模版
metadata: # 模版
labels: # 设定资源的标签
app: yifu-permission
annotations:
dapr.io/enabled: "true" #设定此参数为 true 注入Dapr sidecar到pod
dapr.io/app-id: "yifu-permission" #应用程序唯一 ID。 用于服务发现、状态封装 和 发布/订阅 消费者ID
dapr.io/app-port: "5026" #这个参数告诉Dapr你的应用程序正在监听哪个端口。
#dapr.io/log-level: "debug" #为 Dapr sidecar设置日志级别。 允许的值是debug,info,warn,error。 默认是 info
#dapr.io/log-as-json: "false" #将此参数设置为true以JSON格式输出日志。 默认值为 false.
#dapr.io/config: file #告诉 Dapr 要使用哪个配置 CRD
dapr.io/app-protocol: "http" #告诉 Dapr 你的应用程序正在使用哪种协议。 有效选项是 http and grpc。 Default is http
#dapr.io/app-max-concurrency: "20" #限制应用程序的并发量。 有效的数值是大于 0
#dapr.io/app-ssl: "false" #告诉Dapr通过不安全的SSL连接调用应用程序。 同时适用于HTTP和gRPC。 Traffic between your app and the Dapr sidecar is encrypted with a certificate issued by a non-trusted certificate authority, which is considered insecure. 默认值为 false.
dapr.io/metrics-port: "9090" #设置 sidecar 度量服务器的端口。 默认值为 9090
#dapr.io/sidecar-cpu-limit: 2 #Dapr sidecar可以使用的最大CPU数量。 默认情况下未设置
#dapr.io/sidecar-memory-limit: "800Mi" #Dapr sidecar可以使用的最大内存量。默认情况下未设置 请参阅 https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/ 的有效值。
#dapr.io/sidecar-cpu-request: 1 #Dapr sidecar要求的 CPU 数量
#dapr.io/sidecar-memory-request #Dapr sidecar 请求的内存数量
dapr.io/http-max-request-size: "100" #增加http和grpc服务器请求正文参数的最大大小,单位为MB,以处理大文件的上传。 默认值为 4 MB
dapr.io/http-read-buffer-size: "16" #Dapr has a default limit of 4KB for the http header read buffer size. When sending http headers that are bigger than the default 4KB, you can increase this value. Otherwise, you may encounter a Too big request header
dapr.io/sidecar-listen-addresses: "0.0.0.0"
# 更多dapr配置请参考 https://www.bookstack.cn/read/dapr-1.5-zh/cc77b74e2cc2f4d4.md
spec: # 资源规范字段
nodeSelector: # node 选择器
node-type: worker # node标签
kubernetes.io/hostname: yfmaster1
containers: # 容器
- name: yifu-permission # 容器的名字
#image: 192.168.1.110:5500/prd-mvp/yifu-permission-biz:1.0.0 # 容器镜像地址
image: hub.worfu.com/prd-mvp/yifu-permission-biz:1.0.0 #临时地址
imagePullPolicy: Always # 每次Pod启动拉取镜像策略,三个选择 Always、Never、IfNotPresent
# Always,每次都检查;Never,每次都不检查(不管本地是否有);IfNotPresent,如果本地有就不检查,如果没有就拉取(手动测试时,
# 已经打好镜像存在docker容器中时,使用存在不检查级别,
# 默认为每次都检查,然后会进行拉取新镜像,因镜像仓库不存在,导致部署失败)
ports:
- containerPort: 5027 # 容器端口
env: # 启动环境配置信息 active and timeZone set
- name: SPRING_PROFILES_ACTIVE
value: test
- name: TZ
value: Asia/Shanghai
resources: #资源配置限制
limits: # 最大使用
memory: "4096Mi"
#cpu: 300m # CPU,1核心 = 1000m
requests: # 容器运行时,最低资源需求,也就是说最少需要多少资源容器才能正常运行
#cpu: 100m
memory: "500Mi"
#livenessProbe: # pod 内部健康检查的设置
# httpGet: # 通过httpget检查健康,返回200-399之间,则认为容器正常
# path: /healthCheck # URI地址
# port: 8080 # 端口
# scheme: HTTP # 协议
# # host: 127.0.0.1 # 主机地址
# initialDelaySeconds: 30 # 表明第一次检测在容器启动后多长时间后开始
# timeoutSeconds: 5 # 检测的超时时间
# periodSeconds: 30 # 检查间隔时间
# successThreshold: 1 # 成功门槛
# failureThreshold: 5 # 失败门槛,连接失败5次,pod杀掉,重启一个新的pod
# readinessProbe: # Pod 准备服务健康检查设置
# httpGet:
# path: /healthCheck
# port: 8080
# scheme: HTTP
# initialDelaySeconds: 30
# timeoutSeconds: 5
# periodSeconds: 10
# successThreshold: 1
# failureThreshold: 5
#也可以用这种方法
#exec: 执行命令的方法进行监测,如果其退出码不为0,则认为容器正常
# command:
# - cat
# - /tmp/health
#也可以用这种方法
#tcpSocket: # 通过tcpSocket检查健康
# port: number
#ports:
# - name: http # 名称
# containerPort: 8080 # 容器开发对外的端口
# protocol: TCP # 协议
imagePullSecrets: # 镜像仓库拉取密钥
- name: login
#affinity: # 亲和性调试
# nodeAffinity: # 节点亲和力
# requiredDuringSchedulingIgnoredDuringExecution: # pod 必须部署到满足条件的节点上
# nodeSelectorTerms: # 节点满足任何一个条件就可以
# - matchExpressions: # 有多个选项,则只有同时满足这些逻辑选项的节点才能运行 pod
# - key: beta.kubernetes.io/arch
# operator: In
# values:
# - amd64
\ No newline at end of file
apiVersion: v1 # 指定api版本,此值必须在kubectl api-versions中
kind: Service # 指定创建资源的角色/类型
metadata: # 资源的元数据/属性
labels: # 设定资源的标签
app: yifu-permission # 资源的名字,在同一个namespace中必须唯一
name: yifu-permission # 资源的名字,在同一个namespace中必须唯一
namespace: prd-mvp # 部署在哪个namespace中
spec: # 资源规范字段
ports:
- port: 5027 # service 端口
protocol: TCP # 协议
targetPort: 5027 # 容器暴露的端口
name: http-permission # 端口名称
- port: 3500 # service 端口
protocol: TCP # 协议
targetPort: 3500 # 容器暴露的端口
name: http-permission-dapr
selector: # 选择器
app: yifu-permission # 资源名称
type: ClusterIP # ClusterIP 类型
\ No newline at end of file
......@@ -105,6 +105,7 @@
<module>yifu-mail</module>
<module>yifu-business</module>
<module>yifu-msg</module>
<module>yifu-permission</module>
</modules>
<dependencyManagement>
......
......@@ -215,6 +215,8 @@ public class SalaryProveController {
} else {
return R.failed("参数出错!");
}
// 存储最近一次选择的档案信息
tProveApplyService.setCompanyRedisInfo(record.getUnitName(),record.getUnitAddr(),record.getPhone());
return R.ok(record);
}
......@@ -427,4 +429,14 @@ public class SalaryProveController {
return R.failed("无此证明记录!");
}
}
/**
* 获取最近一次选择的客户名称
*
* @author fxj
* @date 2023-08-23 17:31:05
**/
@GetMapping("/getLastCompanyName")
public R<TCompanyInfo> getLastCompanyName() {
return tProveApplyService.getLastCompanyName();
}
}
......@@ -28,6 +28,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
......@@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List;
......@@ -89,7 +91,7 @@ public class TCompanyInfoController {
*/
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('demo_tcompanyinfo_get')")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('demo_tcompanyinfo_get')")
@PreAuthorize("@pms.hasPermission('tcompanyinfo_get')")
public R<TCompanyInfo> getById(@PathVariable("id") String id) {
return R.ok(tCompanyInfoService.getById(id));
}
......@@ -100,10 +102,10 @@ public class TCompanyInfoController {
* @param tCompanyInfo 收入证明 中的 单位信息维护表
* @return R
*/
@Operation(summary = "新增收入证明 中的 单位信息维护表", description = "新增收入证明 中的 单位信息维护表:hasPermission('demo_tcompanyinfo_add')")
@Operation(summary = "新增收入证明 中的 单位信息维护表", description = "新增收入证明 中的 单位信息维护表:hasPermission('tcompanyinfo_add')")
@SysLog("新增收入证明 中的 单位信息维护表")
@PostMapping
@PreAuthorize("@pms.hasPermission('demo_tcompanyinfo_add')")
@PreAuthorize("@pms.hasPermission('tcompanyinfo_add')")
public R<Boolean> save(@RequestBody TCompanyInfo tCompanyInfo) {
TCompanyInfo exits = tCompanyInfoService.getOne(Wrappers.<TCompanyInfo>query().lambda()
.eq(TCompanyInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
......@@ -111,6 +113,11 @@ public class TCompanyInfoController {
if (Common.isNotNull(exits)){
return R.failed("已存在相同公司名称的有效数据!");
}
tCompanyInfo.setCreateName(SecurityUtils.getUser().getNickname());
tCompanyInfo.setCreateBy(SecurityUtils.getUser().getId());
tCompanyInfo.setCreateTime(LocalDateTime.now());
tCompanyInfo.setUpdateBy(SecurityUtils.getUser().getId());
tCompanyInfo.setUpdateTime(LocalDateTime.now());
return R.ok(tCompanyInfoService.save(tCompanyInfo));
}
/**
......@@ -119,10 +126,10 @@ public class TCompanyInfoController {
* @param tCompanyInfo 收入证明 中的 单位信息维护表
* @return R
*/
@Operation(summary = "修改收入证明 中的 单位信息维护表", description = "修改收入证明 中的 单位信息维护表:hasPermission('demo_tcompanyinfo_edit')")
@Operation(summary = "修改收入证明 中的 单位信息维护表", description = "修改收入证明 中的 单位信息维护表:hasPermission('tcompanyinfo_edit')")
@SysLog("修改收入证明 中的 单位信息维护表")
@PutMapping
@PreAuthorize("@pms.hasPermission('demo_tcompanyinfo_edit')")
@PreAuthorize("@pms.hasPermission('tcompanyinfo_edit')")
public R<Boolean> updateById(@RequestBody TCompanyInfo tCompanyInfo) {
TCompanyInfo exits = tCompanyInfoService.getOne(Wrappers.<TCompanyInfo>query().lambda()
.eq(TCompanyInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
......@@ -131,6 +138,9 @@ public class TCompanyInfoController {
if (Common.isNotNull(exits)){
return R.failed("已存在相同公司名称的有效数据!");
}
tCompanyInfo.setCreateTime(LocalDateTime.now());
tCompanyInfo.setUpdateBy(SecurityUtils.getUser().getId());
tCompanyInfo.setUpdateTime(LocalDateTime.now());
return R.ok(tCompanyInfoService.updateById(tCompanyInfo));
}
......@@ -140,10 +150,10 @@ public class TCompanyInfoController {
* @param id id
* @return R
*/
@Operation(summary = "通过id删除收入证明 中的 单位信息维护表", description = "通过id删除收入证明 中的 单位信息维护表:hasPermission('demo_tcompanyinfo_del')")
@Operation(summary = "通过id删除收入证明 中的 单位信息维护表", description = "通过id删除收入证明 中的 单位信息维护表:hasPermission('tcompanyinfo_del')")
@SysLog("通过id删除收入证明 中的 单位信息维护表")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('demo_tcompanyinfo_del')")
@PreAuthorize("@pms.hasPermission('tcompanyinfo_del')")
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(tCompanyInfoService.removeById(id));
}
......@@ -155,10 +165,10 @@ public class TCompanyInfoController {
* @date 2023-08-23 17:31:05
**/
@SneakyThrows
@Operation(description = "批量新增收入证明 中的 单位信息维护表 hasPermission('demo_tcompanyinfo-batch-import')")
@Operation(description = "批量新增收入证明 中的 单位信息维护表 hasPermission('tcompanyinfo-batch-import')")
@SysLog("批量新增收入证明 中的 单位信息维护表")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('demo_tcompanyinfo-batch-import')")
@PreAuthorize("@pms.hasPermission('tcompanyinfo-batch-import')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) {
return tCompanyInfoService.importDiy(file.getInputStream());
}
......@@ -169,9 +179,9 @@ public class TCompanyInfoController {
* @author fxj
* @date 2023-08-23 17:31:05
**/
@Operation(description = "导出收入证明 中的 单位信息维护表 hasPermission('demo_tcompanyinfo-export')")
@Operation(description = "导出收入证明 中的 单位信息维护表 hasPermission('tcompanyinfo-export')")
@PostMapping("/export")
@PreAuthorize("@pms.hasPermission('demo_tcompanyinfo-export')")
@PreAuthorize("@pms.hasPermission('tcompanyinfo-export')")
public void export(HttpServletResponse response, @RequestBody TCompanyInfoSearchVo searchVo) {
tCompanyInfoService.listExport(response, searchVo);
}
......
......@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCompanyInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TProveApply;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -23,4 +24,7 @@ public interface TProveApplyService extends IService<TProveApply> {
R<String> validSave(TProveApply proveApply, String[] attaIdArray);
R<TCompanyInfo> getLastCompanyName();
void setCompanyRedisInfo(String unitName, String unitAddr, String phone);
}
......@@ -280,46 +280,44 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
public R<Boolean> taskCreateContractAlert() {
// 获取合同为在档、员工类型为“0外包”、“1派遣”、最近一次合同审核通过、过期或离过期还有3个月的数据
List<TEmployeeContractInfo> alertList = contractInfoMapper.selectList(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getAuditStatus, CommonConstants.TWO_STRING)
.lambda().eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.TWO_STRING)
.isNotNull(TEmployeeContractInfo::getAuditTimeLast)
.eq(TEmployeeContractInfo::getIsObsolete, CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getContractType, CommonConstants.ONE_STRING)
.eq(TEmployeeContractInfo::getWorkFlag, CommonConstants.ZERO_STRING)
.ne(TEmployeeContractInfo::getSituation, "续签 ")
.ne(TEmployeeContractInfo::getSituation, "终止")
.le(TEmployeeContractInfo::getContractEnd, DateUtil.dateIncreaseByDay(
.eq(TEmployeeContractInfo::getInUse,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getContractType,CommonConstants.ONE_STRING)
.eq(TEmployeeContractInfo::getWorkFlag,CommonConstants.ZERO_STRING)
.ne(TEmployeeContractInfo::getSituation,"续签")
.ne(TEmployeeContractInfo::getSituation,"终止")
.le(TEmployeeContractInfo::getContractEnd,DateUtil.dateIncreaseByDay(
DateUtil.dateIncreaseByMonth(DateUtil.getCurrentDateTime(),
CommonConstants.dingleDigitIntArray[3]), CommonConstants.dingleDigitIntArray[1]))
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_STRING));
CommonConstants.dingleDigitIntArray[3]),CommonConstants.dingleDigitIntArray[1]))
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING));
// 获取所有未审核通过的合同数据
List<TEmployeeContractInfo> notAccessList = contractInfoMapper.selectList(Wrappers.<TEmployeeContractInfo>query().lambda()
.and(obj -> obj.eq(TEmployeeContractInfo::getAuditStatus, CommonConstants.ZERO_STRING)
.or().eq(TEmployeeContractInfo::getAuditStatus, CommonConstants.ONE_STRING))
.eq(TEmployeeContractInfo::getIsObsolete, CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getWorkFlag, CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_STRING));
Map<String, TEmpContractAlert> alertMap = new HashMap<>();
Map<String, TEmpContractAlert> existMap = new HashMap<>();
.and(obj->obj.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ZERO_STRING)
.or().eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_STRING))
.eq(TEmployeeContractInfo::getWorkFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING));
Map<String,TEmpContractAlert> alertMap = new HashMap<>();
Map<String,TEmpContractAlert> existMap = new HashMap<>();
initExistMap(existMap);
if (Common.isNotNull(alertList)) {
if (Common.isNotNull(alertList)){
Date nowDate = new Date();
for (TEmployeeContractInfo contract : alertList) {
extracted(nowDate, contract, alertMap, existMap);
for (TEmployeeContractInfo contract:alertList){
extracted(nowDate, contract,alertMap,existMap);
}
}
if (Common.isNotNull(notAccessList) && Common.isNotNull(alertMap)) {
if (Common.isNotNull(notAccessList) && Common.isNotNull(alertMap)){
TEmpContractAlert exist;
for (TEmployeeContractInfo contract : notAccessList) {
exist = alertMap.get(contract.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + contract.getDeptNo());
if (Common.isNotNull(exist)) {
for (TEmployeeContractInfo contract:notAccessList){
exist = alertMap.get(contract.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+contract.getDeptNo());
if (Common.isNotNull(exist)){
exist.setHandleStatus(CommonConstants.ONE_STRING);
alertMap.put(contract.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + contract.getDeptNo(), exist);
alertMap.put(contract.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+contract.getDeptNo(),exist);
}
}
}
baseMapper.truncate();
if (Common.isNotNull(alertMap)) {
if (Common.isNotNull(alertMap)){
this.saveBatch(alertMap.values());
}
return R.ok();
......
......@@ -5,13 +5,16 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCompanyInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TProveApply;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TProveApplyMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TAttaInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TProveApplyService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -27,7 +30,8 @@ import java.util.List;
*/
@Service
public class TProveApplyServiceImpl extends ServiceImpl<TProveApplyMapper, TProveApply> implements TProveApplyService {
@Autowired
private RedisUtil redisUtil;
@Autowired
private TAttaInfoService tAttaInfoService;
......@@ -79,5 +83,30 @@ public class TProveApplyServiceImpl extends ServiceImpl<TProveApplyMapper, TProv
return R.ok("操作成功!");
}
@Override
public R<TCompanyInfo> getLastCompanyName() {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
String userKey = CacheConstants.WXHR_LAST_SELECT_COMPANY_NAME + "_" + user.getId();
Object info = redisUtil.get(userKey);
if(Common.isEmpty(info)){
return R.ok(null);
}
return R.ok((TCompanyInfo)info);
}
@Override
public void setCompanyRedisInfo(String unitName, String unitAddr, String phone) {
YifuUser user = SecurityUtils.getUser();
if (!Common.isEmpty(user)){
String userKey = CacheConstants.WXHR_LAST_SELECT_COMPANY_NAME + "_" + user.getId();
TCompanyInfo info = new TCompanyInfo();
info.setCompanyName(unitName);
info.setCompanyTel(phone);
info.setCompanyAddress(unitAddr);
redisUtil.set(userKey,info);
}
}
}
......@@ -53,7 +53,7 @@
AND a.id = #{tCompanyInfo.id}
</if>
<if test="tCompanyInfo.companyName != null and tCompanyInfo.companyName.trim() != ''">
AND a.COMPANY_NAME = #{tCompanyInfo.companyName}
AND a.COMPANY_NAME like CONCAT('%',#{tCompanyInfo.companyName},'%')
</if>
<if test="tCompanyInfo.companyAddress != null and tCompanyInfo.companyAddress.trim() != ''">
AND a.COMPANY_ADDRESS = #{tCompanyInfo.companyAddress}
......
......@@ -167,4 +167,9 @@ public interface CacheConstants {
String FUND_IMPORT_HANDLE_LOCK = "fund_import_handle_handle_lock";
public static final String WX_ACCOSS_TOKEN = "WX_ACCOSS_TOKEN";
/**
* 登录用户最近一次选择的收入证明单位名称
*/
public static final String WXHR_LAST_SELECT_COMPANY_NAME = "wxhr_last_select_company_name";
}
package com.yifu.cloud.plus.v1.yifu.common.dapr.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
* @Author hgw
* @Date 2023-9-5 09:42:31
* @Description EKP数据权限
* @Version 1.0
*/
@Data
@Component
@PropertySource("classpath:daprConfig.properties")
@ConfigurationProperties(value = "dapr.permission", ignoreInvalidFields = false)
public class DaprEkpPermissionProperties {
/*
* @author fxj
* @date 14:34
* @Description dapr sidercar url 如:http://localhost:3005/v1.0/invoke/
**/
String appUrl;
/*
* @author fxj
* @date 14:35
* @decription app_id 如:"yifu_upms_sider"
**/
String appId;
String appPort;
String httpPort;
String grpcPort;
String metricsPort;
}
......@@ -26,4 +26,8 @@ dapr.business.appId=yifu-business
#\u6D4B\u8BD5\u73AF\u5883-\u6D88\u606F\u63D0\u9192\u670D\u52A1
dapr.msg.appUrl=http://yifu-msg.qas-mvp.svc.cluster.local:3500/v1.0/invoke/
dapr.msg.appId=yifu-msg
\ No newline at end of file
dapr.msg.appId=yifu-msg
#\u6D4B\u8BD5\u73AF\u5883-EKP\u6743\u9650
dapr.permission.appUrl=http://yifu-permission.qas-mvp.svc.cluster.local:3500/v1.0/invoke/
dapr.permission.appId=yifu-permission
\ No newline at end of file
......@@ -313,5 +313,7 @@ public class EkpSalaryParam implements Serializable {
private String fd_3bcd41d77e4812;
// 应发工资(导表金额)
private String fd_3bcdee91cacb6c;
// 创建人
private String fd_3c3e5ff65115a2;
}
package com.yifu.cloud.plus.v1.job.compont;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprEkpPermissionProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Author hgw
* @Description EKP权限定时任务
* @Date 2023-9-5 09:40:09
**/
@Component(value = "ekpPermissionTask")
@Slf4j
@EnableConfigurationProperties(DaprEkpPermissionProperties.class)
public class EkpPermissionTask {
@Autowired
private DaprEkpPermissionProperties daprEkpPermissionProperties;
/**
* @return
* @Author hgw
* @Description 刷新EKP权限里的账号信息
* @Date 2023-9-5 09:45:22
* @Param
**/
public void doRefreshEkpUser() throws Exception {
log.info("-------------刷新EKP权限里的账号信息-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprEkpPermissionProperties.getAppUrl(), daprEkpPermissionProperties.getAppId(),
"/sysuserinfo/inner/doRefreshEkpUser", "", Object.class,
SecurityConstants.FROM_IN);
log.info("-------------刷新EKP权限里的账号信息-定时任务结束------------");
}
}
\ No newline at end of file
......@@ -116,7 +116,13 @@
b1.fd_id ORDER_ID,
'1' AS ALERT_TYPE,
DATE_ADD(NOW(), INTERVAL 30 MINUTE) as 'date1',
IF(b1.fd_3b779ba2168eea = 1,DATE_ADD(a.fd_start_date,INTERVAL 3 HOUR),IF(b1.fd_3b779ba2168eea = 4,DATE_ADD(a.fd_start_date,INTERVAL 5 HOUR),DATE_ADD(a.fd_start_date,INTERVAL 8 HOUR))) as 'date2'
IF(b1.fd_3b779ba2168eea = 1,
DATE_ADD(a.fd_start_date,INTERVAL 3 HOUR),
IF(b1.fd_3b779ba2168eea = 4,
DATE_ADD(a.fd_start_date,INTERVAL 5 HOUR),
IF(b1.fd_3b779ba2168eea = 7,
DATE_ADD(a.fd_start_date,INTERVAL 8 HOUR),
DATE_ADD(a.fd_start_date,INTERVAL 2 MONTH)))) as 'date2'
FROM
lbpm_workitem a
LEFT JOIN lbpm_node e ON e.fd_id = a.fd_node_id
......@@ -127,7 +133,7 @@
e.fd_fact_node_id = 'N5'
AND b1.fd_id IS NOT NULL
) x
where x.date1 > date2 GROUP BY x.ORDER_NO
where x.date1 >= date2 GROUP BY x.ORDER_NO
</select>
<select id="getMsgByTaskOne" resultMap="msgInfoMap">
......
# 忽略匹配下列规则的Git 提交 V2.1.0
### gradle ###
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
### STS ###
.settings/
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
bin/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
*.lock
rebel.xml
### NetBeans ###
nbproject/private/
build/
nbbuild/
nbdist/
.nb-gradle/
### maven ###
target/
*.war
*.ear
*.zip
*.tar
*.tar.gz
### logs ####
/logs/
*.log
### temp ignore ###
*.cache
*.diff
*.patch
*.tmp
*.java~
*.properties~
*.xml~
### system ignore ###
.DS_Store
Thumbs.db
Servers
.metadata
upload
gen_code
### node ###
node_modules
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>yifu</artifactId>
<groupId>com.yifu.cloud.plus.v1</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yifu-permission</artifactId>
<description>EKP-权限服务</description>
<packaging>pom</packaging>
<!--项目子模块-->
<modules>
<module>yifu-permission-api</module>
<module>yifu-permission-biz</module>
</modules>
</project>
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu</artifactId>
<version>1.0.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>yifu-permission-api</artifactId>
<packaging>jar</packaging>
<description>EKP 权限配置</description>
<dependencies>
<!-- core 工具类 -->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-core</artifactId>
</dependency>
<!--swagger 注解-->
<!--<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>-->
<!--feign 注解依赖-->
<!--<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign-core</artifactId>
<optional>true</optional>
</dependency>-->
<!--mybatis 依赖-->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-mybatis</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
</dependencies>
</project>
package com.yifu.cloud.plus.v1.yifu.permission.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 新权限-菜单表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Data
@TableName("sys_menu")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "新权限-菜单表")
public class SysMenu extends BaseEntity {
/**
* ID
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "ID")
private String id;
/**
* 菜单名称
*/
@Schema(description = "菜单名称")
private String menuName;
/**
* 上级菜单名称
*/
@Schema(description = "上级菜单名称")
private String menuNameParent;
/**
* 上级菜单id
*/
@Schema(description = "上级菜单id")
private String menuParentId;
/**
* 表单ID
*/
@Schema(description = "表单ID")
private String modelId;
/**
* 视图ID
*/
@Schema(description = "视图ID")
private String viewId;
/**
* 权限维度
*/
@Schema(description = "权限维度")
private String permissionType;
/**
* 授权状态(0启用、1禁用)
*/
@Schema(description = "授权状态(0启用、1禁用)")
private String permissionStatus;
/**
* 删除状态(0是、1否)
*/
@Schema(description = "删除状态(0是、1否)")
private String deleteStatus;
/**
* 收入权限id
*/
@Schema(description = "收入权限id")
private String incomeId;
/**
* 客户权限id
* 1客户权限;2商机;3报价单;4合同;5项目;6BU;7条线;8部门;9收入归属
*/
@Schema(description = "客户权限id")
private String customerId;
/**
* 合同权限id
*/
@Schema(description = "合同权限id")
private String contractId;
/**
* 商机权限id
*/
@Schema(description = "商机权限id")
private String bussinessId;
/**
* 报价单权限id
*/
@Schema(description = "报价单权限id")
private String quotationId;
/**
* 项目权限id
*/
@Schema(description = "项目权限id")
private String domainId;
/**
* BU归属权限id
*/
@Schema(description = "BU归属权限id")
private String buId;
/**
* 条线类型权限id
*/
@Schema(description = "条线类型权限id")
private String lineId;
/**
* 部门权限id
*/
@Schema(description = "部门权限id")
private String deptId;
/**
* 权限idList
*/
@Schema(description = "权限idList")
@TableField(exist = false)
private List<String> columnIdList;
/**
* 是否开关(0开、1关)
*/
@Schema(description = "是否开关(0开、1关)")
private String isOpen;
}
package com.yifu.cloud.plus.v1.yifu.permission.entity;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* 新权限-角色表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Data
@TableName("sys_role_info")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "新权限-角色表")
public class SysRoleInfo extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("主键")
@Schema(description = "主键")
private String fdId;
/**
* 角色名称
*/
@ExcelAttribute(name = "角色名称", isNotEmpty = true, errorInfo = "角色名称不能为空", maxLength = 20)
@NotBlank(message = "角色名称不能为空")
@Length(max = 20, message = "角色名称不能超过20个字符")
@ExcelProperty("角色名称")
@Schema(description = "角色名称")
private String roleName;
/**
* 角色描述
*/
@ExcelAttribute(name = "角色描述", maxLength = 200)
@Length(max = 200, message = "角色描述不能超过200个字符")
@ExcelProperty("角色描述")
@Schema(description = "角色描述")
private String remark;
/**
* 状态:0:正常;1:冻结/停用
*/
@ExcelAttribute(name = "状态:0:正常;1:冻结/停用", isNotEmpty = true, errorInfo = "状态:0:正常;1:冻结/停用不能为空")
@NotBlank(message = "状态:0:正常;1:冻结/停用不能为空")
@ExcelProperty("状态:0:正常;1:冻结/停用")
@Schema(description = "状态:0:正常;1:冻结/停用")
private Integer status;
/**
* 删除状态图:0:正常;1:删除
*/
@ExcelAttribute(name = "删除状态图:0:正常;1:删除", isNotEmpty = true, errorInfo = "删除状态图:0:正常;1:删除不能为空")
@NotBlank(message = "删除状态图:0:正常;1:删除不能为空")
@ExcelProperty("删除状态图:0:正常;1:删除")
@Schema(description = "删除状态图:0:正常;1:删除")
private Integer deleteFlag;
/**
* 数据权限(全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)
*/
@ExcelAttribute(name = "数据权限(全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)", isNotEmpty = true, errorInfo = "数据权限(全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)不能为空", maxLength = 50)
@NotBlank(message = "数据权限(全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)不能为空")
@Length(max = 50, message = "数据权限(全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)不能超过50个字符")
@ExcelProperty("数据权限(全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)")
@Schema(description = "数据权限(全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)")
private String dataAuth;
}
package com.yifu.cloud.plus.v1.yifu.permission.entity;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* 新权限-角色-菜单-关联表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Data
@TableName("sys_role_menu_res")
@Schema(description = "新权限-角色-菜单-关联表")
public class SysRoleMenuRes {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("主键")
@Schema(description = "主键")
private String fdId;
/**
* 角色ID
*/
@ExcelAttribute(name = "角色ID", isNotEmpty = true, errorInfo = "角色ID不能为空", maxLength = 36)
@NotBlank(message = "角色ID不能为空")
@Length(max = 36, message = "角色ID不能超过36个字符")
@ExcelProperty("角色ID")
@Schema(description = "角色ID")
private String roleId;
/**
* 菜单ID
*/
@ExcelAttribute(name = "菜单ID", isNotEmpty = true, errorInfo = "菜单ID不能为空", maxLength = 36)
@NotBlank(message = "菜单ID不能为空")
@Length(max = 36, message = "菜单ID不能超过36个字符")
@ExcelProperty("菜单ID")
@Schema(description = "菜单ID")
private String menuId;
}
package com.yifu.cloud.plus.v1.yifu.permission.entity;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* 新权限-账号管理表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Data
@TableName("sys_user_info")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "新权限-账号管理表")
public class SysUserInfo extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("主键")
@Schema(description = "主键")
private String fdId;
/**
* ele表-员工姓名
*/
@ExcelAttribute(name = "ele表-员工姓名", maxLength = 200)
@Length(max = 200, message = "ele表-员工姓名不能超过200个字符")
@ExcelProperty("ele表-员工姓名")
@Schema(description = "ele表-员工姓名")
private String fdName;
/**
* per表-登录账号
*/
@ExcelAttribute(name = "per表-登录账号", maxLength = 200)
@Length(max = 200, message = "per表-登录账号不能超过200个字符")
@ExcelProperty("per表-登录账号")
@Schema(description = "per表-登录账号")
private String fdLoginName;
/**
* ele表-所在部门
*/
@ExcelAttribute(name = "ele表-所在部门", maxLength = 450)
@Length(max = 450, message = "ele表-所在部门不能超过450个字符")
@ExcelProperty("ele表-所在部门")
@Schema(description = "ele表-所在部门")
private String fdLdapDn;
/**
* 所在部门
*/
@ExcelAttribute(name = "所在部门", maxLength = 100)
@Length(max = 100, message = "所在部门不能超过100个字符")
@ExcelProperty("所在部门")
@Schema(description = "所在部门")
private String fdDeptName;
/**
* per表-手机号
*/
@ExcelAttribute(name = "per表-手机号", maxLength = 150)
@Length(max = 150, message = "per表-手机号不能超过150个字符")
@ExcelProperty("per表-手机号")
@Schema(description = "per表-手机号")
private String fdMobileNo;
/**
* per表-邮箱
*/
@ExcelAttribute(name = "per表-邮箱", maxLength = 200)
@Length(max = 200, message = "per表-邮箱不能超过200个字符")
@ExcelProperty("per表-邮箱")
@Schema(description = "per表-邮箱")
private String fdEmail;
/**
* 状态:0正常;1冻结
*/
@ExcelAttribute(name = "状态:0正常;1冻结", isNotEmpty = true, errorInfo = "状态:0正常;1冻结不能为空")
@NotBlank(message = "状态:0正常;1冻结不能为空")
@ExcelProperty("状态:0正常;1冻结")
@Schema(description = "状态:0正常;1冻结")
private Integer status;
/**
* 角色名称合集
*/
@TableField(exist = false)
private String roleNames;
}
package com.yifu.cloud.plus.v1.yifu.permission.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Data
@TableName("sys_user_permission")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "新权限-用户权限表")
public class SysUserPermission extends BaseEntity {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "id")
private String id;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 登录账号
*/
@Schema(description = "登录账号")
private String empLoginName;
/**
* 用户id
*/
@Schema(description = "用户id")
private String userId;
/**
* 所在部门
*/
@Schema(description = "所在部门")
private String empDept;
/**
* 权限类型 客户、商机、报价单、
* 1客户权限;2商机;3报价单;4合同;5项目;6BU;7条线;8部门;9收入归属
*/
@Schema(description = "权限类型")
private String permissionType;
/**
* 名称
*/
@Schema(description = "名称")
private String name;
/**
* 编码
*/
@Schema(description = "编码")
private String code;
/**
* 是否包含(0 是 1否)
*/
@Schema(description = "是否包含(0 是 1否)")
private String isContains;
/**
* 授权状态(0启用、1禁用)
*/
@Schema(description = "授权状态(0启用、1禁用)")
private String permissionStatus;
/**
* 删除状态(0是、1否)
*/
@Schema(description = "删除状态(0是、1否)")
private String deleteFlag;
/**
* 部门id
*/
@Schema(description = "部门id")
private String domainId;
/**
* 0:从EKP同步的;1:MVP新增的。
*/
@Schema(description = "来源")
private String sourceType;
}
package com.yifu.cloud.plus.v1.yifu.permission.entity;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* 新权限-账号-角色关联表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Data
@TableName("sys_user_role_res")
@Schema(description = "新权限-账号-角色关联表")
public class SysUserRoleRes {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("主键")
@Schema(description = "主键")
private String fdId;
/**
* 账号ID
*/
@ExcelAttribute(name = "账号ID", isNotEmpty = true, errorInfo = "账号ID不能为空", maxLength = 36)
@NotBlank(message = "账号ID不能为空")
@Length(max = 36, message = "账号ID不能超过36个字符")
@ExcelProperty("账号ID")
@Schema(description = "账号ID")
private String userId;
/**
* 角色ID
*/
@ExcelAttribute(name = "角色ID", isNotEmpty = true, errorInfo = "角色ID不能为空", maxLength = 36)
@NotBlank(message = "角色ID不能为空")
@Length(max = 36, message = "角色ID不能超过36个字符")
@ExcelProperty("角色ID")
@Schema(description = "角色ID")
private String roleId;
@TableField(exist = false)
private String roleName;
@TableField(exist = false)
private String userName;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* @Author hgw
* @Date 2023-9-21 17:03:57
* @Description
* @Version 1.0
*/
@Data
public class IdTypeEkpVo implements Serializable {
/**
* 主键
*/
@Schema(description = "主键")
private String fdId;
/**
* 类型
*/
@Schema(description = "类型")
private String type;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;/*
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* 新权限-字段vo
*
* @author huyc
* @date 2023-09-04 14:49:40
*/
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@Data
public class SysDictVo implements Serializable {
/**
* 名称
*/
@Schema(description = "名称")
private String id;
/**
* 编码
*/
@Schema(description = "编码")
private String name;
}
\ No newline at end of file
package com.yifu.cloud.plus.v1.yifu.permission.vo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 新权限-菜单表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Data
public class SysMenuSearchVo extends SysMenu {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,多个逗号分割")
private String ids;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema(description = "创建时间区间")
private LocalDateTime[] createTimes;
/**
* @Author fxj
* 查询数据起
**/
@Schema(description = "查询limit 开始")
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
@Schema(description = "查询limit 数据条数")
private int limitEnd;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 新权限-菜单表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Data
public class SysMenuVo extends RowIndex implements Serializable {
/**
* ID
*/
@TableId(type = IdType.ASSIGN_ID)
@NotBlank(message = "ID 不能为空")
@Length(max = 36, message = "ID 不能超过36 个字符")
@ExcelAttribute(name = "ID", isNotEmpty = true, errorInfo = "ID 不能为空", maxLength = 36)
@Schema(description = "ID")
@ExcelProperty("ID")
private String id;
/**
* 菜单名称
*/
@Length(max = 20, message = "菜单名称 不能超过20 个字符")
@ExcelAttribute(name = "菜单名称", maxLength = 20)
@Schema(description = "菜单名称")
@ExcelProperty("菜单名称")
private String menuName;
/**
* 上级菜单名称
*/
@Length(max = 20, message = "上级菜单名称 不能超过20 个字符")
@ExcelAttribute(name = "上级菜单名称", maxLength = 20)
@Schema(description = "上级菜单名称")
@ExcelProperty("上级菜单名称")
private String menuNameParent;
/**
* 上级菜单id
*/
@Length(max = 36, message = "上级菜单id 不能超过36 个字符")
@ExcelAttribute(name = "上级菜单id", maxLength = 36)
@Schema(description = "上级菜单id")
@ExcelProperty("上级菜单id")
private String menuParentId;
/**
* 表单ID
*/
@Length(max = 36, message = "表单ID 不能超过36 个字符")
@ExcelAttribute(name = "表单ID", maxLength = 36)
@Schema(description = "表单ID")
@ExcelProperty("表单ID")
private String modelId;
/**
* 视图ID
*/
@Length(max = 36, message = "视图ID 不能超过36 个字符")
@ExcelAttribute(name = "视图ID", maxLength = 36)
@Schema(description = "视图ID")
@ExcelProperty("视图ID")
private String viewId;
/**
* 授权状态(0启用、1禁用)
*/
@Length(max = 1, message = "授权状态(0启用、1禁用) 不能超过1 个字符")
@ExcelAttribute(name = "授权状态(0启用、1禁用)", maxLength = 1)
@Schema(description = "授权状态(0启用、1禁用)")
@ExcelProperty("授权状态(0启用、1禁用)")
private String permissionStatus;
/**
* 删除状态(0是、1否)
*/
@Length(max = 1, message = "删除状态(0是、1否) 不能超过1 个字符")
@ExcelAttribute(name = "删除状态(0是、1否)", maxLength = 1)
@Schema(description = "删除状态(0是、1否)")
@ExcelProperty("删除状态(0是、1否)")
private String deleteStatus;
/**
* 收入权限id
*/
@Length(max = 20, message = "收入权限id 不能超过20 个字符")
@ExcelAttribute(name = "收入权限id", maxLength = 20)
@Schema(description = "收入权限id")
@ExcelProperty("收入权限id")
private String incomeId;
/**
* 客户权限id
*/
@Length(max = 20, message = "客户权限id 不能超过20 个字符")
@ExcelAttribute(name = "客户权限id", maxLength = 20)
@Schema(description = "客户权限id")
@ExcelProperty("客户权限id")
private String customerId;
/**
* 合同权限id
*/
@Length(max = 20, message = "合同权限id 不能超过20 个字符")
@ExcelAttribute(name = "合同权限id", maxLength = 20)
@Schema(description = "合同权限id")
@ExcelProperty("合同权限id")
private String contractId;
/**
* 商机权限id
*/
@Length(max = 20, message = "商机权限id 不能超过20 个字符")
@ExcelAttribute(name = "商机权限id", maxLength = 20)
@Schema(description = "商机权限id")
@ExcelProperty("商机权限id")
private String bussinessId;
/**
* 报价单权限id
*/
@Length(max = 20, message = "报价单权限id 不能超过20 个字符")
@ExcelAttribute(name = "报价单权限id", maxLength = 20)
@Schema(description = "报价单权限id")
@ExcelProperty("报价单权限id")
private String quotationId;
/**
* 项目权限id
*/
@Length(max = 20, message = "项目权限id 不能超过20 个字符")
@ExcelAttribute(name = "项目权限id", maxLength = 20)
@Schema(description = "项目权限id")
@ExcelProperty("项目权限id")
private String domainId;
/**
* BU归属权限id
*/
@Length(max = 20, message = "BU归属权限id 不能超过20 个字符")
@ExcelAttribute(name = "BU归属权限id", maxLength = 20)
@Schema(description = "BU归属权限id")
@ExcelProperty("BU归属权限id")
private String buId;
/**
* 条线类型权限id
*/
@Length(max = 20, message = "条线类型权限id 不能超过20 个字符")
@ExcelAttribute(name = "条线类型权限id", maxLength = 20)
@Schema(description = "条线类型权限id")
@ExcelProperty("条线类型权限id")
private String lineId;
/**
* 部门权限id
*/
@Length(max = 20, message = "部门权限id 不能超过20 个字符")
@ExcelAttribute(name = "部门权限id", maxLength = 20)
@Schema(description = "部门权限id")
@ExcelProperty("部门权限id")
private String deptId;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import cn.hutool.core.lang.tree.Tree;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleInfo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleMenuRes;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 角色新增vo
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Data
public class SysRoleInfoSaveVo implements Serializable {
private SysRoleInfo role;
private List<SysRoleMenuRes> resList;
private List<Tree<String>> tree;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 新权限-角色表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Data
public class SysRoleInfoSearchVo extends SysRoleInfo {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,多个逗号分割")
private String ids;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema(description = "创建时间起")
private LocalDateTime createTimeStart;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema(description = "创建时间止")
private LocalDateTime createTimeEnd;
/**
* @Author fxj
* 查询数据起
**/
@Schema(description = "查询limit 开始")
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
@Schema(description = "查询limit 数据条数")
private int limitEnd;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 新权限-角色表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Data
public class SysRoleInfoVo extends RowIndex implements Serializable {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@NotBlank(message = "主键 不能为空")
@Length(max = 36, message = "主键 不能超过36 个字符")
@ExcelAttribute(name = "主键", isNotEmpty = true, errorInfo = "主键 不能为空", maxLength = 36)
@Schema(description = "主键")
@ExcelProperty("主键")
private String fdId;
/**
* 角色名称
*/
@NotBlank(message = "角色名称 不能为空")
@Length(max = 20, message = "角色名称 不能超过20 个字符")
@ExcelAttribute(name = "角色名称", isNotEmpty = true, errorInfo = "角色名称 不能为空", maxLength = 20)
@Schema(description = "角色名称")
@ExcelProperty("角色名称")
private String roleName;
/**
* 角色描述
*/
@Length(max = 200, message = "角色描述 不能超过200 个字符")
@ExcelAttribute(name = "角色描述", maxLength = 200)
@Schema(description = "角色描述")
@ExcelProperty("角色描述")
private String remark;
/**
* 状态:0:正常;1:冻结/停用
*/
@NotBlank(message = "状态:0:正常;1:冻结/停用 不能为空")
@ExcelAttribute(name = "状态:0:正常;1:冻结/停用", isNotEmpty = true, errorInfo = "状态:0:正常;1:冻结/停用 不能为空")
@Schema(description = "状态:0:正常;1:冻结/停用")
@ExcelProperty("状态:0:正常;1:冻结/停用")
private Integer status;
/**
* 删除状态图:0:正常;1:删除
*/
@NotBlank(message = "删除状态图:0:正常;1:删除 不能为空")
@ExcelAttribute(name = "删除状态图:0:正常;1:删除", isNotEmpty = true, errorInfo = "删除状态图:0:正常;1:删除 不能为空")
@Schema(description = "删除状态图:0:正常;1:删除")
@ExcelProperty("删除状态图:0:正常;1:删除")
private Integer deleteFlag;
/**
* 数据权限(全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)
*/
@NotBlank(message = "数据权限(全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;) 不能为空")
@Length(max = 50, message = "数据权限(全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;) 不能超过50 个字符")
@ExcelAttribute(name = "数据权限(全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)", isNotEmpty = true, errorInfo = "数据权限(全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;) 不能为空", maxLength = 50)
@Schema(description = "数据权限(全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)")
@ExcelProperty("数据权限(全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)")
private String dataAuth;
/**
* 创建人id
*/
@Length(max = 36, message = "创建人id 不能超过36 个字符")
@ExcelAttribute(name = "创建人id", maxLength = 36)
@Schema(description = "创建人id")
@ExcelProperty("创建人id")
private String createBy;
/**
* 创建人姓名
*/
@Length(max = 200, message = "创建人姓名 不能超过200 个字符")
@ExcelAttribute(name = "创建人姓名", maxLength = 200)
@Schema(description = "创建人姓名")
@ExcelProperty("创建人姓名")
private String createName;
/**
* 创建时间
*/
@ExcelAttribute(name = "创建时间", isDate = true)
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
/**
* 更新人id
*/
@Length(max = 200, message = "更新人id 不能超过200 个字符")
@ExcelAttribute(name = "更新人id", maxLength = 200)
@Schema(description = "更新人id")
@ExcelProperty("更新人id")
private String updateBy;
/**
* 更新时间
*/
@ExcelAttribute(name = "更新时间", isDate = true)
@Schema(description = "更新时间")
@ExcelProperty("更新时间")
private LocalDateTime updateTime;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleMenuRes;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 新权限-角色-菜单-关联表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Data
public class SysRoleMenuResSearchVo extends SysRoleMenuRes {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,多个逗号分割")
private String ids;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema(description = "创建时间区间")
private LocalDateTime[] createTimes;
/**
* @Author fxj
* 查询数据起
**/
@Schema(description = "查询limit 开始")
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
@Schema(description = "查询limit 数据条数")
private int limitEnd;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 新权限-角色-菜单-关联表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Data
public class SysRoleMenuResVo extends RowIndex implements Serializable {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@NotBlank(message = "主键 不能为空")
@Length(max = 36, message = "主键 不能超过36 个字符")
@ExcelAttribute(name = "主键", isNotEmpty = true, errorInfo = "主键 不能为空", maxLength = 36)
@Schema(description = "主键")
@ExcelProperty("主键")
private String fdId;
/**
* 角色ID
*/
@NotBlank(message = "角色ID 不能为空")
@Length(max = 36, message = "角色ID 不能超过36 个字符")
@ExcelAttribute(name = "角色ID", isNotEmpty = true, errorInfo = "角色ID 不能为空", maxLength = 36)
@Schema(description = "角色ID")
@ExcelProperty("角色ID")
private String roleId;
/**
* 菜单ID
*/
@NotBlank(message = "菜单ID 不能为空")
@Length(max = 36, message = "菜单ID 不能超过36 个字符")
@ExcelAttribute(name = "菜单ID", isNotEmpty = true, errorInfo = "菜单ID 不能为空", maxLength = 36)
@Schema(description = "菜单ID")
@ExcelProperty("菜单ID")
private String menuId;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* 新权限-账号管理表
*
* @author huyc
* @date 2023-09-04 14:49:40
*/
@Data
public class SysUserDeptVo implements Serializable {
/**
* 名称
*/
@Schema(description = "名称")
private String name;
/**
* 编码
*/
@Schema(description = "编码")
private String code;
/**
* 类型
*/
@Schema(description = "类型")
private String type;
/**
* 登录名
*/
@Schema(description = "登录名")
private String loginName;
/**
* 部门id
*/
@Schema(description = "部门id")
private String domainId;
}
\ No newline at end of file
package com.yifu.cloud.plus.v1.yifu.permission.vo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 账号新增vo
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Data
public class SysUserInfoSaveVo implements Serializable {
private SysUserInfo user;
private List<SysUserRoleRes> resList;
private String dataAuth;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 新权限-账号管理表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Data
public class SysUserInfoSearchVo extends SysUserInfo {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,多个逗号分割")
private String ids;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema(description = "创建时间区间")
private LocalDateTime[] createTimes;
/**
* @Author fxj
* 查询数据起
**/
@Schema(description = "查询limit 开始")
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
@Schema(description = "查询limit 数据条数")
private int limitEnd;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 新权限-账号管理表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Data
public class SysUserInfoVo extends RowIndex implements Serializable {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@NotBlank(message = "主键 不能为空")
@Length(max = 36, message = "主键 不能超过36 个字符")
@ExcelAttribute(name = "主键", isNotEmpty = true, errorInfo = "主键 不能为空", maxLength = 36)
@Schema(description = "主键")
@ExcelProperty("主键")
private String fdId;
/**
* ele表-员工姓名
*/
@Length(max = 200, message = "ele表-员工姓名 不能超过200 个字符")
@ExcelAttribute(name = "ele表-员工姓名", maxLength = 200)
@Schema(description = "ele表-员工姓名")
@ExcelProperty("ele表-员工姓名")
private String fdName;
/**
* per表-登录账号
*/
@Length(max = 200, message = "per表-登录账号 不能超过200 个字符")
@ExcelAttribute(name = "per表-登录账号", maxLength = 200)
@Schema(description = "per表-登录账号")
@ExcelProperty("per表-登录账号")
private String fdLoginName;
/**
* ele表-所在部门
*/
@Length(max = 450, message = "ele表-所在部门 不能超过450 个字符")
@ExcelAttribute(name = "ele表-所在部门", maxLength = 450)
@Schema(description = "ele表-所在部门")
@ExcelProperty("ele表-所在部门")
private String fdLdapDn;
/**
* 所在部门
*/
@Length(max = 100, message = "所在部门 不能超过100 个字符")
@ExcelAttribute(name = "所在部门", maxLength = 100)
@Schema(description = "所在部门")
@ExcelProperty("所在部门")
private String fdDeptName;
/**
* per表-手机号
*/
@Length(max = 150, message = "per表-手机号 不能超过150 个字符")
@ExcelAttribute(name = "per表-手机号", maxLength = 150)
@Schema(description = "per表-手机号")
@ExcelProperty("per表-手机号")
private String fdMobileNo;
/**
* per表-邮箱
*/
@Length(max = 200, message = "per表-邮箱 不能超过200 个字符")
@ExcelAttribute(name = "per表-邮箱", maxLength = 200)
@Schema(description = "per表-邮箱")
@ExcelProperty("per表-邮箱")
private String fdEmail;
/**
* 状态:0正常;1冻结
*/
@NotBlank(message = "状态:0正常;1冻结 不能为空")
@ExcelAttribute(name = "状态:0正常;1冻结", isNotEmpty = true, errorInfo = "状态:0正常;1冻结 不能为空")
@Schema(description = "状态:0正常;1冻结")
@ExcelProperty("状态:0正常;1冻结")
private Integer status;
/**
* 角色名称合集
*/
@Length(max = 200, message = "角色名称合集 不能超过200 个字符")
@ExcelAttribute(name = "角色名称合集", maxLength = 200)
@Schema(description = "角色名称合集")
@ExcelProperty("角色名称合集")
private String roleNames;
/**
* 创建人id
*/
@Length(max = 36, message = "创建人id 不能超过36 个字符")
@ExcelAttribute(name = "创建人id", maxLength = 36)
@Schema(description = "创建人id")
@ExcelProperty("创建人id")
private String createBy;
/**
* 创建人姓名
*/
@Length(max = 200, message = "创建人姓名 不能超过200 个字符")
@ExcelAttribute(name = "创建人姓名", maxLength = 200)
@Schema(description = "创建人姓名")
@ExcelProperty("创建人姓名")
private String createName;
/**
* 创建时间
*/
@ExcelAttribute(name = "创建时间", isDate = true)
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
/**
* 更新人id
*/
@Length(max = 200, message = "更新人id 不能超过200 个字符")
@ExcelAttribute(name = "更新人id", maxLength = 200)
@Schema(description = "更新人id")
@ExcelProperty("更新人id")
private String updateBy;
/**
* 更新时间
*/
@ExcelAttribute(name = "更新时间", isDate = true)
@Schema(description = "更新时间")
@ExcelProperty("更新时间")
private LocalDateTime updateTime;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Data
public class SysUserPermissionExportVo implements Serializable {
/**
* 员工姓名
*/
@Length(max = 20, message = "员工姓名 不能超过20 个字符")
@ExcelAttribute(name = "员工姓名", maxLength = 20)
@Schema(description = "员工姓名")
@ExcelProperty("员工姓名")
private String empName;
/**
* 登录账号
*/
@NotBlank(message = "登录账号 不能为空")
@Length(max = 10, message = "登录账号 不能超过10 个字符")
@ExcelAttribute(name = "登录账号", isNotEmpty = true, errorInfo = "登录账号 不能为空", maxLength = 10)
@Schema(description = "登录账号")
@ExcelProperty("登录账号")
private String empLoginName;
/**
* 所属部门
*/
@Length(max = 20, message = "所属部门 不能超过20 个字符")
@ExcelAttribute(name = "所属部门", maxLength = 20)
@Schema(description = "所属部门")
@ExcelProperty("所属部门")
private String empDept;
/**
* 权限类型
*/
@Length(max = 8, message = "权限类型 不能超过8 个字符")
@ExcelAttribute(name = "权限类型", maxLength = 8)
@Schema(description = "权限类型")
@ExcelProperty("权限类型")
private String permissionType;
/**
* 名称
*/
@Length(max = 20, message = "名称 不能超过20 个字符")
@ExcelAttribute(name = "名称", maxLength = 20)
@Schema(description = "名称")
@ExcelProperty("名称")
private String name;
/**
* 编码
*/
@Length(max = 30, message = "编码 不能超过30 个字符")
@ExcelAttribute(name = "编码", maxLength = 30)
@Schema(description = "编码")
@ExcelProperty("编码")
private String code;
/**
* 是否包含(0 是 1否)
*/
@Length(max = 1, message = "是否含下级部门 不能超过1 个字符")
@ExcelAttribute(name = "是否含下级部门", maxLength = 1)
@Schema(description = "是否含下级部门")
@ExcelProperty("是否含下级部门")
private String isContains;
/**
* 授权状态(0启用、1禁用)
*/
@Length(max = 1, message = "授权状态 不能超过1 个字符")
@ExcelAttribute(name = "授权状态", maxLength = 1)
@Schema(description = "授权状态")
@ExcelProperty("授权状态")
private String permissionStatus;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Data
public class SysUserPermissionSearchVo extends SysUserPermission {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,数组")
private List<String> idList;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema(description = "创建时间区间")
private LocalDateTime[] createTimes;
/**
* @Author fxj
* 查询数据起
**/
@Schema(description = "查询limit 开始")
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
@Schema(description = "查询limit 数据条数")
private int limitEnd;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Data
public class SysUserPermissionVo extends RowIndex implements Serializable {
/**
* 员工姓名
*/
@Length(max = 20, message = "员工姓名 不能超过20 个字符")
@ExcelAttribute(name = "员工姓名", maxLength = 20)
@Schema(description = "员工姓名")
@ExcelProperty("员工姓名")
private String empName;
/**
* 登录账号
*/
@NotBlank(message = "登录账号 不能为空")
@Length(max = 20, message = "登录账号 不能超过20 个字符")
@ExcelAttribute(name = "登录账号", isNotEmpty = true, errorInfo = "登录账号 不能为空", maxLength = 20)
@Schema(description = "登录账号")
@ExcelProperty("登录账号")
private String empLoginName;
/**
* 用户id
*/
@Schema(description = "用户id")
@ExcelAttribute(name = "用户id")
private String userId;
/**
* 所属部门
*/
@Length(max = 20, message = "所属部门 不能超过20 个字符")
@ExcelAttribute(name = "所属部门", maxLength = 20)
@Schema(description = "所属部门")
@ExcelProperty("所属部门")
private String empDept;
/**
* 权限类型
*/
@NotBlank(message = "权限类型 不能为空")
@Length(max = 8, message = "权限类型 不能超过8 个字符")
@ExcelAttribute(name = "权限类型", isNotEmpty = true, errorInfo = "权限类型 不能为空", maxLength = 8)
@Schema(description = "权限类型")
@ExcelProperty("权限类型")
private String permissionType;
/**
* 名称
*/
@Length(max = 200, message = "名称 不能超过200 个字符")
@ExcelAttribute(name = "名称", maxLength = 200)
@Schema(description = "名称")
@ExcelProperty("名称")
private String name;
/**
* 编码
*/
@Length(max = 30, message = "编码 不能超过30 个字符")
@ExcelAttribute(name = "编码", maxLength = 30)
@Schema(description = "编码")
@ExcelProperty("编码")
private String code;
/**
* 是否包含(0 是 1否)
*/
@Length(max = 1, message = "是否含下级部门 不能超过1 个字符")
@ExcelAttribute(name = "是否含下级部门", maxLength = 1)
@Schema(description = "是否含下级部门")
@ExcelProperty("是否含下级部门")
private String isContains;
/**
* 授权状态(0启用、1禁用)
*/
@Length(max = 1, message = "授权状态 不能超过1 个字符")
@ExcelAttribute(name = "授权状态", maxLength = 1)
@Schema(description = "授权状态")
@ExcelProperty("授权状态")
private String permissionStatus;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 新权限-账号-角色关联表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Data
public class SysUserRoleResSearchVo extends SysUserRoleRes {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,多个逗号分割")
private String ids;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema(description = "创建时间区间")
private LocalDateTime[] createTimes;
/**
* @Author fxj
* 查询数据起
**/
@Schema(description = "查询limit 开始")
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
@Schema(description = "查询limit 数据条数")
private int limitEnd;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 新权限-账号-角色关联表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Data
public class SysUserRoleResVo extends RowIndex implements Serializable {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@NotBlank(message = "主键 不能为空")
@Length(max = 36, message = "主键 不能超过36 个字符")
@ExcelAttribute(name = "主键", isNotEmpty = true, errorInfo = "主键 不能为空", maxLength = 36)
@Schema(description = "主键")
@ExcelProperty("主键")
private String fdId;
/**
* 账号ID
*/
@NotBlank(message = "账号ID 不能为空")
@Length(max = 36, message = "账号ID 不能超过36 个字符")
@ExcelAttribute(name = "账号ID", isNotEmpty = true, errorInfo = "账号ID 不能为空", maxLength = 36)
@Schema(description = "账号ID")
@ExcelProperty("账号ID")
private String userId;
/**
* 角色ID
*/
@NotBlank(message = "角色ID 不能为空")
@Length(max = 36, message = "角色ID 不能超过36 个字符")
@ExcelAttribute(name = "角色ID", isNotEmpty = true, errorInfo = "角色ID 不能为空", maxLength = 36)
@Schema(description = "角色ID")
@ExcelProperty("角色ID")
private String roleId;
}
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.yifu.cloud.plus.v1.msg.utils.EkpMsgUtil
\ No newline at end of file
FROM moxm/java:1.8-full
RUN mkdir -p /yifu-permission-biz
WORKDIR yifu-permission-biz
ARG JAR_FILE=target/yifu-permission-biz.jar
COPY ${JAR_FILE} app.jar
EXPOSE 5026
ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom"
CMD sleep 60; java -jar app.jar $JAVA_OPTS
#!/usr/bin/env bash
mvn clean package -Pprd -Dmaven.test.skip=true docker:build -DpushImage
\ No newline at end of file
#!/usr/bin/env bash
mvn clean package -Ptest -Dmaven.test.skip=true docker:build -DpushImage
\ No newline at end of file
#!/usr/bin/env bash
mvn clean package -Dmaven.test.skip=true docker:build -DpushImage
\ No newline at end of file
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>yifu-permission-biz</artifactId>
<packaging>jar</packaging>
<description>EKP-权限配置</description>
<dependencies>
<!--选配: 依赖seata模块-->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-seata</artifactId>
</dependency>
<!--选配: orm 模块-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!--必备:安全模块-->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-security</artifactId>
</dependency>
<!--必备:日志处理-->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-log</artifactId>
</dependency>
<!--必备:swagger-->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-swagger</artifactId>
</dependency>
<!--必备:undertow容器-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-msg-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-permission-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.1.0</version>
<configuration>
<serverId>docker-hub</serverId>
<!--指定生成的镜像名-->
<imageName>${my.hub.host}/${map.group.name}/${project.artifactId}:${project.version}</imageName>
<dockerDirectory>${project.basedir}/</dockerDirectory>
<!--指定远程 docker api地址-->
<!--<dockerHost>http://172.16.66.232:2375</dockerHost>-->
<!-- 这里是复制 jar 包到 docker 容器指定目录配置-->
<resources>
<resource>
<targetPath>/</targetPath>
<!--jar 包所在的路径 此处配置的 即对应 target 目录-->
<directory>${project.build.directory}</directory>
<!-- 需要包含的 jar包 ,这里对应的是 Dockerfile中添加的文件名 -->
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<forceTags>true</forceTags>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.yifu.cloud.plus.v1.permission;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.EnableYifuResourceServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author pig archetype
* <p>
* 项目启动类
*/
@EnableYifuResourceServer
@SpringBootApplication
public class PermissionApplication {
public static void main(String[] args) {
SpringApplication.run(PermissionApplication.class, args);
}
}
package com.yifu.cloud.plus.v1.msg.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.web.client.RestTemplate;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @Author: huyc
* @Date: 2023/7/28
* @Description:
* @return: 企业微信配置
**/
@Configuration
@Data
@Slf4j
public class WxConfig {
@Value("${wx.corpid}")
private String corpid;
@Value("${wx.corpsecret}")
private String corpsecret;
@Value("${wx.agentid}")
private String agentid;
@Value("${wx.authUrl}")
private String authUrl;
@Autowired
private RedisTemplate redisTemplate;
//未授权
private String accossTokenInvliad = "40014";
/**
* @param
* @Author: huyc
* @Date: 2023/7/28
* @Description: 获取微信accos_token
* @return: java.lang.String
**/
public String getAccessToken(RestTemplate restTemplate) {
if (Common.isNotNull(agentid)) {
return this.getToken(restTemplate, CacheConstants.WX_ACCOSS_TOKEN.concat(agentid), corpsecret);
}
return this.getToken(restTemplate, CacheConstants.WX_ACCOSS_TOKEN, corpsecret);
}
public String getAccessToken(RestTemplate restTemplate,String corpsecret)throws AuthenticationServiceException {
if(Common.isEmpty(corpsecret)){
throw new AuthenticationServiceException("未找到对应的corpsecret请联系管理员配置");
}
return this.getToken(restTemplate, CacheConstants.WX_ACCOSS_TOKEN.concat(agentid), corpsecret);
}
/**
* @param restTemplate
* @param tokenKey
* @param corpsecretKey
* @Description: 获取token
* @Author: huyc
* @Date: 2023/7/28 14:46
* @return: java.lang.String
**/
public String getToken(RestTemplate restTemplate,String tokenKey, String corpsecretKey) {
Object wxToken = redisTemplate.opsForValue().get(tokenKey);
if (null != wxToken) {
return String.valueOf(wxToken);
}
String requestTokenUrl = String.format(SecurityConstants.WX_GET_ACCOSS_TOKEN, corpid, corpsecretKey);
String result = restTemplate.getForObject(requestTokenUrl, String.class);
if (Common.isEmpty(result)) {
throw new CheckedException("微信授权失败");
}
String token = JSON.parseObject(result).getString("access_token");
if (Common.isEmpty(token)) {
log.info(result);
throw new CheckedException("获取微信token失败");
}
redisTemplate.opsForValue().set(tokenKey, token);
redisTemplate.expire(tokenKey, 3600, TimeUnit.SECONDS);
return token;
}
/**
* @param
* @Author: huyc
* @Date: 2023/7/28 14:43
* @Description: 移除微信accossToken
* @return: java.lang.String
**/
public void removeAccessToken() {
redisTemplate.delete(CacheConstants.WX_ACCOSS_TOKEN);
}
/**
* @param restTemplate
* @param requestMap 请求内容
* @Author: huyc
* @Date: 2023/7/28 14:48
* @Description: 发送卡片消息
* @return: java.lang.String
**/
public boolean sendTextCard(RestTemplate restTemplate, Map<String, Object> requestMap) {
// 必须加上header说明
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
Gson gson = new Gson();
log.info(gson.toJson(requestMap));
HttpEntity<String> requestEntity = new HttpEntity<>(gson.toJson(requestMap), headers);
String accessToken = getAccessToken(restTemplate);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(String.format(SecurityConstants.WX_SEND_MESSAGE, accessToken), requestEntity, String.class);
log.info(JSON.toJSONString(responseEntity));
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(responseEntity));
JSONObject jsonBody = jsonObject.getJSONObject("body");
if (jsonBody != null) {
String errcode = jsonBody.getString("errcode");
if (accossTokenInvliad.equals(errcode)) {
//删除accossToken缓存
removeAccessToken();
return false;
}
if (!CommonConstants.ZERO_STRING.equals(errcode)) { //非正常,则打印错误日志
log.info(jsonObject.toJSONString());
}
} else {
log.info(jsonObject.toJSONString());
}
return true;
}
/**
* @param restTemplate
* @param requestMap 请求内容
* @Author: huyc
* @Date: 2023/7/28 14:50
* @Description: 发送卡片消息
* @return: java.lang.String
**/
public boolean sendAppTextCard(RestTemplate restTemplate, Map<String, Object> requestMap) {
// 必须加上header说明
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
Gson gson = new Gson();
log.info("发企业微信===请求:{}", gson.toJson(requestMap));
HttpEntity<String> requestEntity = new HttpEntity<>(gson.toJson(requestMap), headers);
String accessToken = getAppAccessToken(restTemplate);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(String.format(SecurityConstants.WX_SEND_MESSAGE, accessToken), requestEntity, String.class);
log.info("发企业微信===返回:{}",JSON.toJSONString(responseEntity));
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(responseEntity));
JSONObject jsonBody = jsonObject.getJSONObject("body");
if (jsonBody != null) {
String errcode = jsonBody.getString("errcode");
if (accossTokenInvliad.equals(errcode)) {
//删除accossToken缓存
removeAccessToken();
return false;
}
if (!CommonConstants.ZERO_STRING.equals(errcode)) { //非正常,则打印错误日志
log.info(jsonObject.toJSONString());
}
} else {
log.info(jsonObject.toJSONString());
}
return true;
}
/**
* 功能描述: 获取微信accos_token
* @Author: huyc
* @Date: 2023/7/28 14:50
* @return: java.lang.String
*/
public String getAppAccessToken(RestTemplate restTemplate) {
return this.getToken(restTemplate, CacheConstants.WX_ACCOSS_TOKEN, corpsecret);
}
}
package com.yifu.cloud.plus.v1.permission.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.permission.service.SysMenuService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
/**
* 新权限-菜单表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/sysmenu")
@Tag(name = "新权限-菜单表管理")
public class SysMenuController {
private final SysMenuService sysMenuService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param sysMenu 新权限-菜单表
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<SysMenu>> getSysMenuPage(Page<SysMenu> page, SysMenuSearchVo sysMenu) {
return new R<>(sysMenuService.getSysMenuPage(page, sysMenu));
}
/**
* 新增新权限-菜单表
*
* @param sysMenu 新权限-菜单表
* @return R
*/
@Operation(description = "新增新权限-菜单表:hasPermission('permission_sysmenu_add')")
@SysLog("新增新权限-菜单表")
@PostMapping("/addMenu")
@PreAuthorize("@pms.hasPermission('permission_sysmenu_add')")
public R<Boolean> save(@RequestBody SysMenu sysMenu) {
return sysMenuService.saveMenu(sysMenu);
}
/**
* 修改新权限-菜单表
*
* @param sysMenu 新权限-菜单表
* @return R
*/
@Operation(description = "修改新权限-菜单表:hasPermission('permission_sysmenu_edit')")
@SysLog("修改新权限-菜单表")
@PostMapping("/updateMenu")
@PreAuthorize("@pms.hasPermission('permission_sysmenu_edit')")
public R<Boolean> updateById(@RequestBody SysMenu sysMenu) {
return sysMenuService.updateMenu(sysMenu);
}
/**
* 修改新权限-菜单表
*
* @param sysMenu 新权限-菜单表
* @return R
*/
@Operation(description = "修改新权限-菜单表:hasPermission('permission_sysmenu_edit')")
@SysLog("修改新权限-菜单表")
@PostMapping("/updateMenuById")
@PreAuthorize("@pms.hasPermission('permission_sysmenu_edit')")
public R<Boolean> updateMenu(@RequestBody SysMenu sysMenu) {
return new R<>(sysMenuService.updateById(sysMenu));
}
/**
* 通过id查询新权限-菜单表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
public R<SysMenu> getById(@PathVariable("id") String id) {
return R.ok(sysMenuService.getById(id));
}
}
package com.yifu.cloud.plus.v1.permission.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.permission.service.SysRoleInfoService;
import com.yifu.cloud.plus.v1.permission.service.SysUserRoleResService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleInfo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysRoleInfoSaveVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysRoleInfoSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 新权限-角色表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/sysroleinfo")
@Tag(name = "新权限-角色表管理")
public class SysRoleInfoController {
private final SysRoleInfoService sysRoleInfoService;
private final SysUserRoleResService sysUserRoleResService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param sysRoleInfo 新权限-角色表
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<SysRoleInfo>> getSysRoleInfoPage(Page<SysRoleInfo> page, SysRoleInfoSearchVo sysRoleInfo) {
return new R<>(sysRoleInfoService.getSysRoleInfoPage(page, sysRoleInfo));
}
/**
* 不分页查询
*
* @param sysRoleInfo 新权限-角色表
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage")
//@PreAuthorize("@pms.hasPermission('ekp_sysroleinfo_get')" )
public R<List<SysRoleInfo>> getSysRoleInfoNoPage(@RequestBody SysRoleInfoSearchVo sysRoleInfo) {
return R.ok(sysRoleInfoService.noPageDiy(sysRoleInfo));
}
/**
* 通过id查询新权限-角色表
*
* @param fdId id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{fdId}")
public R<SysRoleInfoSaveVo> getById(@PathVariable("fdId") String fdId) {
return sysRoleInfoService.getInfoById(fdId);
}
/**
* @param roleIdList 角色列表
* @Description: 给前端使用:根据角色id组合获取角色权限
* @Author: hgw
* @Date: 2023/9/8 9:29
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo>
**/
@Operation(summary = "给前端使用:根据角色id组合获取角色权限", description = "给前端使用:根据角色id组合获取角色权限")
@PostMapping("/getRoleDataAuthByRoleId")
public R<String> getRoleDataAuthByRoleId(@RequestBody List<String> roleIdList) {
return R.ok(sysRoleInfoService.getRoleDataAuthByRoleId(roleIdList));
}
/**
* 新增新权限-角色表
*
* @param vo 新权限-角色表
* @return R
*/
@Operation(summary = "新增或编辑新权限-角色表", description = "新增或保存新权限-角色表:hasPermission('ekp_sysroleinfo_add')")
@SysLog("新增或编辑新权限-角色表")
@PostMapping
@PreAuthorize("@pms.hasPermission('ekp_sysroleinfo_add')")
public R<String> saveOrUpdateRoleInfo(@RequestBody SysRoleInfoSaveVo vo) {
return sysRoleInfoService.saveOrUpdateRoleInfo(vo);
}
/**
* 修改新权限-角色表
*
* @param sysRoleInfo 新权限-角色表
* @return R
*/
@Operation(summary = "修改新权限-角色表(可以修改状态)", description = "修改新权限-角色表:hasPermission('ekp_sysroleinfo_edit')")
@SysLog("修改新权限-角色表")
@PutMapping
@PreAuthorize("@pms.hasPermission('ekp_sysroleinfo_edit')")
public R<Boolean> updateById(@RequestBody SysRoleInfo sysRoleInfo) {
return R.ok(sysRoleInfoService.updateById(sysRoleInfo));
}
/**
* 通过id删除新权限-角色表
*
* @param fdId id
* @return R
*/
@Operation(summary = "通过id删除新权限-角色表-假删除", description = "通过id删除新权限-角色表:hasPermission('ekp_sysroleinfo_del')")
@SysLog("通过id删除新权限-角色表")
@DeleteMapping("/{fdId}")
@PreAuthorize("@pms.hasPermission('ekp_sysroleinfo_del')")
public R<Boolean> removeById(@PathVariable String fdId) {
SysRoleInfo roleInfo = sysRoleInfoService.getById(fdId);
if (roleInfo == null || Common.isEmpty(roleInfo.getFdId()) || Common.isEmpty(roleInfo.getRoleName())) {
return R.failed("未找到角色");
}
// 删除关联表
sysUserRoleResService.deleteByRoleId(fdId);
// 假删除角色表
roleInfo.setDeleteFlag(CommonConstants.ONE_INT);
sysRoleInfoService.updateById(roleInfo);
return R.ok();
}
/**
* 通过id删除新权限-角色表
*
* @param fdId id
* @return R
*/
@Operation(summary = "冻结-角色表", description = "冻结-角色表:hasPermission('ekp_sysroleinfo_freeze')")
@SysLog("冻结-角色表")
@PostMapping("/freezeById")
@PreAuthorize("@pms.hasPermission('ekp_sysroleinfo_freeze')")
public R<Boolean> freezeById(@RequestParam String fdId) {
SysRoleInfo roleInfo = sysRoleInfoService.getById(fdId);
if (roleInfo == null || Common.isEmpty(roleInfo.getFdId()) || Common.isEmpty(roleInfo.getRoleName())) {
return R.failed("未找到角色");
}
// 删除关联表
sysUserRoleResService.deleteByRoleId(fdId);
// 冻结角色表
roleInfo.setStatus(CommonConstants.ONE_INT);
sysRoleInfoService.updateById(roleInfo);
return R.ok();
}
}
package com.yifu.cloud.plus.v1.permission.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.permission.service.SysRoleMenuResService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleMenuRes;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysRoleMenuResSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 新权限-角色-菜单-关联表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/sysrolemenures")
@Tag(name = "新权限-角色-菜单-关联表管理")
public class SysRoleMenuResController {
private final SysRoleMenuResService sysRoleMenuResService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param sysRoleMenuRes 新权限-角色-菜单-关联表
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<SysRoleMenuRes>> getSysRoleMenuResPage(Page<SysRoleMenuRes> page, SysRoleMenuResSearchVo sysRoleMenuRes) {
return new R<>(sysRoleMenuResService.getSysRoleMenuResPage(page, sysRoleMenuRes));
}
/**
* 不分页查询
*
* @param sysRoleMenuRes 新权限-角色-菜单-关联表
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage")
public R<List<SysRoleMenuRes>> getSysRoleMenuResNoPage(@RequestBody SysRoleMenuResSearchVo sysRoleMenuRes) {
return R.ok(sysRoleMenuResService.noPageDiy(sysRoleMenuRes));
}
/**
* 通过id查询新权限-角色-菜单-关联表
*
* @param fdId id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('ekp_sysrolemenures_get')")
@GetMapping("/{fdId}")
@PreAuthorize("@pms.hasPermission('ekp_sysrolemenures_get')")
public R<SysRoleMenuRes> getById(@PathVariable("fdId") String fdId) {
return R.ok(sysRoleMenuResService.getById(fdId));
}
}
package com.yifu.cloud.plus.v1.permission.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.permission.service.SysUserInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 新权限-账号管理表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/sysuserinfo")
@Tag(name = "新权限-账号管理表管理")
public class SysUserInfoController {
private final SysUserInfoService sysUserInfoService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param sysUserInfo 新权限-账号管理表
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<SysUserInfo>> getSysUserInfoPage(Page<SysUserInfo> page, SysUserInfoSearchVo sysUserInfo) {
return new R<>(sysUserInfoService.getSysUserInfoPage(page, sysUserInfo));
}
/**
* 不分页查询
*
* @param sysUserInfo 新权限-账号管理表
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage")
//@PreAuthorize("@pms.hasPermission('ekp_sysuserinfo_get')" )
public R<List<SysUserInfo>> getSysUserInfoNoPage(@RequestBody SysUserInfoSearchVo sysUserInfo) {
return R.ok(sysUserInfoService.noPageDiy(sysUserInfo));
}
/**
* 通过id查询新权限-账号管理表
*
* @param fdId id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{fdId}")
public R<SysUserInfoSaveVo> getById(@PathVariable("fdId") String fdId) {
return sysUserInfoService.getInfoById(fdId);
}
/**
* 新增新权限-账号管理表
*
* @param vo 新权限-账号管理表
* @return R
*/
@Operation(summary = "新增或编辑新权限-账号管理表", description = "新增或编辑新权限-账号管理表:hasPermission('ekp_sysuserinfo_add')")
@SysLog("新增或编辑新权限-账号管理表")
@PostMapping
@PreAuthorize("@pms.hasPermission('ekp_sysuserinfo_add')")
public R<String> saveOrUpdateUserInfo(@RequestBody SysUserInfoSaveVo vo) {
return sysUserInfoService.saveOrUpdateUserInfo(vo);
}
/**
* 修改新权限-账号管理表
*
* @param sysUserInfo 新权限-账号管理表
* @return R
*/
@Operation(summary = "修改新权限-账号管理表", description = "修改新权限-账号管理表:hasPermission('ekp_sysuserinfo_edit')")
@SysLog("修改新权限-账号管理表")
@PutMapping
@PreAuthorize("@pms.hasPermission('ekp_sysuserinfo_edit')")
public R<Boolean> updateById(@RequestBody SysUserInfo sysUserInfo) {
return R.ok(sysUserInfoService.updateById(sysUserInfo));
}
/**
* 通过id删除新权限-账号管理表
*
* @param fdId id
* @return R
*/
@Operation(summary = "通过id删除新权限-账号管理表", description = "通过id删除新权限-账号管理表:hasPermission('ekp_sysuserinfo_del')")
@SysLog("通过id删除新权限-账号管理表")
@DeleteMapping("/{fdId}")
@PreAuthorize("@pms.hasPermission('ekp_sysuserinfo_del')")
public R<Boolean> removeById(@PathVariable String fdId) {
return R.ok(sysUserInfoService.removeById(fdId));
}
/**
* @Description: 手动同步并更新账号信息
* @Author: hgw
* @Date: 2023/9/5 16:14
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "手动同步并更新账号信息", description = "手动同步并更新账号信息")
@SysLog("手动同步并更新账号信息")
@PostMapping("/startRefreshEkpUser")
public R<String> startRefreshEkpUser() {
sysUserInfoService.doRefreshEkpUser();
return R.ok();
}
/**
* @param
* @Description: 定时任务-自动同步并更新账号信息
* @Author: hgw
* @Date: 2023/9/4 16:07
* @return: void
**/
@Inner
@Operation(description = "定时任务-自动同步并更新账号信息")
@PostMapping("/inner/doRefreshEkpUser")
public void doRefreshEkpUser() {
sysUserInfoService.doRefreshEkpUser();
}
/**
* @Description: 手动同步并更新账号信息
* @Author: hgw
* @Date: 2023/9/5 16:14
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "测试权限sql", description = "测试权限sql")
@SysLog("测试权限sql")
@PostMapping("/testPermission")
public R<String> testPermission(@RequestParam String modelId, @RequestParam(required = false) String userId) {
return R.ok(sysUserInfoService.testPermission(modelId, userId));
}
/**
* 简单分页查询
* hyc 2023-9-11 15:25:50
* @param page 分页对象
* @param name 新权限-账号管理表
* @return
*/
@Operation(description = "根据编码或者登录名简单分页查询")
@GetMapping("/getUserByCodeOrLoginName")
public R<IPage<SysUserInfo>> getUserByCodeOrLoginName(Page<SysUserInfo> page, String name) {
return new R<>(sysUserInfoService.getUserByCodeOrLoginName(page, name));
}
}
package com.yifu.cloud.plus.v1.permission.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.permission.service.SysUserPermissionService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import com.yifu.cloud.plus.v1.yifu.permission.vo.IdTypeEkpVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.List;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/sysuserpermission")
@Tag(name = "用户权限表管理")
public class SysUserPermissionController {
private final SysUserPermissionService sysUserPermissionService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param sysUserPermission 新权限-用户权限表
* @return
*/
@Operation(summary = "简单分页查询",description = "简单分页查询")
@GetMapping("/page")
public R<IPage<SysUserPermission>> getSysUserPermissionPage(Page<SysUserPermission> page, SysUserPermissionSearchVo sysUserPermission) {
return new R<>(sysUserPermissionService.getSysUserPermissionPage(page, sysUserPermission));
}
/**
* 通过id查询新权限-用户权限表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
public R<SysUserPermission> getById(@PathVariable("id") String id) {
return R.ok(sysUserPermissionService.getById(id));
}
/**
* 新增新权限-用户权限表
*
* @param sysUserPermission 新权限-用户权限表
* @return R
*/
@Operation(summary = "新增用户权限表",description = "新增用户权限表:hasPermission('permission_sysuserpermission_add')")
@SysLog("新增用户权限表")
@PostMapping("/savePermission")
@PreAuthorize("@pms.hasPermission('permission_sysuserpermission_add')")
public R save(@RequestBody SysUserPermission sysUserPermission) {
return sysUserPermissionService.savePermission(sysUserPermission);
}
/**
* 修改新权限-用户权限表
*
* @param sysUserPermissionList 用户权限表list
* @return R
*/
@Operation(summary = "修改用户权限表",description = "修改用户权限表:hasPermission('permission_sysuserpermission_edit')")
@SysLog("修改用户权限表")
@PostMapping("/updatePermission")
@PreAuthorize("@pms.hasPermission('permission_sysuserpermission_edit')")
public R<Boolean> updateById(@RequestBody List<SysUserPermission> sysUserPermissionList) {
for (SysUserPermission permission : sysUserPermissionList) {
sysUserPermissionService.updateById(permission);
}
return R.ok();
}
/**
* 通过id删除新权限-用户权限表
*
* @param idList
* @return R
*/
@Operation(summary = "通过id删除用户权限表",description = "通过id删除用户权限表:hasPermission('permission_sysuserpermission_del')")
@SysLog("通过id删除用户权限表")
@PostMapping("/deleteByIds")
@PreAuthorize("@pms.hasPermission('permission_sysuserpermission_del')")
public R<Boolean> removeById(@RequestBody List<String> idList) {
return R.ok(sysUserPermissionService.removeBatchByIds(idList));
}
/**
* 新权限-用户权限表 批量导入
*
* @author hyc
* @date 2023-08-29 14:49:40
**/
@SneakyThrows
@Operation(summary = "批量新增用户权限表",description = "批量新增用户权限表 hasPermission('permission_sysuserpermission-batch-import')")
@SysLog("批量新增用户权限表")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('permission_sysuserpermission-batch-import')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) {
return sysUserPermissionService.importDiy(file.getInputStream());
}
/**
* 新权限-用户权限表 批量导出
*
* @author hyc
* @date 2023-08-29 14:49:40
**/
@Operation(summary = "导出用户权限表",description = "导出用户权限表")
@PostMapping("/export")
@SysLog("批量导出用户权限表")
public void export(HttpServletResponse response, @RequestBody SysUserPermissionSearchVo searchVo) {
sysUserPermissionService.listExport(response, searchVo);
}
/**
* 名称,编码模糊搜索
*
* @param page 分页对象
* @param searchVo 新权限-用户权限表
* @return
*/
@Operation(summary = "根据名称,编码模糊搜索",description = "根据名称,编码模糊搜索")
@GetMapping("/customerPage")
public R<IPage<SysUserDeptVo>> getNameCodePage(Page<SysUserDeptVo> page, SysUserDeptVo searchVo) {
return new R<>(sysUserPermissionService.getNameCodePage(page,searchVo));
}
/**
* 根据类型查询字典值
*
* @param type 字典类型
* @return
*/
@Operation(summary = "根据类型查询字典值",description = "根据类型查询字典值")
@PostMapping("/selectDictByType")
public R<List<SysDictVo>> selectDictByType(@RequestParam String type) {
return new R<>(sysUserPermissionService.selectDictByType(type));
}
/**
* 修改项目表--EKP调用接口
* @author hyc
* @param jsonStr 项目表
* @return R
*/
@Operation(summary = "自动同步权限--EKP调用接口", description = "自动同步权限--EKP调用接口")
@SysLog("自动同步权限--EKP调用接口")
@PostMapping("/autoCreateAuth")
public R<String> autoCreateAuth(@RequestBody String jsonStr) {
try {
jsonStr = URLDecoder.decode(jsonStr, CommonConstants.UTF8).replace("=", "");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
List<IdTypeEkpVo> list= JSONObject.parseArray(jsonStr, IdTypeEkpVo.class);
if (list != null && !list.isEmpty()) {
return sysUserPermissionService.autoCreateAuth(list.get(0));
}
return R.failed("自动同步权限错误-无参数");
}
}
package com.yifu.cloud.plus.v1.permission.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.permission.service.SysUserRoleResService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserRoleResSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 新权限-账号-角色关联表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/sysuserroleres")
@Tag(name = "新权限-账号-角色关联表管理")
public class SysUserRoleResController {
private final SysUserRoleResService sysUserRoleResService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param sysUserRoleRes 新权限-账号-角色关联表
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<SysUserRoleRes>> getSysUserRoleResPage(Page<SysUserRoleRes> page, SysUserRoleResSearchVo sysUserRoleRes) {
return new R<>(sysUserRoleResService.getSysUserRoleResPage(page, sysUserRoleRes));
}
/**
* 不分页查询
*
* @param sysUserRoleRes 新权限-账号-角色关联表
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage")
public R<List<SysUserRoleRes>> getSysUserRoleResNoPage(@RequestBody SysUserRoleResSearchVo sysUserRoleRes) {
return R.ok(sysUserRoleResService.noPageDiy(sysUserRoleRes));
}
/**
* 根据角色id获取被使用的账号名称
* @return
*/
@Operation(summary = "根据角色id获取被使用的账号名称", description = "根据角色id获取被使用的账号名称")
@GetMapping("/getSysUserByRoleId")
public R<List<String>> getSysUserByRoleId(@RequestParam String roleId) {
return R.ok(sysUserRoleResService.getSysUserByRoleId(roleId));
}
/**
* 通过id查询新权限-账号-角色关联表
*
* @param fdId id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('ekp_sysuserroleres_get')")
@GetMapping("/{fdId}")
@PreAuthorize("@pms.hasPermission('ekp_sysuserroleres_get')")
public R<SysUserRoleRes> getById(@PathVariable("fdId") String fdId) {
return R.ok(sysUserRoleResService.getById(fdId));
}
/**
* 新增新权限-账号-角色关联表
*
* @param sysUserRoleRes 新权限-账号-角色关联表
* @return R
*/
@Operation(summary = "新增新权限-账号-角色关联表", description = "新增新权限-账号-角色关联表:hasPermission('ekp_sysuserroleres_add')")
@SysLog("新增新权限-账号-角色关联表")
@PostMapping
@PreAuthorize("@pms.hasPermission('ekp_sysuserroleres_add')")
public R<Boolean> save(@RequestBody SysUserRoleRes sysUserRoleRes) {
return R.ok(sysUserRoleResService.save(sysUserRoleRes));
}
/**
* 修改新权限-账号-角色关联表
*
* @param sysUserRoleRes 新权限-账号-角色关联表
* @return R
*/
@Operation(summary = "修改新权限-账号-角色关联表", description = "修改新权限-账号-角色关联表:hasPermission('ekp_sysuserroleres_edit')")
@SysLog("修改新权限-账号-角色关联表")
@PutMapping
@PreAuthorize("@pms.hasPermission('ekp_sysuserroleres_edit')")
public R<Boolean> updateById(@RequestBody SysUserRoleRes sysUserRoleRes) {
return R.ok(sysUserRoleResService.updateById(sysUserRoleRes));
}
/**
* 通过id删除新权限-账号-角色关联表
*
* @param fdId id
* @return R
*/
@Operation(summary = "通过id删除新权限-账号-角色关联表", description = "通过id删除新权限-账号-角色关联表:hasPermission('ekp_sysuserroleres_del')")
@SysLog("通过id删除新权限-账号-角色关联表")
@DeleteMapping("/{fdId}")
@PreAuthorize("@pms.hasPermission('ekp_sysuserroleres_del')")
public R<Boolean> removeById(@PathVariable String fdId) {
return R.ok(sysUserRoleResService.removeById(fdId));
}
}
package com.yifu.cloud.plus.v1.permission.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface SysMenuMapper extends BaseMapper<SysMenu> {
/**
* 新权限-菜单表简单分页查询
*
* @param sysMenu 新权限-菜单表
* @Author: huyc
* @Date: 2023/8/29 14:19
* @return
*/
IPage<SysMenu> getSysMenuPage(Page<SysMenu> page, @Param("sysMenu") SysMenuSearchVo sysMenu);
/**
* 判断是否存在此菜单
*
* @param modelId 表单id
* @Author: huyc
* @Date: 2023/8/30 14:20
* @return
*/
long selectMenuId(@Param("modelId") String modelId);
/**
* 判断是否存在此菜单视图
*
* @param modelId 表单id
* @Author: huyc
* @Date: 2023/8/30 14:20
* @return
*/
long selectViewId(@Param("viewId") String viewId,@Param("modelId") String modelId);
/**
* 判断是否存在此字段
*
* @param modelId 表单id
* @Author: huyc
* @Date: 2023/8/30 14:41
* @return
*/
List<String> selectColumnList(@Param("modelId") String modelId);
/**
* @param modelId
* @Description: 根据modelId获取菜单
* @Author: hgw
* @Date: 2023/9/11 11:48
* @return: com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu
**/
SysMenu getSysMenuByModelId(@Param("modelId") String modelId);
}
package com.yifu.cloud.plus.v1.permission.mapper;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleInfo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysRoleInfoSearchVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 新权限-角色表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Mapper
public interface SysRoleInfoMapper extends BaseMapper<SysRoleInfo> {
/**
* 新权限-角色表简单分页查询
*
* @param sysRoleInfo 新权限-角色表
* @return
*/
IPage<SysRoleInfo> getSysRoleInfoPage(Page<SysRoleInfo> page, @Param("sysRoleInfo") SysRoleInfoSearchVo sysRoleInfo);
/**
* @Description: 给前端使用:根据角色id组合获取角色权限
* @Author: hgw
* @Date: 2023/9/8 9:21
* @return: java.util.List<java.lang.String>
**/
List<String> getRoleDataAuthByRoleId(@Param("roleIdList") List<String> roleIdList);
/**
* @param userId
* @Description: 获取账号的所有权限
* @Author: hgw
* @Date: 2023/9/8 9:22
* @return: java.util.List<java.lang.String>
**/
List<String> getAllRoleDataAuthByUserId(@Param("userId") String userId);
/**
* @param roleName
* @param roleId
* @Description: 查找名称是否存在
* @Author: hgw
* @Date: 2023/9/8 9:22
* @return: int
**/
int checkExistenceRole(@Param("roleName") String roleName, @Param("roleId") String roleId);
}
package com.yifu.cloud.plus.v1.permission.mapper;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleMenuRes;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 新权限-角色-菜单-关联表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Mapper
public interface SysRoleMenuResMapper extends BaseMapper<SysRoleMenuRes> {
/**
* 新权限-角色-菜单-关联表简单分页查询
*
* @param sysRoleMenuRes 新权限-角色-菜单-关联表
* @return
*/
IPage<SysRoleMenuRes> getSysRoleMenuResPage(Page<SysRoleMenuRes> page, @Param("sysRoleMenuRes") SysRoleMenuRes sysRoleMenuRes);
/**
* @param roleId
* @Description: 根据角色删除关联表
* @Author: hgw
* @Date: 2023/8/30 15:19
* @return: boolean
**/
boolean deleteByRoleId(@Param("roleId") String roleId);
}
package com.yifu.cloud.plus.v1.permission.mapper;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 新权限-账号管理表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Mapper
public interface SysUserInfoMapper extends BaseMapper<SysUserInfo> {
/**
* 新权限-账号管理表简单分页查询
*
* @param sysUserInfo 新权限-账号管理表
* @return
*/
IPage<SysUserInfo> getSysUserInfoPage(Page<SysUserInfo> page, @Param("sysUserInfo") SysUserInfo sysUserInfo);
/**
* @param
* @Description: 获取EKP全部账号
* @Author: hgw
* @Date: 2023/9/4 11:32
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo>
**/
List<SysUserInfo> getEkpUser();
List<SysUserRoleRes> getResAndRoleNameUserId(@Param("userId") String userId);
/**
* @Description: 获取列表是否全量的权限
* @Author: hgw
* @Date: 2023/9/8 17:00
* @return: java.lang.int
**/
int getAuthByUserIdAndModelId(@Param("modelId") String modelId, @Param("userId") String userId);
/**
* @Description: 根据编码或者登录名简单分页查询
* @Author: huyc
* @Date: 2023/9/11 10:00
* @return:
**/
IPage<SysUserInfo> getUserByCodeOrLoginName(Page<SysUserInfo> page, @Param("code") String code);
}
package com.yifu.cloud.plus.v1.permission.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionExportVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionSearchVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Mapper
public interface SysUserPermissionMapper extends BaseMapper<SysUserPermission> {
/**
* 新权限-用户权限表简单分页查询
*
* @param sysUserPermission 新权限-用户权限表
* @return
*/
IPage<SysUserPermission> getSysUserPermissionPage(Page<SysUserPermission> page, @Param("sysUserPermission") SysUserPermissionSearchVo sysUserPermission);
/**
* 导出查询数量
*
* @param sysUserPermission 新权限-用户权限表
* @return
*/
long userSelectCount(@Param("sysUserPermission") SysUserPermissionSearchVo sysUserPermission);
/**
* 查询导出数据
*
* @param sysUserPermission 新权限-用户权限表
* @return
*/
List<SysUserPermissionExportVo> userSelectList(@Param("sysUserPermission") SysUserPermissionSearchVo sysUserPermission);
/**
* 根据名称或者编码查询数据
* 单位权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectUnitVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据名称或者编码查询数据
* 合同权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectContractVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据名称或者编码查询数据
* 合同权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectContractSimpleVO(Page<SysUserDeptVo> page, @Param("loginName") String loginName, @Param("name") String name, @Param("type") String type);
/**
* 根据名称或者编码查询数据
* 项目权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectSettleVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据名部门编码查询id
* 部门权限
* @param code 编码
* @return
*/
String selectSettleByCode(@Param("code") String code);
/**
* 根据名称或者编码查询数据
* 商机权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectBusinessVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据名称或者编码查询数据
* 报价单权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectQuotationVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据名称或者编码查询数据
* 部门&&收入归属权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectDeptVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据类型查询字典值
*
* @param type 类型
* @return
*/
List<SysDictVo> selectDictByType(@Param("type") String type);
/**
* 根据类型查询字典值
*
* @param type 类型
* @return
*/
List<SysDictVo> selectDictByTypeOne(@Param("type") String type,@Param("userId") String userId);
/**
* 根据类型和名称判断字典值是否存在
*
* @param type 类型
* @return
*/
Integer selectDictByName(@Param("name") String name,@Param("type") String type);
/**
* 根据名称或者编码查询数据
* 单位权限
* @param name 名称
* @return
*/
Integer selectUnitCount(@Param("name") String name);
/**
* 根据名称或者编码查询数据
* 合同权限
* @param name 名称
* @return
*/
Integer selectContractCount(@Param("name") String name);
/**
* 根据名称或者编码查询数据
* 项目权限
* @param name 名称
* @return
*/
Integer selectSettleCount(@Param("name") String name);
/**
* 根据名称或者编码查询数据
* 商机权限
* @param name 名称
* @return
*/
Integer selectBusinessCount(@Param("name") String name);
/**
* 根据名称或者编码查询数据
* 报价单权限
* @param name 名称
* @return
*/
Integer selectQuotationCount(@Param("name") String name);
/**
* 根据名称或者编码查询数据
* 部门&&收入归属权限
* @param name 名称
* @return
*/
Integer selectDeptCount(@Param("name") String name);
/**
* @param userId
* @Description: 查找当前用户的所有权限
* @Author: hgw
* @Date: 2023/9/11 11:44
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission>
**/
List<SysUserPermission> getUserPermissionByUserId(@Param("userId") String userId);
List<SysUserPermission> getUserPermissionByAutoCreateKH(@Param("fdId") String fdId);
List<SysUserPermission> getUserPermissionByAutoCreateSJ(@Param("fdId") String fdId);
List<SysUserPermission> getUserPermissionByAutoCreateBJD(@Param("fdId") String fdId);
List<SysUserPermission> getUserPermissionByAutoCreateHT(@Param("fdId") String fdId);
List<SysUserPermission> getUserPermissionByAutoCreateXM(@Param("fdId") String fdId);
List<SysUserPermission> getUserPermissionByAutoCreateHTBG(@Param("fdId") String fdId);
List<SysUserPermission> getUserPermissionByAutoCreateXMBG(@Param("fdId") String fdId);
String selectCodeByFdId(@Param("fdId") String fdId);
void deleteUserPermissionByIdAndType(@Param("code") String code, @Param("permissionType") String permissionType);
}
package com.yifu.cloud.plus.v1.permission.mapper;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 新权限-账号-角色关联表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Mapper
public interface SysUserRoleResMapper extends BaseMapper<SysUserRoleRes> {
/**
* 新权限-账号-角色关联表简单分页查询
*
* @param sysUserRoleRes 新权限-账号-角色关联表
* @return
*/
IPage<SysUserRoleRes> getSysUserRoleResPage(Page<SysUserRoleRes> page, @Param("sysUserRoleRes") SysUserRoleRes sysUserRoleRes);
/**
* @param roleId
* @Description: 根据角色id获取被使用的账号名称
* @Author: hgw
* @Date: 2023/9/8 17:38
* @return: java.util.List<java.lang.String>
**/
List<String> getSysUserByRoleId(@Param("roleId") String roleId);
boolean deleteByUserId(@Param("userId") String userId);
boolean deleteByRoleId(@Param("roleId") String roleId);
}
package com.yifu.cloud.plus.v1.permission.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo;
/**
* 新权限-菜单表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
public interface SysMenuService extends IService<SysMenu> {
/**
* 新权限-菜单表简单分页查询
* @param sysMenu 新权限-菜单表
* @return
*/
IPage<SysMenu> getSysMenuPage(Page<SysMenu> page, SysMenuSearchVo sysMenu);
/**
* 新增菜单表
* @param menu 新权限-菜单表
* @return
*/
R<Boolean> saveMenu(SysMenu menu);
/**
* 更新菜单表
* @param menu 新权限-菜单表
* @return
*/
R<Boolean> updateMenu(SysMenu menu);
}
package com.yifu.cloud.plus.v1.permission.service;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleInfo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysRoleInfoSaveVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysRoleInfoSearchVo;
import java.util.List;
/**
* 新权限-角色表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
public interface SysRoleInfoService extends IService<SysRoleInfo> {
/**
* 新权限-角色表简单分页查询
*
* @param sysRoleInfo 新权限-角色表
* @return
*/
IPage<SysRoleInfo> getSysRoleInfoPage(Page<SysRoleInfo> page, SysRoleInfoSearchVo sysRoleInfo);
/**
* @param fdId
* @Description: 查看
* @Author: hgw
* @Date: 2023/8/30 15:10
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.permission.vo.SysRoleInfoSaveVo>
**/
R<SysRoleInfoSaveVo> getInfoById(String fdId);
/**
* @param vo
* @Description: 新增或编辑新权限-角色表
* @Author: hgw
* @Date: 2023/8/30 15:10
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
R<String> saveOrUpdateRoleInfo(SysRoleInfoSaveVo vo);
List<SysRoleInfo> noPageDiy(SysRoleInfoSearchVo searchVo);
/**
* @param userId
* @Description: 各种角色的权限融合
* @Author: hgw
* @Date: 2023/8/30 18:06
* @return: java.lang.String
**/
String getAllRoleDataAuthByUserId(String userId);
/**
* @param roleIdList
* @Description: 给前端使用:根据角色id组合获取角色权限
* @Author: hgw
* @Date: 2023/9/8 9:25
* @return: java.lang.String
**/
String getRoleDataAuthByRoleId(List<String> roleIdList);
}
package com.yifu.cloud.plus.v1.permission.service;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleMenuRes;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysRoleMenuResSearchVo;
import java.util.List;
/**
* 新权限-角色-菜单-关联表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
public interface SysRoleMenuResService extends IService<SysRoleMenuRes> {
/**
* 新权限-角色-菜单-关联表简单分页查询
*
* @param sysRoleMenuRes 新权限-角色-菜单-关联表
* @return
*/
IPage<SysRoleMenuRes> getSysRoleMenuResPage(Page<SysRoleMenuRes> page, SysRoleMenuResSearchVo sysRoleMenuRes);
List<SysRoleMenuRes> noPageDiy(SysRoleMenuResSearchVo searchVo);
/**
* @param roleId
* @Description: 根据角色删除关联表
* @Author: hgw
* @Date: 2023/8/30 15:19
* @return: boolean
**/
boolean deleteByRoleId(String roleId);
}
package com.yifu.cloud.plus.v1.permission.service;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSearchVo;
import java.util.List;
/**
* 新权限-账号管理表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
public interface SysUserInfoService extends IService<SysUserInfo> {
/**
* 新权限-账号管理表简单分页查询
*
* @param sysUserInfo 新权限-账号管理表
* @return
*/
IPage<SysUserInfo> getSysUserInfoPage(Page<SysUserInfo> page, SysUserInfoSearchVo sysUserInfo);
List<SysUserInfo> noPageDiy(SysUserInfoSearchVo searchVo);
/**
* @param fdId
* @Description: 查看
* @Author: hgw
* @Date: 2023/8/30 15:10
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo>
**/
R<SysUserInfoSaveVo> getInfoById(String fdId);
/**
* @param vo
* @Description: 新增或编辑新权限-账号表
* @Author: hgw
* @Date: 2023/8/30 15:10
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
R<String> saveOrUpdateUserInfo(SysUserInfoSaveVo vo);
/**
* @param
* @Description: 同步并更新账号信息
* @Author: hgw
* @Date: 2023/9/4 11:30
* @return: void
**/
void doRefreshEkpUser();
/**
* @Description: 给EKP用的,获取权限
* @Author: hgw
* @Date: 2023/9/8 16:35
* @return: java.lang.String
**/
String testPermission(String modelId, String userId);
IPage<SysUserInfo> getUserByCodeOrLoginName(Page<SysUserInfo> page, String code);
}
package com.yifu.cloud.plus.v1.permission.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import com.yifu.cloud.plus.v1.yifu.permission.vo.IdTypeEkpVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionSearchVo;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
public interface SysUserPermissionService extends IService<SysUserPermission> {
/**
* 新权限-用户权限表简单分页查询
* @param sysUserPermission 新权限-用户权限表
* @return
*/
IPage<SysUserPermission> getSysUserPermissionPage(Page<SysUserPermission> page, SysUserPermissionSearchVo sysUserPermission);
/**
* 新增权限
* @param sysUserPermission 新权限-用户权限表
*/
R savePermission(SysUserPermission sysUserPermission);
R<List<ErrorMessage>> importDiy(InputStream inputStream);
void listExport(HttpServletResponse response, SysUserPermissionSearchVo searchVo);
/**
* 新权限-用户权限表简单分页查询
* @param searchVo
* @return
*/
IPage<SysUserDeptVo> getNameCodePage(Page<SysUserDeptVo> page, SysUserDeptVo searchVo);
List<SysDictVo> selectDictByType(String type);
R<String> autoCreateAuth(IdTypeEkpVo vo);
}
package com.yifu.cloud.plus.v1.permission.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserRoleResSearchVo;
import java.util.List;
/**
* 新权限-账号-角色关联表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
public interface SysUserRoleResService extends IService<SysUserRoleRes> {
/**
* 新权限-账号-角色关联表简单分页查询
*
* @param sysUserRoleRes 新权限-账号-角色关联表
* @return
*/
IPage<SysUserRoleRes> getSysUserRoleResPage(Page<SysUserRoleRes> page, SysUserRoleResSearchVo sysUserRoleRes);
List<SysUserRoleRes> noPageDiy(SysUserRoleResSearchVo searchVo);
/**
* @param roleId
* @Description: 根据角色id获取被使用的账号名称
* @Author: hgw
* @Date: 2023/9/8 17:38
* @return: java.util.List<java.lang.String>
**/
List<String> getSysUserByRoleId(String roleId);
/**
* @param userId
* @Description: 根据账号删除关联表
* @Author: hgw
* @Date: 2023/8/30 15:45
* @return: boolean
**/
boolean deleteByUserId(String userId);
/**
* @param roleId
* @Description: 根据角色删除关联表
* @Author: hgw
* @Date: 2023/8/30 15:45
* @return: boolean
**/
boolean deleteByRoleId(String roleId);
}
package com.yifu.cloud.plus.v1.permission.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.permission.mapper.SysMenuMapper;
import com.yifu.cloud.plus.v1.permission.service.SysMenuService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 新权限-菜单表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Log4j2
@Service
@RequiredArgsConstructor
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements SysMenuService {
/**
* 新权限-菜单表简单分页查询
*
* @param sysMenu 新权限-菜单表
* @return
*/
@Override
public IPage<SysMenu> getSysMenuPage(Page<SysMenu> page, SysMenuSearchVo sysMenu) {
return baseMapper.getSysMenuPage(page, sysMenu);
}
/**
* 新增菜单表
*
* @param menu 新权限-菜单表
* @return
*/
@Override
public R<Boolean> saveMenu(SysMenu menu) {
if (Common.isEmpty(menu.getModelId())) {
return R.failed("表单ID不可为空");
}
//判断表单id是否填写正确
long menuIdCount = baseMapper.selectMenuId(menu.getModelId());
if (menuIdCount < 1) {
return R.failed("表单ID填写错误,请确认");
}
//判断view id是否填写正确并且要属于modeleID
long viewIdCount = baseMapper.selectViewId(menu.getViewId(),menu.getModelId());
if (viewIdCount < 1) {
return R.failed("视图ID不存在或者不属于填写的表单id,请确认");
}
//唯一性校验--视图ID唯一
long modelCount = baseMapper.selectCount(Wrappers.<SysMenu>query().lambda()
.eq(SysMenu::getViewId, menu.getViewId())
.eq(SysMenu::getDeleteStatus, CommonConstants.ONE_STRING));
if (modelCount > 0) {
return R.failed("已存在对应菜单的权限维度");
}
//是否开关为是的话,modelId只能有一个
boolean errorFlag = isOpenCheck(menu);
if (errorFlag) {
return R.failed("只能存在一个开关状态为开的表单ID");
}
//判断菜单是否为一级菜单
if (Common.isNotNull(menu.getMenuName()) && Common.isEmpty(menu.getMenuNameParent())) {
//一级菜单的上级菜单id为0
menu.setMenuParentId(CommonConstants.ZERO_STRING);
}
//错误信息
StringBuilder errorStr = new StringBuilder();
//权限维度
StringBuilder permissionType = new StringBuilder();
this.check(menu,errorStr,permissionType);
//权限维度的控件id填写错误的话统一返回
if (errorStr.length() > 0) {
return R.failed(errorStr.substring(0, errorStr.lastIndexOf(";")));
}
menu.setPermissionType(permissionType.substring(0, permissionType.lastIndexOf("、")));
int res = baseMapper.insert(menu);
if (res <= CommonConstants.ZERO_INT) {
return R.failed();
}
return R.ok();
}
@Override
public R<Boolean> updateMenu(SysMenu menu) {
//是否开关为是的话,modelId只能有一个
boolean errorFlag = isOpenCheck(menu);
if (errorFlag) {
return R.failed("只能存在一个开关状态为开的表单ID");
}
//错误信息
StringBuilder errorStr = new StringBuilder();
//权限维度
StringBuilder permissionType = new StringBuilder();
this.check(menu,errorStr,permissionType);
//权限维度的控件id填写错误的话统一返回
if (errorStr.length() > 0) {
return R.failed(errorStr.substring(0, errorStr.lastIndexOf(";")));
}
menu.setPermissionType(permissionType.substring(0, permissionType.lastIndexOf("、")));
baseMapper.updateById(menu);
return R.ok();
}
public void check(SysMenu menu,StringBuilder errorStr,StringBuilder permissionType) {
//权限类型
String name;
//判断填写的控件id 是否属于表单的字段
List<String> list = baseMapper.selectColumnList(menu.getModelId());
if (!menu.getColumnIdList().isEmpty()) {
for (String columnId : menu.getColumnIdList()) {
name = columnId.substring(0, columnId.indexOf(";"));
permissionType.append(name).append("、");
//label为控件id;columnId格式为【客户权限;fd_3ae495ff53c560】
String label = columnId.substring(columnId.indexOf(";") + 1);
if (list.stream().noneMatch(e -> e.equals(label))) {
errorStr.append(name).append("的控件id填写有误;");
}
}
}
}
public boolean isOpenCheck(SysMenu menu) {
if (Common.isNotNull(menu.getIsOpen()) && CommonConstants.ZERO_STRING.equals(menu.getIsOpen())) {
if (Common.isNotNull(menu.getId())) {
long modelCount = baseMapper.selectCount(Wrappers.<SysMenu>query().lambda()
.eq(SysMenu::getModelId, menu.getModelId())
.eq(SysMenu::getDeleteStatus, CommonConstants.ONE_STRING)
.eq(SysMenu::getIsOpen, CommonConstants.ZERO_STRING)
.ne(SysMenu::getId, menu.getId()));
return modelCount > 0;
}else {
long modelCount = baseMapper.selectCount(Wrappers.<SysMenu>query().lambda()
.eq(SysMenu::getModelId, menu.getModelId())
.eq(SysMenu::getDeleteStatus, CommonConstants.ONE_STRING)
.eq(SysMenu::getIsOpen, CommonConstants.ZERO_STRING));
return modelCount > 0;
}
} else {
return false;
}
}
}
package com.yifu.cloud.plus.v1.permission.service.impl;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNode;
import cn.hutool.core.lang.tree.TreeUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.permission.mapper.SysMenuMapper;
import com.yifu.cloud.plus.v1.permission.mapper.SysRoleInfoMapper;
import com.yifu.cloud.plus.v1.permission.service.SysRoleInfoService;
import com.yifu.cloud.plus.v1.permission.service.SysRoleMenuResService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleInfo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleMenuRes;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysRoleInfoSaveVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysRoleInfoSearchVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysRoleMenuResSearchVo;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import javax.validation.constraints.NotNull;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 新权限-角色表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Log4j2
@Service
@AllArgsConstructor
public class SysRoleInfoServiceImpl extends ServiceImpl<SysRoleInfoMapper, SysRoleInfo> implements SysRoleInfoService {
private final SysRoleMenuResService sysRoleMenuResService;
private final SysMenuMapper sysMenuMapper;
/**
* 新权限-角色表简单分页查询
*
* @param sysRoleInfo 新权限-角色表
* @return
*/
@Override
public IPage<SysRoleInfo> getSysRoleInfoPage(Page<SysRoleInfo> page, SysRoleInfoSearchVo sysRoleInfo) {
return baseMapper.getSysRoleInfoPage(page, sysRoleInfo);
}
@NotNull
private Function<SysMenu, TreeNode<String>> getNodeFunction() {
return menu -> {
TreeNode<String> node = new TreeNode<>();
node.setId(menu.getId());
node.setName(menu.getMenuName());
node.setParentId(menu.getMenuParentId());
// 扩展属性
Map<String, Object> extra = new HashMap<>();
extra.put("label", menu.getMenuName());
node.setExtra(extra);
return node;
};
}
@Override
public R<SysRoleInfoSaveVo> getInfoById(String fdId) {
SysRoleInfoSaveVo vo = new SysRoleInfoSaveVo();
SysRoleInfo role = this.getById(fdId);
if (role != null && Common.isNotNull(role.getFdId())) {
SysRoleMenuResSearchVo sysRoleMenuRes = new SysRoleMenuResSearchVo();
sysRoleMenuRes.setRoleId(role.getFdId());
List<SysRoleMenuRes> resList = sysRoleMenuResService.noPageDiy(sysRoleMenuRes);
vo.setRole(role);
vo.setResList(resList);
}
List<TreeNode<String>> collect = sysMenuMapper
.selectList(Wrappers.<SysMenu>lambdaQuery().eq(SysMenu::getDeleteStatus,CommonConstants.ONE_STRING)
.eq(SysMenu::getPermissionStatus,CommonConstants.ZERO_STRING)
.orderByAsc(SysMenu::getCreateTime)).stream()
.map(getNodeFunction()).collect(Collectors.toList());
List<Tree<String>> tree = TreeUtil.build(collect, CommonConstants.ZERO_STRING);
vo.setTree(tree);
return R.ok(vo);
}
/**
* @param vo
* @Description: 新增或编辑新权限-角色表
* @Author: hgw
* @Date: 2023/8/30 15:24
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> saveOrUpdateRoleInfo(SysRoleInfoSaveVo vo) {
SysRoleInfo role = vo.getRole();
List<SysRoleMenuRes> resList = vo.getResList();
if (role != null && Common.isNotNull(role.getRoleName()) && resList != null && !resList.isEmpty()) {
if (Common.isNotNull(role.getFdId())) {
sysRoleMenuResService.deleteByRoleId(role.getFdId());
}
int num = baseMapper.checkExistenceRole(role.getRoleName(), role.getFdId());
if (num > 0) {
return R.failed("名称已存在");
}
this.saveOrUpdate(role);
for (SysRoleMenuRes res : resList) {
res.setRoleId(role.getFdId());
}
sysRoleMenuResService.saveBatch(resList);
return R.ok("保存成功");
}
return R.failed("请检查信息");
}
@Override
public List<SysRoleInfo> noPageDiy(SysRoleInfoSearchVo searchVo) {
LambdaQueryWrapper<SysRoleInfo> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)) {
wrapper.in(SysRoleInfo::getFdId, idList);
}
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) {
wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd());
}
wrapper.orderByDesc(BaseEntity::getCreateTime);
return baseMapper.selectList(wrapper);
}
@Override
public String getAllRoleDataAuthByUserId(String userId) {
List<String> authList = baseMapper.getAllRoleDataAuthByUserId(userId);
return this.getAuths(authList);
}
/**
* @param roleIdList
* @Description: 给前端使用:根据角色id组合获取角色权限
* @Author: hgw
* @Date: 2023/9/8 9:25
* @return: java.lang.String
**/
@Override
public String getRoleDataAuthByRoleId(List<String> roleIdList) {
List<String> authList = baseMapper.getRoleDataAuthByRoleId(roleIdList);
return this.getAuths(authList);
}
private String getAuths(List<String> authList) {
StringBuilder auths = new StringBuilder();
if (authList != null && !authList.isEmpty()) {
String[] authArr;
Set<String> authSet = new HashSet<>();
for (String auth : authList) {
authArr = auth.split(",");
Collections.addAll(authSet, authArr);
}
boolean flag = false;
for (String subAuth : authSet) {
if (flag) {
auths.append(",").append(subAuth);
} else {
auths.append(subAuth);
flag = true;
}
}
}
return auths.toString();
}
private LambdaQueryWrapper buildQueryWrapper(SysRoleInfoSearchVo entity) {
LambdaQueryWrapper<SysRoleInfo> wrapper = Wrappers.lambdaQuery();
wrapper.eq(SysRoleInfo::getDeleteFlag, CommonConstants.ZERO_INT);
if (Common.isNotNull(entity.getRoleName())) {
wrapper.like(SysRoleInfo::getRoleName, entity.getRoleName());
}
if (Common.isNotNull(entity.getStatus())) {
wrapper.eq(SysRoleInfo::getStatus, entity.getStatus());
}
if (Common.isNotNull(entity.getCreateTimeStart())) {
wrapper.ge(SysRoleInfo::getCreateTime, entity.getCreateTimeStart());
}
if (Common.isNotNull(entity.getCreateTimeEnd())) {
wrapper.le(SysRoleInfo::getCreateTime, entity.getCreateTimeEnd());
}
if (Common.isNotNull(entity.getCreateName())) {
wrapper.eq(SysRoleInfo::getCreateName, entity.getCreateName());
}
return wrapper;
}
}
package com.yifu.cloud.plus.v1.permission.service.impl;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.permission.mapper.SysRoleMenuResMapper;
import com.yifu.cloud.plus.v1.permission.service.SysRoleMenuResService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleMenuRes;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysRoleMenuResSearchVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 新权限-角色-菜单-关联表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Log4j2
@Service
public class SysRoleMenuResServiceImpl extends ServiceImpl<SysRoleMenuResMapper, SysRoleMenuRes> implements SysRoleMenuResService {
/**
* 新权限-角色-菜单-关联表简单分页查询
*
* @param sysRoleMenuRes 新权限-角色-菜单-关联表
* @return
*/
@Override
public IPage<SysRoleMenuRes> getSysRoleMenuResPage(Page<SysRoleMenuRes> page, SysRoleMenuResSearchVo sysRoleMenuRes) {
return baseMapper.getSysRoleMenuResPage(page, sysRoleMenuRes);
}
@Override
public List<SysRoleMenuRes> noPageDiy(SysRoleMenuResSearchVo searchVo) {
LambdaQueryWrapper<SysRoleMenuRes> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)) {
wrapper.in(SysRoleMenuRes::getFdId, idList);
}
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) {
wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd());
}
return baseMapper.selectList(wrapper);
}
/**
* @param roleId
* @Description: 根据角色删除关联表
* @Author: hgw
* @Date: 2023/8/30 15:19
* @return: boolean
**/
@Override
public boolean deleteByRoleId(String roleId) {
return baseMapper.deleteByRoleId(roleId);
}
private LambdaQueryWrapper buildQueryWrapper(SysRoleMenuResSearchVo entity) {
LambdaQueryWrapper<SysRoleMenuRes> wrapper = Wrappers.lambdaQuery(entity);
return wrapper;
}
}
package com.yifu.cloud.plus.v1.permission.service.impl;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.permission.mapper.SysMenuMapper;
import com.yifu.cloud.plus.v1.permission.mapper.SysUserInfoMapper;
import com.yifu.cloud.plus.v1.permission.mapper.SysUserPermissionMapper;
import com.yifu.cloud.plus.v1.permission.service.SysMenuService;
import com.yifu.cloud.plus.v1.permission.service.SysRoleInfoService;
import com.yifu.cloud.plus.v1.permission.service.SysUserInfoService;
import com.yifu.cloud.plus.v1.permission.service.SysUserRoleResService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSearchVo;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 新权限-账号管理表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Log4j2
@Service
@AllArgsConstructor
public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUserInfo> implements SysUserInfoService {
private final SysUserRoleResService sysUserRoleResService;
private final SysRoleInfoService sysRoleInfoService;
private final SysMenuMapper sysMenuMapper;
private final SysUserPermissionMapper sysUserPermissionMapper;
/**
* 新权限-账号管理表简单分页查询
*
* @param sysUserInfo 新权限-账号管理表
* @return
*/
@Override
public IPage<SysUserInfo> getSysUserInfoPage(Page<SysUserInfo> page, SysUserInfoSearchVo sysUserInfo) {
return baseMapper.getSysUserInfoPage(page, sysUserInfo);
}
@Override
public List<SysUserInfo> noPageDiy(SysUserInfoSearchVo searchVo) {
LambdaQueryWrapper<SysUserInfo> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)) {
wrapper.in(SysUserInfo::getFdId, idList);
}
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) {
wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd());
}
wrapper.orderByDesc(BaseEntity::getCreateTime);
return baseMapper.selectList(wrapper);
}
private LambdaQueryWrapper buildQueryWrapper(SysUserInfoSearchVo entity) {
LambdaQueryWrapper<SysUserInfo> wrapper = Wrappers.lambdaQuery();
if (Common.isNotNull(entity.getFdName())) {
wrapper.like(SysUserInfo::getFdName, entity.getFdName());
}
if (Common.isNotNull(entity.getFdLoginName())) {
wrapper.eq(SysUserInfo::getFdLoginName, entity.getFdLoginName());
}
if (Common.isNotNull(entity.getFdDeptName())) {
wrapper.like(SysUserInfo::getFdDeptName, entity.getFdDeptName());
}
if (Common.isNotNull(entity.getRoleNames())) {
wrapper.like(SysUserInfo::getRoleNames, entity.getRoleNames());
}
if (Common.isNotNull(entity.getStatus())) {
wrapper.eq(SysUserInfo::getStatus, entity.getStatus());
}
if (ArrayUtil.isNotEmpty(entity.getCreateTimes())) {
wrapper.ge(SysUserInfo::getCreateTime, entity.getCreateTimes()[0])
.le(SysUserInfo::getCreateTime,
entity.getCreateTimes()[1]);
}
if (Common.isNotNull(entity.getCreateName())) {
wrapper.eq(SysUserInfo::getCreateName, entity.getCreateName());
}
return wrapper;
}
/**
* @param fdId
* @Description: 查看详情
* @Author: hgw
* @Date: 2023/8/30 18:14
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo>
**/
@Override
public R<SysUserInfoSaveVo> getInfoById(String fdId) {
SysUserInfoSaveVo vo = new SysUserInfoSaveVo();
SysUserInfo user = this.getById(fdId);
if (user != null && Common.isNotNull(user.getFdId())) {
List<SysUserRoleRes> resList = baseMapper.getResAndRoleNameUserId(user.getFdId());
vo.setUser(user);
if (resList != null && !resList.isEmpty()) {
// 各种角色的权限融合
String dataAuth = sysRoleInfoService.getAllRoleDataAuthByUserId(user.getFdId());
vo.setDataAuth(dataAuth);
}
vo.setResList(resList);
}
return R.ok(vo);
}
/**
* @param vo
* @Description: 新增或编辑新权限-角色表
* @Author: hgw
* @Date: 2023/8/30 15:24
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> saveOrUpdateUserInfo(SysUserInfoSaveVo vo) {
SysUserInfo user = vo.getUser();
List<SysUserRoleRes> resList = vo.getResList();
if (user != null && Common.isNotNull(user.getFdName()) && resList != null && !resList.isEmpty()) {
if (Common.isNotNull(user.getFdId())) {
sysUserRoleResService.deleteByUserId(user.getFdId());
}
this.saveOrUpdate(user);
for (SysUserRoleRes res : resList) {
res.setUserId(user.getFdId());
}
sysUserRoleResService.saveBatch(resList);
return R.ok("保存成功");
}
return R.failed("请检查信息");
}
/**
* @param
* @Description: 同步并更新账号信息
* @Author: hgw
* @Date: 2023/9/4 11:31
* @return: java.lang.String
**/
@Override
public void doRefreshEkpUser() {
List<SysUserInfo> ekpUser = baseMapper.getEkpUser();
this.saveOrUpdateBatch(ekpUser);
}
private final SysMenuService sysMenuService;
/**
* @param modelId
* @param userId
* @Description: 给EKP用的,获取权限
* @Author: hgw
* @Date: 2023/9/8 16:04
* @return: void
**/
@Override
public String testPermission(String modelId, String userId) {
//1:获取菜单是否已配置,是:第2步;否:结束,用EKP本身权限;
//2:获取账号,有:第3步;无:结束,用EKP;
//3:检测账号的角色 是否有 对应的菜单,有,第4不,无:结束,用ekp;
//4:查询角色的数据权限,如果是全量或部分全量,检测当前菜单是否有对应维度,有,直接查全量,无,第5步;
//5:查询用户当前菜单数据权限,拼接sql:
//and ((客户字段 in (客户1,客户2))
//or (商机字段 in (商机1,商机2))
//)——最后一个括号放在最后合上,此处可以去掉
//6:判断创建人权限;
//or (docCreateUser = 账号id)
//7:部门权限
//如果有部门权限,先查部门以及下属部门的所有账号id;
//第6步的sql要改为:
//or (docCreateUser in (账号id,其他账号id))
StringBuilder sql = new StringBuilder();
// 测试权限
SysMenu menu = sysMenuMapper.getSysMenuByModelId(modelId);
if (menu != null) {
// 返回0:无配置;1:全量;2:继续下一步,找数据权限配置
int allAuth = baseMapper.getAuthByUserIdAndModelId(modelId, userId);
if (allAuth == 0) {
sql.append(" 1=2 ");
} else if (allAuth == 1) {
sql.append(" 1=1 ");
} else {
sql.append(" 1=2 ");
// 继续下一步,找数据权限配置
List<SysUserPermission> permissionList = sysUserPermissionMapper.getUserPermissionByUserId(userId);
if (permissionList != null && !permissionList.isEmpty() ) {
setAuthSql(sql, "1", menu.getCustomerId(), permissionList);
setAuthSql(sql, "2", menu.getBussinessId(), permissionList);
setAuthSql(sql, "3", menu.getQuotationId(), permissionList);
setAuthSql(sql, "4", menu.getContractId(), permissionList);
setAuthSql(sql, "5", menu.getDomainId(), permissionList);
setAuthSql(sql, "6", menu.getBuId(), permissionList);
setAuthSql(sql, "7", menu.getLineId(), permissionList);
setAuthSql(sql, "9", menu.getIncomeId(), permissionList);
// TODO-部门
setAuthSqlByDept(sql, menu.getDeptId(), permissionList);
}
}
}
if (Common.isNotNull(sql) && sql.length() > 0) {
return " or ( " + sql + " ) ";
}
return "";
}
private void setAuthSql(StringBuilder sql, String type, String shuXing, List<SysUserPermission> permissionList) {
if (Common.isNotNull(shuXing)) {
StringBuilder tempValue = new StringBuilder();
for (SysUserPermission permission : permissionList) {
if (("6".equals(type) || "7".equals(type)) && type.equals(permission.getPermissionType()) && Common.isNotNull(permission.getName())) {
tempValue.append("'").append(permission.getName()).append("',");
} else if (type.equals(permission.getPermissionType()) && Common.isNotNull(permission.getCode())) {
tempValue.append("'").append(permission.getCode()).append("',");
}
}
if (tempValue.length() > 0) {
tempValue.deleteCharAt(tempValue.length() - 1);
}
sql.append(" or (").append(shuXing).append(" in (").append(tempValue).append("))");
}
}
private void setAuthSqlByDept(StringBuilder sql, String shuXing, List<SysUserPermission> permissionList) {
if (Common.isNotNull(shuXing)) {
StringBuilder tempValue = new StringBuilder();
for (SysUserPermission permission : permissionList) {
if ("8".equals(permission.getPermissionType()) && Common.isNotNull(permission.getCode())) {
tempValue.append("'").append(permission.getCode()).append("',");
}
}
if (tempValue.length() > 0) {
tempValue.deleteCharAt(tempValue.length() - 1);
}
sql.append(" or (").append(shuXing).append(" in (").append(tempValue).append("))");
}
}
/**
* 新权限-账号管理表简单分页查询
*
* @param code
* @return
*/
@Override
public IPage<SysUserInfo> getUserByCodeOrLoginName(Page<SysUserInfo> page, String code) {
return baseMapper.getUserByCodeOrLoginName(page, code);
}
}
package com.yifu.cloud.plus.v1.permission.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.permission.mapper.SysUserPermissionMapper;
import com.yifu.cloud.plus.v1.permission.service.SysUserInfoService;
import com.yifu.cloud.plus.v1.permission.service.SysUserPermissionService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import com.yifu.cloud.plus.v1.yifu.permission.vo.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Log4j2
@Service
@RequiredArgsConstructor
public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionMapper, SysUserPermission> implements SysUserPermissionService {
@Autowired
private SysUserInfoService userInfoService;
/**
* 新权限-用户权限表简单分页查询
*
* @param sysUserPermission 新权限-用户权限表
* @return
*/
@Override
public IPage<SysUserPermission> getSysUserPermissionPage(Page<SysUserPermission> page, SysUserPermissionSearchVo sysUserPermission) {
return baseMapper.getSysUserPermissionPage(page, sysUserPermission);
}
@Override
public R savePermission(SysUserPermission sysUserPermission) {
YifuUser user = SecurityUtils.getUser();
//非管理员判断是否包含此权限维度
SysUserPermission permission;
if (Common.isNotNull(user.getId()) && CommonConstants.ONE_STRING.equals(user.getSystemFlag())) {
permission = this.getOne(Wrappers.<SysUserPermission>query().lambda()
.eq(SysUserPermission::getPermissionStatus, CommonConstants.ZERO_STRING)
.eq(SysUserPermission::getEmpLoginName, user.getUsername())
.eq(SysUserPermission::getCode,sysUserPermission.getCode()).last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(permission)) {
return R.failed("操作人仅可对本账号有权限的数据新增账号");
}
}
if (CommonConstants.SIX_STRING.equals(sysUserPermission.getPermissionType())
|| CommonConstants.SEVEN_STRING.equals(sysUserPermission.getPermissionType())) {
permission = this.getOne(Wrappers.<SysUserPermission>query().lambda()
.eq(SysUserPermission::getEmpLoginName, sysUserPermission.getEmpLoginName())
.eq(SysUserPermission::getPermissionType, sysUserPermission.getPermissionType())
.eq(SysUserPermission::getName,sysUserPermission.getName()).last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(permission)) {
return R.failed("系统中已经存在对应名称的权限类型");
}
} else {
permission = this.getOne(Wrappers.<SysUserPermission>query().lambda()
.eq(SysUserPermission::getEmpLoginName, sysUserPermission.getEmpLoginName())
.eq(SysUserPermission::getPermissionType, sysUserPermission.getPermissionType())
.eq(SysUserPermission::getCode,sysUserPermission.getCode()).last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(permission)) {
return R.failed("系统中已经存在对应编码的权限类型");
}
}
this.save(sysUserPermission);
return R.ok();
}
/**
* 新权限-用户权限表批量导出
*
* @param searchVo 新权限-用户权限表
* @return
*/
@Override
public void listExport(HttpServletResponse response, SysUserPermissionSearchVo searchVo) {
String fileName = "数据权限表批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<SysUserPermissionExportVo> list = new ArrayList<>();
long count = baseMapper.userSelectCount(searchVo);
try (ServletOutputStream out = response.getOutputStream()) {
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, SysUserPermissionExportVo.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.userSelectList(searchVo);
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("数据权限表" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
if (Common.isNotNull(list)) {
list.clear();
}
}
} else {
WriteSheet writeSheet = EasyExcel.writerSheet("数据权限表" + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)) {
list.clear();
}
excelWriter.finish();
} catch (Exception e) {
log.error("执行异常", e);
}
}
@Override
public IPage<SysUserDeptVo> getNameCodePage(Page<SysUserDeptVo> page, SysUserDeptVo searchVo) {
if (Common.isNotNull(searchVo) && Common.isNotNull(searchVo.getType())) {
YifuUser user = SecurityUtils.getUser();
IPage<SysUserDeptVo> iPage;
//客户权限
if (CommonConstants.ONE_STRING.equals(searchVo.getType())) {
iPage = baseMapper.selectUnitVO(page,searchVo.getName());
} else if (CommonConstants.TWO_STRING.equals(searchVo.getType())) {
//商机权限
iPage = baseMapper.selectBusinessVO(page, searchVo.getName());
} else if (CommonConstants.THREE_STRING.equals(searchVo.getType())) {
//报价单权限
iPage = baseMapper.selectQuotationVO(page, searchVo.getName());
} else if (CommonConstants.FOUR_STRING.equals(searchVo.getType())) {
//合同权限
if (Common.isNotNull(user.getId()) && CommonConstants.ZERO_STRING.equals(user.getSystemFlag())) {
iPage = baseMapper.selectContractVO(page, searchVo.getName());
} else {
iPage = baseMapper.selectContractSimpleVO(page, user.getUsername(),searchVo.getName(),searchVo.getType());
}
} else if (CommonConstants.EIGHT_STRING.equals(searchVo.getType()) || CommonConstants.NINE_STRING.equals(searchVo.getType())) {
//部门&&收入归属权限
iPage = baseMapper.selectDeptVO(page, searchVo.getName());
} else {
//项目权限
if (Common.isNotNull(user.getId()) && CommonConstants.ZERO_STRING.equals(user.getSystemFlag())) {
iPage = baseMapper.selectSettleVO(page, searchVo.getName());
} else {
iPage = baseMapper.selectContractSimpleVO(page, user.getUsername(),searchVo.getName(),searchVo.getType());
}
}
return iPage;
}
return null;
}
@Override
public List<SysDictVo> selectDictByType(String type) {
YifuUser user = SecurityUtils.getUser();
if ("permission".equals(type) && Common.isNotNull(user.getId()) && CommonConstants.ONE_STRING.equals(user.getSystemFlag())) {
return baseMapper.selectDictByTypeOne(type,CommonConstants.ZERO_STRING);
} else {
return baseMapper.selectDictByType(type);
}
}
@Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<SysUserPermissionVo> util1 = new ExcelUtil<>(SysUserPermissionVo.class);
//查询权限类型字典
List<SysDictVo> typeList = baseMapper.selectDictByType("permission");
Map<String, String> typeMap = typeList.stream().collect(Collectors.toMap(SysDictVo::getName, SysDictVo::getId));
//查询所有用户的信息
List<SysUserInfo> userInfoList = userInfoService.list(Wrappers.<SysUserInfo>query().lambda()
.eq(SysUserInfo::getStatus, CommonConstants.ZERO_INT));
//登录账号+维度+唯一标识唯一
Map<String,String> uniqueMap = new HashMap<>();
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, SysUserPermissionVo.class, new ReadListener<SysUserPermissionVo>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<SysUserPermissionVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(SysUserPermissionVo data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex + 1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)) {
errorMessage.setData(data);
errorMessageList.add(errorMessage);
} else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importSysUserPermission(cachedDataList, errorMessageList,typeMap,userInfoList,uniqueMap);
log.info("存储数据库成功!");
}
}).sheet().doRead();
} catch (Exception e) {
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
}
private void importSysUserPermission(List<SysUserPermissionVo> excelVOList, List<ErrorMessage> errorMessageList,
Map<String,String> typeMap,List<SysUserInfo> userInfoList,Map<String,String> uniqueMap) {
YifuUser user = SecurityUtils.getUser();
SysUserPermission permission;
List<SysUserInfo> userInfo;
String domainId;
try {
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
SysUserPermissionVo excel = excelVOList.get(i);
//登录名校验
userInfo = userInfoList.stream().filter(e -> excel.getEmpLoginName().equals(e.getFdLoginName())).collect(Collectors.toList());
if (userInfo.isEmpty()) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "登录名填写错误,请核实", excel));
continue;
}
//从用户表中获取部门和用户名
SysUserInfo sysUserInfo = userInfo.get(0);
excel.setEmpDept(sysUserInfo.getFdDeptName());
excel.setEmpName(sysUserInfo.getFdName());
excel.setUserId(sysUserInfo.getFdId());
SysUserPermission insert = new SysUserPermission();
BeanUtil.copyProperties(excel, insert);
//判断表格权限类型是否正确
if (typeMap.isEmpty()) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "获取权限类型字典值异常", excel));
continue;
}
//判断表格权限类型是否正确
if (null == typeMap.get(excel.getPermissionType())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "权限类型填写错误,请核实", excel));
continue;
} else {
insert.setPermissionType(typeMap.get(excel.getPermissionType()));
}
//部门权限的时候是否含下级必填
if (CommonConstants.EIGHT_STRING.equals(insert.getPermissionType()) && Common.isEmpty(excel.getIsContains())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "权限类型为部门权限时,是否含下级部门必填", excel));
continue;
}
//登录账号+维度+唯一标识唯一
StringBuilder flag = new StringBuilder();
flag.append(excel.getEmpLoginName());
flag.append("_");
flag.append(insert.getPermissionType());
flag.append("_");
if (CommonConstants.SIX_STRING.equals(insert.getPermissionType()) ||
CommonConstants.SEVEN_STRING.equals(insert.getPermissionType())) {
flag.append(excel.getName());
} else {
flag.append(excel.getCode());
}
if (null != uniqueMap.get(flag.toString())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "导表中已经存在该登录名对应的权限类型的名称或者编码!", excel));
continue;
} else {
uniqueMap.put(flag.toString(), CommonConstants.ONE_STRING);
}
//BU和条线的时候用名称判断,其他用编码判断
//判断此登录名是否已经存在此权限维度
if (CommonConstants.SIX_STRING.equals(insert.getPermissionType())
|| CommonConstants.SEVEN_STRING.equals(insert.getPermissionType())) {
//判断对应维度的名称是否存在
Integer count;
if (CommonConstants.SIX_STRING.equals(insert.getPermissionType())) {
count = baseMapper.selectDictByName(excel.getName(), "bu");
} else {
count = baseMapper.selectDictByName(excel.getName(), "line");
}
if (count < 1) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "不存在对应权限类型的名称信息", excel));
continue;
}
permission = this.getOne(Wrappers.<SysUserPermission>query().lambda()
.eq(SysUserPermission::getEmpLoginName, excel.getEmpLoginName())
.eq(SysUserPermission::getPermissionType, insert.getPermissionType())
.eq(SysUserPermission::getName, excel.getName()).last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(permission)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "系统中已经存在该用户对应的名称的权限类型", excel));
continue;
}
insert.setCode(null);
} else {
//判断对应维度的编码是否存在
Integer count = this.checkExit(insert.getPermissionType(), excel.getCode());
if (count < 1) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "不存在对应权限类型的编码信息", excel));
continue;
}
permission = this.getOne(Wrappers.<SysUserPermission>query().lambda()
.eq(SysUserPermission::getEmpLoginName, excel.getEmpLoginName())
.eq(SysUserPermission::getPermissionType, insert.getPermissionType())
.eq(SysUserPermission::getCode, excel.getCode()).last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(permission)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "系统中已经存在该用户对应的编码的权限类型", excel));
continue;
}
}
//非管理员的用户只能导入合同和项目权限维度的数据且只有自己有权限的维度才可导入
//当登录人不是管理员时根据导表登录名查询权限数据
if (Common.isNotNull(user.getId()) && CommonConstants.ONE_STRING.equals(user.getSystemFlag())) {
permission = this.getOne(Wrappers.<SysUserPermission>query().lambda()
.eq(SysUserPermission::getPermissionStatus, CommonConstants.ZERO_STRING)
.eq(SysUserPermission::getEmpLoginName, user.getUsername())
.eq(SysUserPermission::getPermissionType, insert.getPermissionType())
.eq(SysUserPermission::getCode, excel.getCode()).last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(permission)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "操作人仅可对本账号有权限的数据新增账号", excel));
continue;
}
}
//项目权限的时候赋值项目id
if (CommonConstants.EIGHT_STRING.equals(insert.getPermissionType()) ||
CommonConstants.NINE_STRING.equals(insert.getPermissionType())) {
domainId = baseMapper.selectSettleByCode(insert.getCode());
insert.setDomainId(domainId);
}
if (!CommonConstants.EIGHT_STRING.equals(insert.getPermissionType())) {
insert.setIsContains(null);
}
// 插入数据
insertExcel(insert);
}
} catch (Exception e) {
log.error("用户权限表导入异常:" + e);
}
}
/**
* 插入excel bad record
*/
private void insertExcel(SysUserPermission insert) {
//转化是否含下级
if (Common.isNotNull(insert.getIsContains())) {
if (CommonConstants.IS_TRUE.equals(insert.getIsContains())) {
insert.setIsContains(CommonConstants.ZERO_STRING);
} else {
insert.setIsContains(CommonConstants.ONE_STRING);
}
}
this.save(insert);
}
private Integer checkExit(String type,String name) {
//客户权限
if (CommonConstants.ONE_STRING.equals(type)) {
return baseMapper.selectUnitCount(name);
} else if (CommonConstants.TWO_STRING.equals(type)) {
//商机权限
return baseMapper.selectBusinessCount(name);
} else if (CommonConstants.THREE_STRING.equals(type)) {
//报价单权限
return baseMapper.selectQuotationCount(name);
} else if (CommonConstants.FOUR_STRING.equals(type)) {
//合同权限
return baseMapper.selectContractCount(name);
} else if (CommonConstants.EIGHT_STRING.equals(type) || CommonConstants.NINE_STRING.equals(type)) {
//部门&&收入归属权限
return baseMapper.selectDeptCount(name);
} else {
//项目权限
return baseMapper.selectSettleCount(name);
}
}
@Override
public R<String> autoCreateAuth(IdTypeEkpVo vo) {
String fdId = vo.getFdId();
String type = vo.getType();
// 先找到表(客户、项目、项目立项等),找到创建人、服务团队;
// 组装实体类,查重,新增或更新
List<SysUserPermission> list;
// 1客户;2商机;3报价单;4合同;5项目;
log.error("11111同步权限,EKP传过来的fdId=" + fdId + ",type="+ type);
String deleteType = CommonConstants.ONE_STRING;
switch (type) {
case "客户":
deleteType = CommonConstants.dingleDigitStrArray[1];
list = baseMapper.getUserPermissionByAutoCreateKH(fdId); break;
case "商机":
deleteType = CommonConstants.dingleDigitStrArray[2];
list = baseMapper.getUserPermissionByAutoCreateSJ(fdId); break;
case "报价单":
deleteType = CommonConstants.dingleDigitStrArray[3];
list = baseMapper.getUserPermissionByAutoCreateBJD(fdId); break;
case "合同":
deleteType = CommonConstants.dingleDigitStrArray[4];
list = baseMapper.getUserPermissionByAutoCreateHT(fdId); break;
case "合同变更":
deleteType = CommonConstants.dingleDigitStrArray[4];
list = baseMapper.getUserPermissionByAutoCreateHTBG(fdId); break;
case "项目":
deleteType = CommonConstants.dingleDigitStrArray[5];
list = baseMapper.getUserPermissionByAutoCreateXM(fdId); break;
case "项目变更":
deleteType = CommonConstants.dingleDigitStrArray[5];
list = baseMapper.getUserPermissionByAutoCreateXMBG(fdId); break;
default:
list = new ArrayList<>();
}
if (list != null && !list.isEmpty()) {
if (Common.isNotNull(list.get(0).getCode())) {
baseMapper.deleteUserPermissionByIdAndType(list.get(0).getCode(), deleteType);
}
for (SysUserPermission sysUserPermission : list) {
SysUserPermission permission = this.getOne(Wrappers.<SysUserPermission>query().lambda()
.eq(SysUserPermission::getDeleteFlag, CommonConstants.ONE_STRING)
.eq(SysUserPermission::getEmpLoginName, sysUserPermission.getEmpLoginName())
.eq(SysUserPermission::getPermissionType, sysUserPermission.getPermissionType())
.eq(SysUserPermission::getCode, sysUserPermission.getCode()).last(CommonConstants.LAST_ONE_SQL));
if (permission == null || Common.isEmpty(permission) || Common.isEmpty(permission.getId())) {
this.save(sysUserPermission);
}
}
} else {
String code = baseMapper.selectCodeByFdId(fdId);
if (Common.isNotNull(code)) {
baseMapper.deleteUserPermissionByIdAndType(code, deleteType);
}
}
return R.ok();
}
}
package com.yifu.cloud.plus.v1.permission.service.impl;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.permission.mapper.SysUserRoleResMapper;
import com.yifu.cloud.plus.v1.permission.service.SysUserRoleResService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserRoleResSearchVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 新权限-账号-角色关联表
*
* @author hgw
* @date 2023-08-29 14:49:40
*/
@Log4j2
@Service
public class SysUserRoleResServiceImpl extends ServiceImpl<SysUserRoleResMapper, SysUserRoleRes> implements SysUserRoleResService {
/**
* 新权限-账号-角色关联表简单分页查询
*
* @param sysUserRoleRes 新权限-账号-角色关联表
* @return
*/
@Override
public IPage<SysUserRoleRes> getSysUserRoleResPage(Page<SysUserRoleRes> page, SysUserRoleResSearchVo sysUserRoleRes) {
return baseMapper.getSysUserRoleResPage(page, sysUserRoleRes);
}
@Override
public List<SysUserRoleRes> noPageDiy(SysUserRoleResSearchVo searchVo) {
LambdaQueryWrapper<SysUserRoleRes> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)) {
wrapper.in(SysUserRoleRes::getFdId, idList);
}
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) {
wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd());
}
return baseMapper.selectList(wrapper);
}
/**
* @param roleId
* @Description: 根据角色id获取被使用的账号名称
* @Author: hgw
* @Date: 2023/9/8 17:38
* @return: java.util.List<java.lang.String>
**/
@Override
public List<String> getSysUserByRoleId(String roleId) {
return baseMapper.getSysUserByRoleId(roleId);
}
@Override
public boolean deleteByUserId(String userId) {
return baseMapper.deleteByUserId(userId);
}
@Override
public boolean deleteByRoleId(String roleId) {
return baseMapper.deleteByRoleId(roleId);
}
private LambdaQueryWrapper buildQueryWrapper(SysUserRoleResSearchVo entity) {
LambdaQueryWrapper<SysUserRoleRes> wrapper = Wrappers.lambdaQuery();
return wrapper;
}
}
# 数据源配置
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
config:
activate:
on-profile: dev
redis:
host: 127.0.0.1
password: '@yf_2017'
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: ll_mysql
url: jdbc:mysql://192.168.1.122:33306/ekp?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
hikari:
driver-class-name: ${spring.datasource.driver-class-name}
jdbc-url: ${spring.datasource.url}
username: ${spring.datasource.username}
password: ${spring.datasource.password}
minimum-idle: 10 # 最小空闲连接数量
idle-timeout: 60000 # 空闲连接存活最大时间,默认600000(10分钟)
maximum-pool-size: 12 # 连接池最大连接数,默认是10
auto-commit: true #此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime: 0 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
## spring security 配置
security:
oauth2:
resource:
loadBalanced: true
token-info-uri: http://127.0.0.1:3000/oauth/check_token
# 直接放行URL
ignore:
urls:
- /v3/api-docs
- /actuator/**
- /swagger-ui/**
- /msg/**
\ No newline at end of file
# 数据源配置
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
config:
activate:
on-profile: test
redis:
host: 192.168.1.65
port: 22379
password: '@yf_2017'
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: ll_mysql
url: jdbc:mysql://192.168.1.122:33306/ekp?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
hikari:
driver-class-name: ${spring.datasource.driver-class-name}
jdbc-url: ${spring.datasource.url}
username: ${spring.datasource.username}
password: ${spring.datasource.password}
minimum-idle: 10 # 最小空闲连接数量
idle-timeout: 60000 # 空闲连接存活最大时间,默认600000(10分钟)
maximum-pool-size: 12 # 连接池最大连接数,默认是10
auto-commit: true #此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime: 0 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
## spring security 配置
security:
oauth2:
resource:
loadBalanced: true
token-info-uri: http://127.0.0.1:3000/oauth/check_token
# 直接放行URL
ignore:
urls:
- /v3/api-docs
- /actuator/**
- /swagger-ui/**
\ No newline at end of file
server:
port: 5027
# 加解密根密码
jasypt:
encryptor:
password: yifu #根密码
# 暴露监控端点
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
# mybaits-plus配置
mybatis-plus:
mapper-locations: classpath:/mapper/*Mapper.xml
global-config:
banner: false
db-config:
id-type: auto
table-underline: true
logic-delete-value: 1
logic-not-delete-value: 0
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
spring:
application:
name: @artifactId@
servlet:
multipart:
#所有上传文件最大大小
max-request-size: 100MB
#单个文件最大大小
max-file-size: 50MB
#swagger 文档 https://springdoc.org/
### OpenAPI3 注解
# OpenAPI 3 注解位置
# @Tag(name = “接口类描述”) Controller 类上
# @Operation(summary =“接口方法描述”) Controller 方法上
# @Parameters Controller 方法上
# @Parameter(description=“参数描述”) Controller 方法上 @Parameters 里
# @Parameter(description=“参数描述”) Controller 方法的参数上
# @Parameter(hidden = true) 或 @Hidden --
# @Schema DTO类上
# @Schema DTO属性上
springdoc:
api-docs:
#是否开启文档功能
enabled: true
#swagger后端请求地址
path: /api-docs
swagger-ui:
#自定义swagger前端请求路径,输入http:127.0.0.1:8080/test会自动重定向到swagger页面
path: /api
#包扫描路径
packages-to-scan: com.yifu.cloud.plus.v1.permission.controller
#这里定义了两个分组,可定义多个,也可以不定义
group-configs:
#分组名
#- group: admin
#按路径匹配
# pathsToMatch: /admin/**
#分组名
- group: mail
#按包路径匹配
packagesToScan: com.yifu.cloud.plus.v1.permission.controller
wx:
corpid: ww59249a765dd499ad
corpsecret: o3fLn0u9SFHh5_htpIRBSp2bOibTa8pZGcOJIJqvidQ
agentid: 1000003
authUrl: https://wx.worfu.com/auth/oauth/wxLogin
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="false">
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
<property name="log.path" value="logs/${spring.application.name}"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
</root>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.permission.mapper.SysMenuMapper">
<resultMap id="sysMenuMap" type="com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu">
<id property="id" column="ID"/>
<result property="menuName" column="MENU_NAME"/>
<result property="menuNameParent" column="MENU_NAME_PARENT"/>
<result property="menuParentId" column="MENU_PARENT_ID"/>
<result property="modelId" column="MODEL_ID"/>
<result property="viewId" column="VIEW_ID"/>
<result property="permissionType" column="PERMISSION_TYPE"/>
<result property="permissionStatus" column="PERMISSION_STATUS"/>
<result property="deleteStatus" column="DELETE_STATUS"/>
<result property="incomeId" column="INCOME_ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="contractId" column="CONTRACT_ID"/>
<result property="bussinessId" column="BUSSINESS_ID"/>
<result property="quotationId" column="QUOTATION_ID"/>
<result property="domainId" column="DOMAIN_ID"/>
<result property="buId" column="BU_ID"/>
<result property="lineId" column="LINE_ID"/>
<result property="deptId" column="DEPT_ID"/>
<result property="createBy" column="CREATE_BY"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="isOpen" column="IS_OPEN"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.MENU_NAME,
a.MODEL_ID,
a.MENU_NAME_PARENT,
a.MENU_PARENT_ID,
a.PERMISSION_TYPE,
a.PERMISSION_STATUS,
a.DELETE_STATUS,
a.INCOME_ID,
a.CUSTOMER_ID,
a.CONTRACT_ID,
a.BUSSINESS_ID,
a.QUOTATION_ID,
a.DOMAIN_ID,
a.BU_ID,
a.LINE_ID,
a.DEPT_ID,
a.IS_OPEN,
a.VIEW_ID,
a.CREATE_TIME
</sql>
<sql id="sysMenu_where">
<if test="sysMenu != null">
<if test="sysMenu.menuName != null and sysMenu.menuName.trim() != ''">
AND a.MENU_NAME like concat('%',#{sysMenu.menuName},'%')
</if>
<if test="sysMenu.menuNameParent != null and sysMenu.menuNameParent.trim() != ''">
AND a.MENU_NAME_PARENT = #{sysMenu.menuNameParent}
</if>
<if test="sysMenu.menuParentId != null and sysMenu.menuParentId.trim() != ''">
AND a.MENU_PARENT_ID = #{sysMenu.menuParentId}
</if>
<if test="sysMenu.permissionStatus != null and sysMenu.permissionStatus.trim() != ''">
AND a.PERMISSION_STATUS = #{sysMenu.permissionStatus}
</if>
</if>
</sql>
<!--sysMenu简单分页查询-->
<select id="getSysMenuPage" resultMap="sysMenuMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_menu a
<where>
a.DELETE_STATUS = '1'
<include refid="sysMenu_where"/>
</where>
order by a.CREATE_TIME desc
</select>
<select id="selectMenuId" resultType="java.lang.Long">
SELECT
count(1)
FROM modeling_app_model a
WHERE a.fd_id = #{modelId}
</select>
<select id="selectViewId" resultType="java.lang.Long">
SELECT
count(1)
FROM modeling_app_collection_view a
WHERE a.fd_model_id = #{modelId} and a.fd_id = #{viewId}
</select>
<select id="selectColumnList" resultType="java.lang.String">
SELECT
a.fd_column
FROM sys_xform_db_column a
LEFT JOIN sys_xform_db_table b on a.fd_main_id = b.fd_id
WHERE b.fd_model_id = #{modelId}
</select>
<!--根据modelId获取菜单-->
<select id="getSysMenuByModelId" resultMap="sysMenuMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_menu a
where a.DELETE_STATUS = '1' and a.PERMISSION_STATUS='0' and a.MODEL_ID = #{modelId}
limit 1
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.permission.mapper.SysRoleInfoMapper">
<resultMap id="sysRoleInfoMap" type="com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleInfo">
<id property="fdId" column="fd_id"/>
<result property="roleName" column="role_name"/>
<result property="remark" column="remark"/>
<result property="status" column="status"/>
<result property="deleteFlag" column="delete_flag"/>
<result property="dataAuth" column="data_auth"/>
<result property="createBy" column="CREATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
</resultMap>
<sql id="Base_Column_List">
a.fd_id,
a.role_name,
a.remark,
a.status,
a.delete_flag,
a.data_auth,
a.CREATE_BY,
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME
</sql>
<sql id="sysRoleInfo_where">
<if test="sysRoleInfo != null">
<if test="sysRoleInfo.fdId != null and sysRoleInfo.fdId.trim() != ''">
AND a.fd_id = #{sysRoleInfo.fdId}
</if>
<if test="sysRoleInfo.roleName != null and sysRoleInfo.roleName.trim() != ''">
AND a.role_name like concat('%',#{sysRoleInfo.roleName},'%')
</if>
<if test="sysRoleInfo.remark != null and sysRoleInfo.remark.trim() != ''">
AND a.remark = #{sysRoleInfo.remark}
</if>
<if test="sysRoleInfo.status != null">
AND a.status = #{sysRoleInfo.status}
</if>
<if test="sysRoleInfo.deleteFlag != null">
AND a.delete_flag = #{sysRoleInfo.deleteFlag}
</if>
<if test="sysRoleInfo.dataAuth != null and sysRoleInfo.dataAuth.trim() != ''">
AND a.data_auth = #{sysRoleInfo.dataAuth}
</if>
<if test="sysRoleInfo.createBy != null and sysRoleInfo.createBy.trim() != ''">
AND a.CREATE_BY = #{sysRoleInfo.createBy}
</if>
<if test="sysRoleInfo.createName != null and sysRoleInfo.createName.trim() != ''">
AND a.CREATE_NAME = #{sysRoleInfo.createName}
</if>
<if test="sysRoleInfo.createTime != null">
AND a.CREATE_TIME = #{sysRoleInfo.createTime}
</if>
<if test="sysRoleInfo.createTimeStart != null">
AND a.CREATE_TIME <![CDATA[ >= ]]> #{sysRoleInfo.createTimeStart}
</if>
<if test="sysRoleInfo.createTimeEnd != null">
AND a.CREATE_TIME <![CDATA[ <= ]]> #{sysRoleInfo.createTimeEnd}
</if>
<if test="sysRoleInfo.updateBy != null and sysRoleInfo.updateBy.trim() != ''">
AND a.UPDATE_BY = #{sysRoleInfo.updateBy}
</if>
<if test="sysRoleInfo.updateTime != null">
AND a.UPDATE_TIME = #{sysRoleInfo.updateTime}
</if>
</if>
</sql>
<!--sysRoleInfo简单分页查询-->
<select id="getSysRoleInfoPage" resultMap="sysRoleInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_role_info a
<where>
a.delete_flag = 0
<include refid="sysRoleInfo_where"/>
</where>
order by a.CREATE_TIME desc
</select>
<!-- 根据用户Id获取所有的角色的权限-->
<select id="getAllRoleDataAuthByUserId" resultType="java.lang.String">
SELECT
a.data_auth
FROM sys_role_info a
left join sys_user_role_res r on r.role_id = a.fd_id
where a.delete_flag = 0 and r.user_id = #{userId}
</select>
<!-- 根据角色Id获取所有的角色的权限-->
<select id="getRoleDataAuthByRoleId" resultType="java.lang.String">
SELECT
a.data_auth
FROM sys_role_info a
where a.delete_flag = 0 and a.fd_id in
<foreach item="idStr" index="index" collection="roleIdList" open="(" separator="," close=")">
#{idStr}
</foreach>
</select>
<!-- 查找名称是否存在-->
<select id="checkExistenceRole" resultType="java.lang.Integer">
SELECT
count(1)
FROM sys_role_info a
where a.delete_flag = 0 and a.role_name = #{roleName}
<if test="roleId != null and roleId.trim() != ''">
AND a.fd_id != #{roleId}
</if>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.permission.mapper.SysRoleMenuResMapper">
<resultMap id="sysRoleMenuResMap" type="com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleMenuRes">
<id property="fdId" column="fd_id"/>
<result property="roleId" column="role_id"/>
<result property="menuId" column="menu_id"/>
</resultMap>
<sql id="Base_Column_List">
a.fd_id,
a.role_id,
a.menu_id
</sql>
<sql id="sysRoleMenuRes_where">
<if test="sysRoleMenuRes != null">
<if test="sysRoleMenuRes.fdId != null and sysRoleMenuRes.fdId.trim() != ''">
AND a.fd_id = #{sysRoleMenuRes.fdId}
</if>
<if test="sysRoleMenuRes.roleId != null and sysRoleMenuRes.roleId.trim() != ''">
AND a.role_id = #{sysRoleMenuRes.roleId}
</if>
<if test="sysRoleMenuRes.menuId != null and sysRoleMenuRes.menuId.trim() != ''">
AND a.menu_id = #{sysRoleMenuRes.menuId}
</if>
</if>
</sql>
<!--sysRoleMenuRes简单分页查询-->
<select id="getSysRoleMenuResPage" resultMap="sysRoleMenuResMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_role_menu_res a
<where>
1=1
<include refid="sysRoleMenuRes_where"/>
</where>
</select>
<!-- 根据角色删除关联表 -->
<delete id="deleteByRoleId">
delete from sys_role_menu_res where role_id = #{roleId}
</delete>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.permission.mapper.SysUserInfoMapper">
<resultMap id="sysUserInfoMap" type="com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo">
<id property="fdId" column="fd_id"/>
<result property="fdName" column="fd_name"/>
<result property="fdLoginName" column="fd_login_name"/>
<result property="fdLdapDn" column="fd_ldap_dn"/>
<result property="fdDeptName" column="fd_dept_name"/>
<result property="fdMobileNo" column="fd_mobile_no"/>
<result property="fdEmail" column="fd_email"/>
<result property="status" column="status"/>
<result property="roleNames" column="role_names"/>
<result property="createBy" column="CREATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
</resultMap>
<sql id="Base_Column_List">
a.fd_id,
a.fd_name,
a.fd_login_name,
a.fd_ldap_dn,
a.fd_dept_name,
a.fd_mobile_no,
a.fd_email,
a.status,
GROUP_CONCAT(r.role_name ORDER BY r.create_time asc) as role_names,
a.CREATE_BY,
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME
</sql>
<sql id="sysUserInfo_where">
<if test="sysUserInfo != null">
<if test="sysUserInfo.fdId != null and sysUserInfo.fdId.trim() != ''">
AND a.fd_id = #{sysUserInfo.fdId}
</if>
<if test="sysUserInfo.fdName != null and sysUserInfo.fdName.trim() != ''">
AND a.fd_name like concat('%',#{sysUserInfo.fdName},'%')
</if>
<if test="sysUserInfo.fdLoginName != null and sysUserInfo.fdLoginName.trim() != ''">
AND a.fd_login_name = #{sysUserInfo.fdLoginName}
</if>
<if test="sysUserInfo.fdLdapDn != null and sysUserInfo.fdLdapDn.trim() != ''">
AND a.fd_ldap_dn = #{sysUserInfo.fdLdapDn}
</if>
<if test="sysUserInfo.fdDeptName != null and sysUserInfo.fdDeptName.trim() != ''">
AND a.fd_dept_name like concat('%',#{sysUserInfo.fdDeptName},'%')
</if>
<if test="sysUserInfo.fdMobileNo != null and sysUserInfo.fdMobileNo.trim() != ''">
AND a.fd_mobile_no = #{sysUserInfo.fdMobileNo}
</if>
<if test="sysUserInfo.fdEmail != null and sysUserInfo.fdEmail.trim() != ''">
AND a.fd_email = #{sysUserInfo.fdEmail}
</if>
<if test="sysUserInfo.status != null">
AND a.status = #{sysUserInfo.status}
</if>
<if test="sysUserInfo.createBy != null and sysUserInfo.createBy.trim() != ''">
AND a.CREATE_BY = #{sysUserInfo.createBy}
</if>
<if test="sysUserInfo.createName != null and sysUserInfo.createName.trim() != ''">
AND a.CREATE_NAME = #{sysUserInfo.createName}
</if>
<if test="sysUserInfo.createTime != null">
AND a.CREATE_TIME = #{sysUserInfo.createTime}
</if>
<if test="sysUserInfo.updateBy != null and sysUserInfo.updateBy.trim() != ''">
AND a.UPDATE_BY = #{sysUserInfo.updateBy}
</if>
<if test="sysUserInfo.updateTime != null">
AND a.UPDATE_TIME = #{sysUserInfo.updateTime}
</if>
</if>
</sql>
<!--sysUserInfo简单分页查询-->
<select id="getSysUserInfoPage" resultMap="sysUserInfoMap">
SELECT
a.fd_id,
a.fd_name,
a.fd_login_name,
a.fd_ldap_dn,
a.fd_dept_name,
a.fd_mobile_no,
a.fd_email,
a.status,
a.role_names,
a.CREATE_BY,
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME
from (
SELECT
<include refid="Base_Column_List"/>
FROM sys_user_info a
LEFT JOIN sys_user_role_res res on a.fd_id=res.user_id
LEFT JOIN sys_role_info r on res.role_id=r.fd_id and r.delete_flag = 0 and r.status = 0
<where>
1=1
<include refid="sysUserInfo_where"/>
</where>
GROUP BY a.fd_id
) a
<if test="sysUserInfo != null">
<if test="sysUserInfo.roleNames != null and sysUserInfo.roleNames.trim() != ''">
where a.role_names like concat('%',#{sysUserInfo.roleNames},'%')
</if>
</if>
order by a.CREATE_TIME desc
</select>
<!--list-->
<select id="getEkpUser" resultMap="sysUserInfoMap">
select e.fd_id,e.fd_name,p.fd_login_name,e.fd_ldap_dn
,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) AS fd_dept_name
,p.fd_mobile_no,p.fd_email
from sys_org_element e JOIN sys_org_person p on e.fd_id=p.fd_id
where e.fd_is_available = '1'
</select>
<!--list-->
<select id="getResAndRoleNameUserId" resultType="com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes">
SELECT
a.fd_id as fdId
,a.user_id as userId
,a.role_id as roleId
,r.role_name as roleName
FROM sys_user_role_res a
LEFT JOIN sys_role_info r on a.role_id=r.fd_id and r.delete_flag = 0 and r.status = 0
where a.user_id=#{userId}
</select>
<!--给EKP用的,获取列表是否全量的权限-->
<!--#全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)-->
<select id="getAuthByUserIdAndModelId" resultType="java.lang.Integer">
select
case
when a.data_auth is null then 0
when a.data_auth like "%0%" then 1
when a.data_auth like "%a%" and a.CUSTOMER_ID is not null then 1
when a.data_auth like "%b%" and a.BUSSINESS_ID is not null then 1
when a.data_auth like "%c%" and a.QUOTATION_ID is not null then 1
when a.data_auth like "%d%" and a.CONTRACT_ID is not null then 1
when a.data_auth like "%e%" and a.DOMAIN_ID is not null then 1
when a.data_auth like "%f%" and a.BU_ID is not null then 1
when a.data_auth like "%g%" and a.LINE_ID is not null then 1
when a.data_auth like "%h%" and a.INCOME_ID is not null then 1
else 2 end
from (
SELECT
GROUP_CONCAT(DISTINCT a.data_auth) as data_auth
,b.INCOME_ID
,b.CUSTOMER_ID
,b.CONTRACT_ID
,b.BUSSINESS_ID
,b.QUOTATION_ID
,b.DOMAIN_ID
,b.BU_ID
,b.LINE_ID
FROM
sys_menu b
join sys_role_menu_res m on b.id=m.menu_id
join sys_role_info a on m.role_id = a.fd_id
join sys_user_role_res r on r.role_id = a.fd_id
where a.delete_flag = 0 and a.status = 0 and b.DELETE_STATUS='1' and b.PERMISSION_STATUS='0'
and r.user_id = #{userId} and b.MODEL_ID=#{modelId}
) a
</select>
<select id="getUserByCodeOrLoginName" resultMap="sysUserInfoMap">
SELECT
a.fd_id,
a.fd_name,
a.fd_login_name,
a.fd_dept_name
FROM sys_user_info a
<where>
1=1 and a.status = 0
<if test="code != null and code != ''">
AND (a.fd_login_name like concat('%',#{code},'%') or a.fd_name like concat('%',#{code},'%'))
</if>
</where>
order by a.CREATE_TIME desc
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.permission.mapper.SysUserPermissionMapper">
<resultMap id="sysUserPermissionMap" type="com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission">
<id property="id" column="ID"/>
<result property="empName" column="EMP_NAME"/>
<result property="empLoginName" column="EMP_LOGIN_NAME"/>
<result property="empDept" column="EMP_DEPT"/>
<result property="permissionType" column="PERMISSION_TYPE"/>
<result property="name" column="NAME"/>
<result property="code" column="CODE"/>
<result property="isContains" column="IS_CONTAINS"/>
<result property="permissionStatus" column="PERMISSION_STATUS"/>
<result property="deleteFlag" column="DELETE_FLAG"/>
<result property="createBy" column="CREATE_BY"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="sourceType" column="SOURCE_TYPE"/>
</resultMap>
<resultMap id="sysUserPermissionExportMap" type="com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionExportVo">
<result property="empName" column="EMP_NAME"/>
<result property="empLoginName" column="EMP_LOGIN_NAME"/>
<result property="empDept" column="EMP_DEPT"/>
<result property="permissionType" column="PERMISSION_TYPE"/>
<result property="name" column="NAME"/>
<result property="code" column="CODE"/>
<result property="isContains" column="IS_CONTAINS"/>
<result property="permissionStatus" column="PERMISSION_STATUS"/>
</resultMap>
<resultMap id="nameAndCodeMap" type="com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo">
<result property="name" column="name"/>
<result property="code" column="code"/>
<result property="domainId" column="domainId"/>
</resultMap>
<resultMap id="dictMap" type="com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo">
<result property="id" column="id"/>
<result property="name" column="name"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.EMP_NAME,
a.EMP_LOGIN_NAME,
b.fd_dept_name as EMP_DEPT,
a.PERMISSION_TYPE,
a.NAME,
a.CODE,
a.IS_CONTAINS,
a.PERMISSION_STATUS,
a.DELETE_FLAG,
a.CREATE_TIME
</sql>
<sql id="sysUserPermission_where">
<if test="sysUserPermission != null">
<if test="sysUserPermission.idList != null">
AND a.id in
<foreach item="idStr" index="index" collection="sysUserPermission.idList" open="(" separator="," close=")">
#{idStr}
</foreach>
</if>
<if test="sysUserPermission.idList == null">
<if test="sysUserPermission.empName != null and sysUserPermission.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{sysUserPermission.empName},'%')
</if>
<if test="sysUserPermission.empLoginName != null and sysUserPermission.empLoginName.trim() != ''">
AND a.EMP_LOGIN_NAME = #{sysUserPermission.empLoginName}
</if>
<if test="sysUserPermission.empDept != null and sysUserPermission.empDept.trim() != ''">
AND b.fd_dept_name like concat('%',#{sysUserPermission.empDept},'%')
</if>
<if test="sysUserPermission.permissionType != null and sysUserPermission.permissionType.trim() != ''">
AND a.PERMISSION_TYPE = #{sysUserPermission.permissionType}
</if>
<if test="sysUserPermission.name != null and sysUserPermission.name.trim() != ''">
AND a.NAME like concat('%',#{sysUserPermission.name},'%')
</if>
<if test="sysUserPermission.code != null and sysUserPermission.code.trim() != ''">
AND a.CODE = #{sysUserPermission.code}
</if>
<if test="sysUserPermission.permissionStatus != null and sysUserPermission.permissionStatus.trim() != ''">
AND a.PERMISSION_STATUS = #{sysUserPermission.permissionStatus}
</if>
</if>
</if>
</sql>
<!--sysUserPermission简单分页查询-->
<select id="getSysUserPermissionPage" resultMap="sysUserPermissionMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_user_permission a left join sys_user_info b on a.user_id = b.fd_id
<where>
a.DELETE_FLAG = '1'
<include refid="sysUserPermission_where"/>
</where>
order by a.CREATE_TIME desc
</select>
<select id="userSelectCount" resultType="java.lang.Long">
SELECT
count(1)
FROM sys_user_permission a left join sys_user_info b on a.user_id = b.fd_id
<where>
a.DELETE_FLAG = '1'
<include refid="sysUserPermission_where"/>
</where>
</select>
<select id="userSelectList" resultMap="sysUserPermissionExportMap">
SELECT
a.EMP_NAME,
a.EMP_LOGIN_NAME,
b.fd_dept_name as EMP_DEPT,
c.name AS PERMISSION_TYPE,
a.NAME,
a.CODE,
CASE WHEN a.IS_CONTAINS=0 THEN "是"
WHEN a.IS_CONTAINS =1 THEN "否"
ELSE a.IS_CONTAINS END as IS_CONTAINS,
CASE WHEN a.PERMISSION_STATUS=0 THEN "启用"
WHEN a.PERMISSION_STATUS =1 THEN "禁用"
ELSE a.PERMISSION_STATUS END as PERMISSION_STATUS
FROM sys_user_permission a
LEFT JOIN permission_type c on a.PERMISSION_TYPE = c.id
LEFT JOIN sys_user_info b on a.user_id = b.fd_id
<where>
a.DELETE_FLAG = '1'
<include refid="sysUserPermission_where"/>
</where>
limit #{sysUserPermission.limitStart},#{sysUserPermission.limitEnd}
</select>
<select id="selectUnitVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3a9d1d4d438bfc code,a.fd_3a9d1d4caeeeb8 name
from ekp_05b7485fd444f95a6177 a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3a9d1d4d438bfc like concat('%',#{name},'%') or a.fd_3a9d1d4caeeeb8 like concat('%',#{name},'%'))
</if>
</select>
<select id="selectContractVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3ade33763baa0e code,a.fd_3ade334bac0016 name
from ekp_0103c453b2848c3bb31c a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3ade33763baa0e like concat('%',#{name},'%') or a.fd_3ade334bac0016 like concat('%',#{name},'%'))
</if>
</select>
<select id="selectSettleVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3a37fe508071fe code,a.fd_3a2b38c61ef9aa name
from ekp_24a8e6a7fc143bb8c48a a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3a37fe508071fe like concat('%',#{name},'%') or a.fd_3a2b38c61ef9aa like concat('%',#{name},'%'))
</if>
</select>
<select id="selectContractSimpleVO" resultMap="nameAndCodeMap">
SELECT
a.NAME,
a.CODE
from sys_user_permission a
where a.EMP_LOGIN_NAME = #{loginName} and a.PERMISSION_TYPE = #{type} and a.PERMISSION_STATUS = '0'
<if test="name != null and name.trim() != ''">
AND (a.NAME like concat('%',#{name},'%') or a.CODE like concat('%',#{name},'%'))
</if>
</select>
<select id="selectBusinessVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3b107f1084fd96 code,a.fd_3b04b95268f19c name
from ekp_2f8e08660c542d8a169f a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3b107f1084fd96 like concat('%',#{name},'%') or a.fd_3b04b95268f19c like concat('%',#{name},'%'))
</if>
</select>
<select id="selectQuotationVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3b04b9dc64a9f4 code,a.fd_3b04b9d8688cfa name
from ekp_fd1449d265845e087bf2 a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3b04b9dc64a9f4 like concat('%',#{name},'%') or a.fd_3b04b9d8688cfa like concat('%',#{name},'%'))
</if>
</select>
<select id="selectDeptVO" resultMap="nameAndCodeMap">
SELECT
a.fd_no code,a.fd_name name,a.fd_id domainId
from sys_org_element a
where a.fd_is_available = '1' and a.fd_org_type = 2
<if test="name != null and name.trim() != ''">
AND (a.fd_no like concat('%',#{name},'%') or a.fd_name like concat('%',#{name},'%'))
</if>
</select>
<!--根据部门编码查询id-->
<select id="selectSettleByCode" resultType="java.lang.String">
SELECT
a.fd_id
from sys_org_element a
where a.fd_is_available = '1' and a.fd_org_type = 2 and a.fd_no = #{code}
limit 1
</select>
<select id="selectDictByType" resultMap="dictMap">
SELECT
a.dict_id as id,a.name
from permission_type a
where a.dict_type = #{type}
</select>
<select id="selectDictByTypeOne" resultMap="dictMap">
SELECT
a.dict_id as id,a.name
from permission_type a
where a.dict_type = #{type} and a.user_id = #{userId}
</select>
<!--针对BU归属和条线类型时的存在判断-->
<select id="selectDictByName" resultType="java.lang.Integer">
SELECT
count(1)
from permission_type a
where a.dict_type = #{type} and a.name = #{name}
</select>
<!--判断对应维度的名称或者编码是否存在-->
<select id="selectUnitCount" resultType="java.lang.Integer">
SELECT
count(1)
from ekp_05b7485fd444f95a6177 a
where a.fd_3a9d1d4d438bfc = #{name}
</select>
<select id="selectContractCount" resultType="java.lang.Integer">
SELECT
count(1)
from ekp_0103c453b2848c3bb31c a
where a.fd_3ade33763baa0e = #{name}
</select>
<select id="selectSettleCount" resultType="java.lang.Integer">
SELECT
count(1)
from ekp_24a8e6a7fc143bb8c48a a
where a.fd_3a37fe508071fe = #{name}
</select>
<select id="selectBusinessCount" resultType="java.lang.Integer">
SELECT
count(1)
from ekp_2f8e08660c542d8a169f a
where a.fd_3b107f1084fd96 = #{name}
</select>
<select id="selectQuotationCount" resultType="java.lang.Integer">
SELECT
count(1)
from ekp_fd1449d265845e087bf2 a
where a.fd_3b04b9dc64a9f4 = #{name}
</select>
<select id="selectDeptCount" resultType="java.lang.Integer">
SELECT
count(1)
from sys_org_element a
where a.fd_is_available = '1' and fd_org_type = 2 and a.fd_no = #{name}
</select>
<!-- 查找当前用户的所有权限 -->
<select id="getUserPermissionByUserId" resultMap="sysUserPermissionMap">
select
p.PERMISSION_TYPE,p.NAME,p.CODE,ifnull(p.IS_CONTAINS,'1') IS_CONTAINS
from
sys_user_permission p
where p.DELETE_FLAG='1' and p.PERMISSION_STATUS='0'
and p.USER_ID = #{userId}
ORDER BY p.PERMISSION_TYPE
</select>
<!-- 查找权限,用来新建 - 客户 -->
<select id="getUserPermissionByAutoCreateKH" resultMap="sysUserPermissionMap">
select
e.fd_name EMP_NAME ,p.fd_login_name EMP_LOGIN_NAME ,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'1' PERMISSION_TYPE ,d.fd_3a9d1d4caeeeb8 NAME ,d.fd_3a9d1d4d438bfc CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS ,'0' PERMISSION_STATUS ,'1' DELETE_FLAG ,e.fd_id USER_ID ,d.fd_id DOMAIN_ID
from ekp_fa3e25a1b6c472683e96 d
LEFT JOIN ekp_c472683e96_8b4d79b2c8 f on f.fd_parent_id = d.fd_id
LEFT JOIN sys_org_element e on e.fd_id = f.fd_3b118b5e5d1024
JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId} GROUP BY e.fd_id
</select>
<!-- 查找权限,用来新建 - 商机 -->
<select id="getUserPermissionByAutoCreateSJ" resultMap="sysUserPermissionMap">
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'2' PERMISSION_TYPE,d.fd_3b04b95268f19c NAME,d.fd_3b107f1084fd96 CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_24385b8cc934eb8a9231 d
LEFT JOIN ekp_34eb8a9231_8c4fb81d42 f on f.fd_parent_id = d.fd_id
LEFT JOIN sys_org_element e on e.fd_id = f.fd_3b0e8c7f169ed2
JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId} GROUP BY e.fd_id
</select>
<!-- 查找权限,用来新建 - 报价单 -->
<select id="getUserPermissionByAutoCreateBJD" resultMap="sysUserPermissionMap">
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'3' PERMISSION_TYPE,d.fd_3b04b9d8688cfa NAME,d.fd_3b04b9dc64a9f4 CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_fd06fd1251d4bac8cc91 d
LEFT JOIN ekp_d4bac8cc91_8aad2804b4 f1 on f1.fd_parent_id = d.fd_id
LEFT JOIN ekporg_18308def06b6c534b70e f on f.fd_parent_id = f1.fd_id
LEFT JOIN sys_org_element e on e.fd_id = f.sys_org_person_id JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId} GROUP BY e.fd_id
</select>
<!-- 查找权限,用来新建 - 合同 -->
<select id="getUserPermissionByAutoCreateHT" resultMap="sysUserPermissionMap">
select a.EMP_NAME,a.EMP_LOGIN_NAME,a.EMP_DEPT,a.PERMISSION_TYPE,a.NAME,a.CODE,a.SOURCE_TYPE,a.IS_CONTAINS,a.PERMISSION_STATUS,a.DELETE_FLAG,a.USER_ID,a.DOMAIN_ID
from (
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'4' PERMISSION_TYPE,d.fd_3ad97ed761c75c NAME,d.fd_3ade319226ed52 CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_4834ce2ea964f1a8cfdb d
LEFT JOIN ekporg_183823dc7ae199aa37e9 f on f.fd_parent_id = d.fd_id
LEFT JOIN sys_org_element e on e.fd_id = f.sys_org_person_id JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
union ALL
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'4' PERMISSION_TYPE,d.fd_3ad97ed761c75c NAME,d.fd_3ade319226ed52 CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_4834ce2ea964f1a8cfdb d
LEFT JOIN sys_org_element e on e.fd_id = d.fd_3ade318b64b54c
JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
) a GROUP BY a.USER_ID
</select>
<!-- 查找权限,用来新建 - 项目 -->
<select id="getUserPermissionByAutoCreateXM" resultMap="sysUserPermissionMap">
select a.EMP_NAME,a.EMP_LOGIN_NAME,a.EMP_DEPT,a.PERMISSION_TYPE,a.NAME,a.CODE,a.SOURCE_TYPE,a.IS_CONTAINS,a.PERMISSION_STATUS,a.DELETE_FLAG,a.USER_ID,a.DOMAIN_ID
from (
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'5' PERMISSION_TYPE,d.fd_3a829ae9bab760 NAME,d.fd_3a829aea0b84a4 CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_fb3b8d0c8f148639b8e2 d
LEFT JOIN ekporg_1832fea7d722404c1e92 f on f.fd_parent_id = d.fd_id
LEFT JOIN sys_org_element e on e.fd_id = f.sys_org_person_id JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
union ALL
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'5' PERMISSION_TYPE,d.fd_3a829ae9bab760 NAME,d.fd_3a829aea0b84a4 CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_fb3b8d0c8f148639b8e2 d
LEFT JOIN sys_org_element e on e.fd_id = d.fd_3ae55447e30d62
JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
) a GROUP BY a.USER_ID
</select>
<!-- 查找权限,用来新建 - 合同变更 -->
<select id="getUserPermissionByAutoCreateHTBG" resultMap="sysUserPermissionMap">
select a.EMP_NAME,a.EMP_LOGIN_NAME,a.EMP_DEPT,a.PERMISSION_TYPE,a.NAME,a.CODE,a.SOURCE_TYPE,a.IS_CONTAINS,a.PERMISSION_STATUS,a.DELETE_FLAG,a.USER_ID,a.DOMAIN_ID
from (
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'4' PERMISSION_TYPE,d.fd_3b8797876dc13c_text NAME,d.fd_3b879793d37afe CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_224c54af6ae4418ae0a2 d
LEFT JOIN ekporg_186a02b160aa59dd70f4 f on f.fd_parent_id = d.fd_id
LEFT JOIN sys_org_element e on e.fd_id = f.sys_org_person_id JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
union all
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'4' PERMISSION_TYPE,d.fd_3b8797876dc13c_text NAME,d.fd_3b879793d37afe CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_224c54af6ae4418ae0a2 d
left join ekp_0103c453b2848c3bb31c h on d.fd_3b879793d37afe=h.fd_3ade33763baa0e
LEFT JOIN sys_org_element e on e.fd_id = h.fd_3ade318b64b54c JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
) a
GROUP BY a.USER_ID
</select>
<!-- 查找权限,用来新建 - 项目变更 -->
<select id="getUserPermissionByAutoCreateXMBG" resultMap="sysUserPermissionMap">
select a.EMP_NAME,a.EMP_LOGIN_NAME,a.EMP_DEPT,a.PERMISSION_TYPE,a.NAME,a.CODE,a.SOURCE_TYPE,a.IS_CONTAINS,a.PERMISSION_STATUS,a.DELETE_FLAG,a.USER_ID,a.DOMAIN_ID
from (
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'5' PERMISSION_TYPE,d.fd_3b8797876dc13c_text NAME,d.fd_3b879793d37afe CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_d701e3e72794ff390ca8 d
LEFT JOIN ekporg_18622320f73771d520db f on f.fd_parent_id = d.fd_id
LEFT JOIN sys_org_element e on e.fd_id = f.sys_org_person_id JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
union all
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'5' PERMISSION_TYPE,d.fd_3b8797876dc13c_text NAME,d.fd_3b879793d37afe CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_d701e3e72794ff390ca8 d
LEFT JOIN ekp_24a8e6a7fc143bb8c48a f on f.fd_3a37fe508071fe = d.fd_3b879793d37afe
LEFT JOIN sys_org_element e on e.fd_id = f.fd_3b212a2d7a65c6 JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
) a GROUP BY a.USER_ID
</select>
<!-- 查找fdId对应的code -->
<select id="selectCodeByFdId" resultType="java.lang.String">
select d.fd_3a9d1d4d438bfc CODE from ekp_fa3e25a1b6c472683e96 d where d.fd_id = #{fdId}
union ALL
select d.fd_3b107f1084fd96 CODE from ekp_24385b8cc934eb8a9231 d where d.fd_id = #{fdId}
union ALL
select d.fd_3b04b9dc64a9f4 CODE from ekp_fd06fd1251d4bac8cc91 d where d.fd_id = #{fdId}
union ALL
select d.fd_3ade319226ed52 CODE from ekp_4834ce2ea964f1a8cfdb d where d.fd_id = #{fdId}
union ALL
select d.fd_3a829aea0b84a4 CODE from ekp_fb3b8d0c8f148639b8e2 d where d.fd_id = #{fdId}
union ALL
select d.fd_3b879793d37afe CODE from ekp_d701e3e72794ff390ca8 d where d.fd_id = #{fdId}
union ALL
select d.fd_3b879793d37afe CODE from ekp_224c54af6ae4418ae0a2 d where d.fd_id = #{fdId}
limit 1
</select>
<!-- 删除EKP新建的 -->
<delete id="deleteUserPermissionByIdAndType">
delete from sys_user_permission p
where SOURCE_TYPE = 0 and CODE = #{code} and PERMISSION_TYPE = #{permissionType}
</delete>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.permission.mapper.SysUserRoleResMapper">
<resultMap id="sysUserRoleResMap" type="com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes">
<id property="fdId" column="fd_id"/>
<result property="userId" column="user_id"/>
<result property="roleId" column="role_id"/>
</resultMap>
<sql id="Base_Column_List">
a.fd_id,
a.user_id,
a.role_id
</sql>
<sql id="sysUserRoleRes_where">
<if test="sysUserRoleRes != null">
<if test="sysUserRoleRes.fdId != null and sysUserRoleRes.fdId.trim() != ''">
AND a.fd_id = #{sysUserRoleRes.fdId}
</if>
<if test="sysUserRoleRes.userId != null and sysUserRoleRes.userId.trim() != ''">
AND a.user_id = #{sysUserRoleRes.userId}
</if>
<if test="sysUserRoleRes.roleId != null and sysUserRoleRes.roleId.trim() != ''">
AND a.role_id = #{sysUserRoleRes.roleId}
</if>
</if>
</sql>
<!--sysUserRoleRes简单分页查询-->
<select id="getSysUserRoleResPage" resultMap="sysUserRoleResMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_user_role_res a
<where>
1=1
<include refid="sysUserRoleRes_where"/>
</where>
</select>
<!--sysUserRoleRes简单分页查询-->
<select id="getSysUserByRoleId" resultType="java.lang.String">
SELECT
DISTINCT u.fd_name
FROM sys_user_role_res a
join sys_user_info u on a.user_id=u.fd_id
where a.role_id = #{roleId}
</select>
<!-- 根据账号删除关联表 -->
<delete id="deleteByUserId">
delete from sys_user_role_res where user_id = #{userId}
</delete>
<!-- 根据角色删除关联表 -->
<delete id="deleteByRoleId">
delete from sys_user_role_res where role_id = #{roleId}
</delete>
</mapper>
......@@ -225,6 +225,7 @@
<result property="fd_3bcd41da212afe" column="fd_3bcd41da212afe"/>
<result property="fd_3bcd41d77e4812" column="fd_3bcd41d77e4812"/>
<result property="fd_3bcdee91cacb6c" column="fd_3bcdee91cacb6c"/>
<result property="fd_3c3e5ff65115a2" column="fd_3c3e5ff65115a2"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -715,6 +716,7 @@
,ifnull(unitFund.SALARY_MONEY,'0') fd_3bcd41d1f6f58a
,ifnull(unitSocial.SALARY_MONEY,'0') fd_3bcd41db081b72
,ifnull(if(a.RELAY_SALARY_UNIT is not null and a.RELAY_SALARY_UNIT != 0,a.RELAY_SALARY_UNIT,a.RELAY_SALARY),'0') fd_3bcdee91cacb6c
,ifnull(a.CREATE_NAME,'') fd_3c3e5ff65115a2
from t_salary_account a
LEFT JOIN t_salary_standard s on a.SALARY_FORM_ID=s.ID
left join t_salary_account_item withholidingPersonSocial on withholidingPersonSocial.SALARY_ACCOUNT_ID = a.id and withholidingPersonSocial.JAVA_FIED_NAME='withholidingPersonSocial'
......
......@@ -64,6 +64,12 @@ public class TDispatchInfoExportVo {
@ExcelProperty("员工身份证")
private String empIdcard;
@ExcelAttribute(name = "手机号码", maxLength = 32)
@Schema(description = "手机号码" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("手机号码" )
private String empMobile;
@ExcelAttribute(name = "客户名称", maxLength = 50)
@Schema(description = "客户名称")
@HeadFontStyle(fontHeightInPoints = 11)
......
......@@ -198,6 +198,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} else {
redisUtil.set(key, user.getId(), 600L);
}
if (count > 200000 && !CommonConstants.ONE_STRING.equals(user.getId())) {
out.write(CommonConstants.SOCIAL_EXPORT_LIMIT.getBytes("GBK"));
out.close();
redisUtil.remove(key);
return;
}
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TPaymentInfoBatchVo.class).includeColumnFieldNames(searchVo.getExportFields()).build();
int index = 0;
......@@ -229,16 +235,13 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
excelWriter.finish();
}
} catch (Exception e) {
redisUtil.remove(key);
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
redisUtil.remove(key);
} catch (IOException e) {
redisUtil.remove(key);
log.error("执行异常", e);
}
}
......
......@@ -26,7 +26,7 @@ mybatis-plus:
logic-not-delete-value: 0
configuration:
map-underscore-to-camel-case: true
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# spring security 配置
security:
......
......@@ -162,6 +162,7 @@
<result property="unitBigailmentCardinal" column="UNIT_BIGAILMENT_CARDINAL"/>
<result property="unitWorkInjuryCardinal" column="UNIT_WORK_INJURY_CARDINAL"/>
<result property="unitBirthCardinal" column="UNIT_BIRTH_CARDINAL"/>
<result property="empMobile" column="EMP_MOBILE"/>
</resultMap>
<resultMap id="fundSupplementaryMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.FundSupplementaryExportVo">
......@@ -932,7 +933,8 @@
s.UNIT_BIRTH_CARDINAL,
c.PROVIDENT_HOUSEHOLD_NAME,
c.UNIT_PROVIDENG_CARDINAL,
c.UNIT_PROVIDENT_PER
c.UNIT_PROVIDENT_PER,
a.EMP_MOBILE
from t_dispatch_info a
left join t_social_info s on s.id=a.SOCIAL_ID
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment