模型查询接口增加按子表字段查询
This commit is contained in:
@@ -23,6 +23,8 @@ namespace Tnb.Vengine.Domain;
|
||||
[SugarTable("sys_vmodel")]
|
||||
public partial class Vmodel : Entity
|
||||
{
|
||||
public const string MAIN_ALIES = "m";
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
@@ -146,7 +148,8 @@ public partial class Vmodel : Entity
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
//private Dictionary<string, string>? _mapField2Prop = null;
|
||||
//private Dictionary<string, string>? _mapProp2Field = null;
|
||||
/// <summary>
|
||||
/// 通过实体创建模型
|
||||
/// </summary>
|
||||
@@ -351,11 +354,30 @@ public partial class Vmodel : Entity
|
||||
if (filter == null) return wheres;
|
||||
foreach (var item in filter)
|
||||
{
|
||||
VmDbProp? prop = null;
|
||||
// TODO 按子表条件查询
|
||||
if (item.Key.Contains("."))
|
||||
{
|
||||
var codes = item.Key.Split('.');
|
||||
if (codes.Length >= 2)
|
||||
{
|
||||
var navProp = navProps.FirstOrDefault(a => a.code == codes[0]);
|
||||
if (navProp != null && navProp.naviModel != null)
|
||||
{
|
||||
var dbProp = navProp.naviModel.dbProps.FirstOrDefault(a => a.code == codes[1]);
|
||||
if (dbProp != null)
|
||||
{
|
||||
prop = new VmDbProp();
|
||||
prop.field = codes[0] + "." + dbProp.field;
|
||||
prop.csType = dbProp.csType;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
prop = dbProps.FirstOrDefault(a => a.code == item.Key);
|
||||
}
|
||||
var prop = dbProps.FirstOrDefault(a => a.code == item.Key);
|
||||
if (prop == null) continue;
|
||||
if (item.Value is JArray val)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user