41 lines
886 B
Java
41 lines
886 B
Java
package com.cim.idm.utils;
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
public class ParamUtils {
|
|
/**
|
|
* 获取参数值并处理空值
|
|
*
|
|
* @param param 参数Map
|
|
* @param key 参数键
|
|
* @return 参数值的字符串表示,如果参数为空则返回空字符串
|
|
*/
|
|
public static String getStringParam(Map<String, Object> param, String key) {
|
|
// 校验输入参数是否为null
|
|
if (param == null || key == null) {
|
|
return "";
|
|
}
|
|
|
|
// 获取参数值
|
|
Object value = param.get(key);
|
|
|
|
// 处理值为null或非String类型的情况
|
|
if (value == null) {
|
|
return "";
|
|
} else if (value instanceof String) {
|
|
return (String) value;
|
|
} else {
|
|
return value.toString();
|
|
}
|
|
}
|
|
|
|
|
|
public static boolean isEmpty(String actNoPDA) {
|
|
// 处理 null 和空字符串的情况
|
|
return actNoPDA == null || actNoPDA.trim().isEmpty();
|
|
}
|
|
|
|
}
|
|
|