diff --git a/Hadoop/ZKLT.Hadoop.API/Program.cs b/Hadoop/ZKLT.Hadoop.API/Program.cs index 3e2187e..38f3a30 100644 --- a/Hadoop/ZKLT.Hadoop.API/Program.cs +++ b/Hadoop/ZKLT.Hadoop.API/Program.cs @@ -40,34 +40,34 @@ namespace ZKLT.Hadoop.API app.UseCors("all"); #endregion + app.UseHadoop((c) => + { + c.Host = "127.0.0.1"; + c.Account = "root"; + c.PassWord = "root"; + c.Key = "hadoopdb"; + c.Port = 3306; + }); + + //app.UseHadoop((c) => //{ - // c.Host = "127.0.0.1"; + // c.Host = "172.17.0.1"; // c.Account = "root"; // c.PassWord = "root"; - // c.Key = "hadoopdb"; - // c.Port = 3306; + // c.Key = "testdb"; + // c.Port = 4000; //}); - //app.UseHadoop((c) => //{ - // c.Host = "172.17.0.1"; + // c.Host = "118.195.165.218"; // c.Account = "root"; // c.PassWord = "root"; // c.Key = "testdb"; // c.Port = 4000; //}); - app.UseHadoop((c) => - { - c.Host = "118.195.165.218"; - c.Account = "root"; - c.PassWord = "root"; - c.Key = "testdb"; - c.Port = 4000; - }); - // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { diff --git a/Hadoop/ZKLT.Hadoop.API/Properties/launchSettings.json b/Hadoop/ZKLT.Hadoop.API/Properties/launchSettings.json index fb9f190..828e8ba 100644 --- a/Hadoop/ZKLT.Hadoop.API/Properties/launchSettings.json +++ b/Hadoop/ZKLT.Hadoop.API/Properties/launchSettings.json @@ -33,7 +33,7 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:59844", + "applicationUrl": "http://localhost:43666", "sslPort": 0 } } diff --git a/Hadoop/ZKLT.Hadoop.Model/HDP_CommandAction.cs b/Hadoop/ZKLT.Hadoop.Model/HDP_CommandAction.cs index c20d37c..0d3be48 100644 --- a/Hadoop/ZKLT.Hadoop.Model/HDP_CommandAction.cs +++ b/Hadoop/ZKLT.Hadoop.Model/HDP_CommandAction.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Text.RegularExpressions; namespace ZKLT.Hadoop.Model { @@ -42,5 +43,35 @@ namespace ZKLT.Hadoop.Model return action; } } + + /// + /// 列转换 + /// + /// 列 + /// 参数 + /// 公式 + /// + public static string ColConvert(HDP_Column column, Dictionary param,object value) { + string _guid; + if (value is string) { + string _action = value.ToString()!; + Regex _regex1 = new Regex(@"(?<=(\+\=))\d+"); + if(_regex1.IsMatch(_action)) + { + _guid = Guid.NewGuid().ToString("N"); + param.Add(_guid,_regex1.Match(_action).Value); + return @$"`{column.Key}` + @{_guid}"; + } + Regex _regex2 = new Regex(@"(?<=(\-\=))\d+"); + if (_regex2.IsMatch(_action)) + { + _guid = Guid.NewGuid().ToString("N"); + param.Add(_guid, _regex2.Match(_action).Value); + return @$"`{column.Key}` - @{_guid}"; + } + } + param.Add(column.Key!, value); + return $@"@{column.Key}"; + } } } diff --git a/Hadoop/ZKLT.Hadoop/TableService.cs b/Hadoop/ZKLT.Hadoop/TableService.cs index c63230d..3d2850d 100644 --- a/Hadoop/ZKLT.Hadoop/TableService.cs +++ b/Hadoop/ZKLT.Hadoop/TableService.cs @@ -579,8 +579,7 @@ namespace ZKLT.Hadoop var _column = table.Columns[i]; if (_row.ContainsKey(_column.Key!) && !_where.Any(x => x.ContainsKey(_column.Key!))) { - _colstr.Append($@"`{_column.Key!}`=@{_column.Key!},"); - _params.Add(_column.Key!, ((JValue)_row[_column.Key!]!).Value!); + _colstr.Append(@$"`{_column.Key!}`={HDP_CommandAction.ColConvert(_column,_params, ((JValue)_row[_column.Key!]!).Value!)},"); } else if (!string.IsNullOrEmpty(_column.UpdateDefault)) {