Commit bc16fb52 by 李小龙

整理代码

parent dbbf87b1
...@@ -2,7 +2,6 @@ package com.makeit.global.bodyadvice; ...@@ -2,7 +2,6 @@ package com.makeit.global.bodyadvice;
import com.makeit.common.page.PageReqDTO; import com.makeit.common.page.PageReqDTO;
import com.makeit.utils.data.ReflectionUtil; import com.makeit.utils.data.ReflectionUtil;
import com.makeit.utils.old.StringUtils;
import org.springframework.core.MethodParameter; import org.springframework.core.MethodParameter;
import org.springframework.http.HttpInputMessage; import org.springframework.http.HttpInputMessage;
import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter;
...@@ -13,6 +12,7 @@ import java.io.IOException; ...@@ -13,6 +12,7 @@ import java.io.IOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.List; import java.util.List;
import java.util.Objects;
@RestControllerAdvice @RestControllerAdvice
public class StringTrimRequestBodyAdvice implements RequestBodyAdvice { public class StringTrimRequestBodyAdvice implements RequestBodyAdvice {
...@@ -50,7 +50,8 @@ public class StringTrimRequestBodyAdvice implements RequestBodyAdvice { ...@@ -50,7 +50,8 @@ public class StringTrimRequestBodyAdvice implements RequestBodyAdvice {
try { try {
Object o = e.get(body); Object o = e.get(body);
String s = (String) o; String s = (String) o;
if (StringUtils.isNotBlank(s)) { //前端如果传"" 字段无法更新成功
if (Objects.nonNull(s)) {
e.set(body, s.trim()); e.set(body, s.trim());
} else { } else {
e.set(body, null); e.set(body, null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment