62 lines
1.8 KiB
C#
62 lines
1.8 KiB
C#
/////////////////////////////////////////////////////////////////////////////////
|
|
// 宁波拓通e智造平台 ToTong Next Builder //
|
|
// https://git.tuotong-tech.com/tnb/tnb.server //
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
using JNPF.DependencyInjection;
|
|
using JNPF.DynamicApiController;
|
|
using Tnb.Vengine.DataAccess;
|
|
using Tnb.Vengine.Domain;
|
|
|
|
namespace Tnb.Vengine.AppService;
|
|
|
|
/// <summary>
|
|
/// 增删改查基类
|
|
/// </summary>
|
|
public class BaseAppService : IDynamicApiController, ITransient
|
|
{
|
|
protected readonly IDataAccess _dataAccess;
|
|
private readonly Dictionary<string, Vmodel> _models = new();
|
|
|
|
public BaseAppService(IDataAccess dataAccess)
|
|
{
|
|
_dataAccess = dataAccess;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据id获取Vmodel
|
|
/// </summary>
|
|
protected async Task<Vmodel> GetVmodelAsync(string id)
|
|
{
|
|
if (!_models.ContainsKey(id))
|
|
{
|
|
_models[id] = await _dataAccess.GetVmodelAsync(id, false);
|
|
}
|
|
return _models[id];
|
|
}
|
|
/// <summary>
|
|
/// 根据areaCode和vmCode获取Vmodel
|
|
/// </summary>
|
|
protected async Task<Vmodel> GetVmodelAsync(string areaCode, string vmCode)
|
|
{
|
|
var key = areaCode + "/" + vmCode;
|
|
if (!_models.ContainsKey(key))
|
|
{
|
|
_models[key] = await _dataAccess.GetVmodelAsync(areaCode, vmCode, false);
|
|
}
|
|
return _models[key];
|
|
}
|
|
}
|
|
|
|
//[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 100)]
|
|
//public class VTestAppService : BaseAppService
|
|
//{
|
|
// /// <summary>
|
|
// /// 获取多条 数据列表
|
|
// /// </summary>
|
|
// public async Task<dynamic> ListAsync(string vmid, [FromQuery] VmGetListInput input)
|
|
// {
|
|
// return new List<string>();
|
|
// }
|
|
|
|
//} |