update 优化 encrypt 加解密模块语法 简化代码消除警告

This commit is contained in:
疯狂的狮子li 2023-02-17 12:48:23 +08:00
parent 5722ba3f6c
commit 088002bd62
2 changed files with 5 additions and 5 deletions

View File

@ -55,11 +55,11 @@ public class MybatisDecryptInterceptor implements Interceptor {
* @param sourceObject 待加密对象
*/
private void decryptHandler(Object sourceObject) {
if (sourceObject instanceof Map) {
((Map<?, Object>) sourceObject).values().forEach(this::decryptHandler);
if (sourceObject instanceof Map<?, ?>) {
((Map<?, ?>) sourceObject).values().forEach(this::decryptHandler);
return;
}
if (sourceObject instanceof List) {
if (sourceObject instanceof List<?>) {
// 判断第一个元素是否含有注解如果没有直接返回提高效率
Object firstItem = ((List<?>) sourceObject).get(0);
if (CollectionUtil.isEmpty(encryptorManager.getFieldCache(firstItem.getClass()))) {

View File

@ -67,11 +67,11 @@ public class MybatisEncryptInterceptor implements Interceptor {
*/
@SuppressWarnings("unchecked cast")
private void encryptHandler(Object sourceObject) {
if (sourceObject instanceof Map) {
if (sourceObject instanceof Map<?, ?>) {
((Map<?, Object>) sourceObject).values().forEach(this::encryptHandler);
return;
}
if (sourceObject instanceof List) {
if (sourceObject instanceof List<?>) {
// 判断第一个元素是否含有注解如果没有直接返回提高效率
Object firstItem = ((List<?>) sourceObject).get(0);
if (CollectionUtil.isEmpty(encryptorManager.getFieldCache(firstItem.getClass()))) {