This commit is contained in:
孟帅
2024-04-22 23:08:40 +08:00
parent 82483bd7b9
commit e144b12580
445 changed files with 17457 additions and 6708 deletions

View File

@@ -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
}