Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
2023-09-22 16:58:49 +08:00
3 changed files with 17 additions and 10 deletions

View File

@@ -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;
}
@@ -93,6 +100,7 @@ public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
Vmodel vm = input.data.Adapt<Vmodel>();
vm.areaCode = vm.areaCode.ToKebab();
vm.vmCode = vm.vmCode.ToKebab();
vm.navProps.ForEach(a => a.naviModel = null);
await _db.Updateable(vm).WhereColumns(a => a.id).ExecuteCommandAsync();
return input;
}

View File

@@ -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;
}

View File

@@ -51,7 +51,7 @@ public class VmNavProp : VmBaseProp
//[JsonIgnore]
//public string? midTable { get; set; }
[JsonIgnore]
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public Vmodel? naviModel { get; set; }
#endregion Properties