PropertyHeadLists.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace app\workerapi\lists;
  3. use app\common\model\master_worker_register\MasterWorkerRegister;
  4. use app\common\lists\ListsSearchInterface;
  5. use app\common\model\property\PropertyHead;
  6. use app\common\model\works\ServiceWork;
  7. use app\workerapi\logic\SaleLogic;
  8. use think\facade\Db;
  9. /**
  10. * PropertyHeadLists列表
  11. * Class PropertyHeadLists
  12. * @package app\workerapi\lists
  13. */
  14. class PropertyHeadLists extends BaseWorkerDataLists implements ListsSearchInterface
  15. {
  16. /**
  17. * @notes 设置搜索条件
  18. * @return \string[][]
  19. * @author likeadmin
  20. * @date 2025/02/25 09:29
  21. */
  22. public function setSearch(): array
  23. {
  24. $sale_id = SaleLogic::getSaleIdByToken($this->params['sale_token']??'00000');
  25. $this->params['sale_id'] = $sale_id;
  26. return [
  27. '=' => ['sale_id'],
  28. '%like%' => ['property_name', 'village_name', 'head_name'],
  29. ];
  30. }
  31. /**
  32. * @notes 获取列表
  33. * @return array
  34. * @throws \think\db\exception\DataNotFoundException
  35. * @throws \think\db\exception\DbException
  36. * @throws \think\db\exception\ModelNotFoundException
  37. * @author likeadmin
  38. * @date 2025/02/25 09:29
  39. */
  40. public function lists(): array
  41. {
  42. return PropertyHead::where($this->searchWhere)
  43. ->field(['*'])
  44. ->limit($this->limitOffset, $this->limitLength)
  45. ->order(['id' => 'desc'])
  46. ->select()
  47. ->toArray();
  48. }
  49. /**
  50. * @notes 获取数量
  51. * @return int
  52. * @author likeadmin
  53. * @date 2025/02/25 09:29
  54. */
  55. public function count(): int
  56. {
  57. return PropertyHead::where($this->searchWhere)->count();
  58. }
  59. }