Commit 54993a65 authored by yanzg's avatar yanzg

检测时间类型

parent b16fd61a
...@@ -142,7 +142,7 @@ public final class CheckerHelper { ...@@ -142,7 +142,7 @@ public final class CheckerHelper {
/** /**
* 检验IP是否合法 * 检验IP是否合法
* *
* @param paramName * @param paramName 需要检测的名称
* @param paramVal * @param paramVal
* @return * @return
*/ */
...@@ -158,6 +158,14 @@ public final class CheckerHelper { ...@@ -158,6 +158,14 @@ public final class CheckerHelper {
return this; return this;
} }
/**
* 检测是否符合时间类型
*
* @param paramName
* @param paramVal
* @param queryType
* @return
*/
public CheckerHelper notDateCheck(String paramName, String paramVal, String queryType) { public CheckerHelper notDateCheck(String paramName, String paramVal, String queryType) {
if (!isValid()) { if (!isValid()) {
return this; return this;
...@@ -219,9 +227,10 @@ public final class CheckerHelper { ...@@ -219,9 +227,10 @@ public final class CheckerHelper {
* @param length * @param length
* @return * @return
*/ */
public CheckerHelper paramLengthCheck(String paramName, String paramVal, int length) { public CheckerHelper checkLength(String paramName, String paramVal, int length) {
if (!isValid()) if (!isValid()) {
return this; return this;
}
if (!StringHelper.isEmpty(paramVal) && length < paramVal.length()) { if (!StringHelper.isEmpty(paramVal) && length < paramVal.length()) {
this.checkResult = String.format(PARAM_OVER_MAX_LENGTH, paramName) + length; this.checkResult = String.format(PARAM_OVER_MAX_LENGTH, paramName) + length;
this.setValid(false); this.setValid(false);
...@@ -229,6 +238,17 @@ public final class CheckerHelper { ...@@ -229,6 +238,17 @@ public final class CheckerHelper {
return this; return this;
} }
/**
* 日期字符串
*
* @param paramName 参数名称
* @param paramVal 参数值
* @return
*/
public CheckerHelper checkDate(String paramName, String paramVal) {
return checkDate(paramName, paramVal, StringHelper.EMPTY);
}
/** /**
* 日期字符串 * 日期字符串
* *
...@@ -237,7 +257,7 @@ public final class CheckerHelper { ...@@ -237,7 +257,7 @@ public final class CheckerHelper {
* @param formatStr 日期格式 * @param formatStr 日期格式
* @return * @return
*/ */
public CheckerHelper paramDateCheck(String paramName, String paramVal, String formatStr) { public CheckerHelper checkDate(String paramName, String paramVal, String formatStr) {
if (!isValid()) { if (!isValid()) {
return this; return this;
} }
......
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 to comment