namespace SafeCampus.Application.Services.Business.AttendanceService; public class AttendanceService:DbRepository, IAttendanceService { public async Task Add(AttendanceDto input) { var model = input.Adapt(); await InsertAsync(model); return true; } public async Task> GetPageList(AttendanceSearch search) { var query = Context.Queryable() //.Includes(x => x.CameraInfoItem) .WhereIF(search.IsAuto.HasValue, x => x.IsAuto == search.IsAuto) .WhereIF(!string.IsNullOrEmpty(search.PersonSetId), x => x.PersonSetId == search.PersonSetId) .WhereIF(!string.IsNullOrEmpty(search.PersonId), x => x.PersonId == search.PersonId) .WhereIF(!string.IsNullOrEmpty(search.TrackId), x => x.TrackId == search.TrackId) .WhereIF(!string.IsNullOrEmpty(search.CameraId), x => x.CameraId == search.CameraId) .WhereIF(search.StartTick.HasValue, x => x.Tick >= search.StartTick) .WhereIF(search.EndTick.HasValue, x => x.Tick <= search.EndTick); var list = await query.OrderByDescending(x => x.Tick) .ToPagedListAsyncMapster(search.PageNum, search.PageSize); return list; } public async Task> GetNoPageList(AttendanceSearch search) { var query = Context.Queryable() //.Includes(x => x.CameraInfoItem) .WhereIF(search.IsAuto.HasValue, x => x.IsAuto == search.IsAuto) .WhereIF(!string.IsNullOrEmpty(search.PersonSetId), x => x.PersonSetId == search.PersonSetId) .WhereIF(!string.IsNullOrEmpty(search.PersonId), x => x.PersonId == search.PersonId) .WhereIF(!string.IsNullOrEmpty(search.TrackId), x => x.TrackId == search.TrackId) .WhereIF(!string.IsNullOrEmpty(search.CameraId), x => x.CameraId == search.CameraId) .WhereIF(search.StartTick.HasValue, x => x.Tick >= search.StartTick) .WhereIF(search.EndTick.HasValue, x => x.Tick <= search.EndTick); var list = await query.OrderByDescending(x => x.Tick) .ToListAsync(); return list.Adapt>(); } }