zhangqian
2024-04-07 d384930963f9b960a06864223aff779edc4cf54c
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
}