|
|
|
@ -27,6 +27,7 @@ namespace ZKLT.Hadoop
|
|
|
|
|
/// <param name="param">参数</param>
|
|
|
|
|
private void MergeWhere(HDP_Table table, Dictionary<string, string>? where, Dictionary<string, object>? row, StringBuilder command, Dictionary<string, object> param)
|
|
|
|
|
{
|
|
|
|
|
string _guid = "";
|
|
|
|
|
//执行条件
|
|
|
|
|
StringBuilder _wherestr = new StringBuilder();
|
|
|
|
|
_wherestr.Append("WHERE 1 = 1");
|
|
|
|
@ -40,8 +41,9 @@ namespace ZKLT.Hadoop
|
|
|
|
|
switch (where[_column.Key!])
|
|
|
|
|
{
|
|
|
|
|
case HDP_WhereType.LIKE:
|
|
|
|
|
_wherestr.Append($@" AND `{_column.Key!}` {where[_column.Key!]} CONCAT('%',@{_column.Key!},'%')");
|
|
|
|
|
param.Add(_column.Key!, row![_column.Key!]);
|
|
|
|
|
_guid = Guid.NewGuid().ToString("N");
|
|
|
|
|
_wherestr.Append($@" AND `{_column.Key!}` {where[_column.Key!]} CONCAT('%',@{_guid},'%')");
|
|
|
|
|
param.Add(_guid, row![_column.Key!]);
|
|
|
|
|
break;
|
|
|
|
|
case HDP_WhereType.BETWEEN:
|
|
|
|
|
if (row![_column.Key!] != null)
|
|
|
|
@ -51,20 +53,23 @@ namespace ZKLT.Hadoop
|
|
|
|
|
{
|
|
|
|
|
if (_betweendata[0] != null && _betweendata[0].ToString() != "")
|
|
|
|
|
{
|
|
|
|
|
_wherestr.Append($@" AND `{_column.Key!}` >= @{_column.Key!}0");
|
|
|
|
|
param.Add(_column.Key! + "0", _betweendata[0]);
|
|
|
|
|
_guid = Guid.NewGuid().ToString("N");
|
|
|
|
|
_wherestr.Append($@" AND `{_column.Key!}` >= @{_guid}");
|
|
|
|
|
param.Add(_guid, _betweendata[0]);
|
|
|
|
|
}
|
|
|
|
|
if (_betweendata[1] != null && _betweendata[1].ToString() != "")
|
|
|
|
|
{
|
|
|
|
|
_wherestr.Append($@" AND `{_column.Key!}` <= @{_column.Key!}1");
|
|
|
|
|
param.Add(_column.Key! + "1", _betweendata[1]);
|
|
|
|
|
_guid = Guid.NewGuid().ToString("N");
|
|
|
|
|
_wherestr.Append($@" AND `{_column.Key!}` <= @{_guid}");
|
|
|
|
|
param.Add(_guid, _betweendata[1]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
_wherestr.Append($@" AND `{_column.Key!}` {where[_column.Key!]} @{_column.Key!}");
|
|
|
|
|
param.Add(_column.Key!, row![_column.Key!]);
|
|
|
|
|
_guid = Guid.NewGuid().ToString("N");
|
|
|
|
|
_wherestr.Append($@" AND `{_column.Key!}` {where[_column.Key!]} @{_guid}");
|
|
|
|
|
param.Add(_guid, row![_column.Key!]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -108,6 +113,7 @@ namespace ZKLT.Hadoop
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private string MergeOrder(HDP_Table table, Dictionary<string, object>? order, Dictionary<string, object> param)
|
|
|
|
|
{
|
|
|
|
|
string _guid = "";
|
|
|
|
|
StringBuilder _orderstr = new StringBuilder();
|
|
|
|
|
if (order != null && order.Count > 0)
|
|
|
|
|
{
|
|
|
|
@ -135,7 +141,7 @@ namespace ZKLT.Hadoop
|
|
|
|
|
_orderstr.Append(@$"CASE `{_column.Key!}`");
|
|
|
|
|
for (var i = 0; i < _orderTemp!.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
var _guid = Guid.NewGuid().ToString("N");
|
|
|
|
|
_guid = Guid.NewGuid().ToString("N");
|
|
|
|
|
_orderstr.Append(@$" WHEN @{_guid} THEN {i}");
|
|
|
|
|
param.Add(_guid, _orderTemp[i]);
|
|
|
|
|
}
|
|
|
|
|