SystemConfigTabDao.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 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 $where
  32. * @param array $field
  33. * @return array
  34. * @throws \think\db\exception\DataNotFoundException
  35. * @throws \think\db\exception\DbException
  36. * @throws \think\db\exception\ModelNotFoundException
  37. */
  38. public function getConfigTabAll(array $searchWhere, array $field = ['*'], array $where = [])
  39. {
  40. return $this->search($searchWhere)->when(count($where), function ($query) use ($where) {
  41. $query->where($where);
  42. })->field($field)->order('sort desc,id asc')->select()->toArray();
  43. }
  44. /**
  45. * 配置分类列表
  46. * @param array $where
  47. * @param int $page
  48. * @param int $limit
  49. * @return \think\Collection
  50. * @throws \think\db\exception\DataNotFoundException
  51. * @throws \think\db\exception\DbException
  52. * @throws \think\db\exception\ModelNotFoundException
  53. */
  54. public function getConfgTabList(array $where, int $page, int $limit)
  55. {
  56. return $this->search($where)->order('sort desc,id asc')->select();
  57. }
  58. }