IssueWorkLists.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace app\workerapi\lists;
  3. use app\common\model\works\IssueWork;
  4. use app\common\lists\ListsSearchInterface;
  5. /**
  6. * IssueWork列表
  7. * Class IssueWorkLists
  8. * @package app\workerapi\listsworks
  9. */
  10. class IssueWorkLists extends BaseWorkerDataLists implements ListsSearchInterface
  11. {
  12. /**
  13. * @notes 设置搜索条件
  14. * @return \string[][]
  15. * @author whitef
  16. * @date 2024/07/10 15:06
  17. */
  18. public function setSearch(): array
  19. {
  20. return [
  21. '=' => ['work_sn', 'service_work_id', 'master_worker_id', 'issue_approval', 'complaint_status', 'responsible', 'complaint_details', 'finished_time', 'approval_admin_id', 'approval_time', 'create_time', 'update_time'],
  22. ];
  23. }
  24. /**
  25. * @notes 获取列表
  26. * @return array
  27. * @throws \think\db\exception\DataNotFoundException
  28. * @throws \think\db\exception\DbException
  29. * @throws \think\db\exception\ModelNotFoundException
  30. * @author whitef
  31. * @date 2024/07/10 15:06
  32. */
  33. public function lists(): array
  34. {
  35. return IssueWork::where($this->searchWhere)
  36. ->field(['id', 'work_sn', 'service_work_id', 'master_worker_id', 'issue_approval', 'complaint_status', 'responsible', 'complaint_details', 'complaint_images', 'finished_time', 'approval_admin_id', 'approval_time', 'create_time', 'update_time'])
  37. ->limit($this->limitOffset, $this->limitLength)
  38. ->order(['id' => 'desc'])
  39. ->select()
  40. ->toArray();
  41. }
  42. /**
  43. * @notes 获取数量
  44. * @return int
  45. * @author whitef
  46. * @date 2024/07/10 15:06
  47. */
  48. public function count(): int
  49. {
  50. return IssueWork::where($this->searchWhere)->count();
  51. }
  52. }