using JNPF.Common.Core.Manager;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.Systems.Interfaces.System;
using JNPF.VisualDev;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.BasicData.Interfaces;
namespace Tnb.BasicData
{
///
/// çŠćć¸
ĺ
///
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
[Route("api/[area]/[controller]/[action]")]
public class BasDefectService: IBasDefectService,IDynamicApiController, ITransient
{
private readonly ISqlSugarRepository _repository;
private readonly DataBaseManager _dbManager;
private readonly IDictionaryDataService _dictionaryDataService;
public BasDefectService(
ISqlSugarRepository repository,DataBaseManager dbManager,IDictionaryDataService dictionaryDataService)
{
_repository = repository;
_dbManager = dbManager;
_dictionaryDataService = dictionaryDataService;
}
[HttpPost]
public async Task GetDefectListByProcessId(Dictionary dic)
{
string processId = dic["processId"];
return await _repository.AsSugarClient().Queryable()
.LeftJoin((a, b) => a.process_id == b.id)
.LeftJoin((a, b, c) => a.defective_id == c.id)
.LeftJoin((a,b,c,d)=>c.defect_type_id==d.id)
.Where((a, b, c) => a.process_id == processId && c.enabled==1)
.Select((a, b, c,d) => new
{
id = c.id,
defect_code = c.defect_code,
defect_name = c.defect_name,
defect_type_id = d.defect_type_name,
defect_type_id_id = d.id
}).ToListAsync();
}
}
}