diff --git a/visualdev/Tnb.Vengine/AppService/VmodelAppService.cs b/visualdev/Tnb.Vengine/AppService/VmodelAppService.cs index 9b55a234..77be98da 100644 --- a/visualdev/Tnb.Vengine/AppService/VmodelAppService.cs +++ b/visualdev/Tnb.Vengine/AppService/VmodelAppService.cs @@ -4,6 +4,8 @@ ///////////////////////////////////////////////////////////////////////////////// using JNPF; +using JNPF.Common.Extension; +using JNPF.Common.Security; using JNPF.ViewEngine; using Mapster; using Microsoft.AspNetCore.Mvc; @@ -35,17 +37,22 @@ public class VmodelAppService : VengineAppService, IVmodelAppService /// public override async Task GetAsync(VmGetInput input) { + VmodelGetInput para = new VmodelGetInput(); + if (!string.IsNullOrEmpty(input.q)) + { + para = input.q.ToObject(); + } var query = _db.Queryable().Where(a => a.deleted == 0); - Vmodel vm; - if (long.TryParse(input.id, out long id)) + Vmodel? vm = null; + if (!string.IsNullOrEmpty(input.id)) { - query.Where(a => a.id == input.id); - vm = await query.FirstAsync(); + vm = await _dataAccess.GetVmodelAsync(input.id, para.drill); } - else + else if(!string.IsNullOrEmpty(para.areaCode) && !string.IsNullOrEmpty(para.vmCode)) { - vm = await query.FirstAsync(a => a.vmCode == input.id); + vm = await _dataAccess.GetVmodelAsync(para.areaCode, para.vmCode, para.drill); } + ThrowIf.IsNull(vm, "输入参数有误, id 和 areaCode,vmCode 不可同时为空"); return vm; } diff --git a/visualdev/Tnb.Vengine/AppService/VmodelDto.cs b/visualdev/Tnb.Vengine/AppService/VmodelDto.cs index ab280788..9c69cd3a 100644 --- a/visualdev/Tnb.Vengine/AppService/VmodelDto.cs +++ b/visualdev/Tnb.Vengine/AppService/VmodelDto.cs @@ -23,10 +23,9 @@ public class CreatePageFromVmodelInput public class VmodelGetInput { - public long? id { get; set; } - public string? moduleCode { get; set; } + public string? areaCode { get; set; } public string? vmCode { get; set; } public string? dbCode { get; set; } public string? tableName { get; set; } - public bool drill { get; set; } + public bool drill { get; set; } = false; } \ No newline at end of file