查询模型详情时,钻取导航属性的模型
This commit is contained in:
@@ -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<Vmodel>, IVmodelAppService
|
||||
/// </summary>
|
||||
public override async Task<dynamic> GetAsync(VmGetInput 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;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user