Files
tnb.server/PerMgr/Tnb.PerMgr/PerProcessParamService.cs

51 lines
1.7 KiB
C#

using JNPF.Common.Core.Manager;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.FriendlyException;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NPOI.SS.UserModel;
using NPOI.SS.Util;
using NPOI.XSSF.UserModel;
using SqlSugar;
using Tnb.PerMgr.Entities;
using Tnb.PerMgr.Entities.Dto;
using Tnb.PerMgr.Interfaces;
namespace Tnb.PerMgr
{
/// <summary>
/// 工艺参数
/// </summary>
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
[Route("api/[area]/[controller]/[action]")]
public class PerProcessParamService : IPerProcessParamService, IDynamicApiController, ITransient
{
private readonly ISqlSugarRepository<PerProcessParam> _repository;
private readonly IUserManager _userManager;
public PerProcessParamService(ISqlSugarRepository<PerProcessParam> repository, IUserManager userManager)
{
_userManager = userManager;
_repository = repository;
}
[HttpPost]
public async Task<ProcessParamOutput> GetProcessParamInfo(Dictionary<string, string> dic)
{
string id = dic["id"];
var db = _repository.AsSugarClient();
var result = await db.Queryable<PerProcessParam>()
.LeftJoin<PerToleranceCategory>((a, b) => a.tolerance_category_id == b.id)
.Where((a, b) => a.id == id)
.Select((a, b) => new ProcessParamOutput()
{
name = a.name,
upper_value = b.upper_value,
lower_value = b.lower_value,
}).SingleAsync();
return result;
}
}
}