diff --git a/Model/Extension/CommonExtension.cs b/Model/Extension/CommonExtension.cs index 160d8b5..d8260a1 100644 --- a/Model/Extension/CommonExtension.cs +++ b/Model/Extension/CommonExtension.cs @@ -5,6 +5,11 @@ namespace SparkClient.Model.Extension; public static class CommonExtension { + /// + /// 安全的ToString + /// + /// + /// public static string ToSafeString(this object obj) { if (null == obj) @@ -13,15 +18,25 @@ public static class CommonExtension } else { - return obj.ToString( ); + return obj.ToString(); } } + /// + /// 简单的判断字符串是否为Null或空白 + /// + /// + /// public static bool IsNullOrEmpty(this string str) { return String.IsNullOrEmpty(str); } - public static string toMD5Code(this object obj) + /// + /// 生成对象签名(Null对象为时间戳) + /// + /// + /// + public static string GenerateSign(this object obj) { if (null == obj) { @@ -34,7 +49,12 @@ public static class CommonExtension } } - public static JToken ConvertJTokenValue(this string value) + /// + /// 字符串按类型转为JToken + /// + /// + /// + public static JToken ConvertJTokenValue(this string value) { // 处理布尔类型(不区分大小写) if (string.Equals(value, "true", StringComparison.OrdinalIgnoreCase)) @@ -55,7 +75,7 @@ public static class CommonExtension // 超出int范围使用long类型 return new JValue((long)numericValue); } - + // 保留小数部分 return new JValue(numericValue); } @@ -63,4 +83,9 @@ public static class CommonExtension // 默认处理为字符串 return new JValue(value); } + + // public static string ConvertNumberToString(this ob value) + // { + // return ""; + // } } \ No newline at end of file diff --git a/ViewModel/Configuration/AlgorithmConfigVM.cs b/ViewModel/Configuration/AlgorithmConfigVM.cs index 4ad7641..81bb648 100644 --- a/ViewModel/Configuration/AlgorithmConfigVM.cs +++ b/ViewModel/Configuration/AlgorithmConfigVM.cs @@ -91,7 +91,7 @@ public class AlgorithmConfigVM : BaseViewModel if (row.Mode == null || row.Spec == null) continue; insertSql.Add($"INSERT INTO AGILE_ALGORITHM_CONFIG (GUID, Mode, Spec, Shape, JsonKey, Value)" + - $@"VALUES ('{row.toMD5Code()}',{row.Mode.Value},'{row.Spec.Value}','{row.Shape}','{row.JsonKey}','{row.Value}');"); + $@"VALUES ('{row.GenerateSign()}',{row.Mode.Value},'{row.Spec.Value}','{row.Shape}','{row.JsonKey}','{row.Value}');"); finalSaveData.Add(row); }