【fix sonar】BaseMap文件

This commit is contained in:
梁琦涛
2023-03-08 10:01:58 +08:00
parent 7d978355e9
commit 207bb2a387
@@ -6,10 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
import org.apache.commons.beanutils.ConvertUtils;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -36,7 +33,7 @@ public class BaseMap extends HashMap<String, Object> {
}
public BaseMap add(String key, Object value) {
super.put(key, Optional.ofNullable(value).orElse(""));
this.put(key,value);
return this;
}
@@ -73,15 +70,15 @@ public class BaseMap extends HashMap<String, Object> {
if (ObjectUtil.isNotEmpty(v)) {
return (Long[]) v;
}
return null;
return new Long[0];
}
public List<Long> getListLong(String key) {
List<String> list = get(key);
if (ObjectUtil.isNotEmpty(list)) {
return list.stream().map(e -> new Long(e)).collect(Collectors.toList());
return list.stream().map(Long::new).collect(Collectors.toList());
} else {
return null;
return Collections.emptyList();
}
}
@@ -90,7 +87,7 @@ public class BaseMap extends HashMap<String, Object> {
if (ObjectUtil.isNotEmpty(ids)) {
return (Long[]) ConvertUtils.convert(ids.toString().split(","), Long.class);
} else {
return null;
return new Long[0];
}
}