update 优化 encrypt 加解密模块语法 简化代码消除警告
parent
833dbda7e6
commit
6dad73d9de
|
|
@ -55,11 +55,11 @@ public class MybatisDecryptInterceptor implements Interceptor {
|
||||||
* @param sourceObject 待加密对象
|
* @param sourceObject 待加密对象
|
||||||
*/
|
*/
|
||||||
private void decryptHandler(Object sourceObject) {
|
private void decryptHandler(Object sourceObject) {
|
||||||
if (sourceObject instanceof Map) {
|
if (sourceObject instanceof Map<?, ?>) {
|
||||||
((Map<?, Object>) sourceObject).values().forEach(this::decryptHandler);
|
((Map<?, ?>) sourceObject).values().forEach(this::decryptHandler);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (sourceObject instanceof List) {
|
if (sourceObject instanceof List<?>) {
|
||||||
// 判断第一个元素是否含有注解。如果没有直接返回,提高效率
|
// 判断第一个元素是否含有注解。如果没有直接返回,提高效率
|
||||||
Object firstItem = ((List<?>) sourceObject).get(0);
|
Object firstItem = ((List<?>) sourceObject).get(0);
|
||||||
if (CollectionUtil.isEmpty(encryptorManager.getFieldCache(firstItem.getClass()))) {
|
if (CollectionUtil.isEmpty(encryptorManager.getFieldCache(firstItem.getClass()))) {
|
||||||
|
|
|
||||||
|
|
@ -65,13 +65,12 @@ public class MybatisEncryptInterceptor implements Interceptor {
|
||||||
*
|
*
|
||||||
* @param sourceObject 待加密对象
|
* @param sourceObject 待加密对象
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked cast")
|
|
||||||
private void encryptHandler(Object sourceObject) {
|
private void encryptHandler(Object sourceObject) {
|
||||||
if (sourceObject instanceof Map) {
|
if (sourceObject instanceof Map<?, ?>) {
|
||||||
((Map<?, Object>) sourceObject).values().forEach(this::encryptHandler);
|
((Map<?, ?>) sourceObject).values().forEach(this::encryptHandler);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (sourceObject instanceof List) {
|
if (sourceObject instanceof List<?>) {
|
||||||
// 判断第一个元素是否含有注解。如果没有直接返回,提高效率
|
// 判断第一个元素是否含有注解。如果没有直接返回,提高效率
|
||||||
Object firstItem = ((List<?>) sourceObject).get(0);
|
Object firstItem = ((List<?>) sourceObject).get(0);
|
||||||
if (CollectionUtil.isEmpty(encryptorManager.getFieldCache(firstItem.getClass()))) {
|
if (CollectionUtil.isEmpty(encryptorManager.getFieldCache(firstItem.getClass()))) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue