调整进入getKeyData的判断条件

This commit is contained in:
DEVICE8\12494
2023-04-07 17:13:11 +08:00
parent 9d85cceab6
commit adba94e833
3 changed files with 354 additions and 319 deletions

View File

@@ -824,6 +824,22 @@ public static class StringExtensions
return char.ToUpper(str[0]) + str.Substring(1, str.Length - 1);
}
/// <summary>
/// Span实现首字符大写
/// added by ly on 20230407
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static string FirstCharToUpperAsSpan(this string input)
{
if (string.IsNullOrEmpty(input))
{
return string.Empty;
}
Span<char> destination = stackalloc char[1];
input.AsSpan(0, 1).ToUpperInvariant(destination);
return $"{destination}{input.AsSpan(1)}";
}
/// <summary>
/// 计算当前字符串与指定字符串的编辑距离(相似度).

View File

@@ -1,6 +1,7 @@
using System.Collections;
using System.Data;
using System.Text;
using System.Text.RegularExpressions;
using JNPF.Common.Configuration;
using JNPF.Common.Core.Manager;
using JNPF.Common.Core.Manager.Files;
@@ -386,11 +387,24 @@ public class DataBaseService : IDynamicApiController, ITransient
{
var pos = 0;
if ((pos = s.IndexOf("_", StringComparison.Ordinal)) > -1)
{
var separatorStrings = Regex.Split(s, @"_", RegexOptions.Compiled);
if (separatorStrings.Length > 2)
{
var sb = new StringBuilder();
foreach (var item in separatorStrings)
{
sb.Append(item.ToUpperCase());
}
return sb.ToString();
}
else
{
var first = s.AsSpan().Slice(0, pos).ToString().ToUpperCase();
var second = s.AsSpan().Slice(pos + 1).ToString().ToUpperCase();
return $"{first}{second}";
}
}
else
{
return s.ToUpperCase();

View File

@@ -1,4 +1,5 @@
using System.Text;
using System.Text.RegularExpressions;
using JNPF.Common.Const;
using JNPF.Common.Core.Manager;
using JNPF.Common.Dtos.VisualDev;
@@ -206,8 +207,8 @@ public class RunService : IRunService, ITransient
{
if (templateInfo.SingleFormData.Any(x => x.__config__.templateJson != null && x.__config__.templateJson.Any()))
realList.list = await _formDataParsing.GetKeyData(templateInfo.SingleFormData.Where(x => x.__config__.templateJson != null && x.__config__.templateJson.Any()).ToList(), realList.list, templateInfo.ColumnData, actionType, templateInfo.WebType, primaryKey);
else
realList.list = await _formDataParsing.GetKeyData(templateInfo.SingleFormData.Where(x => x.__config__.templateJson == null).ToList(), realList.list, templateInfo.ColumnData, actionType, templateInfo.WebType, primaryKey);
else //modified by ly on 20230407
realList.list = await _formDataParsing.GetKeyData(templateInfo.SingleFormData.Where(x => x.__config__.templateJson == null|| !x.__config__.templateJson.Any()).ToList(), realList.list, templateInfo.ColumnData, actionType, templateInfo.WebType, primaryKey);
// 如果是无表数据并且排序字段不为空,再进行数据排序
if (!templateInfo.IsHasTable && input.sidx.IsNotEmptyOrNull())
@@ -2865,8 +2866,8 @@ public class RunService : IRunService, ITransient
break;
case JnpfKeyConst.SELECT:
{
//modified by ly on 20230407
var itemValue = item.Value.ToString().Contains("[") ? item.Value.ToJsonString() : item.Value.ToString();
//modified by ly on 20230407
JArray jarr = null;
if (itemValue!.Contains("["))
{
@@ -2889,6 +2890,7 @@ public class RunService : IRunService, ITransient
}
});
}
//modified by ly on 20230407
else if (jarr?.Children() != null && jarr?.Children().ToList().Count > 1)
{
var values = jarr.ToList().Select(t => t.Value<string>()).ToList();
@@ -2896,17 +2898,20 @@ public class RunService : IRunService, ITransient
condition.ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>(values.Count);
values.ForEach(x =>
{
new KeyValuePair<WhereType, ConditionalModel>(WhereType.Or, new ConditionalModel
condition.ConditionalList.Add(new KeyValuePair<WhereType, ConditionalModel>(WhereType.Or, new ConditionalModel
{
FieldName = item.Key,
ConditionalType = ConditionalType.Equal,
FieldValue = itemValue
});
FieldValue = x,
}));
});
conModels.Add(condition);
}
else
{
//modified by ly on 20230407
itemValue = Regex.Match(itemValue, @"\[(.+)\]").Groups[1].Value;
itemValue = itemValue.Trim('"');
conModels.Add(new ConditionalCollections()
{
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()