This commit is contained in:
技术老胡
2026-02-27 16:56:35 +08:00
parent 282ff275f6
commit 54ad21ac8f
3 changed files with 0 additions and 92 deletions

View File

@@ -1,19 +0,0 @@
<?php
namespace app\repositories;
use app\common\base\BaseRepository;
use app\models\DictItem;
/**
* 字典项仓储
*/
class DictItemRepository extends BaseRepository
{
public function __construct()
{
parent::__construct(new DictItem());
}
}

View File

@@ -1,54 +0,0 @@
<?php
namespace app\repositories;
use app\common\base\BaseRepository;
use app\models\Menu;
/**
* 菜单 / 权限仓储
*/
class MenuRepository extends BaseRepository
{
public function __construct()
{
parent::__construct(new Menu());
}
/**
* 获取所有启用的菜单(仅目录和菜单类型,排除按钮)
*/
public function getAllEnabledMenus(): array
{
return $this->model
->newQuery()
->whereIn('type', [1, 2]) // 1目录 2菜单排除3按钮
->where('status', 1) // 只获取启用的菜单
->orderBy('sort', 'asc')
->orderBy('id', 'asc')
->get()
->toArray();
}
/**
* 根据菜单ID列表获取启用的菜单仅目录和菜单类型排除按钮
*/
public function getMenusByIds(array $menuIds): array
{
if (empty($menuIds)) {
return [];
}
return $this->model
->newQuery()
->whereIn('id', $menuIds)
->whereIn('type', [1, 2]) // 1目录 2菜单排除3按钮
->where('status', 1) // 只获取启用的菜单
->orderBy('sort', 'asc')
->orderBy('id', 'asc')
->get()
->toArray();
}
}

View File

@@ -1,19 +0,0 @@
<?php
namespace app\repositories;
use app\common\base\BaseRepository;
use app\models\Role;
/**
* 角色仓储
*/
class RoleRepository extends BaseRepository
{
public function __construct()
{
parent::__construct(new Role());
}
}