JobsLists.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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\adminapi\lists\dept;
  15. use app\adminapi\lists\BaseAdminDataLists;
  16. use app\common\lists\ListsExcelInterface;
  17. use app\common\lists\ListsSearchInterface;
  18. use app\common\model\dept\Jobs;
  19. /**
  20. * 岗位列表
  21. * Class JobsLists
  22. * @package app\adminapi\lists\dept
  23. */
  24. class JobsLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
  25. {
  26. /**
  27. * @notes 设置搜索条件
  28. * @return \string[][]
  29. * @author 段誉
  30. * @date 2022/5/26 9:46
  31. */
  32. public function setSearch(): array
  33. {
  34. return [
  35. '%like%' => ['name'],
  36. '=' => ['code', 'status']
  37. ];
  38. }
  39. /**
  40. * @notes 获取管理列表
  41. * @return array
  42. * @author heshihu
  43. * @date 2022/2/21 17:11
  44. */
  45. public function lists(): array
  46. {
  47. $lists = Jobs::where($this->searchWhere)
  48. ->append(['status_desc'])
  49. ->limit($this->limitOffset, $this->limitLength)
  50. ->order(['sort' => 'desc', 'id' => 'desc'])
  51. ->select()
  52. ->toArray();
  53. return $lists;
  54. }
  55. /**
  56. * @notes 获取数量
  57. * @return int
  58. * @author 段誉
  59. * @date 2022/5/26 9:48
  60. */
  61. public function count(): int
  62. {
  63. return Jobs::where($this->searchWhere)->count();
  64. }
  65. /**
  66. * @notes 导出文件名
  67. * @return string
  68. * @author 段誉
  69. * @date 2022/11/24 16:17
  70. */
  71. public function setFileName(): string
  72. {
  73. return '岗位列表';
  74. }
  75. /**
  76. * @notes 导出字段
  77. * @return string[]
  78. * @author 段誉
  79. * @date 2022/11/24 16:17
  80. */
  81. public function setExcelFields(): array
  82. {
  83. return [
  84. 'code' => '岗位编码',
  85. 'name' => '岗位名称',
  86. 'remark' => '备注',
  87. 'status_desc' => '状态',
  88. 'create_time' => '添加时间',
  89. ];
  90. }
  91. }