初步完成代码级重写通用接口功能

This commit is contained in:
2023-11-17 14:05:05 +08:00
parent 47fe9030d6
commit e5ab4d6887
12 changed files with 177 additions and 145 deletions

View File

@@ -34,22 +34,6 @@ public class VmGetInput : VmBaseInput
/// </summary>
public string o { get; set; } = "*";
/// <summary>
/// 转换为QueryInput
/// </summary>
/// <param name="primaryKey"></param>
/// <returns></returns>
public VmQueryInput ToQueryInput(string primaryKey)
{
VmQueryInput arg = this.Adapt<VmQueryInput>();
if (!string.IsNullOrEmpty(id))
{
if (arg.q == null) arg.q = new DObject();
arg.q.Add(primaryKey, id);
}
return arg;
}
}
public class VmGetListInput : VmBaseInput
@@ -94,6 +78,27 @@ public class VmQueryInput : VmGetListInput
/// 查询条件
/// </summary>
public new DObject? q { get; set; }
/// <summary>
/// 添加一个查询条件
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
public void AddQueryPara(string key, object value)
{
if (q == null) q = new DObject();
q.Add(key, value);
}
/// <summary>
/// 添加一个查询条件
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
public void AddQueryParaIf(bool condition, string key, object value)
{
if(condition) AddQueryPara(key, value);
}
}
/// <summary>
@@ -110,6 +115,11 @@ public class VmEditInput : VmBaseInput
/// 批量添加
/// </summary>
public List<DObject>? items { get; set; }
public virtual VmEditInput ToEditInput()
{
return this;
}
}
/// <summary>