bug
This commit is contained in:
@@ -5,6 +5,7 @@ using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.BasicData.Interfaces;
|
||||
|
||||
@@ -33,18 +34,21 @@ namespace Tnb.BasicData
|
||||
public async Task<dynamic> GetDefectListByProcessId(Dictionary<string, string> dic)
|
||||
{
|
||||
string processId = dic["processId"];
|
||||
return await _repository.AsSugarClient().Queryable<BasProcessDefective>()
|
||||
.LeftJoin<BasProcess>((a, b) => a.process_id == b.id)
|
||||
.LeftJoin<BasDefect>((a, b, c) => a.defective_id == c.id)
|
||||
.LeftJoin<BasDefectType>((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
|
||||
var db = _repository.AsSugarClient();
|
||||
List<string> defectIds = await db.Queryable<BasProcessDefective>().Where(x=>x.process_id==processId).Select(x=>x.defective_id).ToListAsync();
|
||||
List<string> defectTypeIds = await db.Queryable<BasDefect>().Where(x=>defectIds.Contains(x.id) && x.enabled==1).Select(x=>x.defect_type_id).ToListAsync();
|
||||
return await _repository.AsSugarClient().Queryable<BasDefectType>()
|
||||
.Where((a) => defectTypeIds.Contains(a.id))
|
||||
.Select(a => 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
|
||||
defect_type_id = a.id,
|
||||
defect_type_name = a.defect_type_name,
|
||||
children = SqlFunc.Subqueryable<BasDefect>().Where(x=>x.defect_type_id==a.id && defectIds.Contains(x.id)).ToList(x=>new DefectOutput()
|
||||
{
|
||||
id = x.id,
|
||||
defect_code = x.defect_code,
|
||||
defect_name = x.defect_name,
|
||||
})
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user