FaultCodeLists.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\workerapi\lists;
  15. use app\common\model\fault_code\FaultCode;
  16. use app\common\lists\ListsSearchInterface;
  17. /**
  18. * FaultCode列表
  19. * Class FaultCodeLists
  20. * @package app\adminapi\lists
  21. */
  22. class FaultCodeLists extends BaseWorkerDataLists implements ListsSearchInterface
  23. {
  24. /**
  25. * @notes 设置搜索条件
  26. * @return \string[][]
  27. * @author likeadmin
  28. * @date 2024/10/18 09:58
  29. */
  30. public function setSearch(): array
  31. {
  32. return [
  33. '=' => ['status','type_id'],
  34. '%like%' => ['codes', 'fault_name', 'detail'],
  35. ];
  36. }
  37. /**
  38. * @notes 获取列表
  39. * @return array
  40. * @throws \think\db\exception\DataNotFoundException
  41. * @throws \think\db\exception\DbException
  42. * @throws \think\db\exception\ModelNotFoundException
  43. * @author likeadmin
  44. * @date 2024/10/18 09:58
  45. */
  46. public function lists(): array
  47. {
  48. return FaultCode::where($this->searchWhere)
  49. ->field(['id', 'codes', 'fault_name','status','detail'])
  50. ->limit($this->limitOffset, $this->limitLength)
  51. ->order(['id' => 'desc'])
  52. ->select()
  53. ->toArray();
  54. }
  55. /**
  56. * @notes 获取数量
  57. * @return int
  58. * @author likeadmin
  59. * @date 2024/10/18 09:58
  60. */
  61. public function count(): int
  62. {
  63. return FaultCode::where($this->searchWhere)->count();
  64. }
  65. }