安灯
This commit is contained in:
parent
517b3a79d3
commit
f7a3e5c57c
@ -7,6 +7,7 @@ namespace ZR.Model.MES.andon.Dto
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class AndonAlarmAreaQueryDto : PagerInfo
|
public class AndonAlarmAreaQueryDto : PagerInfo
|
||||||
{
|
{
|
||||||
|
public string Area { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -20,6 +21,7 @@ namespace ZR.Model.MES.andon.Dto
|
|||||||
public int? ParentId { get; set; }
|
public int? ParentId { get; set; }
|
||||||
|
|
||||||
public string Area { get; set; }
|
public string Area { get; set; }
|
||||||
|
public string ParentArea { get; set; }
|
||||||
|
|
||||||
public string CreatedBy { get; set; }
|
public string CreatedBy { get; set; }
|
||||||
|
|
||||||
|
|||||||
@ -23,10 +23,25 @@ namespace ZR.Service.mes.andon
|
|||||||
public PagedInfo<AndonAlarmAreaDto> GetList(AndonAlarmAreaQueryDto parm)
|
public PagedInfo<AndonAlarmAreaDto> GetList(AndonAlarmAreaQueryDto parm)
|
||||||
{
|
{
|
||||||
var predicate = Expressionable.Create<AndonAlarmArea>();
|
var predicate = Expressionable.Create<AndonAlarmArea>();
|
||||||
|
predicate.AndIF(!string.IsNullOrEmpty(parm.Area), w => w.Area.Contains(parm.Area));
|
||||||
|
|
||||||
var response = Queryable()
|
var response = Queryable()
|
||||||
.Where(predicate.ToExpression())
|
// 左连接自身表,别名 t_parent 代表父级区域
|
||||||
.ToPage<AndonAlarmArea, AndonAlarmAreaDto>(parm);
|
.LeftJoin<AndonAlarmArea>((t, t_parent) => t.ParentId == t_parent.Id)
|
||||||
|
.Where(predicate.ToExpression())
|
||||||
|
// 字段映射:将父级区域的 Area 赋值给 DTO 的 ParentArea
|
||||||
|
.Select((t, t_parent) => new AndonAlarmAreaDto
|
||||||
|
{
|
||||||
|
Id = t.Id,
|
||||||
|
ParentId = t.ParentId,
|
||||||
|
ParentArea = t_parent == null ? string.Empty : t_parent.Area,
|
||||||
|
Area = t.Area,
|
||||||
|
CreatedBy = t.CreatedBy,
|
||||||
|
CreatedTime = t.CreatedTime,
|
||||||
|
UpdatedBy = t.UpdatedBy,
|
||||||
|
UpdatedTime = t.UpdatedTime
|
||||||
|
})
|
||||||
|
.ToPage(parm);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user