SystemRoleDao.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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\admin;
  12. use app\dao\BaseDao;
  13. use app\model\system\admin\SystemRole;
  14. /**
  15. * Class SystemRoleDao
  16. * @package app\dao\system\admin
  17. */
  18. class SystemRoleDao extends BaseDao
  19. {
  20. /**
  21. * 设置模型名
  22. * @return string
  23. */
  24. protected function setModel(): string
  25. {
  26. return SystemRole::class;
  27. }
  28. /**
  29. * 获取权限
  30. * @param string $field
  31. * @param string $key
  32. * @return mixed
  33. */
  34. public function getRoule(array $where = [], ?string $field = null, ?string $key = null)
  35. {
  36. return $this->search($where)->column($field ?: 'role_name', $key ?: 'id');
  37. }
  38. /**
  39. * 获取身份列表
  40. * @param array $where
  41. * @param int $page
  42. * @param int $limit
  43. * @return array
  44. * @throws \think\db\exception\DataNotFoundException
  45. * @throws \think\db\exception\DbException
  46. * @throws \think\db\exception\ModelNotFoundException
  47. */
  48. public function getRouleList(array $where, int $page, int $limit)
  49. {
  50. return $this->search($where)->page($page, $limit)->select()->toArray();
  51. }
  52. }