using HL_FristAidPlatform_Help; using HL_FristAidPlatform_Help.Model; using HL_FristAidPlatform_IDataBase; using HL_FristAidPlatform_Models; using SqlSugar; using System; namespace HL_FristAidPlatform_DataBase { public class T_Service_FirstAid_DriverHandoverDB : BaseDB, IT_Service_FirstAid_DriverHandover { public SqlSugarClient db = GetClient(); /// /// 司机交接记录 /// /// /// /// /// /// /// /// public TableModel GetDriverHandoverList(string guid, string name, string time1, string time2, int pageIndex, int pageSize) { int total = 0; var data = db.Queryable ((a, b, c, d, e) => new JoinQueryInfos( JoinType.Left, a.AlarmTaskGUID == b.GUID, JoinType.Left, b.AlarmGuid == c.GUID, JoinType.Left, b.VehicleGUID == d.GUID, JoinType.Left, a.DriverGUID == e.GUID )) .Where((a, b, c, d, e) => c.HospitalGuid == guid || c.CallHospitalGuid == guid) .WhereIF(!SqlFunc.IsNullOrEmpty(name), (a, b, c, d, e) => e.FullName.Contains(name)) .WhereIF(!SqlFunc.IsNullOrEmpty(time1), (a, b, c, d, e) => a.HandoverTime >= Convert.ToDateTime(time1)) .WhereIF(!SqlFunc.IsNullOrEmpty(time2), (a, b, c, d, e) => a.HandoverTime <= Convert.ToDateTime(time2).AddDays(1)) .OrderBy((a, b, c, d, e) => a.HandoverTime, OrderByType.Desc) .Select((a, b, c, d, e) => new DriverHandoverListModel() { Name = e.FullName, DrvingTime = Convert.ToDateTime(b.DrivingTime).ToString("yyyy-MM-dd HH:mm:ss"), HandoverTime = a.HandoverTime.ToString("yyyy-MM-dd HH:mm:ss"), PateNumber = d.PlateNumber }).ToPageList(pageIndex, pageSize, ref total); TableModel t = new TableModel(); t.Code = 0; t.PageCount = data.Count; t.TotalNumber = total; t.Data = data; t.Msg = "成功"; return t; } } }