|
@@ -37,7 +37,7 @@ namespace Util
|
|
|
var paramList = paramService.GetList(m => m.projectId == projectId);
|
|
|
foreach(var param in paramList)
|
|
|
{
|
|
|
- dic.Add(param.fieldEnName, jsonData[param.fieldEnName].ToString());
|
|
|
+ if(content.Contains("\"" + param.fieldEnName + "\"")) dic.Add(param.fieldEnName, jsonData[param.fieldEnName].ToString());
|
|
|
}
|
|
|
return dic;
|
|
|
}
|
|
@@ -55,7 +55,7 @@ namespace Util
|
|
|
var db = new SqlSugarClient(new ConnectionConfig()
|
|
|
{
|
|
|
ConnectionString = "server=" + server + ";port=" + port + ";user=" + user + ";password=" + password + ";database=" + database + ";charset=utf8;",
|
|
|
- DbType = DbType.MySql,
|
|
|
+ DbType = SqlSugar.DbType.MySql,
|
|
|
IsAutoCloseConnection = true,
|
|
|
});
|
|
|
return db;
|
|
@@ -112,7 +112,8 @@ namespace Util
|
|
|
if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
- condi += "'%" + req[fieldQueryValue] + "%'";
|
|
|
+ string val = req.ContainsKey(fieldQueryValue) ? req[fieldQueryValue] : "0";
|
|
|
+ condi += "'%" + val + "%'";
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
@@ -122,6 +123,11 @@ namespace Util
|
|
|
{
|
|
|
condi += "'%" + GetDbExpressionVal(fieldQueryValue) + "%'";
|
|
|
}
|
|
|
+ else if(fieldQueryModel == "query_field")
|
|
|
+ {
|
|
|
+ string val = dic.ContainsKey(fieldQueryValue) ? dic[fieldQueryValue].ToString() : "0";
|
|
|
+ condi += "'%" + val + "%'";
|
|
|
+ }
|
|
|
}
|
|
|
else if(fieldQueryKind == "2") //精确匹配
|
|
|
{
|
|
@@ -133,7 +139,7 @@ namespace Util
|
|
|
if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
- val = req[fieldQueryValue];
|
|
|
+ val = req.ContainsKey(fieldQueryValue) ? req[fieldQueryValue] : "0";
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
@@ -143,6 +149,10 @@ namespace Util
|
|
|
{
|
|
|
val = GetDbExpressionVal(fieldQueryValue);
|
|
|
}
|
|
|
+ else if(fieldQueryModel == "query_field")
|
|
|
+ {
|
|
|
+ val = dic.ContainsKey(fieldQueryValue) ? dic[fieldQueryValue].ToString() : "0";
|
|
|
+ }
|
|
|
if(fieldQueryValueType == "text")
|
|
|
{
|
|
|
val = "'" + val + "'";
|
|
@@ -199,6 +209,21 @@ namespace Util
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ else if(fieldQueryModel == "query_field")
|
|
|
+ {
|
|
|
+ foreach(string sub in valList)
|
|
|
+ {
|
|
|
+ string dicVal = dic.ContainsKey(sub) ? dic[sub].ToString() : "0";
|
|
|
+ if(fieldQueryValueType == "text")
|
|
|
+ {
|
|
|
+ val += "'" + dicVal + "',";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ val += dicVal + ",";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
val = val.TrimEnd(',');
|
|
|
condi += val + ")";
|
|
|
}
|
|
@@ -234,15 +259,22 @@ namespace Util
|
|
|
}
|
|
|
else if(fieldQueryModel == "db_field")
|
|
|
{
|
|
|
+ if(!string.IsNullOrEmpty(val[0])) condi += " and " + fieldEnName + ">=" + GetDbExpressionVal(val[0]);
|
|
|
+ if(!string.IsNullOrEmpty(val[1])) condi += " and " + fieldEnName + "<=" + GetDbExpressionVal(val[1]);
|
|
|
+ }
|
|
|
+ else if(fieldQueryModel == "query_field")
|
|
|
+ {
|
|
|
+ string dicValLeft = dic.ContainsKey(val[0]) ? dic[val[0]].ToString() : "0";
|
|
|
+ string dicValRight = dic.ContainsKey(val[1]) ? dic[val[1]].ToString() : "0";
|
|
|
if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(val[0])) condi += " and " + fieldEnName + ">=" + val[0];
|
|
|
- if(!string.IsNullOrEmpty(val[1])) condi += " and " + fieldEnName + "<=" + val[1];
|
|
|
+ if(!string.IsNullOrEmpty(dicValLeft)) condi += " and " + fieldEnName + ">=" + dicValLeft;
|
|
|
+ if(!string.IsNullOrEmpty(dicValRight)) condi += " and " + fieldEnName + "<=" + dicValRight;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(val[0])) condi += " and " + fieldEnName + ">='" + GetDbExpressionVal(val[0]) + "'";
|
|
|
- if(!string.IsNullOrEmpty(val[1])) condi += " and " + fieldEnName + "<='" + GetDbExpressionVal(val[1]) + "'";
|
|
|
+ if(!string.IsNullOrEmpty(dicValLeft)) condi += " and " + fieldEnName + ">='" + GetExpressionVal(dicValLeft) + "'";
|
|
|
+ if(!string.IsNullOrEmpty(dicValRight)) condi += " and " + fieldEnName + "<='" + GetExpressionVal(dicValRight) + "'";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -256,7 +288,7 @@ namespace Util
|
|
|
if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
- val = req[fieldQueryValue];
|
|
|
+ val = req.ContainsKey(fieldQueryValue) ? req[fieldQueryValue] : "0";
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
@@ -266,6 +298,10 @@ namespace Util
|
|
|
{
|
|
|
val = GetDbExpressionVal(fieldQueryValue);
|
|
|
}
|
|
|
+ else if(fieldQueryModel == "query_field")
|
|
|
+ {
|
|
|
+ val = dic.ContainsKey(fieldQueryValue) ? dic[fieldQueryValue].ToString() : "0";
|
|
|
+ }
|
|
|
if(fieldQueryValueType == "text")
|
|
|
{
|
|
|
val = "'" + val + "'";
|
|
@@ -282,7 +318,7 @@ namespace Util
|
|
|
{
|
|
|
foreach(System.Data.DataColumn item in items.Columns)
|
|
|
{
|
|
|
- dic.Add(item.ColumnName, items.Rows[0][item.ColumnName].ToString());
|
|
|
+ if(!dic.ContainsKey(item.ColumnName)) dic.Add(item.ColumnName, items.Rows[0][item.ColumnName].ToString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -316,7 +352,8 @@ namespace Util
|
|
|
if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
- condi += "'%" + req[fieldQueryValue] + "%'";
|
|
|
+ string val = req.ContainsKey(fieldQueryValue) ? req[fieldQueryValue] : "0";
|
|
|
+ condi += "'%" + val + "%'";
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
@@ -334,7 +371,7 @@ namespace Util
|
|
|
if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
- val = req[fieldQueryValue];
|
|
|
+ val = req.ContainsKey(fieldQueryValue) ? req[fieldQueryValue] : "0";
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
@@ -453,7 +490,7 @@ namespace Util
|
|
|
if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
- val = req[fieldQueryValue];
|
|
|
+ val = req.ContainsKey(fieldQueryValue) ? req[fieldQueryValue] : "0";
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
@@ -587,42 +624,42 @@ namespace Util
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && (decimal)checkObj >= decimal.Parse(Function.CheckNum(req[val[0]])) && (decimal)checkObj <= decimal.Parse(Function.CheckNum(req[val[1]]))) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(req[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && (decimal)checkObj >= decimal.Parse(Function.CheckNum(req[val[0]]))) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && (decimal)checkObj <= decimal.Parse(Function.CheckNum(req[val[1]]))) passCount += 1;
|
|
|
+ if(!string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(req[val[0]])) && decimal.Parse(checkObj) <= decimal.Parse(Function.CheckNum(req[val[1]]))) passCount += 1;
|
|
|
+ else if(!string.IsNullOrEmpty(req[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(req[val[0]]))) passCount += 1;
|
|
|
+ else if(string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && decimal.Parse(checkObj) <= decimal.Parse(Function.CheckNum(req[val[1]]))) passCount += 1;
|
|
|
}
|
|
|
else if(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && (int)checkObj >= int.Parse(Function.CheckInt(req[val[0]])) && (int)checkObj <= int.Parse(Function.CheckInt(req[val[1]]))) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(req[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && (int)checkObj >= int.Parse(Function.CheckInt(req[val[0]]))) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && (int)checkObj <= int.Parse(Function.CheckInt(req[val[1]]))) passCount += 1;
|
|
|
+ if(!string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(req[val[0]])) && int.Parse(checkObj) <= int.Parse(Function.CheckInt(req[val[1]]))) passCount += 1;
|
|
|
+ else if(!string.IsNullOrEmpty(req[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(req[val[0]]))) passCount += 1;
|
|
|
+ else if(string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && int.Parse(checkObj) <= int.Parse(Function.CheckInt(req[val[1]]))) passCount += 1;
|
|
|
}
|
|
|
else if(fieldQueryValueType.StartsWith("date"))
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && (DateTime)checkObj >= DateTime.Parse(req[val[0]]) && (DateTime)checkObj <= DateTime.Parse(req[val[1]])) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(req[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && (DateTime)checkObj >= DateTime.Parse(req[val[0]])) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && (DateTime)checkObj <= DateTime.Parse(req[val[1]])) passCount += 1;
|
|
|
+ if(!string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) >= DateTime.Parse(req[val[0]]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[val[1]])) passCount += 1;
|
|
|
+ else if(!string.IsNullOrEmpty(req[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) >= DateTime.Parse(req[val[0]])) passCount += 1;
|
|
|
+ else if(string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[val[1]])) passCount += 1;
|
|
|
}
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
|
if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && (decimal)checkObj >= decimal.Parse(Function.CheckNum(val[0])) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(val[1]))) passCount += 1;
|
|
|
+ if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(val[0])) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(val[1]))) passCount += 1;
|
|
|
else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) >= decimal.Parse(Function.CheckNum(val[0]))) passCount += 1;
|
|
|
else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(val[1]))) passCount += 1;
|
|
|
}
|
|
|
else if(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && (int)checkObj >= int.Parse(Function.CheckInt(val[0])) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(val[1]))) passCount += 1;
|
|
|
+ if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(val[0])) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(val[1]))) passCount += 1;
|
|
|
else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckInt(checkObj.ToString())) >= int.Parse(Function.CheckInt(val[0]))) passCount += 1;
|
|
|
else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(val[1]))) passCount += 1;
|
|
|
}
|
|
|
else if(fieldQueryValueType.StartsWith("date"))
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && (DateTime)checkObj >= DateTime.Parse(GetExpressionVal(val[0])) && (DateTime)checkObj <= DateTime.Parse(GetExpressionVal(val[1]))) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && (DateTime)checkObj >= DateTime.Parse(GetExpressionVal(val[0]))) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && (DateTime)checkObj <= DateTime.Parse(GetExpressionVal(val[1]))) passCount += 1;
|
|
|
+ if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj) >= DateTime.Parse(GetExpressionVal(val[0])) && DateTime.Parse(checkObj) <= DateTime.Parse(GetExpressionVal(val[1]))) passCount += 1;
|
|
|
+ else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj) >= DateTime.Parse(GetExpressionVal(val[0]))) passCount += 1;
|
|
|
+ else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj) <= DateTime.Parse(GetExpressionVal(val[1]))) passCount += 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -630,11 +667,11 @@ namespace Util
|
|
|
{
|
|
|
if(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if((int)checkObj != int.Parse(Function.CheckInt(checkVal))) passCount += 1;
|
|
|
+ if(int.Parse(checkObj) != int.Parse(Function.CheckInt(checkVal))) passCount += 1;
|
|
|
}
|
|
|
else if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if((decimal)checkObj != decimal.Parse(Function.CheckNum(checkVal))) passCount += 1;
|
|
|
+ if(decimal.Parse(checkObj) != decimal.Parse(Function.CheckNum(checkVal))) passCount += 1;
|
|
|
}
|
|
|
else if(fieldQueryValueType == "text")
|
|
|
{
|
|
@@ -747,21 +784,21 @@ namespace Util
|
|
|
{
|
|
|
if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && (decimal)checkObj >= decimal.Parse(Function.CheckNum(val[0])) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(val[1]))) passCount += 1;
|
|
|
+ if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) >= decimal.Parse(Function.CheckNum(val[0])) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(val[1]))) passCount += 1;
|
|
|
else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) >= decimal.Parse(Function.CheckNum(val[0]))) passCount += 1;
|
|
|
else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(val[1]))) passCount += 1;
|
|
|
}
|
|
|
else if(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && (int)checkObj >= int.Parse(Function.CheckInt(val[0])) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(val[1]))) passCount += 1;
|
|
|
+ if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckNum(checkObj.ToString())) >= int.Parse(Function.CheckInt(val[0])) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(val[1]))) passCount += 1;
|
|
|
else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckInt(checkObj.ToString())) >= int.Parse(Function.CheckInt(val[0]))) passCount += 1;
|
|
|
else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(val[1]))) passCount += 1;
|
|
|
}
|
|
|
else if(fieldQueryValueType.StartsWith("date"))
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && (DateTime)checkObj >= DateTime.Parse(GetExpressionVal(val[0])) && (DateTime)checkObj <= DateTime.Parse(GetExpressionVal(val[1]))) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && (DateTime)checkObj >= DateTime.Parse(GetExpressionVal(val[0]))) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && (DateTime)checkObj <= DateTime.Parse(GetExpressionVal(val[1]))) passCount += 1;
|
|
|
+ if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj.ToString()) >= DateTime.Parse(GetExpressionVal(val[0])) && DateTime.Parse(checkObj.ToString()) <= DateTime.Parse(GetExpressionVal(val[1]))) passCount += 1;
|
|
|
+ else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj.ToString()) >= DateTime.Parse(GetExpressionVal(val[0]))) passCount += 1;
|
|
|
+ else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj.ToString()) <= DateTime.Parse(GetExpressionVal(val[1]))) passCount += 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -769,11 +806,11 @@ namespace Util
|
|
|
{
|
|
|
if(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if((int)checkObj != int.Parse(Function.CheckInt(checkVal))) passCount += 1;
|
|
|
+ if(int.Parse(Function.CheckNum(checkObj.ToString())) != int.Parse(Function.CheckInt(checkVal))) passCount += 1;
|
|
|
}
|
|
|
else if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if((decimal)checkObj != decimal.Parse(Function.CheckNum(checkVal))) passCount += 1;
|
|
|
+ if(decimal.Parse(Function.CheckNum(checkObj.ToString())) != decimal.Parse(Function.CheckNum(checkVal))) passCount += 1;
|
|
|
}
|
|
|
else if(fieldQueryValueType == "text")
|
|
|
{
|
|
@@ -913,7 +950,8 @@ namespace Util
|
|
|
if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
- condi += "'%" + req[fieldQueryValue] + "%'";
|
|
|
+ string val = req.ContainsKey(fieldQueryValue) ? req[fieldQueryValue] : "0";
|
|
|
+ condi += "'%" + val + "%'";
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
@@ -931,7 +969,7 @@ namespace Util
|
|
|
if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
- val = req[fieldQueryValue];
|
|
|
+ val = req.ContainsKey(fieldQueryValue) ? req[fieldQueryValue] : "0";
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
@@ -1050,7 +1088,7 @@ namespace Util
|
|
|
if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
- val = req[fieldQueryValue];
|
|
|
+ val = req.ContainsKey(fieldQueryValue) ? req[fieldQueryValue] : "0";
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
@@ -1106,7 +1144,7 @@ namespace Util
|
|
|
if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
- fieldQueryValue = req[fieldQueryValue];
|
|
|
+ fieldQueryValue = req.ContainsKey(fieldQueryValue) ? req[fieldQueryValue] : "0";
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
@@ -1139,7 +1177,8 @@ namespace Util
|
|
|
if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
- condi += "'%" + req[fieldQueryValue] + "%'";
|
|
|
+ string val = req.ContainsKey(fieldQueryValue) ? req[fieldQueryValue] : "0";
|
|
|
+ condi += "'%" + val + "%'";
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
@@ -1153,7 +1192,7 @@ namespace Util
|
|
|
if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
- val = req[fieldQueryValue];
|
|
|
+ val = req.ContainsKey(fieldQueryValue) ? req[fieldQueryValue] : "0";
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
@@ -1255,7 +1294,7 @@ namespace Util
|
|
|
if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
- val = req[fieldQueryValue];
|
|
|
+ val = req.ContainsKey(fieldQueryValue) ? req[fieldQueryValue] : "0";
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
@@ -1293,8 +1332,9 @@ namespace Util
|
|
|
//库内字段值表达式
|
|
|
public static string GetDbExpressionVal(string str)
|
|
|
{
|
|
|
- if(str.StartsWith("#{now") && str.EndsWith("DAY}#")) str = "DATE_ADD(" + str + ",INTERVAL " + str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1] + " DAY)";
|
|
|
- if(str.StartsWith("#{now") && str.EndsWith("MONTH}#")) str = "DATE_ADD(" + str + ",INTERVAL " + str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1] + " MONTH)";
|
|
|
+ string[] data = str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',');
|
|
|
+ if(str.StartsWith("#{") && str.EndsWith("DAY}#")) str = "DATE_ADD(" + data[0] + ",INTERVAL " + data[1] + " DAY)";
|
|
|
+ if(str.StartsWith("#{") && str.EndsWith("MONTH}#")) str = "DATE_ADD(" + data[0] + ",INTERVAL " + data[1] + " MONTH)";
|
|
|
return str;
|
|
|
}
|
|
|
}
|