SystemConfigTabDao.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\dao\system\config;
  12. use app\dao\BaseDao;
  13. use app\model\system\config\SystemConfigTab;
  14. /**
  15. * 配置分类
  16. * Class SystemConfigTabDao
  17. * @package app\dao\system\config
  18. */
  19. class SystemConfigTabDao extends BaseDao
  20. {
  21. /**
  22. * 设置模型
  23. * @return string
  24. */
  25. protected function setModel(): string
  26. {
  27. return SystemConfigTab::class;
  28. }
  29. /**
  30. * 获取配置分类
  31. * @param array $searchWhere
  32. * @param array $field
  33. * @param array $where
  34. * @return array
  35. * @throws \think\db\exception\DataNotFoundException
  36. * @throws \think\db\exception\DbException
  37. * @throws \think\db\exception\ModelNotFoundException
  38. */
  39. public function getConfigTabAll(array $searchWhere, array $field = ['*'], array $where = [])
  40. {
  41. return $this->search($searchWhere)->when(count($where), function ($query) use ($where) {
  42. $query->where($where);
  43. })->field($field)->order('sort desc,id asc')->select()->toArray();
  44. }
  45. /**
  46. * 配置分类列表
  47. * @param array $where
  48. * @param int $page
  49. * @param int $limit
  50. * @return \think\Collection
  51. * @throws \think\db\exception\DataNotFoundException
  52. * @throws \think\db\exception\DbException
  53. * @throws \think\db\exception\ModelNotFoundException
  54. */
  55. public function getConfgTabList(array $where, int $page, int $limit)
  56. {
  57. return $this->search($where)->order('sort desc,id asc')->page($page, $limit)->select();
  58. }
  59. }