You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ZKLT.Hadoop.Model
{
/// <summary>
/// 命令函数
/// </summary>
public class HDP_CommandAction
{
/// <summary>
/// 当前日期
/// </summary>
public const string DATENOW = "DATE_NOW()";
/// <summary>
/// 唯一码
/// </summary>
public const string UUID = "UUID()";
/// <summary>
/// 转换命令
/// </summary>
/// <param name="command">命令</param>
/// <param name="param">参数</param>
/// <returns>命令</returns>
public static string ConvertCommand(string command, Dictionary<string, object> param)
{
//日期转换
command = command.Replace(DATENOW,@$"'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'");
command = command.Replace(UUID, @$"'{Guid.NewGuid().ToString()}'");
return command;
}
/// <summary>
/// 判断是否方法
/// </summary>
/// <param name="action">方法</param>
/// <returns>是否包含</returns>
public static bool IsAction(string action)
{
var _Result = false;
if (action == DATENOW) {
return true;
}
if(action == UUID)
{
return true;
}
return _Result;
}
}
}