var newDynamic = base.Context.Queryable<FileOperationTaskMain, FileOperationTaskStatus, FileOperationTaskInfo>((main, fots, info) => new JoinQueryInfos(
JoinType.Left, main.TaskID == fots.TaskID,
JoinType.Left, fots.TaskID == info.TaskID
)).Where(@"(DATEDIFF(mi,fots.dStartTime,GETDATE())>120 and fots.iStatus=0)
or(DATEDIFF(mi, fots.dDownloadStartTime, GETDATE()) > 30 and fots.iStatus = 1)
or(DATEDIFF(mi, fots.dDownloadEndTime, GETDATE()) > 120 and fots.iStatus = 2)
or fots.iStatus = 3
or(DATEDIFF(mi, fots.dUpdateTime, GETDATE()) > 30 and fots.iStatus = 4)
or(DATEDIFF(mi, fots.dProcessStartTime, GETDATE()) > 30 and fots.iStatus = 5)
or(DATEDIFF(mi, fots.dProcessEndTime, GETDATE()) > 120 and fots.iStatus = 6)
or fots.iStatus = 7
or(DATEDIFF(mi, fots.dUpdateTime, GETDATE()) > 30 and fots.iStatus = 8)
or(DATEDIFF(mi, fots.dUploadStartTime, GETDATE()) > 30 and fots.iStatus = 9)
or(DATEDIFF(mi, fots.dUploadEndTime, GETDATE()) > 120 and fots.iStatus = 10)
or fots.iStatus = 11")//自定义语句条件
.Select((main, fots, info) => new { cTaskID = main.TaskID, cFacCode = info.FacCode, cOrderNo = info.OrderNo, iOrderSeq = info.OrderSeq, cPartType = info.PartType }).ToList();
//Select((main, fots, info) => new {要查询(显示)的字段属性})
Sql Sugar三表联查(查对应的字段属性)
最新推荐文章于 2024-07-01 22:56:12 发布