点检保养报修添加时间过滤 自定义排序
This commit is contained in:
@@ -101,7 +101,7 @@ namespace Tnb.EquipMgr
|
||||
string id = dic["id"];
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
status = RepairApplyStatus.CLOSE
|
||||
status = RepairApplyStatus.CLOSE,
|
||||
}, x => x.id == id);
|
||||
return "关闭成功";
|
||||
}
|
||||
@@ -291,6 +291,9 @@ namespace Tnb.EquipMgr
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetPadRepairList(PadRepairListInput input)
|
||||
{
|
||||
|
||||
DateTime? start_time = input.start_time;
|
||||
DateTime? end_time = input.end_time;
|
||||
List<string> statusList = new List<string>();
|
||||
if (!string.IsNullOrEmpty(input.status))
|
||||
{
|
||||
@@ -315,6 +318,13 @@ namespace Tnb.EquipMgr
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(input.sidx))
|
||||
{
|
||||
input.sidx = "create_time";
|
||||
input.sort = "desc";
|
||||
}
|
||||
|
||||
var db = _repository.AsSugarClient();
|
||||
var result = await db.Queryable<EqpRepairApply>()
|
||||
.LeftJoin<UserEntity>((a,b)=>a.apply_user_id==b.Id)
|
||||
@@ -324,7 +334,9 @@ namespace Tnb.EquipMgr
|
||||
.LeftJoin<DictionaryDataEntity>((a,b,c,d,e,f)=>e.Id==f.DictionaryTypeId && a.status==f.EnCode)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.equip_info),(a,b,c,d)=>d.code.Contains(input.equip_info) || d.name.Contains(input.equip_info))
|
||||
.WhereIF(!string.IsNullOrEmpty(input.status),(a,b,c,d)=>statusList.Contains(a.status))
|
||||
.OrderByDescending(a=>a.create_time)
|
||||
.WhereIF(input.status=="3" && start_time!=null,a=>a.complete_time!=null && a.complete_time>=start_time)
|
||||
.WhereIF(input.status=="3" && end_time!=null,a=>a.complete_time!=null && a.complete_time<=end_time)
|
||||
.OrderBy($"{input.sidx} {input.sort}")
|
||||
.Select((a,b,c,d,e,f) => new PadRepairListOutput
|
||||
{
|
||||
id = a.id,
|
||||
|
||||
Reference in New Issue
Block a user