修复最新简化集合方式的报错
This commit is contained in:
@@ -169,7 +169,7 @@ public class VengineAppService<TEntity, TGetInput, TGetOutput, TQueryInput, TGet
|
||||
}
|
||||
}
|
||||
public class VengineAppService<TEntity, TGetInput, TGetOutput, TQueryInput, TGetListInput> :
|
||||
VengineAppService<TEntity, TGetInput, TGetOutput, TQueryInput, TGetListInput, DObject, VmCreateInput, VmUpdateInput>
|
||||
VengineAppService<TEntity, TGetInput, TGetOutput, TQueryInput, TGetListInput, dynamic, VmCreateInput, VmUpdateInput>
|
||||
where TEntity : Entity
|
||||
where TGetInput : VmGetInput
|
||||
where TGetListInput : VmGetListInput
|
||||
@@ -180,7 +180,7 @@ public class VengineAppService<TEntity, TGetInput, TGetOutput, TQueryInput, TGet
|
||||
}
|
||||
}
|
||||
public class VengineAppService<TEntity, TGetInput, TGetOutput> :
|
||||
VengineAppService<TEntity, TGetInput, TGetOutput, VmQueryInput, VmGetListInput, DObject, VmCreateInput, VmUpdateInput>
|
||||
VengineAppService<TEntity, TGetInput, TGetOutput, VmQueryInput, VmGetListInput, dynamic, VmCreateInput, VmUpdateInput>
|
||||
where TEntity : Entity
|
||||
where TGetInput : VmGetInput
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Tnb.Vengine.AppService;
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, KeepVerb = true, Order = 1102)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
|
||||
public class VmodelAppService : VengineAppService<Vmodel, VmodelGetInput, Vmodel>, IVmodelAppService
|
||||
{
|
||||
private readonly IViewEngine _viewEngine;
|
||||
private readonly ICacheManager _cache;
|
||||
@@ -38,34 +38,34 @@ public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
|
||||
/// <summary>
|
||||
/// 获取一条 数据信息
|
||||
/// </summary>
|
||||
public override async Task<dynamic> GetAsync(VmGetInput input)
|
||||
public override async Task<Vmodel> GetAsync(VmodelGetInput input)
|
||||
{
|
||||
VmodelGetInput para = new VmodelGetInput();
|
||||
if (!string.IsNullOrEmpty(input.q))
|
||||
{
|
||||
para = input.q.ToObject<VmodelGetInput>();
|
||||
}
|
||||
var query = _db.Queryable<Vmodel>().Where(a => a.deleted == 0);
|
||||
Vmodel? vm = null;
|
||||
if (!string.IsNullOrEmpty(input.id))
|
||||
{
|
||||
vm = await _dataAccess.GetVmodelAsync(input.id, para.drill);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(para.areaCode) && !string.IsNullOrEmpty(para.vmCode))
|
||||
{
|
||||
vm = await _dataAccess.GetVmodelAsync(para.areaCode, para.vmCode, para.drill);
|
||||
}
|
||||
ThrowIf.IsNull(vm, "输入参数有误, id 和 areaCode,vmCode 不可同时为空");
|
||||
return vm;
|
||||
//VmodelGetInput para = new VmodelGetInput();
|
||||
//if (!string.IsNullOrEmpty(input.q))
|
||||
//{
|
||||
// para = input.q.ToObject<VmodelGetInput>();
|
||||
//}
|
||||
//var query = _db.Queryable<Vmodel>().Where(a => a.deleted == 0);
|
||||
//Vmodel? vm = null;
|
||||
//if (!string.IsNullOrEmpty(input.id))
|
||||
//{
|
||||
// vm = await _dataAccess.GetVmodelAsync(input.id, para.drill);
|
||||
//}
|
||||
//else if (!string.IsNullOrEmpty(para.areaCode) && !string.IsNullOrEmpty(para.vmCode))
|
||||
//{
|
||||
// vm = await _dataAccess.GetVmodelAsync(para.areaCode, para.vmCode, para.drill);
|
||||
//}
|
||||
//ThrowIf.IsNull(vm, "输入参数有误, id 和 areaCode,vmCode 不可同时为空");
|
||||
return await base.GetAsync(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取多条 数据列表
|
||||
/// </summary>
|
||||
public override async Task<PagedOutput<dynamic>> GetListAsync(VmGetListInput input)
|
||||
{
|
||||
return await ListAsync(input.ToQueryInput());
|
||||
}
|
||||
///// <summary>
|
||||
///// 获取多条 数据列表
|
||||
///// </summary>
|
||||
//public override async Task<PagedOutput<dynamic>> GetListAsync(VmGetListInput input)
|
||||
//{
|
||||
// return await ListAsync(input.ToQueryInput());
|
||||
//}
|
||||
|
||||
[NonAction]
|
||||
public override async Task<PagedOutput<dynamic>> ListAsync(VmQueryInput input)
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
// https://git.tuotong-tech.com/tnb/tnb.server //
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using Tnb.Vengine.Domain;
|
||||
|
||||
namespace Tnb.Vengine.AppService;
|
||||
|
||||
public class VmodelCreateFromTableInput
|
||||
@@ -21,7 +23,7 @@ public class CreatePageFromVmodelInput
|
||||
public string? vmid { get; set; }
|
||||
}
|
||||
|
||||
public class VmodelGetInput
|
||||
public class VmodelGetInput : VmGetInput
|
||||
{
|
||||
public string? areaCode { get; set; }
|
||||
public string? vmCode { get; set; }
|
||||
|
||||
@@ -65,19 +65,19 @@ public partial class Vmodel : Entity
|
||||
/// 表字段属性
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "db_props", IsNullable = false, IsJson = true)]
|
||||
public List<VmDbProp> dbProps { get; set; } = [];
|
||||
public List<VmDbProp> dbProps { get; set; } = new List<VmDbProp>();
|
||||
|
||||
/// <summary>
|
||||
/// 导航属性
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "nav_props", IsNullable = true, IsJson = true)]
|
||||
public List<VmNavProp> navProps { get; set; } = [];
|
||||
public List<VmNavProp> navProps { get; set; } = new List<VmNavProp>();
|
||||
|
||||
/// <summary>
|
||||
/// 计算属性
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "cal_props", IsNullable = true, IsJson = true)]
|
||||
public List<VmCalProp> calProps { get; set; } = [];
|
||||
public List<VmCalProp> calProps { get; set; } = new List<VmCalProp>();
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
@@ -225,7 +225,7 @@ public partial class Vmodel : Entity
|
||||
/// <returns></returns>
|
||||
public DObject GetDefaultDObject()
|
||||
{
|
||||
DObject obj = [];
|
||||
DObject obj = new ();
|
||||
foreach (VmDbProp p in dbProps)
|
||||
{
|
||||
obj.Add(p.code, p.GetDefaultValue()!);
|
||||
@@ -239,7 +239,7 @@ public partial class Vmodel : Entity
|
||||
/// <returns></returns>
|
||||
public DObject ToCreateEntity(DObject input, IUserManager user)
|
||||
{
|
||||
DObject obj = [];
|
||||
DObject obj = new ();
|
||||
foreach (VmDbProp p in dbProps)
|
||||
{
|
||||
if (input.ContainsKey(p.code))
|
||||
@@ -273,7 +273,7 @@ public partial class Vmodel : Entity
|
||||
/// <returns></returns>
|
||||
public DObject ToUpdateEntity(DObject input, IUserManager user)
|
||||
{
|
||||
DObject obj = [];
|
||||
DObject obj = new ();
|
||||
foreach (VmDbProp p in dbProps)
|
||||
{
|
||||
if (input.ContainsKey(p.code))
|
||||
|
||||
Reference in New Issue
Block a user