| | |
| | | package com.panzhihua.service_community.model.helper.encrypt; |
| | | |
| | | import com.panzhihua.common.model.helper.encrypt.EncryptDecryptClass; |
| | | import com.panzhihua.common.model.helper.encrypt.IEncryptDecrypt; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import java.sql.Statement; |
| | | import java.util.ArrayList; |
| | | import java.util.Objects; |
| | | import java.util.Properties; |
| | | |
| | | import org.apache.ibatis.executor.resultset.ResultSetHandler; |
| | | import org.apache.ibatis.plugin.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.sql.Statement; |
| | | import java.util.ArrayList; |
| | | import java.util.Objects; |
| | | import java.util.Properties; |
| | | import com.panzhihua.common.model.helper.encrypt.EncryptDecryptClass; |
| | | import com.panzhihua.common.model.helper.encrypt.IEncryptDecrypt; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * 解密拦截器 |
| | |
| | | * @author cedoo |
| | | * @since 2021-4-1 10:40:52 |
| | | */ |
| | | @Intercepts({ |
| | | @Signature(type = ResultSetHandler.class, method = "handleResultSets", args={Statement.class}) |
| | | }) |
| | | @Intercepts({@Signature(type = ResultSetHandler.class, method = "handleResultSets", args = {Statement.class})}) |
| | | @ConditionalOnProperty(value = "domain.decrypt", havingValue = "true") |
| | | @Component |
| | | @Slf4j |
| | |
| | | public boolean needToDecrypt(Object object){ |
| | | if(object!=null) { |
| | | Class<?> objectClass = object.getClass(); |
| | | EncryptDecryptClass encryptDecryptClass = AnnotationUtils.findAnnotation(objectClass, EncryptDecryptClass.class); |
| | | if (Objects.nonNull(encryptDecryptClass)) { |
| | | return true; |
| | | } |
| | | EncryptDecryptClass encryptDecryptClass = |
| | | AnnotationUtils.findAnnotation(objectClass, EncryptDecryptClass.class); |
| | | return Objects.nonNull(encryptDecryptClass); |
| | | } |
| | | return false; |
| | | } |