DictConfigLists.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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\setting\dict;
  15. use app\adminapi\lists\BaseAdminDataLists;
  16. use app\common\lists\ListsSearchInterface;
  17. use app\common\model\dict\DictConfig;
  18. /**
  19. * 字典配置数据列表
  20. * Class DictCconfigLists
  21. * @package app\adminapi\lists\dict
  22. */
  23. class DictConfigLists extends BaseAdminDataLists implements ListsSearchInterface
  24. {
  25. /**
  26. * @notes 设置搜索条件
  27. * @return \string[]
  28. */
  29. public function setSearch(): array
  30. {
  31. return [
  32. '%like%' => ['name', 'value'],
  33. '=' => ['status']
  34. ];
  35. }
  36. /**
  37. * @notes 获取列表
  38. * @return array
  39. * @throws \think\db\exception\DataNotFoundException
  40. * @throws \think\db\exception\DbException
  41. * @throws \think\db\exception\ModelNotFoundException
  42. */
  43. public function lists(): array
  44. {
  45. return DictConfig::where($this->searchWhere)
  46. ->append(['status_desc'])
  47. ->limit($this->limitOffset, $this->limitLength)
  48. ->order([ 'id' => 'desc'])
  49. ->select()
  50. ->toArray();
  51. }
  52. /**
  53. * @notes 获取数量
  54. * @return int
  55. */
  56. public function count(): int
  57. {
  58. return DictConfig::where($this->searchWhere)->count();
  59. }
  60. }