【7.2.2】更新注解

pull/29/head
fengshuonan 2022-03-16 15:31:00 +08:00
parent 8ed89c8c35
commit 730967e4d8
4 changed files with 13 additions and 13 deletions

View File

@ -8,10 +8,10 @@ import cn.stylefeng.roses.kernel.security.database.annotation.ProtectedField;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.executor.parameter.ParameterHandler;
import org.apache.ibatis.plugin.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.sql.PreparedStatement;
import java.util.Properties;
@ -27,14 +27,14 @@ import java.util.Properties;
@Intercepts({@Signature(type = ParameterHandler.class, method = "setParameters", args = PreparedStatement.class),})
public class ParameterInterceptor implements Interceptor {
@Autowired
@Resource
private EncryptAlgorithmApi encryptAlgorithmApi;
@Override
public Object intercept(Invocation invocation) throws Throwable {
// 若指定ResultSetHandler 这里则能强转为ResultSetHandler
ParameterHandler parameterHandler = (ParameterHandler)invocation.getTarget();
ParameterHandler parameterHandler = (ParameterHandler) invocation.getTarget();
// 获取参数对像,即 mapper 中 paramsType 的实例
Field parameterField = parameterHandler.getClass().getDeclaredField("parameterObject");
@ -63,7 +63,7 @@ public class ParameterInterceptor implements Interceptor {
Object fieldData = declaredField.get(parameterObject);
// 如果是String就处理
if (fieldData instanceof String) {
String value = (String)fieldData;
String value = (String) fieldData;
try {
String encrypt = encryptAlgorithmApi.encrypt(value);
declaredField.set(parameterObject, encrypt);

View File

@ -7,10 +7,10 @@ import cn.stylefeng.roses.kernel.security.database.annotation.ProtectedField;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.executor.resultset.ResultSetHandler;
import org.apache.ibatis.plugin.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.sql.Statement;
import java.util.List;
@ -28,7 +28,7 @@ import java.util.Properties;
@Intercepts({@Signature(type = ResultSetHandler.class, method = "handleResultSets", args = {Statement.class})})
public class ResultInterceptor implements Interceptor {
@Autowired
@Resource
private EncryptAlgorithmApi encryptAlgorithmApi;
@Override
@ -42,7 +42,7 @@ public class ResultInterceptor implements Interceptor {
// 判断结果是List还是对象
if (resultObject instanceof List) {
List resultList = (List)resultObject;
List resultList = (List) resultObject;
// 判断是否为空
if (ObjectUtil.isNotNull(resultList)) {
// 处理数据
@ -94,7 +94,7 @@ public class ResultInterceptor implements Interceptor {
Object object = field.get(result);
//String的解密
if (object instanceof String) {
String value = (String)object;
String value = (String) object;
//对注解的字段进行逐一解密
try {
String decrypt = encryptAlgorithmApi.decrypt(value);

View File

@ -13,9 +13,9 @@ import cn.stylefeng.roses.kernel.timer.modular.param.SysTimersParam;
import cn.stylefeng.roses.kernel.timer.modular.service.SysTimersService;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@ -30,7 +30,7 @@ import java.util.stream.Collectors;
@Component
public class TimerMigrationImpl implements AccessMigrationApi {
@Autowired
@Resource
private SysTimersService sysTimersService;
@Override
@ -67,7 +67,7 @@ public class TimerMigrationImpl implements AccessMigrationApi {
@Override
public boolean importData(String type, MigrationInfo data) {
TimerMigrationInfo timerMigrationInfo = JSONObject.toJavaObject((JSONObject)data.getData(), TimerMigrationInfo.class);
TimerMigrationInfo timerMigrationInfo = JSONObject.toJavaObject((JSONObject) data.getData(), TimerMigrationInfo.class);
if (MigrationAggregationTypeEnum.MIGRATION_INCREMENTAL.getCode().equals(type)) {
// 查询配置信息

View File

@ -8,12 +8,12 @@ import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList;
@ -29,7 +29,7 @@ import java.util.List;
@ApiResource(name = "数据迁移控制器")
public class MigrationController {
@Autowired
@Resource
private MigrationService migrationService;
/**