diff --git a/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/constant/Const.java b/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/constant/Const.java
index 5f9b4063..82addb93 100644
--- a/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/constant/Const.java
+++ b/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/constant/Const.java
@@ -12,11 +12,6 @@ public class Const implements com.orion.lang.constant.Const {
private Const() {
}
- /**
- * 同 ${orion.version} 迭代时候需要手动更改
- */
- public static String VERSION = "1.0.0";
-
public static final Integer NOT_DELETE = 0;
public static final Integer IS_DELETED = 1;
diff --git a/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/constant/OrionOpsProConst.java b/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/constant/OrionOpsProConst.java
index 8215a668..fe7e37e6 100644
--- a/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/constant/OrionOpsProConst.java
+++ b/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/constant/OrionOpsProConst.java
@@ -9,12 +9,15 @@ package com.orion.ops.framework.common.constant;
*/
public interface OrionOpsProConst {
+ /**
+ * 同 ${orion.version} 迭代时候需要手动更改
+ */
+ String VERSION = "1.0.0";
+
String GITHUB = "https://github.com/lijiahangmax/orion-ops-pro";
String GITEE = "https://gitee.com/lijiahangmax/orion-ops-pro";
String ISSUES = "https://gitee.com/lijiahangmax/orion-ops-pro/issues";
- String VERSION = "1.0.0";
-
}
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-storage/src/main/java/com/orion/ops/framework/storage/core/client/FileClient.java b/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/file/FileClient.java
similarity index 97%
rename from orion-ops-framework/orion-ops-spring-boot-starter-storage/src/main/java/com/orion/ops/framework/storage/core/client/FileClient.java
rename to orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/file/FileClient.java
index 51ff4f64..d2e98227 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-storage/src/main/java/com/orion/ops/framework/storage/core/client/FileClient.java
+++ b/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/file/FileClient.java
@@ -1,4 +1,4 @@
-package com.orion.ops.framework.storage.core.client;
+package com.orion.ops.framework.common.file;
import java.io.InputStream;
diff --git a/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/utils/CryptoUtils.java b/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/utils/CryptoUtils.java
index 985ac430..47e96060 100644
--- a/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/utils/CryptoUtils.java
+++ b/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/utils/CryptoUtils.java
@@ -4,6 +4,8 @@ import com.orion.ops.framework.common.crypto.ValueCrypto;
/**
* 加密工具类
+ *
+ * PrimaryValueCrypto 代理类工具
*
* @author Jiahang Li
* @version 1.0.0
@@ -13,6 +15,9 @@ public class CryptoUtils {
private static ValueCrypto delegate;
+ private CryptoUtils() {
+ }
+
/**
* 加密
*
diff --git a/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/utils/FileClientUtils.java b/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/utils/FileClientUtils.java
new file mode 100644
index 00000000..551f51a2
--- /dev/null
+++ b/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/utils/FileClientUtils.java
@@ -0,0 +1,136 @@
+package com.orion.ops.framework.common.utils;
+
+import com.orion.ops.framework.common.file.FileClient;
+
+import java.io.InputStream;
+
+/**
+ * 文件客户端工具
+ *
+ * PrimaryFileClient 代理类工具
+ *
+ * @author Jiahang Li
+ * @version 1.0.0
+ * @since 2023/7/21 12:05
+ */
+public class FileClientUtils {
+
+ private static FileClient delegate;
+
+ private FileClientUtils() {
+ }
+
+ /**
+ * 上传文件
+ *
+ * @param path 文件路径
+ * @param content 文件内容
+ * @return 路径
+ * @throws Exception Exception
+ */
+ public static String upload(String path, byte[] content) throws Exception {
+ return delegate.upload(path, content);
+ }
+
+ /**
+ * 上传文件
+ *
+ * @param path 文件路径
+ * @param content 文件内容
+ * @param overrideIfExist 文件存在是否覆盖
+ * @return 路径
+ * @throws Exception Exception
+ */
+ public static String upload(String path, byte[] content, boolean overrideIfExist) throws Exception {
+ return delegate.upload(path, content, overrideIfExist);
+ }
+
+ /**
+ * 上传文件
+ *
+ * @param path 文件路径
+ * @param in in
+ * @return 路径
+ * @throws Exception Exception
+ */
+ public static String upload(String path, InputStream in) throws Exception {
+ return delegate.upload(path, in);
+ }
+
+ /**
+ * 上传文件
+ *
+ * @param path 文件路径
+ * @param in in
+ * @param autoClose autoClose
+ * @return 路径
+ * @throws Exception Exception
+ */
+ public static String upload(String path, InputStream in, boolean autoClose) throws Exception {
+ return delegate.upload(path, in, autoClose);
+ }
+
+ /**
+ * 上传文件
+ *
+ * @param path 文件路径
+ * @param in in
+ * @param autoClose autoClose
+ * @param overrideIfExist 文件存在是否覆盖
+ * @return 路径
+ * @throws Exception Exception
+ */
+ public static String upload(String path, InputStream in, boolean autoClose, boolean overrideIfExist) throws Exception {
+ return delegate.upload(path, in, autoClose, overrideIfExist);
+ }
+
+ // TODO getOutputStream
+
+ /**
+ * 检测文件是否存在
+ *
+ * @param path path
+ * @return 是否存在
+ */
+ public static boolean isExists(String path) {
+ return delegate.isExists(path);
+ }
+
+ /**
+ * 删除文件
+ *
+ * @param path 路径
+ * @return 是否删除
+ * @throws Exception Exception
+ */
+ public static boolean delete(String path) throws Exception {
+ return delegate.delete(path);
+ }
+
+ /**
+ * 获取文件内容
+ *
+ * @param path path
+ * @return bytes
+ * @throws Exception Exception
+ */
+ public static byte[] getContent(String path) throws Exception {
+ return delegate.getContent(path);
+ }
+
+ /**
+ * 获取文件输入流
+ *
+ * @param path path
+ * @return stream
+ * @throws Exception Exception
+ */
+ public static InputStream getContentInputStream(String path) throws Exception {
+ return delegate.getContentInputStream(path);
+ }
+
+ public static void setDelegate(FileClient delegate) {
+ FileClientUtils.delegate = delegate;
+ }
+
+}
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-desensitize/src/main/java/com/orion/ops/framework/desensitize/core/annotation/Desensitize.java b/orion-ops-framework/orion-ops-spring-boot-starter-desensitize/src/main/java/com/orion/ops/framework/desensitize/core/annotation/Desensitize.java
index 56ee6bba..bcc9165b 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-desensitize/src/main/java/com/orion/ops/framework/desensitize/core/annotation/Desensitize.java
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-desensitize/src/main/java/com/orion/ops/framework/desensitize/core/annotation/Desensitize.java
@@ -7,7 +7,7 @@ import com.orion.ops.framework.desensitize.core.serializer.DesensitizeJsonSerial
import java.lang.annotation.*;
/**
- * 脱敏配置元注解
+ * FastJson / Jackson 脱敏配置元注解
*
* 标注在字段上则标记该字段执行 http 序列化时脱敏
*
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-desensitize/src/main/java/com/orion/ops/framework/desensitize/core/annotation/DesensitizeObject.java b/orion-ops-framework/orion-ops-spring-boot-starter-desensitize/src/main/java/com/orion/ops/framework/desensitize/core/annotation/DesensitizeObject.java
index 730f92c1..63ad33f7 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-desensitize/src/main/java/com/orion/ops/framework/desensitize/core/annotation/DesensitizeObject.java
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-desensitize/src/main/java/com/orion/ops/framework/desensitize/core/annotation/DesensitizeObject.java
@@ -3,7 +3,7 @@ package com.orion.ops.framework.desensitize.core.annotation;
import java.lang.annotation.*;
/**
- * 脱敏配置元注解
+ * FastJson 脱敏配置元注解
*
* 标注在类上则标记该类执行序列化时会执行脱敏
*
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/generator/VelocityTemplateEngine.java b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/generator/VelocityTemplateEngine.java
index 44a9f4b1..7cf8e6c6 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/generator/VelocityTemplateEngine.java
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/generator/VelocityTemplateEngine.java
@@ -25,7 +25,7 @@ import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine;
import com.orion.lang.utils.Strings;
import com.orion.lang.utils.reflect.Fields;
-import com.orion.ops.framework.common.constant.Const;
+import com.orion.ops.framework.common.constant.OrionOpsProConst;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
@@ -161,7 +161,7 @@ public class VelocityTemplateEngine extends AbstractTemplateEngine {
// http 注释标识
objectMap.put("httpComment", "###");
// 版本
- objectMap.put("since", Const.VERSION);
+ objectMap.put("since", OrionOpsProConst.VERSION);
// 替换业务注释
tableInfo.setComment(tables.get(tableInfo.getName()).getComment());
// 实体名称
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/mapper/IMapper.java b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/mapper/IMapper.java
index 73763a48..d54c9ed6 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/mapper/IMapper.java
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/mapper/IMapper.java
@@ -7,6 +7,7 @@ import com.orion.ops.framework.mybatis.core.query.CacheQuery;
import com.orion.ops.framework.mybatis.core.query.Conditions;
import com.orion.ops.framework.mybatis.core.query.DataQuery;
+import java.io.Serializable;
import java.util.Collection;
/**
@@ -55,6 +56,16 @@ public interface IMapper extends BaseMapper {
return CacheQuery.of(this);
}
+ /**
+ * 获取 CacheQuery 对象
+ *
+ * @param id id
+ * @return CacheQuery
+ */
+ default CacheQuery cache(Serializable id) {
+ return CacheQuery.of(this, id);
+ }
+
/**
* 批量插入
*
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/query/CacheQuery.java b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/query/CacheQuery.java
index 4d0ac756..c9e80dd2 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/query/CacheQuery.java
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/query/CacheQuery.java
@@ -65,26 +65,31 @@ public class CacheQuery {
return this;
}
- public Optional get(Function mapper) {
+ public Optional optional(Function mapper) {
Valid.notNull(mapper, "convert function is null");
- return this.get().map(mapper);
+ return Optional.ofNullable(this.get())
+ .map(mapper);
}
- public Optional get() {
+ public Optional optional() {
+ return Optional.ofNullable(this.get());
+ }
+
+ public T get() {
// 不查询缓存
if (!force) {
// 从缓存中获取
Store store = CacheHolder.get(dao, id);
// 命中直接返回
if (store != null) {
- return Optional.of(store).map(Store::get);
+ return store.get();
}
}
// 查询
T row = dao.selectById(id);
// 设置缓存
CacheHolder.set(dao, id, row);
- return Optional.ofNullable(row);
+ return row;
}
}
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-security/src/main/java/com/orion/ops/framework/security/config/OrionCryptoAutoConfiguration.java b/orion-ops-framework/orion-ops-spring-boot-starter-security/src/main/java/com/orion/ops/framework/security/config/OrionCryptoAutoConfiguration.java
index ac10cd51..b393623d 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-security/src/main/java/com/orion/ops/framework/security/config/OrionCryptoAutoConfiguration.java
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-security/src/main/java/com/orion/ops/framework/security/config/OrionCryptoAutoConfiguration.java
@@ -2,12 +2,14 @@ package com.orion.ops.framework.security.config;
import com.orion.ops.framework.common.constant.AutoConfigureOrderConst;
import com.orion.ops.framework.common.crypto.ValueCrypto;
+import com.orion.ops.framework.security.core.crypto.PrimaryValueCrypto;
import com.orion.ops.framework.security.core.crypto.aes.AesCryptoProcessor;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Primary;
import javax.annotation.Resource;
@@ -26,12 +28,21 @@ public class OrionCryptoAutoConfiguration {
@Resource
private CryptoConfig config;
+ /**
+ * @return 默认加密器
+ */
+ @Bean(name = "valueCrypto")
+ @Primary
+ public ValueCrypto primaryValueCrypto() {
+ return new PrimaryValueCrypto();
+ }
+
/**
* @return aes 加密器
*/
@Bean(initMethod = "init")
@ConditionalOnProperty(value = "orion.crypto.aes.enabled", havingValue = "true")
- public ValueCrypto aes() {
+ public ValueCrypto aesValueCrypto() {
return new AesCryptoProcessor(config.getAes());
}
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-security/src/main/java/com/orion/ops/framework/security/core/crypto/CryptoProcessor.java b/orion-ops-framework/orion-ops-spring-boot-starter-security/src/main/java/com/orion/ops/framework/security/core/crypto/CryptoProcessor.java
index 4a7def9e..b6d8ca40 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-security/src/main/java/com/orion/ops/framework/security/core/crypto/CryptoProcessor.java
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-security/src/main/java/com/orion/ops/framework/security/core/crypto/CryptoProcessor.java
@@ -18,6 +18,7 @@ public abstract class CryptoProcessor implements Va
this.config = config;
// 设置为默认加密器
if (config.isPrimary()) {
+ PrimaryValueCrypto.delegate = this;
CryptoUtils.setDelegate(this);
}
}
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-security/src/main/java/com/orion/ops/framework/security/core/crypto/PrimaryValueCrypto.java b/orion-ops-framework/orion-ops-spring-boot-starter-security/src/main/java/com/orion/ops/framework/security/core/crypto/PrimaryValueCrypto.java
new file mode 100644
index 00000000..c304a535
--- /dev/null
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-security/src/main/java/com/orion/ops/framework/security/core/crypto/PrimaryValueCrypto.java
@@ -0,0 +1,30 @@
+package com.orion.ops.framework.security.core.crypto;
+
+import com.orion.ops.framework.common.crypto.ValueCrypto;
+
+/**
+ * 默认加密器
+ *
+ * @author Jiahang Li
+ * @version 1.0.0
+ * @since 2023/7/21 12:11
+ */
+public class PrimaryValueCrypto implements ValueCrypto {
+
+ protected static ValueCrypto delegate;
+
+ @Override
+ public void init() {
+ }
+
+ @Override
+ public byte[] encrypt(byte[] plain) {
+ return delegate.encrypt(plain);
+ }
+
+ @Override
+ public byte[] decrypt(byte[] text) {
+ return delegate.decrypt(text);
+ }
+
+}
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-storage/src/main/java/com/orion/ops/framework/storage/config/OrionStorageAutoConfiguration.java b/orion-ops-framework/orion-ops-spring-boot-starter-storage/src/main/java/com/orion/ops/framework/storage/config/OrionStorageAutoConfiguration.java
index 5b4a22e4..cd0d21d7 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-storage/src/main/java/com/orion/ops/framework/storage/config/OrionStorageAutoConfiguration.java
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-storage/src/main/java/com/orion/ops/framework/storage/config/OrionStorageAutoConfiguration.java
@@ -1,7 +1,7 @@
package com.orion.ops.framework.storage.config;
import com.orion.ops.framework.common.constant.AutoConfigureOrderConst;
-import com.orion.ops.framework.storage.core.client.FileClient;
+import com.orion.ops.framework.common.file.FileClient;
import com.orion.ops.framework.storage.core.client.PrimaryFileClient;
import com.orion.ops.framework.storage.core.client.local.LocalFileClient;
import org.springframework.boot.autoconfigure.AutoConfiguration;
@@ -31,16 +31,16 @@ public class OrionStorageAutoConfiguration {
private StorageConfig config;
/**
- * 默认文件客户端
+ * @return 默认文件客户端
*/
- @Bean
+ @Bean(name = "primaryFileClient")
@Primary
public FileClient primaryFileClient() {
return new PrimaryFileClient();
}
/**
- * 本地文件客户端
+ * @return 本地文件客户端
*/
@Bean
@ConditionalOnProperty(value = "orion.storage.local.enabled", havingValue = "true")
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-storage/src/main/java/com/orion/ops/framework/storage/core/client/AbstractFileClient.java b/orion-ops-framework/orion-ops-spring-boot-starter-storage/src/main/java/com/orion/ops/framework/storage/core/client/AbstractFileClient.java
index e4cb6af8..6f5fe4fb 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-storage/src/main/java/com/orion/ops/framework/storage/core/client/AbstractFileClient.java
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-storage/src/main/java/com/orion/ops/framework/storage/core/client/AbstractFileClient.java
@@ -4,6 +4,8 @@ import com.orion.lang.utils.io.Files1;
import com.orion.lang.utils.io.Streams;
import com.orion.lang.utils.time.Dates;
import com.orion.ops.framework.common.constant.Const;
+import com.orion.ops.framework.common.file.FileClient;
+import com.orion.ops.framework.common.utils.FileClientUtils;
import java.io.InputStream;
import java.util.Date;
@@ -24,6 +26,7 @@ public abstract class AbstractFileClient implem
// 设置默认文件客户端
if (config.isPrimary()) {
PrimaryFileClient.delegate = this;
+ FileClientUtils.setDelegate(this);
}
}
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-storage/src/main/java/com/orion/ops/framework/storage/core/client/PrimaryFileClient.java b/orion-ops-framework/orion-ops-spring-boot-starter-storage/src/main/java/com/orion/ops/framework/storage/core/client/PrimaryFileClient.java
index b451e056..77567b1d 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-storage/src/main/java/com/orion/ops/framework/storage/core/client/PrimaryFileClient.java
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-storage/src/main/java/com/orion/ops/framework/storage/core/client/PrimaryFileClient.java
@@ -1,5 +1,7 @@
package com.orion.ops.framework.storage.core.client;
+import com.orion.ops.framework.common.file.FileClient;
+
import java.io.InputStream;
/**
diff --git a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/controller/AuthenticationController.java b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/controller/AuthenticationController.java
index 7006b346..955b491a 100644
--- a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/controller/AuthenticationController.java
+++ b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/controller/AuthenticationController.java
@@ -50,8 +50,8 @@ public class AuthenticationController {
return UserLoginVO.builder().token(token).build();
}
- @IgnoreLog
@PermitAll
+ @IgnoreLog
@Operation(summary = "登出")
@GetMapping("/logout")
public HttpWrapper> logout(HttpServletRequest servletRequest) {
diff --git a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/controller/SystemUserController.java b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/controller/SystemUserController.java
index d77ed900..d46188a4 100644
--- a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/controller/SystemUserController.java
+++ b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/controller/SystemUserController.java
@@ -5,6 +5,7 @@ import com.orion.lang.define.wrapper.HttpWrapper;
import com.orion.lang.utils.collect.Lists;
import com.orion.ops.framework.common.annotation.IgnoreLog;
import com.orion.ops.framework.common.annotation.RestWrapper;
+import com.orion.ops.framework.common.constant.IgnoreLogMode;
import com.orion.ops.module.infra.entity.request.user.*;
import com.orion.ops.module.infra.entity.vo.SystemUserVO;
import com.orion.ops.module.infra.service.SystemUserRoleService;
@@ -56,7 +57,7 @@ public class SystemUserController {
return systemUserService.updateSystemUser(request);
}
- // TODO 修改头像
+ // TODO 修改头像 最后再说 可有可无的功能 要是有 http 文件需求就写
@PutMapping("/update-status")
@Operation(summary = "修改用户状态")
@@ -86,7 +87,7 @@ public class SystemUserController {
return HttpWrapper.ok();
}
- @IgnoreLog
+ @IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/get")
@Operation(summary = "通过 id 查询用户")
@Parameter(name = "id", description = "id", required = true)
@@ -95,7 +96,7 @@ public class SystemUserController {
return systemUserService.getSystemUser(id);
}
- @IgnoreLog
+ @IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/list")
@Operation(summary = "查询所有用户")
@PreAuthorize("@ss.hasPermission('infra:system-user:query')")
@@ -103,7 +104,7 @@ public class SystemUserController {
return systemUserService.getSystemUserList();
}
- @IgnoreLog
+ @IgnoreLog(IgnoreLogMode.RET)
@PostMapping("/query")
@Operation(summary = "分页查询用户")
@PreAuthorize("@ss.hasPermission('infra:system-user:query')")
diff --git a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/service/impl/PermissionServiceImpl.java b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/service/impl/PermissionServiceImpl.java
index 5769a84e..308ce1cd 100644
--- a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/service/impl/PermissionServiceImpl.java
+++ b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/service/impl/PermissionServiceImpl.java
@@ -30,6 +30,7 @@ import javax.annotation.Resource;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
/**
* 权限服务
@@ -153,11 +154,20 @@ public class PermissionServiceImpl implements PermissionService {
return Lists.empty();
}
// 查询角色菜单
- List menus = roles.stream()
- .map(roleMenuCache::get)
- .filter(Objects::nonNull)
- .flatMap(Collection::stream)
- .distinct()
+ Stream mergeStream;
+ if (RoleDefine.containsAdmin(roles)) {
+ // 管理员拥有全部权限
+ mergeStream = menuCache.stream();
+ } else {
+ // 当前用户所适配的角色
+ mergeStream = roles.stream()
+ .map(roleMenuCache::get)
+ .filter(Objects::nonNull)
+ .flatMap(Collection::stream)
+ .distinct();
+ }
+ // 状态过滤
+ List menus = mergeStream
.filter(s -> MenuStatusEnum.ENABLED.getStatus().equals(s.getStatus()))
.filter(s -> !MenuTypeEnum.FUNCTION.getType().equals(s.getType()))
.map(SystemMenuConvert.MAPPER::to)