1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- package services
- import (
- "eta_gn/eta_api/models/system"
- "eta_gn/eta_api/utils"
- )
- func GetRoleTypeCode(roleType string) string {
- var roleTypeCode string
- switch roleType {
- case utils.ROLE_TYPE_ADMIN:
- roleTypeCode = utils.ROLE_TYPE_CODE_ADMIN
- case utils.ROLE_TYPE_FICC_ADMIN:
- roleTypeCode = utils.ROLE_TYPE_CODE_FICC_ADMIN
- case utils.ROLE_TYPE_FICC_SELLER:
- roleTypeCode = utils.ROLE_TYPE_CODE_FICC_SELLER
- case utils.ROLE_TYPE_RAI_ADMIN:
- roleTypeCode = utils.ROLE_TYPE_CODE_RAI_ADMIN
- case utils.ROLE_TYPE_FICC_GROUP, utils.ROLE_TYPE_FICC_MANAGER:
- roleTypeCode = utils.ROLE_TYPE_CODE_FICC_GROUP
- case utils.ROLE_TYPE_RAI_GROUP:
- roleTypeCode = utils.ROLE_TYPE_CODE_RAI_GROUP
- case utils.ROLE_TYPE_FICC_DEPARTMENT:
- roleTypeCode = utils.ROLE_TYPE_CODE_FICC_DEPARTMENT
- case utils.ROLE_TYPE_RAI_DEPARTMENT:
- roleTypeCode = utils.ROLE_TYPE_CODE_RAI_DEPARTMENT
- case utils.ROLE_TYPE_FICC_RESEARCHR:
- roleTypeCode = utils.ROLE_TYPE_CODE_FICC_RESEARCHR
- case utils.ROLE_TYPE_RAI_RESEARCHR:
- roleTypeCode = utils.ROLE_TYPE_CODE_RAI_RESEARCHR
- default:
- roleTypeCode = utils.ROLE_TYPE_ADMIN
- }
- return roleTypeCode
- }
- // GetMenuTreeRecursive 递归菜单树
- func GetMenuTreeRecursive(list []*system.SysMenuItem, parentId int) []*system.SysMenuItem {
- res := make([]*system.SysMenuItem, 0)
- for _, v := range list {
- if v.ParentId == parentId {
- v.Children = GetMenuTreeRecursive(list, v.MenuId)
- res = append(res, v)
- }
- }
- return res
- }
|