menu.go
2.0 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package service
import (
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/custommenu/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/custommenu/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
)
// 用户菜单维护
type MenuService struct {
}
// 设置收藏菜单
func (menuService *MenuService) MenuFavorite(menuFavoriteCommand *command.MenuFavoriteCommand) (interface{}, error) {
return nil, nil
}
// 返回菜单列表
func (menuService *MenuService) MenuList(menuListQuery *query.MenuListQuery) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
menuListQuery.Operator.CompanyId,
menuListQuery.Operator.OrgId,
menuListQuery.Operator.UserId)
result, err := creationUserGateway.CompanyGetCustomizeMenus(allied_creation_user.ReqCompanyGetCustomizeMenus{
CompanyId: menuListQuery.Operator.CompanyId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return result, nil
}
// 更新菜单
func (menuService *MenuService) MenuUpdate(menuUpdateCommand *command.MenuUpdateCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
menuUpdateCommand.Operator.CompanyId,
menuUpdateCommand.Operator.OrgId,
menuUpdateCommand.Operator.UserId)
_, err := creationUserGateway.CompanySetCustomizeMenus(allied_creation_user.ReqCompanySetCustomizeMenus{
CompanyId: menuUpdateCommand.CompanyId,
MenuAlias: menuUpdateCommand.MenuName,
MenuId: int(menuUpdateCommand.MenuId),
Sort: menuUpdateCommand.Sort,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return menuUpdateCommand, nil
}
func NewMenuService(options map[string]interface{}) *MenuService {
newMenuService := &MenuService{}
return newMenuService
}