Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -19,5 +19,12 @@ namespace Tnb.BasicData.Interfaces
|
|||||||
/// <param name="code"></param>
|
/// <param name="code"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<dynamic> GetWorkStationByCode(Dictionary<string, string> dic);
|
public Task<dynamic> GetWorkStationByCode(Dictionary<string, string> dic);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取工位信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="code"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Task<dynamic> GetWorkstationInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,5 +80,20 @@ namespace Tnb.BasicData
|
|||||||
}).FirstAsync();
|
}).FirstAsync();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> GetWorkstationInfo()
|
||||||
|
{
|
||||||
|
var result = await _repository.AsSugarClient().Queryable<OrganizeEntity>()
|
||||||
|
.LeftJoin<BasQrcode>((a, b) => a.Id == b.source_id && b.source_name == "BASE_ORGANIZE")
|
||||||
|
.Where((a, b) => a.Category == DictConst.RegionCategoryStationCode && a.DeleteMark == null)
|
||||||
|
.Select((a, b) => new
|
||||||
|
{
|
||||||
|
label = a.FullName,
|
||||||
|
value = a.Id,
|
||||||
|
qrcode = b.code
|
||||||
|
}).ToListAsync();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,4 +13,4 @@ namespace Tnb.Vengine.AppService;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class BaseAppService : IDynamicApiController, ITransient
|
public class BaseAppService : IDynamicApiController, ITransient
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -12,5 +12,4 @@ namespace Tnb.Vengine.AppService;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IVengineAppService : ITransient
|
public interface IVengineAppService : ITransient
|
||||||
{
|
{
|
||||||
|
}
|
||||||
}
|
|
||||||
@@ -12,5 +12,4 @@ namespace Tnb.Vengine.AppService;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IVmodelAppService : ITransient
|
public interface IVmodelAppService : ITransient
|
||||||
{
|
{
|
||||||
|
}
|
||||||
}
|
|
||||||
@@ -12,5 +12,4 @@ namespace Tnb.Vengine.AppService;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IVmodelPageAppService : ITransient
|
public interface IVmodelPageAppService : ITransient
|
||||||
{
|
{
|
||||||
|
}
|
||||||
}
|
|
||||||
@@ -40,7 +40,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
|||||||
/// 获取一条 数据信息
|
/// 获取一条 数据信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpGet("api/[area]/[controller]/{vmid}/get")]
|
[HttpGet("api/[area]/[controller]/{vmid}/get")]
|
||||||
public async Task<dynamic?> GetAsync(string vmid, VmGetInput input)
|
public async Task<dynamic?> GetAsync(string vmid, [FromQuery]VmGetInput input)
|
||||||
{
|
{
|
||||||
var vm = await _dataAccess.GetVmodelAsync(vmid, true);
|
var vm = await _dataAccess.GetVmodelAsync(vmid, true);
|
||||||
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
||||||
@@ -57,7 +57,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
|||||||
/// 获取多条 数据列表
|
/// 获取多条 数据列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpGet("api/[area]/[controller]/{vmid}/get-list")]
|
[HttpGet("api/[area]/[controller]/{vmid}/get-list")]
|
||||||
public async Task<VmPagedOutput> GetListAsync(string vmid, VmGetListInput input)
|
public async Task<VmPagedOutput> GetListAsync(string vmid, [FromQuery] VmGetListInput input)
|
||||||
{
|
{
|
||||||
var vm = await _dataAccess.GetVmodelAsync(vmid, true);
|
var vm = await _dataAccess.GetVmodelAsync(vmid, true);
|
||||||
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
||||||
@@ -73,7 +73,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
|||||||
/// 获取多条 数据列表
|
/// 获取多条 数据列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpPost("api/[area]/[controller]/{vmid}/query")]
|
[HttpPost("api/[area]/[controller]/{vmid}/query")]
|
||||||
public async Task<VmPagedOutput> QueryAsync(string vmid, VmQueryInput input)
|
public async Task<VmPagedOutput> QueryAsync(string vmid, [FromBody] VmQueryInput input)
|
||||||
{
|
{
|
||||||
var vm = await _dataAccess.GetVmodelAsync(vmid, true);
|
var vm = await _dataAccess.GetVmodelAsync(vmid, true);
|
||||||
var ls = await _dataAccess.QueryDataAsync(vm, input);
|
var ls = await _dataAccess.QueryDataAsync(vm, input);
|
||||||
@@ -84,7 +84,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
|||||||
/// 新增 数据
|
/// 新增 数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpPost("api/[area]/[controller]/{vmid}/create")]
|
[HttpPost("api/[area]/[controller]/{vmid}/create")]
|
||||||
public async Task<dynamic> CreateAsync(string vmid, VmCreateInput input)
|
public async Task<dynamic> CreateAsync(string vmid, [FromBody] VmCreateInput input)
|
||||||
{
|
{
|
||||||
var vm = await _dataAccess.GetVmodelAsync(vmid);
|
var vm = await _dataAccess.GetVmodelAsync(vmid);
|
||||||
var ret = await _dataAccess.CreateDataAsync(vm, input);
|
var ret = await _dataAccess.CreateDataAsync(vm, input);
|
||||||
@@ -95,7 +95,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
|||||||
/// 更新 数据
|
/// 更新 数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpPut("api/[area]/[controller]/{vmid}/update")]
|
[HttpPut("api/[area]/[controller]/{vmid}/update")]
|
||||||
public async Task<dynamic> UpdateAsync(string vmid, VmUpdateInput input)
|
public async Task<dynamic> UpdateAsync(string vmid, [FromBody] VmUpdateInput input)
|
||||||
{
|
{
|
||||||
var vm = await _dataAccess.GetVmodelAsync(vmid);
|
var vm = await _dataAccess.GetVmodelAsync(vmid);
|
||||||
var ret = await _dataAccess.UpdateDataAsync(vm, input);
|
var ret = await _dataAccess.UpdateDataAsync(vm, input);
|
||||||
@@ -106,19 +106,20 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
|||||||
/// 删除 数据
|
/// 删除 数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpDelete("api/[area]/[controller]/{vmid}/delete")]
|
[HttpDelete("api/[area]/[controller]/{vmid}/delete")]
|
||||||
public async Task<dynamic> DeleteAsync(string vmid, VmDeleteInput input)
|
public async Task<dynamic> DeleteAsync(string vmid, [FromQuery] VmDeleteInput input)
|
||||||
{
|
{
|
||||||
var vm = await _dataAccess.GetVmodelAsync(vmid);
|
var vm = await _dataAccess.GetVmodelAsync(vmid);
|
||||||
var ret = await _dataAccess.DeleteDataAsync(vm, input);
|
var ret = await _dataAccess.DeleteDataAsync(vm, input);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion 按模型的id进行增删改查接口
|
||||||
|
|
||||||
#region 按模型的areaCode和vmcode进行增删改查接口
|
#region 按模型的areaCode和vmcode进行增删改查接口
|
||||||
|
|
||||||
private async Task<Vmodel> GetVmodelAsync(string areaCode, string vmCode)
|
private async Task<Vmodel> GetVmodelAsync(string areaCode, string vmCode)
|
||||||
{
|
{
|
||||||
var vm = await _dataAccess.GetVmodelAsync(areaCode, vmCode, false);
|
var vm = await _dataAccess.GetVmodelAsync(areaCode, vmCode, true);
|
||||||
return vm;
|
return vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +127,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
|||||||
/// 获取一条 数据信息
|
/// 获取一条 数据信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpGet("api/{areaCode}/{vmCode}/get")]
|
[HttpGet("api/{areaCode}/{vmCode}/get")]
|
||||||
public async Task<dynamic?> GetAsync(string areaCode, string vmCode, VmGetInput input)
|
public async Task<dynamic?> GetAsync(string areaCode, string vmCode, [FromQuery] VmGetInput input)
|
||||||
{
|
{
|
||||||
var vm = await GetVmodelAsync(areaCode, vmCode);
|
var vm = await GetVmodelAsync(areaCode, vmCode);
|
||||||
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
||||||
@@ -143,7 +144,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
|||||||
/// 获取多条 数据列表
|
/// 获取多条 数据列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpGet("api/{areaCode}/{vmCode}/get-list")]
|
[HttpGet("api/{areaCode}/{vmCode}/get-list")]
|
||||||
public async Task<VmPagedOutput> GetListAsync(string areaCode, string vmCode, VmGetListInput input)
|
public async Task<VmPagedOutput> GetListAsync(string areaCode, string vmCode, [FromQuery] VmGetListInput input)
|
||||||
{
|
{
|
||||||
var vm = await GetVmodelAsync(areaCode, vmCode);
|
var vm = await GetVmodelAsync(areaCode, vmCode);
|
||||||
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
||||||
@@ -159,7 +160,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
|||||||
/// 获取多条 数据列表
|
/// 获取多条 数据列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpPost("api/{areaCode}/{vmCode}/query")]
|
[HttpPost("api/{areaCode}/{vmCode}/query")]
|
||||||
public async Task<VmPagedOutput> QueryAsync(string areaCode, string vmCode, VmQueryInput input)
|
public async Task<VmPagedOutput> QueryAsync(string areaCode, string vmCode, [FromBody] VmQueryInput input)
|
||||||
{
|
{
|
||||||
var vm = await GetVmodelAsync(areaCode, vmCode);
|
var vm = await GetVmodelAsync(areaCode, vmCode);
|
||||||
var ls = await _dataAccess.QueryDataAsync(vm, input);
|
var ls = await _dataAccess.QueryDataAsync(vm, input);
|
||||||
@@ -170,7 +171,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
|||||||
/// 新增 数据
|
/// 新增 数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpPost("api/{areaCode}/{vmCode}/create")]
|
[HttpPost("api/{areaCode}/{vmCode}/create")]
|
||||||
public async Task<dynamic> CreateAsync(string areaCode, string vmCode, VmCreateInput input)
|
public async Task<dynamic> CreateAsync(string areaCode, string vmCode, [FromBody] VmCreateInput input)
|
||||||
{
|
{
|
||||||
var vm = await GetVmodelAsync(areaCode, vmCode);
|
var vm = await GetVmodelAsync(areaCode, vmCode);
|
||||||
var ret = await _dataAccess.CreateDataAsync(vm, input);
|
var ret = await _dataAccess.CreateDataAsync(vm, input);
|
||||||
@@ -181,7 +182,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
|||||||
/// 更新 数据
|
/// 更新 数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpPut("api/{areaCode}/{vmCode}/update")]
|
[HttpPut("api/{areaCode}/{vmCode}/update")]
|
||||||
public async Task<dynamic> UpdateAsync(string areaCode, string vmCode, VmUpdateInput input)
|
public async Task<dynamic> UpdateAsync(string areaCode, string vmCode, [FromBody] VmUpdateInput input)
|
||||||
{
|
{
|
||||||
var vm = await GetVmodelAsync(areaCode, vmCode);
|
var vm = await GetVmodelAsync(areaCode, vmCode);
|
||||||
var ret = await _dataAccess.UpdateDataAsync(vm, input);
|
var ret = await _dataAccess.UpdateDataAsync(vm, input);
|
||||||
@@ -192,12 +193,12 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
|||||||
/// 删除 数据
|
/// 删除 数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpDelete("api/{areaCode}/{vmCode}/delete")]
|
[HttpDelete("api/{areaCode}/{vmCode}/delete")]
|
||||||
public async Task<dynamic> DeleteAsync(string areaCode, string vmCode, VmDeleteInput input)
|
public async Task<dynamic> DeleteAsync(string areaCode, string vmCode, [FromQuery] VmDeleteInput input)
|
||||||
{
|
{
|
||||||
var vm = await GetVmodelAsync(areaCode, vmCode);
|
var vm = await GetVmodelAsync(areaCode, vmCode);
|
||||||
var ret = await _dataAccess.DeleteDataAsync(vm, input);
|
var ret = await _dataAccess.DeleteDataAsync(vm, input);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
}
|
#endregion 按模型的areaCode和vmcode进行增删改查接口
|
||||||
|
}
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using JNPF;
|
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
@@ -64,7 +63,7 @@ public class VengineAppService<TEntity> : BaseAppService where TEntity : Entity
|
|||||||
/// 获取一条 数据信息
|
/// 获取一条 数据信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public virtual async Task<dynamic> GetAsync(VmGetInput input)
|
public virtual async Task<dynamic> GetAsync([FromQuery] VmGetInput input)
|
||||||
{
|
{
|
||||||
var vm = await GetVmodelAsync();
|
var vm = await GetVmodelAsync();
|
||||||
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
||||||
@@ -81,7 +80,7 @@ public class VengineAppService<TEntity> : BaseAppService where TEntity : Entity
|
|||||||
/// 获取多条 数据列表
|
/// 获取多条 数据列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public virtual async Task<VmPagedOutput> GetListAsync(VmGetListInput input)
|
public virtual async Task<VmPagedOutput> GetListAsync([FromQuery] VmGetListInput input)
|
||||||
{
|
{
|
||||||
var vm = await GetVmodelAsync();
|
var vm = await GetVmodelAsync();
|
||||||
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
||||||
@@ -97,7 +96,7 @@ public class VengineAppService<TEntity> : BaseAppService where TEntity : Entity
|
|||||||
/// 获取多条 数据列表
|
/// 获取多条 数据列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public virtual async Task<VmPagedOutput> QueryAsync(VmQueryInput input)
|
public virtual async Task<VmPagedOutput> QueryAsync([FromBody] VmQueryInput input)
|
||||||
{
|
{
|
||||||
var vm = await GetVmodelAsync();
|
var vm = await GetVmodelAsync();
|
||||||
var ls = await _dataAccess.QueryDataAsync(vm, input);
|
var ls = await _dataAccess.QueryDataAsync(vm, input);
|
||||||
@@ -108,7 +107,7 @@ public class VengineAppService<TEntity> : BaseAppService where TEntity : Entity
|
|||||||
/// 新增 数据
|
/// 新增 数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public virtual async Task<dynamic> CreateAsync(VmCreateInput input)
|
public virtual async Task<dynamic> CreateAsync([FromBody] VmCreateInput input)
|
||||||
{
|
{
|
||||||
var vm = await GetVmodelAsync();
|
var vm = await GetVmodelAsync();
|
||||||
var ret = await _dataAccess.CreateDataAsync(vm, input);
|
var ret = await _dataAccess.CreateDataAsync(vm, input);
|
||||||
@@ -119,7 +118,7 @@ public class VengineAppService<TEntity> : BaseAppService where TEntity : Entity
|
|||||||
/// 更新 数据
|
/// 更新 数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpPut]
|
[HttpPut]
|
||||||
public virtual async Task<dynamic> UpdateAsync(VmUpdateInput input)
|
public virtual async Task<dynamic> UpdateAsync([FromBody] VmUpdateInput input)
|
||||||
{
|
{
|
||||||
var vm = await GetVmodelAsync();
|
var vm = await GetVmodelAsync();
|
||||||
var ret = await _dataAccess.UpdateDataAsync(vm, input);
|
var ret = await _dataAccess.UpdateDataAsync(vm, input);
|
||||||
@@ -130,11 +129,10 @@ public class VengineAppService<TEntity> : BaseAppService where TEntity : Entity
|
|||||||
/// 删除 数据
|
/// 删除 数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpDelete]
|
[HttpDelete]
|
||||||
public virtual async Task<dynamic> DeleteAsync(VmDeleteInput input)
|
public virtual async Task<dynamic> DeleteAsync([FromQuery] VmDeleteInput input)
|
||||||
{
|
{
|
||||||
var vm = await GetVmodelAsync();
|
var vm = await GetVmodelAsync();
|
||||||
var ret = await _dataAccess.DeleteDataAsync(vm, input);
|
var ret = await _dataAccess.DeleteDataAsync(vm, input);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
@@ -3,15 +3,13 @@
|
|||||||
// https://git.tuotong-tech.com/tnb/tnb-server //
|
// https://git.tuotong-tech.com/tnb/tnb-server //
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
using JNPF.Common.Configuration;
|
|
||||||
using JNPF;
|
using JNPF;
|
||||||
|
using JNPF.ViewEngine;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.Core;
|
|
||||||
using Tnb.Vengine.DataAccess;
|
using Tnb.Vengine.DataAccess;
|
||||||
using Tnb.Vengine.Domain;
|
using Tnb.Vengine.Domain;
|
||||||
using JNPF.ViewEngine;
|
|
||||||
|
|
||||||
namespace Tnb.Vengine.AppService;
|
namespace Tnb.Vengine.AppService;
|
||||||
|
|
||||||
@@ -22,11 +20,12 @@ namespace Tnb.Vengine.AppService;
|
|||||||
[Route("api/[area]/[controller]/[action]")]
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
|
public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
|
||||||
{
|
{
|
||||||
private readonly ViewEngine _viewEngine;
|
private readonly IViewEngine _viewEngine;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构造函数
|
/// 构造函数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VmodelAppService(IDataAccess da, ViewEngine viewEngine) : base(da)
|
public VmodelAppService(IDataAccess da, IViewEngine viewEngine) : base(da)
|
||||||
{
|
{
|
||||||
_viewEngine = viewEngine;
|
_viewEngine = viewEngine;
|
||||||
}
|
}
|
||||||
@@ -221,8 +220,6 @@ public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
|
|||||||
//code = CodeHelper.RunCompile($"{TemplateContext.KeyEntityPageVue}.cshtml", ctx, null, "SqlSugar");
|
//code = CodeHelper.RunCompile($"{TemplateContext.KeyEntityPageVue}.cshtml", ctx, null, "SqlSugar");
|
||||||
//CodeHelper.SaveCodeToFile(code, filePath);
|
//CodeHelper.SaveCodeToFile(code, filePath);
|
||||||
|
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
@@ -29,6 +29,4 @@ public class VmodelGetInput
|
|||||||
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; }
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@@ -3,14 +3,12 @@
|
|||||||
// https://git.tuotong-tech.com/tnb/tnb-server //
|
// https://git.tuotong-tech.com/tnb/tnb-server //
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
using System.Text;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System.Text;
|
|
||||||
using Tnb.Core;
|
|
||||||
using Tnb.Vengine.DataAccess;
|
using Tnb.Vengine.DataAccess;
|
||||||
using Tnb.Vengine.Domain;
|
using Tnb.Vengine.Domain;
|
||||||
|
|
||||||
@@ -167,5 +165,4 @@ public class VmodelPageAppService : VengineAppService<VmodelPage>, IVmodelPageAp
|
|||||||
Console.WriteLine(s);
|
Console.WriteLine(s);
|
||||||
return JObject.Parse(s);
|
return JObject.Parse(s);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
@@ -14,4 +14,4 @@ public class VmodelSettingAttribute : Attribute
|
|||||||
Area = area;
|
Area = area;
|
||||||
Code = code;
|
Code = code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,14 +16,14 @@ public class AcmenVmodelContext : TemplateContext
|
|||||||
_da = da;
|
_da = da;
|
||||||
Vm = vm;
|
Vm = vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IDataAccess _da { get; set; }
|
public IDataAccess _da { get; set; }
|
||||||
|
|
||||||
public Vmodel Vm { get; }
|
public Vmodel Vm { get; }
|
||||||
|
|
||||||
public string NsPrefix { get { return "Tnb"; } }
|
public string NsPrefix
|
||||||
|
{ get { return "Tnb"; } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
namespace Tnb.Vengine;
|
namespace Tnb.Vengine;
|
||||||
|
|
||||||
@@ -115,9 +114,10 @@ public class CodeHelper
|
|||||||
float.TryParse(propDefine, out float f);
|
float.TryParse(propDefine, out float f);
|
||||||
return (int)f;
|
return (int)f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int PropDefineToScale(string? propDefine)
|
public static int PropDefineToScale(string? propDefine)
|
||||||
{
|
{
|
||||||
float.TryParse(propDefine, out float f);
|
float.TryParse(propDefine, out float f);
|
||||||
return (int)(f * 10) % 10;
|
return (int)(f * 10) % 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using JNPF.Common.Configuration;
|
using JNPF.Common.Configuration;
|
||||||
using Tnb.Core;
|
|
||||||
|
|
||||||
namespace Tnb.Vengine;
|
namespace Tnb.Vengine;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TemplateContext
|
public class TemplateContext
|
||||||
{
|
{
|
||||||
#region 模板文件名,同时作为模板Key
|
#region 模板文件名,同时作为模板Key
|
||||||
|
|
||||||
public const string KeyAppService = "AppService";
|
public const string KeyAppService = "AppService";
|
||||||
public const string KeyDto = "AppServiceDto";
|
public const string KeyDto = "AppServiceDto";
|
||||||
public const string KeyEntity = "EntityInfo";
|
public const string KeyEntity = "EntityInfo";
|
||||||
@@ -17,10 +18,11 @@ public class TemplateContext
|
|||||||
public const string KeyEntityPageVue = "EntityPageVue";
|
public const string KeyEntityPageVue = "EntityPageVue";
|
||||||
public const string KeyTableForeigns = "TableForeigns";
|
public const string KeyTableForeigns = "TableForeigns";
|
||||||
public const string KeyVmodel = "Vmodel";
|
public const string KeyVmodel = "Vmodel";
|
||||||
#endregion
|
|
||||||
|
#endregion 模板文件名,同时作为模板Key
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TemplateContext(string moduleCode)
|
public TemplateContext(string moduleCode)
|
||||||
{
|
{
|
||||||
@@ -31,27 +33,32 @@ public class TemplateContext
|
|||||||
#endif
|
#endif
|
||||||
ModuleCode = moduleCode;
|
ModuleCode = moduleCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string BasePath { get; set; }
|
public string BasePath { get; set; }
|
||||||
|
|
||||||
private string ModuleCode { get; }
|
private string ModuleCode { get; }
|
||||||
|
|
||||||
private string ModulePath => Path.Combine(BasePath, $"{ModuleCode}.Acmen");
|
private string ModulePath => Path.Combine(BasePath, $"{ModuleCode}.Acmen");
|
||||||
private string UiProjPath => Path.Combine(BasePath, "ItMgrWeb");
|
private string UiProjPath => Path.Combine(BasePath, "ItMgrWeb");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string AppServicePath => Path.Combine(ModulePath, "AppServices");
|
public string AppServicePath => Path.Combine(ModulePath, "AppServices");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PagePath => Path.Combine(UiProjPath, "src", "views");
|
public string PagePath => Path.Combine(UiProjPath, "src", "views");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
@@ -75,4 +82,4 @@ public enum eLambdaType
|
|||||||
Where,
|
Where,
|
||||||
MemberBinding,
|
MemberBinding,
|
||||||
OneToMany
|
OneToMany
|
||||||
}
|
}
|
||||||
@@ -66,5 +66,4 @@ public static class DbConsts
|
|||||||
public static Guid RoleAdminId = Guid.Parse("39fea2c8-01a4-75cd-026f-2f0349a94098");
|
public static Guid RoleAdminId = Guid.Parse("39fea2c8-01a4-75cd-026f-2f0349a94098");
|
||||||
public static Guid EventDefaultCategoryId = Guid.Parse("39ffae5d-13d2-1e43-3f0e-98f774f71c8a");
|
public static Guid EventDefaultCategoryId = Guid.Parse("39ffae5d-13d2-1e43-3f0e-98f774f71c8a");
|
||||||
public static Guid DefaultViewId = Guid.Parse("39fea2c1-b2dd-cfae-1c3d-89de77f94709");
|
public static Guid DefaultViewId = Guid.Parse("39fea2c1-b2dd-cfae-1c3d-89de77f94709");
|
||||||
|
}
|
||||||
}
|
|
||||||
@@ -5,4 +5,4 @@ public class ModuleConst
|
|||||||
public const string Tag = "Tnb";
|
public const string Tag = "Tnb";
|
||||||
public const string Area = "tnb";
|
public const string Area = "tnb";
|
||||||
public const string NsPrefix = "Tnb";
|
public const string NsPrefix = "Tnb";
|
||||||
}
|
}
|
||||||
@@ -11,41 +11,59 @@ public enum eCsType
|
|||||||
{
|
{
|
||||||
[Description("string")]
|
[Description("string")]
|
||||||
String = 10,
|
String = 10,
|
||||||
|
|
||||||
[Description("bool")]
|
[Description("bool")]
|
||||||
Bool = 12,
|
Bool = 12,
|
||||||
|
|
||||||
[Description("uuid")]
|
[Description("uuid")]
|
||||||
Guid = 14,
|
Guid = 14,
|
||||||
|
|
||||||
[Description("int")]
|
[Description("int")]
|
||||||
Int = 20,
|
Int = 20,
|
||||||
|
|
||||||
[Description("short")]
|
[Description("short")]
|
||||||
Short = 22,
|
Short = 22,
|
||||||
|
|
||||||
[Description("long")]
|
[Description("long")]
|
||||||
Long = 24,
|
Long = 24,
|
||||||
|
|
||||||
[Description("float")]
|
[Description("float")]
|
||||||
Float = 30,
|
Float = 30,
|
||||||
|
|
||||||
[Description("double")]
|
[Description("double")]
|
||||||
Double = 32,
|
Double = 32,
|
||||||
|
|
||||||
[Description("decimal")]
|
[Description("decimal")]
|
||||||
Decimal = 34,
|
Decimal = 34,
|
||||||
|
|
||||||
[Description("date")]
|
[Description("date")]
|
||||||
Date = 40,
|
Date = 40,
|
||||||
|
|
||||||
[Description("time")]
|
[Description("time")]
|
||||||
Time = 42,
|
Time = 42,
|
||||||
|
|
||||||
[Description("datetime")]
|
[Description("datetime")]
|
||||||
DateTime = 44,
|
DateTime = 44,
|
||||||
|
|
||||||
[Description("timestamp")]
|
[Description("timestamp")]
|
||||||
Timestamp = 46,
|
Timestamp = 46,
|
||||||
|
|
||||||
[Description("enum")]
|
[Description("enum")]
|
||||||
Enum = 50,
|
Enum = 50,
|
||||||
|
|
||||||
[Description("dictionary")]
|
[Description("dictionary")]
|
||||||
Dictionary = 52,
|
Dictionary = 52,
|
||||||
|
|
||||||
[Description("json")]
|
[Description("json")]
|
||||||
Json = 60,
|
Json = 60,
|
||||||
|
|
||||||
[Description("entity")]
|
[Description("entity")]
|
||||||
Entity = 70,
|
Entity = 70,
|
||||||
|
|
||||||
[Description("customer")]
|
[Description("customer")]
|
||||||
Customer = 80,
|
Customer = 80,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum eDbType
|
public enum eDbType
|
||||||
{
|
{
|
||||||
MySql,
|
MySql,
|
||||||
@@ -59,38 +77,51 @@ public enum eDbType
|
|||||||
Redis,
|
Redis,
|
||||||
InfluxDb
|
InfluxDb
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum eResourceType
|
public enum eResourceType
|
||||||
{
|
{
|
||||||
[Description("菜单")]
|
[Description("菜单")]
|
||||||
Menu = 10,
|
Menu = 10,
|
||||||
|
|
||||||
[Description("页面")]
|
[Description("页面")]
|
||||||
Page = 20,
|
Page = 20,
|
||||||
|
|
||||||
[Description("按钮")]
|
[Description("按钮")]
|
||||||
Button = 30,
|
Button = 30,
|
||||||
|
|
||||||
[Description("接口")]
|
[Description("接口")]
|
||||||
Interface = 40,
|
Interface = 40,
|
||||||
|
|
||||||
[Description("视图")]
|
[Description("视图")]
|
||||||
View = 50,
|
View = 50,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum eSearchType
|
public enum eSearchType
|
||||||
{
|
{
|
||||||
[Description("无")]
|
[Description("无")]
|
||||||
None = 0,
|
None = 0,
|
||||||
|
|
||||||
[Description("精准查询")]
|
[Description("精准查询")]
|
||||||
Exact = 1,
|
Exact = 1,
|
||||||
|
|
||||||
[Description("模糊查询")]
|
[Description("模糊查询")]
|
||||||
Fuzzy = 2,
|
Fuzzy = 2,
|
||||||
|
|
||||||
[Description("范围查询")]
|
[Description("范围查询")]
|
||||||
Range = 3,
|
Range = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum eNavigateType
|
public enum eNavigateType
|
||||||
{
|
{
|
||||||
[Description("无")]
|
[Description("无")]
|
||||||
None = 0,
|
None = 0,
|
||||||
|
|
||||||
[Description("一对一")]
|
[Description("一对一")]
|
||||||
OneToOne = 1,
|
OneToOne = 1,
|
||||||
|
|
||||||
[Description("一对多")]
|
[Description("一对多")]
|
||||||
OneToMany = 2,
|
OneToMany = 2,
|
||||||
|
|
||||||
[Description("多对多")]
|
[Description("多对多")]
|
||||||
ManyToMany = 3,
|
ManyToMany = 3,
|
||||||
}
|
}
|
||||||
@@ -102,8 +133,10 @@ public enum ePropType
|
|||||||
{
|
{
|
||||||
[Description("表字段")]
|
[Description("表字段")]
|
||||||
DbTable = 0,
|
DbTable = 0,
|
||||||
|
|
||||||
[Description("计算属性")]
|
[Description("计算属性")]
|
||||||
Calculate = 1,
|
Calculate = 1,
|
||||||
|
|
||||||
[Description("导航属性")]
|
[Description("导航属性")]
|
||||||
Navigate = 2,
|
Navigate = 2,
|
||||||
}
|
}
|
||||||
@@ -1,30 +1,32 @@
|
|||||||
using JNPF;
|
using System.Collections.Concurrent;
|
||||||
|
using JNPF;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using Tnb.Core;
|
using Tnb.Core;
|
||||||
using Tnb.Vengine.Domain;
|
using Tnb.Vengine.Domain;
|
||||||
|
|
||||||
namespace Tnb.Vengine.DataAccess;
|
namespace Tnb.Vengine.DataAccess;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DataAccess : IDataAccess, ITransient, IDisposable
|
public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||||
{
|
{
|
||||||
const int MAX_PAGE_SIZE = 1000;
|
private const int MAX_PAGE_SIZE = 1000;
|
||||||
private ISqlSugarClient? _db;
|
private ISqlSugarClient? _db;
|
||||||
|
|
||||||
protected ISqlSugarClient Db
|
protected ISqlSugarClient Db
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_db == null)
|
if (_db == null)
|
||||||
{
|
{
|
||||||
var dbType = App.Configuration.GetConnectionString("DbType");
|
ConnectionStringsOptions conn = App.GetConfig<ConnectionStringsOptions>("ConnectionStrings", true);
|
||||||
var dbConn = App.Configuration.GetConnectionString("DbConn");
|
//var dbType = App.Configuration.GetConnectionString("DbType");
|
||||||
_db = SugarHelper.CreateSugarClient("_db_default_", dbType, dbConn);
|
//var dbConn = App.Configuration.GetConnectionString("DbConn");
|
||||||
|
_db = SugarHelper.CreateSugarClient(conn.ConfigId, conn.DBType, conn.ConnectString);
|
||||||
}
|
}
|
||||||
return _db;
|
return _db;
|
||||||
}
|
}
|
||||||
@@ -35,7 +37,7 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 全局缓存
|
/// 全局缓存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static ConcurrentDictionary<string, ISqlSugarClient> DbCache = new ConcurrentDictionary<string, ISqlSugarClient>();
|
private static ConcurrentDictionary<string, ISqlSugarClient> DbCache = new ConcurrentDictionary<string, ISqlSugarClient>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构造
|
/// 构造
|
||||||
@@ -290,9 +292,7 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
|||||||
{
|
{
|
||||||
ret.Add(prop.navCode, new List<DObject>());
|
ret.Add(prop.navCode, new List<DObject>());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@@ -424,5 +424,4 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
|||||||
|
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
@@ -5,7 +5,7 @@ using Tnb.Vengine.Domain;
|
|||||||
namespace Tnb.Vengine.DataAccess;
|
namespace Tnb.Vengine.DataAccess;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IDataAccess : ITransient
|
public interface IDataAccess : ITransient
|
||||||
{
|
{
|
||||||
@@ -27,18 +27,22 @@ public interface IDataAccess : ITransient
|
|||||||
/// 获取 Vmodel, 为空时不抛异常
|
/// 获取 Vmodel, 为空时不抛异常
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<Vmodel?> TryGetVmodelAsync(string id, bool loadNavigate = false);
|
Task<Vmodel?> TryGetVmodelAsync(string id, bool loadNavigate = false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取 Vmodel, 为空时抛异常
|
/// 获取 Vmodel, 为空时抛异常
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<Vmodel> GetVmodelAsync(string id, bool loadNavigate = false);
|
Task<Vmodel> GetVmodelAsync(string id, bool loadNavigate = false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取 Vmodel, 为空时不抛异常
|
/// 获取 Vmodel, 为空时不抛异常
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<Vmodel?> TryGetVmodelAsync(string area, string vmCode, bool loadNavigate = false);
|
Task<Vmodel?> TryGetVmodelAsync(string area, string vmCode, bool loadNavigate = false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取 Vmodel, 为空时抛异常
|
/// 获取 Vmodel, 为空时抛异常
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<Vmodel> GetVmodelAsync(string area, string vmCode, bool loadNavigate = false);
|
Task<Vmodel> GetVmodelAsync(string area, string vmCode, bool loadNavigate = false);
|
||||||
|
|
||||||
//Task<VmPagedOutput> QueryDataAsync(VmBaseInput input);
|
//Task<VmPagedOutput> QueryDataAsync(VmBaseInput input);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -63,4 +67,4 @@ public interface IDataAccess : ITransient
|
|||||||
/// 删除数据 默认方法
|
/// 删除数据 默认方法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<int> DeleteDataAsync(Vmodel vm, VmDeleteInput input);
|
Task<int> DeleteDataAsync(Vmodel vm, VmDeleteInput input);
|
||||||
}
|
}
|
||||||
@@ -7,67 +7,67 @@ namespace Tnb.Vengine.DataAccess;
|
|||||||
|
|
||||||
public class SugarHelper
|
public class SugarHelper
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建SugarClient实例
|
/// 创建SugarClient实例
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static ISqlSugarClient CreateSugarClient(string dbCode, string dbType, string dbConnection, Action<ConnectionConfig>? configConnection = null, Action<ISqlSugarClient>? configSugar = null)
|
public static ISqlSugarClient CreateSugarClient(string dbCode, string dbType, string dbConnection, Action<ConnectionConfig>? configConnection = null, Action<ISqlSugarClient>? configSugar = null)
|
||||||
{
|
|
||||||
var config = new ConnectionConfig
|
|
||||||
{
|
{
|
||||||
ConnectionString = dbConnection,
|
var config = new ConnectionConfig
|
||||||
DbType = dbType.Adapt<DbType>(),
|
{
|
||||||
IsAutoCloseConnection = true,
|
ConnectionString = dbConnection,
|
||||||
ConfigId = dbCode,
|
DbType = dbType.Adapt<DbType>(),
|
||||||
InitKeyType = InitKeyType.Attribute,
|
IsAutoCloseConnection = true,
|
||||||
MoreSettings = new ConnMoreSettings()
|
ConfigId = dbCode,
|
||||||
{
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoRemoveDataCache = true, // 自动清理缓存
|
MoreSettings = new ConnMoreSettings()
|
||||||
IsAutoToUpper = false,
|
{
|
||||||
PgSqlIsAutoToLower = false,
|
IsAutoRemoveDataCache = true, // 自动清理缓存
|
||||||
DisableNvarchar = true
|
IsAutoToUpper = false,
|
||||||
},
|
PgSqlIsAutoToLower = false,
|
||||||
};
|
DisableNvarchar = true
|
||||||
configConnection?.Invoke(config);
|
},
|
||||||
var sugar = new SqlSugarScope(config, configSugar == null ? ConfigSugar : configSugar);
|
};
|
||||||
return sugar;
|
configConnection?.Invoke(config);
|
||||||
}
|
var sugar = new SqlSugarScope(config, configSugar == null ? ConfigSugar : configSugar);
|
||||||
|
return sugar;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SqlSugar默认配置
|
/// SqlSugar默认配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="db"></param>
|
/// <param name="db"></param>
|
||||||
public static void ConfigSugar(ISqlSugarClient db)
|
public static void ConfigSugar(ISqlSugarClient db)
|
||||||
{
|
|
||||||
// 设置超时时间
|
|
||||||
db.Ado.CommandTimeOut = 30;
|
|
||||||
db.Aop.OnLogExecuted = (sql, pars) =>
|
|
||||||
{
|
{
|
||||||
var finalSql = UtilMethods.GetSqlString(db.CurrentConnectionConfig.DbType, sql, pars);
|
// 设置超时时间
|
||||||
if (db.Ado.SqlExecutionTime.TotalMilliseconds > 3000)
|
db.Ado.CommandTimeOut = 30;
|
||||||
{
|
db.Aop.OnLogExecuted = (sql, pars) =>
|
||||||
Log.Warning($"慢查询: {db.Ado.SqlExecutionTime.TotalMilliseconds}ms, SQL: " + finalSql);
|
{
|
||||||
}
|
var finalSql = UtilMethods.GetSqlString(db.CurrentConnectionConfig.DbType, sql, pars);
|
||||||
else
|
if (db.Ado.SqlExecutionTime.TotalMilliseconds > 3000)
|
||||||
{
|
{
|
||||||
var oldColor = Console.ForegroundColor;
|
Log.Warning($"慢查询: {db.Ado.SqlExecutionTime.TotalMilliseconds}ms, SQL: " + finalSql);
|
||||||
Console.ForegroundColor = ConsoleColor.Green;
|
}
|
||||||
Console.WriteLine($"【{DateTime.Now.ToString("HH:mm:ss.fff")}——SQL执行完成】{db.Ado.SqlExecutionTime.TotalMilliseconds} ms");
|
else
|
||||||
Console.WriteLine(finalSql);
|
{
|
||||||
Console.ForegroundColor = oldColor;
|
var oldColor = Console.ForegroundColor;
|
||||||
Console.WriteLine();
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
}
|
Console.WriteLine($"【{DateTime.Now.ToString("HH:mm:ss.fff")}——SQL执行完成】{db.Ado.SqlExecutionTime.TotalMilliseconds} ms");
|
||||||
};
|
Console.WriteLine(finalSql);
|
||||||
db.Aop.OnError = (ex) =>
|
Console.ForegroundColor = oldColor;
|
||||||
{
|
Console.WriteLine();
|
||||||
Log.Error(UtilMethods.GetSqlString(db.CurrentConnectionConfig.DbType, ex.Sql, (SugarParameter[])ex.Parametres));
|
}
|
||||||
};
|
};
|
||||||
}
|
db.Aop.OnError = (ex) =>
|
||||||
|
{
|
||||||
|
Log.Error(UtilMethods.GetSqlString(db.CurrentConnectionConfig.DbType, ex.Sql, (SugarParameter[])ex.Parametres));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static void CustomSnowId()
|
public static void CustomSnowId()
|
||||||
{
|
|
||||||
StaticConfig.CustomSnowFlakeFunc = () =>
|
|
||||||
{
|
{
|
||||||
return YitIdHelper.NextId();
|
StaticConfig.CustomSnowFlakeFunc = () =>
|
||||||
};
|
{
|
||||||
}
|
return YitIdHelper.NextId();
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,21 +10,21 @@ namespace Tnb.Vengine.Domain;
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
public abstract class Entity : IEntity
|
public abstract class Entity : IEntity
|
||||||
{
|
{
|
||||||
protected Entity()
|
protected Entity()
|
||||||
{
|
{
|
||||||
//EntityHelper.TrySetTenantId(this);
|
//EntityHelper.TrySetTenantId(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return $"[ENTITY: {GetType().Name}] Keys = {string.Join(", ", GetKeys())}";
|
return $"[ENTITY: {GetType().Name}] Keys = {string.Join(", ", GetKeys())}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract object[] GetKeys();
|
public abstract object[] GetKeys();
|
||||||
|
|
||||||
//public bool EntityEquals(IEntity other)
|
//public bool EntityEquals(IEntity other)
|
||||||
//{
|
//{
|
||||||
// return EntityHelper.EntityEquals(this, other);
|
// return EntityHelper.EntityEquals(this, other);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,7 @@ public class VmBaseInput
|
|||||||
///// </summary>
|
///// </summary>
|
||||||
//public string vmid { get; set; } = string.Empty;
|
//public string vmid { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class VmGetInput : VmBaseInput
|
public class VmGetInput : VmBaseInput
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -58,6 +59,7 @@ public class VmGetListInput : VmBaseInput
|
|||||||
/// 过滤条件
|
/// 过滤条件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? q { get; set; }
|
public string? q { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 输出字段
|
/// 输出字段
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -138,7 +140,6 @@ public class PagedOutput<T>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class VmPagedOutput : PagedOutput<dynamic>
|
public class VmPagedOutput : PagedOutput<dynamic>
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -152,4 +153,4 @@ public class VmSelectProp
|
|||||||
public string navCode { get; set; } = MAIN_ALIES;
|
public string navCode { get; set; } = MAIN_ALIES;
|
||||||
public ePropType propType { get; set; }
|
public ePropType propType { get; set; }
|
||||||
public eNavigateType navType { get; set; }
|
public eNavigateType navType { get; set; }
|
||||||
}
|
}
|
||||||
@@ -12,25 +12,25 @@ namespace Tnb.Vengine.Domain;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class VmBaseProp
|
public class VmBaseProp
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 属性代码
|
/// 属性代码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string code { get; set; } = string.Empty;
|
public string code { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示名称
|
/// 显示名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string name { get; set; } = string.Empty;
|
public string name { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DictOption
|
public class DictOption
|
||||||
{
|
{
|
||||||
public string dictTypeId { get; set; } = string.Empty;
|
public string dictTypeId { get; set; } = string.Empty;
|
||||||
public string refField { get; set; } = "id";
|
public string refField { get; set; } = "id";
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CompOption
|
public class CompOption
|
||||||
{
|
{
|
||||||
public string type { get; set; } = "el-input";
|
public string type { get; set; } = "el-input";
|
||||||
public JObject attr { get; set; } = new JObject();
|
public JObject attr { get; set; } = new JObject();
|
||||||
}
|
}
|
||||||
@@ -5,8 +5,7 @@
|
|||||||
|
|
||||||
namespace Tnb.Vengine.Domain;
|
namespace Tnb.Vengine.Domain;
|
||||||
|
|
||||||
|
|
||||||
public class VmCalProp : VmBaseProp
|
public class VmCalProp : VmBaseProp
|
||||||
{
|
{
|
||||||
public string calculate { get; set; } = string.Empty;
|
public string calculate { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,7 @@ namespace Tnb.Vengine.Domain;
|
|||||||
public class VmDbProp : VmBaseProp
|
public class VmDbProp : VmBaseProp
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 字段名称
|
/// 字段名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -70,7 +71,8 @@ public class VmDbProp : VmBaseProp
|
|||||||
/// 描述
|
/// 描述
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? descrip { get; set; }
|
public string? descrip { get; set; }
|
||||||
#endregion
|
|
||||||
|
#endregion Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取默认值
|
/// 获取默认值
|
||||||
@@ -79,7 +81,7 @@ public class VmDbProp : VmBaseProp
|
|||||||
public object? GetDefaultValue()
|
public object? GetDefaultValue()
|
||||||
{
|
{
|
||||||
object? val = null;
|
object? val = null;
|
||||||
if(!required) { return val; }
|
if (!required) { return val; }
|
||||||
if (string.IsNullOrEmpty(defValue))
|
if (string.IsNullOrEmpty(defValue))
|
||||||
{
|
{
|
||||||
val = csType switch
|
val = csType switch
|
||||||
@@ -168,11 +170,13 @@ public class VmDbProp : VmBaseProp
|
|||||||
comp.attr.Add("maxlength", length);
|
comp.attr.Add("maxlength", length);
|
||||||
comp.attr.Add("showWordLimit", true);
|
comp.attr.Add("showWordLimit", true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "int":
|
case "int":
|
||||||
case "short":
|
case "short":
|
||||||
case "long":
|
case "long":
|
||||||
comp.type = "el-input-number";
|
comp.type = "el-input-number";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "DateTime":
|
case "DateTime":
|
||||||
comp.type = "el-date-picker";
|
comp.type = "el-date-picker";
|
||||||
break;
|
break;
|
||||||
@@ -205,6 +209,5 @@ public class VmDbProp : VmBaseProp
|
|||||||
//if(isJson) sb.Add("IsJson = true")
|
//if(isJson) sb.Add("IsJson = true")
|
||||||
if (sb.Any()) attr += $"\t[SugarColumn({sb.JoinAsString(", ")})]{Environment.NewLine}";
|
if (sb.Any()) attr += $"\t[SugarColumn({sb.JoinAsString(", ")})]{Environment.NewLine}";
|
||||||
return attr;
|
return attr;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,6 +53,6 @@ public class VmNavProp : VmBaseProp
|
|||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Vmodel? naviModel { get; set; }
|
public Vmodel? naviModel { get; set; }
|
||||||
#endregion
|
|
||||||
|
|
||||||
}
|
#endregion Properties
|
||||||
|
}
|
||||||
@@ -3,15 +3,15 @@
|
|||||||
// https://git.tuotong-tech.com/tnb/tnb.server //
|
// https://git.tuotong-tech.com/tnb/tnb.server //
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Reflection;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Common.Extension;
|
using JNPF.Common.Extension;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using System.Reflection;
|
|
||||||
using Tnb.Core;
|
using Tnb.Core;
|
||||||
using Yitter.IdGenerator;
|
using Yitter.IdGenerator;
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@ namespace Tnb.Vengine.Domain;
|
|||||||
public partial class Vmodel : Entity
|
public partial class Vmodel : Entity
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 主键标识
|
/// 主键标识
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -133,7 +134,8 @@ public partial class Vmodel : Entity
|
|||||||
public string? modifyId { get; set; }
|
public string? modifyId { get; set; }
|
||||||
|
|
||||||
[SugarColumn(IsIgnore = true)]
|
[SugarColumn(IsIgnore = true)]
|
||||||
public string fullCode { get { return areaCode + "/" + vmCode; } }
|
public string fullCode
|
||||||
|
{ get { return areaCode + "/" + vmCode; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 主键
|
/// 主键
|
||||||
@@ -142,7 +144,8 @@ public partial class Vmodel : Entity
|
|||||||
{
|
{
|
||||||
return new object[] { id };
|
return new object[] { id };
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 通过实体创建模型
|
/// 通过实体创建模型
|
||||||
@@ -351,7 +354,6 @@ public partial class Vmodel : Entity
|
|||||||
// TODO 按子表条件查询
|
// TODO 按子表条件查询
|
||||||
if (item.Key.Contains("."))
|
if (item.Key.Contains("."))
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
var prop = dbProps.FirstOrDefault(a => a.code == item.Key);
|
var prop = dbProps.FirstOrDefault(a => a.code == item.Key);
|
||||||
if (prop == null) continue;
|
if (prop == null) continue;
|
||||||
@@ -364,21 +366,26 @@ public partial class Vmodel : Entity
|
|||||||
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThan, CSharpTypeName = prop.csType });
|
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThan, CSharpTypeName = prop.csType });
|
||||||
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThan, CSharpTypeName = prop.csType });
|
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThan, CSharpTypeName = prop.csType });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ">=<":
|
case ">=<":
|
||||||
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThanOrEqual, CSharpTypeName = prop.csType });
|
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThanOrEqual, CSharpTypeName = prop.csType });
|
||||||
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThan, CSharpTypeName = prop.csType });
|
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThan, CSharpTypeName = prop.csType });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "><=":
|
case "><=":
|
||||||
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThan, CSharpTypeName = prop.csType });
|
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThan, CSharpTypeName = prop.csType });
|
||||||
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThanOrEqual, CSharpTypeName = prop.csType });
|
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThanOrEqual, CSharpTypeName = prop.csType });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ">=<=":
|
case ">=<=":
|
||||||
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThanOrEqual, CSharpTypeName = prop.csType });
|
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThanOrEqual, CSharpTypeName = prop.csType });
|
||||||
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThanOrEqual, CSharpTypeName = prop.csType });
|
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThanOrEqual, CSharpTypeName = prop.csType });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "in":
|
case "in":
|
||||||
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val.Skip(1).ToString(), ConditionalType = ConditionalType.In, CSharpTypeName = prop.csType });
|
wheres.Add(new ConditionalModel { FieldName = prop.field, FieldValue = val.Skip(1).ToString(), ConditionalType = ConditionalType.In, CSharpTypeName = prop.csType });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: op = string.Empty; break;
|
default: op = string.Empty; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -425,7 +432,7 @@ public partial class Vmodel : Entity
|
|||||||
{
|
{
|
||||||
return selProps.Where(a => a.navType != eNavigateType.OneToMany && a.navType != eNavigateType.ManyToMany).Select(a => new SelectModel
|
return selProps.Where(a => a.navType != eNavigateType.OneToMany && a.navType != eNavigateType.ManyToMany).Select(a => new SelectModel
|
||||||
{
|
{
|
||||||
FiledName = (a.navCode == VmSelectProp.MAIN_ALIES ? "" : a.navCode + ".") + a.field,
|
FiledName = a.navCode + "." + a.field,
|
||||||
AsName = (a.navCode == VmSelectProp.MAIN_ALIES ? "" : a.navCode + "_") + a.code
|
AsName = (a.navCode == VmSelectProp.MAIN_ALIES ? "" : a.navCode + "_") + a.code
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
@@ -503,6 +510,4 @@ public partial class Vmodel : Entity
|
|||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.Core;
|
|
||||||
using Yitter.IdGenerator;
|
using Yitter.IdGenerator;
|
||||||
|
|
||||||
namespace Tnb.Vengine.Domain;
|
namespace Tnb.Vengine.Domain;
|
||||||
@@ -20,6 +19,7 @@ public partial class VmodelLink : Entity
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(IsPrimaryKey = true)]
|
[SugarColumn(IsPrimaryKey = true)]
|
||||||
public string id { get; set; } = YitIdHelper.NextId().ToString();
|
public string id { get; set; } = YitIdHelper.NextId().ToString();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据库连接
|
/// 数据库连接
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -45,6 +45,4 @@ public partial class VmodelLink : Entity
|
|||||||
{
|
{
|
||||||
return new object[] { id };
|
return new object[] { id };
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.Core;
|
|
||||||
using Yitter.IdGenerator;
|
using Yitter.IdGenerator;
|
||||||
|
|
||||||
namespace Tnb.Vengine.Domain;
|
namespace Tnb.Vengine.Domain;
|
||||||
@@ -17,6 +16,7 @@ namespace Tnb.Vengine.Domain;
|
|||||||
public partial class VmodelPage : Entity
|
public partial class VmodelPage : Entity
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 主键标识
|
/// 主键标识
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -102,6 +102,6 @@ public partial class VmodelPage : Entity
|
|||||||
{
|
{
|
||||||
return new object[] { id };
|
return new object[] { id };
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#endregion Properties
|
||||||
|
}
|
||||||
@@ -10,15 +10,15 @@ namespace Tnb.Vengine;
|
|||||||
|
|
||||||
public class TypeAdapter
|
public class TypeAdapter
|
||||||
{
|
{
|
||||||
public static TypeAdapterConfig IgnoreNull { get; }
|
public static TypeAdapterConfig IgnoreNull { get; }
|
||||||
static TypeAdapter()
|
|
||||||
{
|
|
||||||
TypeAdapterConfig.GlobalSettings.Default.PreserveReference(true);
|
|
||||||
TypeAdapterConfig.GlobalSettings.NewConfig<JToken, JToken>().MapWith(json => json);
|
|
||||||
TypeAdapterConfig.GlobalSettings.NewConfig<JObject, JObject>().MapWith(json => json);
|
|
||||||
TypeAdapterConfig.GlobalSettings.NewConfig<JArray, JArray>().MapWith(json => json);
|
|
||||||
IgnoreNull = TypeAdapterConfig.GlobalSettings.Clone();
|
|
||||||
IgnoreNull.Default.IgnoreNullValues(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
static TypeAdapter()
|
||||||
|
{
|
||||||
|
TypeAdapterConfig.GlobalSettings.Default.PreserveReference(true);
|
||||||
|
TypeAdapterConfig.GlobalSettings.NewConfig<JToken, JToken>().MapWith(json => json);
|
||||||
|
TypeAdapterConfig.GlobalSettings.NewConfig<JObject, JObject>().MapWith(json => json);
|
||||||
|
TypeAdapterConfig.GlobalSettings.NewConfig<JArray, JArray>().MapWith(json => json);
|
||||||
|
IgnoreNull = TypeAdapterConfig.GlobalSettings.Clone();
|
||||||
|
IgnoreNull.Default.IgnoreNullValues(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,41 +13,41 @@ namespace Tnb.Vengine;
|
|||||||
|
|
||||||
public class VmodelMapper : IRegister
|
public class VmodelMapper : IRegister
|
||||||
{
|
{
|
||||||
public void Register(TypeAdapterConfig config)
|
public void Register(TypeAdapterConfig config)
|
||||||
{
|
{
|
||||||
config.ForType<VmGetInput, VmQueryInput>()
|
config.ForType<VmGetInput, VmQueryInput>()
|
||||||
.Map(dest => dest.psize, src => 1)
|
.Map(dest => dest.psize, src => 1)
|
||||||
.Map(dest => dest.pnum, src => 0)
|
.Map(dest => dest.pnum, src => 0)
|
||||||
.Map(dest => dest.q, src => string.IsNullOrEmpty(src.q) ? null : src.q.ToObject<DObject>());
|
.Map(dest => dest.q, src => string.IsNullOrEmpty(src.q) ? null : src.q.ToObject<DObject>());
|
||||||
config.ForType<VmGetListInput, VmQueryInput>()
|
config.ForType<VmGetListInput, VmQueryInput>()
|
||||||
.Map(dest => dest.q, src => string.IsNullOrEmpty(src.q) ? null : src.q.ToObject<DObject>());
|
.Map(dest => dest.q, src => string.IsNullOrEmpty(src.q) ? null : src.q.ToObject<DObject>());
|
||||||
config.ForType<DbColumnInfo, VmDbProp>()
|
config.ForType<DbColumnInfo, VmDbProp>()
|
||||||
.Map(dest => dest.code, src => src.DbColumnName.ToCamel())
|
.Map(dest => dest.code, src => src.DbColumnName.ToCamel())
|
||||||
.Map(dest => dest.name, src => src.ColumnDescription)
|
.Map(dest => dest.name, src => src.ColumnDescription)
|
||||||
.Map(dest => dest.field, src => src.DbColumnName)
|
.Map(dest => dest.field, src => src.DbColumnName)
|
||||||
.Map(dest => dest.dataType, src => src.DataType)
|
.Map(dest => dest.dataType, src => src.DataType)
|
||||||
//.Map(dest => dest.csType, src => src.DbColumnName)
|
//.Map(dest => dest.csType, src => src.DbColumnName)
|
||||||
//.Map(dest => dest.propType, src => ePropType.DbTable)
|
//.Map(dest => dest.propType, src => ePropType.DbTable)
|
||||||
.Map(dest => dest.length, src => src.Length)
|
.Map(dest => dest.length, src => src.Length)
|
||||||
.Map(dest => dest.digit, src => src.DecimalDigits)
|
.Map(dest => dest.digit, src => src.DecimalDigits)
|
||||||
//.Map(dest => dest.ordinal, src => src.i)
|
//.Map(dest => dest.ordinal, src => src.i)
|
||||||
.Map(dest => dest.required, src => !src.IsNullable)
|
.Map(dest => dest.required, src => !src.IsNullable)
|
||||||
.Map(dest => dest.pkey, src => src.IsPrimarykey)
|
.Map(dest => dest.pkey, src => src.IsPrimarykey)
|
||||||
|
//.Map(dest => dest.descrip, src => src.DbColumnName)
|
||||||
|
.Map(dest => dest.defValue, src => src.DefaultValue);
|
||||||
|
config.ForType<SugarColumn, VmDbProp>()
|
||||||
|
//.Map(dest => dest.code, src => src.DbColumnName.SnakeToCamelCase(false))
|
||||||
|
.Map(dest => dest.name, src => src.ColumnDescription)
|
||||||
|
.Map(dest => dest.field, src => src.ColumnName)
|
||||||
|
.Map(dest => dest.dataType, src => src.ColumnDataType)
|
||||||
|
//.Map(dest => dest.csType, src => src.DbColumnName)
|
||||||
|
//.Map(dest => dest.propType, src => ePropType.DbTable)
|
||||||
|
.Map(dest => dest.length, src => src.Length)
|
||||||
|
.Map(dest => dest.digit, src => src.DecimalDigits)
|
||||||
|
//.Map(dest => dest.ordinal, src => src.i)
|
||||||
|
.Map(dest => dest.required, src => !src.IsNullable)
|
||||||
|
.Map(dest => dest.pkey, src => src.IsPrimaryKey);
|
||||||
//.Map(dest => dest.descrip, src => src.DbColumnName)
|
//.Map(dest => dest.descrip, src => src.DbColumnName)
|
||||||
.Map(dest => dest.defValue, src => src.DefaultValue);
|
//.Map(dest => dest.defValue, src => src.DefaultValue);
|
||||||
config.ForType<SugarColumn, VmDbProp>()
|
}
|
||||||
//.Map(dest => dest.code, src => src.DbColumnName.SnakeToCamelCase(false))
|
}
|
||||||
.Map(dest => dest.name, src => src.ColumnDescription)
|
|
||||||
.Map(dest => dest.field, src => src.ColumnName)
|
|
||||||
.Map(dest => dest.dataType, src => src.ColumnDataType)
|
|
||||||
//.Map(dest => dest.csType, src => src.DbColumnName)
|
|
||||||
//.Map(dest => dest.propType, src => ePropType.DbTable)
|
|
||||||
.Map(dest => dest.length, src => src.Length)
|
|
||||||
.Map(dest => dest.digit, src => src.DecimalDigits)
|
|
||||||
//.Map(dest => dest.ordinal, src => src.i)
|
|
||||||
.Map(dest => dest.required, src => !src.IsNullable)
|
|
||||||
.Map(dest => dest.pkey, src => src.IsPrimaryKey);
|
|
||||||
//.Map(dest => dest.descrip, src => src.DbColumnName)
|
|
||||||
//.Map(dest => dest.defValue, src => src.DefaultValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,13 +6,15 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="Extension\**" />
|
||||||
|
<EmbeddedResource Remove="Extension\**" />
|
||||||
|
<None Remove="Extension\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\common\Tnb.Common.Core\Tnb.Common.Core.csproj" />
|
<ProjectReference Include="..\..\common\Tnb.Common.Core\Tnb.Common.Core.csproj" />
|
||||||
<ProjectReference Include="..\..\common\Tnb.Common\Tnb.Common.csproj" />
|
<ProjectReference Include="..\..\common\Tnb.Common\Tnb.Common.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Extension\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user