平安校园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ClassRoomCallTaskService.cs 1.9 KiB

4 months ago
4 months ago
4 months ago
4 months ago
3 months ago
1 month ago
4 months ago
1 month ago
4 months ago
4 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. namespace SafeCampus.Application.Services.Business.ClassRoomCallTaskService;
  2. public class ClassRoomCallTaskService : DbRepository<ClassRoomCallTask> ,IClassRoomCallTaskService
  3. {
  4. public async Task<bool> Add(ClassRoomCallTaskDto input)
  5. {
  6. var model = input.Adapt<ClassRoomCallTask>();
  7. await InsertAsync(model);
  8. return true;
  9. }
  10. public async Task<bool> Remove(long id)
  11. {
  12. var model = await GetFirstAsync(x => x.Id == id);
  13. if (model == null)
  14. {
  15. throw Oops.Oh("信息不存在");
  16. }
  17. await DeleteAsync(model);
  18. var classRoomCall = ChangeRepository<DbRepository<ClassRoomCall>>();//切换仓储
  19. await classRoomCall.DeleteAsync(x => x.TaskId == model.TaskId);
  20. return true;
  21. }
  22. public async Task<SqlSugarPagedList<ClassRoomCallTaskDto>> GetPageList(ClassRoomCallTaskSearch search)
  23. {
  24. var query = Context.Queryable<ClassRoomCallTask>()
  25. .Includes(x => x.CameraInfoItem)
  26. .Includes(x=>x.PersonSetInfoItem,x=>x.MajorInfoItem,x=>x.DepartmentInfoItem )
  27. .WhereIF(!string.IsNullOrEmpty(search.PersonSetId), x => x.PersonSetId == search.PersonSetId)
  28. .WhereIF(!string.IsNullOrEmpty(search.TaskId), x => x.TaskId == search.TaskId)
  29. .WhereIF(!string.IsNullOrEmpty(search.CameraId), x => x.CameraId == search.CameraId)
  30. .WhereIF(search.StartTime.HasValue, x => x.CreateTime >= search.StartTime)
  31. .WhereIF(search.DepId.HasValue, x => x.PersonSetInfoItem.MajorInfoItem.DepId == search.DepId)
  32. .WhereIF(search.MajorId.HasValue, x => x.PersonSetInfoItem.MajorId == search.MajorId)
  33. .WhereIF(search.EndTime.HasValue, x => x.EndTime <= search.EndTime);
  34. var list = await query.OrderByDescending(x => x.CreateTime)
  35. .ToPagedListAsyncMapster<ClassRoomCallTask, ClassRoomCallTaskDto>(search.PageNum, search.PageSize);
  36. return list;
  37. }
  38. }