SystemGroupDao.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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\SystemGroup;
  14. /**
  15. * Class SystemGroupDao
  16. * @package app\dao\system\config
  17. */
  18. class SystemGroupDao extends BaseDao
  19. {
  20. /**
  21. * @return string
  22. */
  23. protected function setModel(): string
  24. {
  25. return SystemGroup::class;
  26. }
  27. /**
  28. * 获取组合数据分页列表
  29. * @param array $where
  30. * @param array $field
  31. * @param int $page
  32. * @param int $limit
  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 getGroupList(array $where, array $field = ['*'], int $page = 0, int $limit = 0)
  39. {
  40. return $this->search($where)->field($field)->when($page && $limit, function ($query) use ($page, $limit) {
  41. $query->page($page, $limit);
  42. })->select()->toArray();
  43. }
  44. /**
  45. * 根据配置名称获取配置id
  46. * @param string $configName
  47. * @return mixed
  48. */
  49. public function getConfigNameId(string $configName)
  50. {
  51. return $this->value(['config_name' => $configName]);
  52. }
  53. }