修复清理vengine

This commit is contained in:
2023-09-19 10:55:14 +08:00
parent b9e9636d72
commit 0bf34fa215
31 changed files with 289 additions and 252 deletions

View File

@@ -10,21 +10,21 @@ namespace Tnb.Vengine.Domain;
[Serializable]
public abstract class Entity : IEntity
{
protected Entity()
{
//EntityHelper.TrySetTenantId(this);
}
protected Entity()
{
//EntityHelper.TrySetTenantId(this);
}
/// <inheritdoc/>
public override string ToString()
{
return $"[ENTITY: {GetType().Name}] Keys = {string.Join(", ", GetKeys())}";
}
/// <inheritdoc/>
public override string ToString()
{
return $"[ENTITY: {GetType().Name}] Keys = {string.Join(", ", GetKeys())}";
}
public abstract object[] GetKeys();
public abstract object[] GetKeys();
//public bool EntityEquals(IEntity other)
//{
// return EntityHelper.EntityEquals(this, other);
//}
}
//public bool EntityEquals(IEntity other)
//{
// return EntityHelper.EntityEquals(this, other);
//}
}

View File

@@ -14,6 +14,7 @@ public class VmBaseInput
///// </summary>
//public string vmid { get; set; } = string.Empty;
}
public class VmGetInput : VmBaseInput
{
/// <summary>
@@ -58,6 +59,7 @@ public class VmGetListInput : VmBaseInput
/// 过滤条件
/// </summary>
public string? q { get; set; }
/// <summary>
/// 输出字段
/// </summary>
@@ -138,7 +140,6 @@ public class PagedOutput<T>
/// </summary>
public class VmPagedOutput : PagedOutput<dynamic>
{
}
/// <summary>
@@ -152,4 +153,4 @@ public class VmSelectProp
public string navCode { get; set; } = MAIN_ALIES;
public ePropType propType { get; set; }
public eNavigateType navType { get; set; }
}
}

View File

@@ -12,25 +12,25 @@ namespace Tnb.Vengine.Domain;
/// </summary>
public class VmBaseProp
{
/// <summary>
/// 属性代码
/// </summary>
public string code { get; set; } = string.Empty;
/// <summary>
/// 属性代码
/// </summary>
public string code { get; set; } = string.Empty;
/// <summary>
/// 显示名称
/// </summary>
public string name { get; set; } = string.Empty;
/// <summary>
/// 显示名称
/// </summary>
public string name { get; set; } = string.Empty;
}
public class DictOption
{
public string dictTypeId { get; set; } = string.Empty;
public string refField { get; set; } = "id";
public string dictTypeId { get; set; } = string.Empty;
public string refField { get; set; } = "id";
}
public class CompOption
{
public string type { get; set; } = "el-input";
public JObject attr { get; set; } = new JObject();
public string type { get; set; } = "el-input";
public JObject attr { get; set; } = new JObject();
}

View File

@@ -5,8 +5,7 @@
namespace Tnb.Vengine.Domain;
public class VmCalProp : VmBaseProp
{
public string calculate { get; set; } = string.Empty;
}
public string calculate { get; set; } = string.Empty;
}

View File

@@ -15,6 +15,7 @@ namespace Tnb.Vengine.Domain;
public class VmDbProp : VmBaseProp
{
#region Properties
/// <summary>
/// 字段名称
/// </summary>
@@ -70,7 +71,8 @@ public class VmDbProp : VmBaseProp
/// 描述
/// </summary>
public string? descrip { get; set; }
#endregion
#endregion Properties
/// <summary>
/// 获取默认值
@@ -79,7 +81,7 @@ public class VmDbProp : VmBaseProp
public object? GetDefaultValue()
{
object? val = null;
if(!required) { return val; }
if (!required) { return val; }
if (string.IsNullOrEmpty(defValue))
{
val = csType switch
@@ -168,11 +170,13 @@ public class VmDbProp : VmBaseProp
comp.attr.Add("maxlength", length);
comp.attr.Add("showWordLimit", true);
break;
case "int":
case "short":
case "long":
comp.type = "el-input-number";
break;
case "DateTime":
comp.type = "el-date-picker";
break;
@@ -205,6 +209,5 @@ public class VmDbProp : VmBaseProp
//if(isJson) sb.Add("IsJson = true")
if (sb.Any()) attr += $"\t[SugarColumn({sb.JoinAsString(", ")})]{Environment.NewLine}";
return attr;
}
}

View File

@@ -53,6 +53,6 @@ public class VmNavProp : VmBaseProp
[JsonIgnore]
public Vmodel? naviModel { get; set; }
#endregion
}
#endregion Properties
}

View File

@@ -3,15 +3,15 @@
// https://git.tuotong-tech.com/tnb/tnb.server //
/////////////////////////////////////////////////////////////////////////////////
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Reflection;
using JNPF.Common.Core.Manager;
using JNPF.Common.Extension;
using Mapster;
using Newtonsoft.Json.Linq;
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Reflection;
using Tnb.Core;
using Yitter.IdGenerator;
@@ -24,6 +24,7 @@ namespace Tnb.Vengine.Domain;
public partial class Vmodel : Entity
{
#region Properties
/// <summary>
/// 主键标识
/// </summary>
@@ -133,7 +134,8 @@ public partial class Vmodel : Entity
public string? modifyId { get; set; }
[SugarColumn(IsIgnore = true)]
public string fullCode { get { return areaCode + "/" + vmCode; } }
public string fullCode
{ get { return areaCode + "/" + vmCode; } }
/// <summary>
/// 主键
@@ -142,7 +144,8 @@ public partial class Vmodel : Entity
{
return new object[] { id };
}
#endregion
#endregion Properties
/// <summary>
/// 通过实体创建模型
@@ -351,7 +354,6 @@ public partial class Vmodel : Entity
// TODO 按子表条件查询
if (item.Key.Contains("."))
{
}
var prop = dbProps.FirstOrDefault(a => a.code == item.Key);
if (prop == null) continue;
@@ -364,21 +366,26 @@ public partial class Vmodel : Entity
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThan, CSharpTypeName = prop.csType });
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThan, CSharpTypeName = prop.csType });
break;
case ">=<":
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThanOrEqual, CSharpTypeName = prop.csType });
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThan, CSharpTypeName = prop.csType });
break;
case "><=":
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThan, CSharpTypeName = prop.csType });
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThanOrEqual, CSharpTypeName = prop.csType });
break;
case ">=<=":
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThanOrEqual, CSharpTypeName = prop.csType });
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThanOrEqual, CSharpTypeName = prop.csType });
break;
case "in":
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val.Skip(1).ToString(), ConditionalType = ConditionalType.In, CSharpTypeName = prop.csType });
break;
default: op = string.Empty; break;
}
}
@@ -425,7 +432,7 @@ public partial class Vmodel : Entity
{
return selProps.Where(a => a.navType != eNavigateType.OneToMany && a.navType != eNavigateType.ManyToMany).Select(a => new SelectModel
{
FiledName = (a.navCode == VmSelectProp.MAIN_ALIES ? "" : a.navCode + ".") + a.field,
FiledName = a.navCode + "." + a.field,
AsName = (a.navCode == VmSelectProp.MAIN_ALIES ? "" : a.navCode + "_") + a.code
}).ToList();
}
@@ -503,6 +510,4 @@ public partial class Vmodel : Entity
}
return obj;
}
}
}

View File

@@ -4,7 +4,6 @@
/////////////////////////////////////////////////////////////////////////////////
using SqlSugar;
using Tnb.Core;
using Yitter.IdGenerator;
namespace Tnb.Vengine.Domain;
@@ -20,6 +19,7 @@ public partial class VmodelLink : Entity
/// </summary>
[SugarColumn(IsPrimaryKey = true)]
public string id { get; set; } = YitIdHelper.NextId().ToString();
/// <summary>
/// 数据库连接
/// </summary>
@@ -45,6 +45,4 @@ public partial class VmodelLink : Entity
{
return new object[] { id };
}
}
}

View File

@@ -5,7 +5,6 @@
using Newtonsoft.Json.Linq;
using SqlSugar;
using Tnb.Core;
using Yitter.IdGenerator;
namespace Tnb.Vengine.Domain;
@@ -17,6 +16,7 @@ namespace Tnb.Vengine.Domain;
public partial class VmodelPage : Entity
{
#region Properties
/// <summary>
/// 主键标识
/// </summary>
@@ -102,6 +102,6 @@ public partial class VmodelPage : Entity
{
return new object[] { id };
}
#endregion
}
#endregion Properties
}