mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-11 11:43:46 +08:00
发布v2.15.1版本,更新内容请查看:https://github.com/bufanyun/hotgo/blob/v2.0/docs/guide-zh-CN/start-update-log.md
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
"hotgo/internal/library/casbin"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/library/hgorm"
|
||||
"hotgo/internal/library/hgorm/handler"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/service"
|
||||
@@ -36,6 +37,11 @@ func init() {
|
||||
service.RegisterAdminMenu(NewAdminMenu())
|
||||
}
|
||||
|
||||
// Model Orm模型
|
||||
func (s *sAdminMenu) Model(ctx context.Context, option ...*handler.Option) *gdb.Model {
|
||||
return handler.Model(dao.AdminMenu.Ctx(ctx), option...)
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (s *sAdminMenu) Delete(ctx context.Context, in *adminin.MenuDeleteInp) (err error) {
|
||||
exist, err := dao.AdminMenu.Ctx(ctx).Where("pid", in.Id).One()
|
||||
@@ -282,3 +288,17 @@ func (s *sAdminMenu) treeList(pid int64, nodes []*entity.AdminMenu) (list []*adm
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// GetFastList 获取菜单列表
|
||||
func (s *sAdminMenu) GetFastList(ctx context.Context) (res map[int64]*entity.AdminMenu, err error) {
|
||||
var models []*entity.AdminMenu
|
||||
if err = dao.AdminMenu.Ctx(ctx).Scan(&models); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = make(map[int64]*entity.AdminMenu, len(models))
|
||||
for _, v := range models {
|
||||
res[v.Id] = v
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user