调整进入getKeyData的判断条件
This commit is contained in:
@@ -824,6 +824,22 @@ public static class StringExtensions
|
|||||||
|
|
||||||
return char.ToUpper(str[0]) + str.Substring(1, str.Length - 1);
|
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>
|
/// <summary>
|
||||||
/// 计算当前字符串与指定字符串的编辑距离(相似度).
|
/// 计算当前字符串与指定字符串的编辑距离(相似度).
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using JNPF.Common.Configuration;
|
using JNPF.Common.Configuration;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Common.Core.Manager.Files;
|
using JNPF.Common.Core.Manager.Files;
|
||||||
@@ -386,11 +387,24 @@ public class DataBaseService : IDynamicApiController, ITransient
|
|||||||
{
|
{
|
||||||
var pos = 0;
|
var pos = 0;
|
||||||
if ((pos = s.IndexOf("_", StringComparison.Ordinal)) > -1)
|
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 first = s.AsSpan().Slice(0, pos).ToString().ToUpperCase();
|
||||||
var second = s.AsSpan().Slice(pos + 1).ToString().ToUpperCase();
|
var second = s.AsSpan().Slice(pos + 1).ToString().ToUpperCase();
|
||||||
return $"{first}{second}";
|
return $"{first}{second}";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return s.ToUpperCase();
|
return s.ToUpperCase();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using JNPF.Common.Const;
|
using JNPF.Common.Const;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Common.Dtos.VisualDev;
|
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()))
|
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);
|
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
|
else //modified by ly on 20230407
|
||||||
realList.list = await _formDataParsing.GetKeyData(templateInfo.SingleFormData.Where(x => x.__config__.templateJson == null).ToList(), realList.list, templateInfo.ColumnData, actionType, templateInfo.WebType, primaryKey);
|
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())
|
if (!templateInfo.IsHasTable && input.sidx.IsNotEmptyOrNull())
|
||||||
@@ -2865,8 +2866,8 @@ public class RunService : IRunService, ITransient
|
|||||||
break;
|
break;
|
||||||
case JnpfKeyConst.SELECT:
|
case JnpfKeyConst.SELECT:
|
||||||
{
|
{
|
||||||
//modified by ly on 20230407
|
|
||||||
var itemValue = item.Value.ToString().Contains("[") ? item.Value.ToJsonString() : item.Value.ToString();
|
var itemValue = item.Value.ToString().Contains("[") ? item.Value.ToJsonString() : item.Value.ToString();
|
||||||
|
//modified by ly on 20230407
|
||||||
JArray jarr = null;
|
JArray jarr = null;
|
||||||
if (itemValue!.Contains("["))
|
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)
|
else if (jarr?.Children() != null && jarr?.Children().ToList().Count > 1)
|
||||||
{
|
{
|
||||||
var values = jarr.ToList().Select(t => t.Value<string>()).ToList();
|
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);
|
condition.ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>(values.Count);
|
||||||
values.ForEach(x =>
|
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,
|
FieldName = item.Key,
|
||||||
ConditionalType = ConditionalType.Equal,
|
ConditionalType = ConditionalType.Equal,
|
||||||
FieldValue = itemValue
|
FieldValue = x,
|
||||||
});
|
}));
|
||||||
});
|
});
|
||||||
conModels.Add(condition);
|
conModels.Add(condition);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//modified by ly on 20230407
|
||||||
|
itemValue = Regex.Match(itemValue, @"\[(.+)\]").Groups[1].Value;
|
||||||
|
itemValue = itemValue.Trim('"');
|
||||||
conModels.Add(new ConditionalCollections()
|
conModels.Add(new ConditionalCollections()
|
||||||
{
|
{
|
||||||
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
|
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
|
||||||
|
|||||||
Reference in New Issue
Block a user