zhangqian
2023-10-13 4a23356a5840b624c81dda44b0028ed8fc3656cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package service
 
import (
    "aps_crm/model"
    "aps_crm/pkg/ecode"
)
 
type MenuService struct{}
 
func (MenuService) GetMenuTree() ([]model.Menu, int) {
    list, err := model.NewMenuSearch(nil).FindAll()
    if err != nil {
        return nil, ecode.MenuListErr
    }
 
    return list, ecode.OK
}
 
// GetMenusByIds get menus by ids
func (MenuService) GetMenusByIds(ids []uint) ([]model.Menu, int) {
    list, err := model.NewMenuSearch(nil).SetIds(ids).FindAll()
    if err != nil {
        return nil, ecode.MenuListErr
    }
 
    return list, ecode.OK
}