代码优化

pull/711/head
Zheng Jie 2021-12-04 14:43:52 +08:00
parent e6077c6613
commit d9d50d3594
2 changed files with 2 additions and 5 deletions

View File

@ -28,8 +28,6 @@ import me.zhengjie.service.mapstruct.LogSmallMapper;
import me.zhengjie.utils.*;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@ -50,7 +48,6 @@ import java.util.*;
@Service
@RequiredArgsConstructor
public class LogServiceImpl implements LogService {
private static final Logger log = LoggerFactory.getLogger(LogServiceImpl.class);
private final LogRepository logRepository;
private final LogErrorMapper logErrorMapper;
private final LogSmallMapper logSmallMapper;
@ -125,7 +122,7 @@ public class LogServiceImpl implements LogService {
argList.add(map);
}
}
if (argList.isEmpty() == 0) {
if (argList.isEmpty()) {
return "";
}
return argList.size() == 1 ? JSONUtil.toJsonStr(argList.get(0)) : JSONUtil.toJsonStr(argList);

View File

@ -76,7 +76,7 @@ public class ConfigurerAdapter implements WebMvcConfigurer {
// 使用 fastjson 序列化,会导致 @JsonIgnore 失效,可以使用 @JSONField(serialize = false) 替换
FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
List<MediaType> supportMediaTypeList = new ArrayList<>();
supportMediaTypeList.add(MediaType.APPLICATION_JSON_UTF8);
supportMediaTypeList.add(MediaType.APPLICATION_JSON);
FastJsonConfig config = new FastJsonConfig();
config.setDateFormat("yyyy-MM-dd HH:mm:ss");
config.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect);