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