给商品excel导入增加校验:校验条码是否是正整数

This commit is contained in:
季圣华
2022-03-16 23:33:00 +08:00
parent 3cfa290847
commit d923c8f11a
3 changed files with 35 additions and 0 deletions

View File

@@ -275,6 +275,28 @@ public class StringUtil {
}
}
/**
* 判断对象是否为正整数
* @param value
* @return
*/
public static boolean isPositiveInteger(Object value) {
if(value!=null) {
String str = value.toString();
if(isNotEmpty(str)) {
if((str.matches("[0-9]+"))&&(Integer.parseInt(str)>0)) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
/**
* sql注入过滤保障sql的安全执行
* @param originStr