Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -4,6 +4,8 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
using JNPF;
|
using JNPF;
|
||||||
|
using JNPF.Common.Extension;
|
||||||
|
using JNPF.Common.Security;
|
||||||
using JNPF.ViewEngine;
|
using JNPF.ViewEngine;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@@ -35,17 +37,22 @@ public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public override async Task<dynamic> GetAsync(VmGetInput input)
|
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);
|
var query = _db.Queryable<Vmodel>().Where(a => a.deleted == 0);
|
||||||
Vmodel vm;
|
Vmodel? vm = null;
|
||||||
if (long.TryParse(input.id, out long id))
|
if (!string.IsNullOrEmpty(input.id))
|
||||||
{
|
{
|
||||||
query.Where(a => a.id == input.id);
|
vm = await _dataAccess.GetVmodelAsync(input.id, para.drill);
|
||||||
vm = await query.FirstAsync();
|
|
||||||
}
|
}
|
||||||
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;
|
return vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,6 +100,7 @@ public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
|
|||||||
Vmodel vm = input.data.Adapt<Vmodel>();
|
Vmodel vm = input.data.Adapt<Vmodel>();
|
||||||
vm.areaCode = vm.areaCode.ToKebab();
|
vm.areaCode = vm.areaCode.ToKebab();
|
||||||
vm.vmCode = vm.vmCode.ToKebab();
|
vm.vmCode = vm.vmCode.ToKebab();
|
||||||
|
vm.navProps.ForEach(a => a.naviModel = null);
|
||||||
await _db.Updateable(vm).WhereColumns(a => a.id).ExecuteCommandAsync();
|
await _db.Updateable(vm).WhereColumns(a => a.id).ExecuteCommandAsync();
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,9 @@ public class CreatePageFromVmodelInput
|
|||||||
|
|
||||||
public class VmodelGetInput
|
public class VmodelGetInput
|
||||||
{
|
{
|
||||||
public long? id { get; set; }
|
public string? areaCode { get; set; }
|
||||||
public string? moduleCode { get; set; }
|
|
||||||
public string? vmCode { get; set; }
|
public string? vmCode { get; set; }
|
||||||
public string? dbCode { get; set; }
|
public string? dbCode { get; set; }
|
||||||
public string? tableName { get; set; }
|
public string? tableName { get; set; }
|
||||||
public bool drill { get; set; }
|
public bool drill { get; set; } = false;
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ public class VmNavProp : VmBaseProp
|
|||||||
//[JsonIgnore]
|
//[JsonIgnore]
|
||||||
//public string? midTable { get; set; }
|
//public string? midTable { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public Vmodel? naviModel { get; set; }
|
public Vmodel? naviModel { get; set; }
|
||||||
|
|
||||||
#endregion Properties
|
#endregion Properties
|
||||||
|
|||||||
Reference in New Issue
Block a user