瀏覽代碼

system: 用户关联权限

Yi 1 年之前
父節點
當前提交
7ca31fecf0

+ 2 - 0
backend/operation/system.proto

@@ -98,6 +98,8 @@ message AddMenuRequest {
   string redirect = 11;      // 重定向
   int64 created_at = 12;     // 创建时间
   string crated_at_format = 13;      // 创建时间格式化
+  int32 level = 14;      // 菜单等级
+  repeated AddMenuRequest children = 15;   // 子分类
 }
 
 message IsShowSystemMenuRequest {

+ 1 - 0
http/handler/system/menu.go

@@ -24,6 +24,7 @@ func AddSystemMenu(c *gin.Context) {
 		valid.Field(&req.Name, valid.Required),
 		valid.Field(&req.Title, valid.Required),
 		valid.Field(&req.MenuType, valid.Required, valid.Min(0), valid.Max(2)),
+		valid.Field(&req.Level, valid.Required, valid.Min(1), valid.Max(3)),
 		valid.Field(&req.Path, valid.Required),
 	); err != nil {
 		apierr.AbortBadRequest(c, http.StatusBadRequest, err)

+ 19 - 1
model/system_menu.go

@@ -9,7 +9,7 @@ type SystemMenu struct {
 	Id        int64                   `json:"id,omitempty"`
 	Name      string                  `json:"name,omitempty"`
 	MenuType  int32                   `json:"menu_type,omitempty"`
-	GroupType int32                   `json:"group_type,omitempty"`
+	Level     int32                   `json:"level,omitempty"`
 	Title     string                  `json:"title,omitempty"`
 	Path      string                  `json:"path,omitempty"`
 	IsShow    operationPb.IsShow_Kind `json:"is_show,omitempty"`
@@ -27,6 +27,22 @@ func (s *SystemMenu) TableName() string {
 	return "system_menu"
 }
 
+func NewSystemMenu(req *operationPb.AddMenuRequest) *SystemMenu {
+	return &SystemMenu{
+		Name:      req.Name,
+		MenuType:  req.MenuType,
+		Title:     req.Title,
+		Path:      req.Path,
+		Component: req.Component,
+		Icon:      req.Icon,
+		Sort:      req.Sort,
+		Redirect:  req.Redirect,
+		ParentId:  req.ParentId,
+		IsShow:    operationPb.IsShow_OK,
+		IsDelete:  operationPb.IsShow_OK,
+	}
+}
+
 type SystemMenuSlice []*SystemMenu
 
 func (s SystemMenuSlice) ToPB() []*operationPb.AddMenuRequest {
@@ -36,6 +52,7 @@ func (s SystemMenuSlice) ToPB() []*operationPb.AddMenuRequest {
 			Id:             v.Id,
 			Name:           v.Name,
 			MenuType:       v.MenuType,
+			Level:          v.Level,
 			Title:          v.Title,
 			IsShow:         v.IsShow,
 			Component:      v.Component,
@@ -55,6 +72,7 @@ func (s *SystemMenu) ToPb() *operationPb.AddMenuRequest {
 		Id:        s.Id,
 		Name:      s.Name,
 		MenuType:  s.MenuType,
+		Level:     s.Level,
 		Title:     s.Title,
 		Path:      s.Path,
 		Component: s.Component,

+ 28 - 0
model/system_menu_permissions.go

@@ -0,0 +1,28 @@
+package model
+
+import operationPb "kpt-tmr-group/proto/go/backend/operation"
+
+type SystemMenuPermissions struct {
+	Id        int64                   `json:"id,omitempty"`
+	RoleId    int64                   `json:"role_id"`
+	MenuId    int64                   `json:"menu_id"`
+	IsShow    operationPb.IsShow_Kind `json:"is_show"`
+	CreatedAt int64                   `json:"created_at"`
+	UpdatedAt int64                   `json:"updated_at"`
+}
+
+func (s *SystemMenuPermissions) TableName() string {
+	return "system_menu_permissions"
+}
+
+func NewSystemMenuPermissions(roleID int64, menuIds []int64) []*SystemMenuPermissions {
+	systemMenuPermissions := make([]*SystemMenuPermissions, len(menuIds))
+	for i, v := range menuIds {
+		systemMenuPermissions[i] = &SystemMenuPermissions{
+			RoleId: roleID,
+			MenuId: v,
+			IsShow: operationPb.IsShow_OK,
+		}
+	}
+	return systemMenuPermissions
+}

+ 15 - 0
model/system_mobile.go

@@ -0,0 +1,15 @@
+package model
+
+import operationPb "kpt-tmr-group/proto/go/backend/operation"
+
+type SystemMobile struct {
+	Id        int64                   `json:"id,omitempty"`
+	Name      string                  `json:"name"`
+	IsShow    operationPb.IsShow_Kind `json:"is_show"`
+	CreatedAt int64                   `json:"created_at"`
+	UpdatedAt int64                   `json:"updated_at"`
+}
+
+func (s *SystemMobile) TableName() string {
+	return "system_mobile"
+}

+ 28 - 0
model/system_mobile_permissions.go

@@ -0,0 +1,28 @@
+package model
+
+import operationPb "kpt-tmr-group/proto/go/backend/operation"
+
+type SystemMobilePermissions struct {
+	Id        int64                   `json:"id,omitempty"`
+	RoleId    int64                   `json:"role_id"`
+	MobileId  int64                   `json:"mobile_id"`
+	IsShow    operationPb.IsShow_Kind `json:"is_show"`
+	CreatedAt int64                   `json:"created_at"`
+	UpdatedAt int64                   `json:"updated_at"`
+}
+
+func (s *SystemMobilePermissions) TableName() string {
+	return "system_mobile_permissions"
+}
+
+func NewSystemMobilePermissions(roleID int64, mobileIds []int64) []*SystemMobilePermissions {
+	systemMobilePermissions := make([]*SystemMobilePermissions, len(mobileIds))
+	for i, v := range mobileIds {
+		systemMobilePermissions[i] = &SystemMobilePermissions{
+			RoleId:   roleID,
+			MobileId: v,
+			IsShow:   operationPb.IsShow_OK,
+		}
+	}
+	return systemMobilePermissions
+}

+ 28 - 0
model/system_pasture_permissions.go

@@ -0,0 +1,28 @@
+package model
+
+import operationPb "kpt-tmr-group/proto/go/backend/operation"
+
+type SystemPasturePermissions struct {
+	Id        int64                   `json:"id,omitempty"`
+	RoleId    int64                   `json:"role_id"`
+	PastureId int64                   `json:"pasture_id"`
+	IsShow    operationPb.IsShow_Kind `json:"is_show"`
+	CreatedAt int64                   `json:"created_at"`
+	UpdatedAt int64                   `json:"updated_at"`
+}
+
+func (s *SystemPasturePermissions) TableName() string {
+	return "system_pasture_permissions"
+}
+
+func NewSystemPasturePermissions(roleID int64, pastureIds []int64) []*SystemPasturePermissions {
+	systemPasturePermissions := make([]*SystemPasturePermissions, len(pastureIds))
+	for i, v := range pastureIds {
+		systemPasturePermissions[i] = &SystemPasturePermissions{
+			RoleId:    roleID,
+			PastureId: v,
+			IsShow:    operationPb.IsShow_OK,
+		}
+	}
+	return systemPasturePermissions
+}

+ 0 - 75
model/system_role.go

@@ -1,10 +1,7 @@
 package model
 
 import (
-	"fmt"
 	operationPb "kpt-tmr-group/proto/go/backend/operation"
-	"strconv"
-	"strings"
 	"time"
 )
 
@@ -12,9 +9,6 @@ type SystemRole struct {
 	Id         int64                   `json:"id,omitempty"`
 	Name       string                  `json:"name,omitempty"`
 	Remarks    string                  `json:"remarks,omitempty"`
-	MenuId     string                  `json:"menu_id"`
-	MobileId   string                  `json:"mobile_id"`
-	PastureId  string                  `json:"pasture_id"`
 	IsShow     operationPb.IsShow_Kind `json:"is_show,omitempty"`
 	CreateUser string                  `json:"create_user,omitempty"`
 	CreatedAt  int64                   `json:"created_at,omitempty"`
@@ -34,78 +28,9 @@ func NewSystemRole(req *operationPb.AddRoleRequest) *SystemRole {
 		IsShow:     operationPb.IsShow_OK,
 		CreateUser: req.CreateUser,
 	}
-
-	systemRole.RolePermissionsFormat(req)
 	return systemRole
 }
 
-func (r *SystemRole) RolePermissionsFormat(req *operationPb.AddRoleRequest) {
-	pastureId := ""
-	for _, v := range req.PastureId {
-		pastureId += fmt.Sprintf("%d,", v)
-	}
-
-	menuId := ""
-	for _, v := range req.MenuId {
-		menuId += fmt.Sprintf("%d,", v)
-	}
-	mobileId := ""
-	for _, v := range req.MobileId {
-		mobileId += fmt.Sprintf("%d", v)
-	}
-
-	if pastureId != "" {
-		r.PastureId = strings.TrimRight(pastureId, ",")
-	}
-
-	if mobileId != "" {
-		r.MobileId = strings.TrimRight(mobileId, ",")
-	}
-
-	if menuId != "" {
-		r.MenuId = strings.TrimRight(menuId, ",")
-	}
-}
-
-func (s *SystemRole) RoleForMenuToSlice() []int {
-	menuIds := make([]int, 0)
-	if s.MenuId != "" {
-		menuIdsStr := strings.Split(s.MenuId, ",")
-		for _, v := range menuIdsStr {
-			menuIdsInt, _ := strconv.Atoi(v)
-			menuIds = append(menuIds, menuIdsInt)
-		}
-	}
-
-	return menuIds
-}
-
-func (s *SystemRole) RoleForMobileToSlice() []int {
-	mobileIds := make([]int, 0)
-	if s.MobileId != "" {
-		mobileIdsStr := strings.Split(s.MenuId, ",")
-		for _, v := range mobileIdsStr {
-			mobileIdsInt, _ := strconv.Atoi(v)
-			mobileIds = append(mobileIds, mobileIdsInt)
-		}
-	}
-
-	return mobileIds
-}
-
-func (s *SystemRole) RoleForPastureToSlice() []int {
-	pastureIds := make([]int, 0)
-	if s.PastureId != "" {
-		pastureIdsStr := strings.Split(s.MenuId, ",")
-		for _, v := range pastureIdsStr {
-			pastureIdsInt, _ := strconv.Atoi(v)
-			pastureIds = append(pastureIds, pastureIdsInt)
-		}
-	}
-
-	return pastureIds
-}
-
 type SystemRoleSlice []*SystemRole
 
 func (s SystemRoleSlice) ToPB() []*operationPb.AddRoleRequest {

+ 174 - 16
module/backend/system_permissions.go

@@ -4,50 +4,208 @@ import (
 	"context"
 	"kpt-tmr-group/model"
 	"kpt-tmr-group/pkg/logger/zaplog"
+	"kpt-tmr-group/pkg/xerr"
 	operationPb "kpt-tmr-group/proto/go/backend/operation"
 	"sync"
+	"time"
 
 	"go.uber.org/zap"
 )
 
-func (s *StoreEntry) GetPermissionsPastureList(ctx context.Context, mobileIds, pastureIds, menuIds []int) *operationPb.SystemUserMenuPermissions {
+type SystemAllPermissionsList struct {
+	PastureList []*model.SystemPasturePermissions
+	MenuList    []*model.SystemMenuPermissions
+	MobileList  []*model.SystemMobilePermissions
+}
+
+const (
+	Level1 = iota + 1
+	Level2
+	Level3
+)
+
+// SystemUserMenuPermissionsUnDuplicate 角色权限去重
+func (s *SystemAllPermissionsList) SystemUserMenuPermissionsUnDuplicate() {
+	newMenuList := make([]*model.SystemMenuPermissions, 0)
+	seen := make(map[int64]bool)
+	for _, menu := range s.MenuList {
+		if _, ok := seen[menu.MenuId]; !ok {
+			newMenuList = append(newMenuList, menu)
+		}
+	}
+	s.MenuList = newMenuList
+}
+
+func (s *StoreEntry) SystemPermissionsFormatPb(pastureList []*model.GroupPasture, mobileList []*model.SystemMobile, menuList []*model.SystemMenu) *operationPb.SystemUserMenuPermissions {
 	systemUserMenuPermissions := &operationPb.SystemUserMenuPermissions{
 		PastureList: make([]*operationPb.AddPastureRequest, 0),
 		MenuList:    make([]*operationPb.AddMenuRequest, 0),
 		MobileList:  make([]*operationPb.AddMobileRequest, 0),
 	}
+
 	wg := sync.WaitGroup{}
 	wg.Add(3)
 
 	go func() {
-		groupPasture := make([]*model.GroupPasture, 0)
-		if err := s.DB.Find(&groupPasture, pastureIds).Error; err != nil {
-			zaplog.Error("GetPermissionsPastureList", zap.Any("GroupPasture", pastureIds), zap.Any("Err", err))
+		for _, v := range pastureList {
+			systemUserMenuPermissions.PastureList = append(systemUserMenuPermissions.PastureList,
+				&operationPb.AddPastureRequest{
+					Id:   v.Id,
+					Name: v.Name,
+				},
+			)
 		}
-		systemUserMenuPermissions.PastureList = append(systemUserMenuPermissions.PastureList, model.GroupPastureSlice(groupPasture).ToPermissionsPB()...)
 		wg.Done()
 	}()
 
+	// TODO 后面优化成递归算法
 	go func() {
-		systemMenu := make([]*model.SystemMenu, 0)
-		if err := s.DB.Find(&systemMenu, menuIds).Error; err != nil {
-			zaplog.Error("GetPermissionsPastureList", zap.Any("SystemMenu", menuIds), zap.Any("Err", err))
+
+		level := make(map[int32][]*operationPb.AddMenuRequest, 0)
+		for _, menu := range menuList {
+			if _, ok := level[menu.Level]; !ok {
+				level[menu.Level] = make([]*operationPb.AddMenuRequest, 0)
+			}
+			level[menu.Level] = append(level[menu.Level], &operationPb.AddMenuRequest{
+				Id:             menu.Id,
+				Name:           menu.Name,
+				ParentId:       menu.ParentId,
+				MenuType:       menu.MenuType,
+				Title:          menu.Title,
+				Path:           menu.Path,
+				IsShow:         menu.IsShow,
+				Component:      menu.Component,
+				Icon:           menu.Icon,
+				Sort:           menu.Sort,
+				Redirect:       menu.Redirect,
+				CreatedAt:      menu.CreatedAt,
+				CratedAtFormat: time.Unix(menu.CreatedAt, 0).Format(model.LayoutTime),
+				Level:          menu.Level,
+				Children:       make([]*operationPb.AddMenuRequest, 0),
+			})
+		}
+
+		for _, leve3Data := range level[Level3] {
+			for _, leve2Data := range level[Level2] {
+				if leve3Data.ParentId == leve2Data.Id {
+					if leve2Data.Children == nil {
+						leve2Data.Children = make([]*operationPb.AddMenuRequest, 0)
+					}
+					leve2Data.Children = append(leve2Data.Children, leve3Data)
+				}
+			}
+		}
+
+		for _, leve2Data := range level[Level2] {
+			for _, leve1Data := range level[Level1] {
+				if leve2Data.ParentId == leve1Data.Id {
+					if leve1Data.Children == nil {
+						leve1Data.Children = make([]*operationPb.AddMenuRequest, 0)
+					}
+					leve1Data.Children = append(leve1Data.Children, leve2Data)
+				}
+			}
 		}
-		systemUserMenuPermissions.MenuList = append(systemUserMenuPermissions.MenuList, model.SystemMenuSlice(systemMenu).ToPB()...)
+
+		systemUserMenuPermissions.MenuList = level[Level1]
 		wg.Done()
 	}()
 
 	go func() {
-		systemUserMenuPermissions.MobileList = append(systemUserMenuPermissions.MobileList, &operationPb.AddMobileRequest{
-			Id:   1,
-			Name: "首页",
-		}, &operationPb.AddMobileRequest{
-			Id:   2,
-			Name: "思维效率",
-		})
+		for _, v := range mobileList {
+			systemUserMenuPermissions.MobileList = append(systemUserMenuPermissions.MobileList,
+				&operationPb.AddMobileRequest{
+					Id:   v.Id,
+					Name: v.Name,
+				},
+			)
+		}
 		wg.Done()
 	}()
 
 	wg.Wait()
 	return systemUserMenuPermissions
 }
+
+// GetSystemAllPermissionsList 获取用户相关权限
+func (s *StoreEntry) GetSystemAllPermissionsList(ctx context.Context, roleId int64) *SystemAllPermissionsList {
+	systemAllPermissionsList := &SystemAllPermissionsList{
+		PastureList: make([]*model.SystemPasturePermissions, 0),
+		MenuList:    make([]*model.SystemMenuPermissions, 0),
+		MobileList:  make([]*model.SystemMobilePermissions, 0),
+	}
+
+	wg := sync.WaitGroup{}
+	wg.Add(3)
+	go func() {
+		pastureList := make([]*model.SystemPasturePermissions, 0)
+		if err := s.DB.Where("role_id = ?", roleId).Find(&pastureList).Error; err != nil {
+			zaplog.Error("SystemPasturePermissions", zap.Any("Err", err))
+		}
+		systemAllPermissionsList.PastureList = pastureList
+		wg.Done()
+	}()
+
+	go func() {
+		menuList := make([]*model.SystemMenuPermissions, 0)
+		if err := s.DB.Where("role_id = ?", roleId).Find(&menuList).Error; err != nil {
+			zaplog.Error("SystemMenuPermissions", zap.Any("Err", err))
+		}
+		systemAllPermissionsList.MenuList = menuList
+		wg.Done()
+	}()
+
+	// 获取供应商数据
+	go func() {
+		mobileList := make([]*model.SystemMobilePermissions, 0)
+		if err := s.DB.Where("role_id = ?", roleId).Find(&mobileList).Error; err != nil {
+			zaplog.Error("SystemMobilePermissions", zap.Any("Err", err))
+		}
+		systemAllPermissionsList.MobileList = mobileList
+		wg.Done()
+	}()
+	wg.Wait()
+	return systemAllPermissionsList
+}
+
+// GetPastureList 获取******
+func (s *StoreEntry) GetPastureList(ctx context.Context, req []*model.SystemPasturePermissions) ([]*model.GroupPasture, error) {
+	ids := make([]int64, 0)
+	for _, v := range req {
+		ids = append(ids, v.PastureId)
+	}
+
+	groupPastureList := make([]*model.GroupPasture, 0)
+	if err := s.DB.Find(&groupPastureList, ids).Error; err != nil {
+		return nil, xerr.WithStack(err)
+	}
+	return groupPastureList, nil
+}
+
+// GetMenuList 获取******
+func (s *StoreEntry) GetMenuList(ctx context.Context, req []*model.SystemMenuPermissions) ([]*model.SystemMenu, error) {
+	ids := make([]int64, 0)
+	for _, v := range req {
+		ids = append(ids, v.MenuId)
+	}
+
+	menuList := make([]*model.SystemMenu, 0)
+	if err := s.DB.Find(&menuList, ids).Error; err != nil {
+		return nil, xerr.WithStack(err)
+	}
+	return menuList, nil
+}
+
+// GetMobileList 获取******
+func (s *StoreEntry) GetMobileList(ctx context.Context, req []*model.SystemMobilePermissions) ([]*model.SystemMobile, error) {
+	ids := make([]int64, 0)
+	for _, v := range req {
+		ids = append(ids, v.MobileId)
+	}
+
+	mobileList := make([]*model.SystemMobile, 0)
+	if err := s.DB.Find(&mobileList, ids).Error; err != nil {
+		return nil, xerr.WithStack(err)
+	}
+	return mobileList, nil
+}

+ 58 - 37
module/backend/system_service.go

@@ -211,30 +211,71 @@ func (s *StoreEntry) GetSystemUserPermissions(ctx context.Context, token string)
 		return nil, xerr.WithStack(err)
 	}
 
-	systemUserMenuPermissions := &operationPb.SystemUserMenuPermissions{
-		PastureList: make([]*operationPb.AddPastureRequest, 0),
-		MenuList:    make([]*operationPb.AddMenuRequest, 0),
-		MobileList:  make([]*operationPb.AddMobileRequest, 0),
+	systemAllPermissionsList := &SystemAllPermissionsList{
+		PastureList: make([]*model.SystemPasturePermissions, 0),
+		MenuList:    make([]*model.SystemMenuPermissions, 0),
+		MobileList:  make([]*model.SystemMobilePermissions, 0),
 	}
 
 	for _, role := range systemRoles {
-		mobileIds := role.RoleForMobileToSlice()
-		pastureIds := role.RoleForPastureToSlice()
-		menuIds := role.RoleForMenuToSlice()
+		item := s.GetSystemAllPermissionsList(ctx, role.Id)
+		systemAllPermissionsList.PastureList = append(systemAllPermissionsList.PastureList, item.PastureList...)
+		systemAllPermissionsList.MenuList = append(systemAllPermissionsList.MenuList, item.MenuList...)
+		systemAllPermissionsList.MobileList = append(systemAllPermissionsList.MobileList, item.MobileList...)
+	}
+
+	systemAllPermissionsList.SystemUserMenuPermissionsUnDuplicate()
+
+	groupPastureList, err := s.GetPastureList(ctx, systemAllPermissionsList.PastureList)
+	if err != nil {
+		return nil, xerr.WithStack(err)
+	}
 
-		item := s.GetPermissionsPastureList(ctx, mobileIds, pastureIds, menuIds)
-		systemUserMenuPermissions.PastureList = append(systemUserMenuPermissions.PastureList, item.PastureList...)
-		systemUserMenuPermissions.MenuList = append(systemUserMenuPermissions.MenuList, item.MenuList...)
-		systemUserMenuPermissions.MobileList = append(systemUserMenuPermissions.MobileList, item.MobileList...)
+	menuList, err := s.GetMenuList(ctx, systemAllPermissionsList.MenuList)
+	if err != nil {
+		return nil, xerr.WithStack(err)
 	}
 
-	return systemUserMenuPermissions, nil
+	mobileList, err := s.GetMobileList(ctx, systemAllPermissionsList.MobileList)
+	if err != nil {
+		return nil, xerr.WithStack(err)
+	}
+
+	return s.SystemPermissionsFormatPb(groupPastureList, mobileList, menuList), nil
 }
 
 // CreateSystemRole 添加角色
 func (s *StoreEntry) CreateSystemRole(ctx context.Context, req *operationPb.AddRoleRequest) error {
-	role := model.NewSystemRole(req)
-	if err := s.DB.Create(role).Debug().Error; err != nil {
+	if err := s.DB.Transaction(func(tx *gorm.DB) error {
+		// 创建角色数据
+		role := model.NewSystemRole(req)
+		if err := tx.Create(role).Error; err != nil {
+			return xerr.WithStack(err)
+		}
+		// 创建角色菜单权限数据
+		if len(req.MenuId) > 0 {
+			menuPermissions := model.NewSystemMenuPermissions(role.Id, req.MenuId)
+			if err := tx.Create(menuPermissions).Error; err != nil {
+				return xerr.WithStack(err)
+			}
+		}
+		// 创建角色移动端权限数据
+		if len(req.MobileId) > 0 {
+			mobilePermissions := model.NewSystemMobilePermissions(role.Id, req.MobileId)
+			if err := tx.Create(mobilePermissions).Error; err != nil {
+				return xerr.WithStack(err)
+			}
+		}
+
+		// 创建角色牧场端权限数据
+		if len(req.PastureId) > 0 {
+			pasturePermissions := model.NewSystemPasturePermissions(role.Id, req.PastureId)
+			if err := tx.Create(pasturePermissions).Error; err != nil {
+				return xerr.WithStack(err)
+			}
+		}
+		return nil
+	}); err != nil {
 		return xerr.WithStack(err)
 	}
 	return nil
@@ -250,17 +291,10 @@ func (s *StoreEntry) EditSystemRole(ctx context.Context, req *operationPb.AddRol
 		return xerr.WithStack(err)
 	}
 
-	updateSystemUser := &model.SystemRole{
-		Id:         req.Id,
-		Name:       req.Name,
-		Remarks:    req.Remarks,
-		CreateUser: req.CreateUser,
-	}
-	updateSystemUser.RolePermissionsFormat(req)
-
+	updateSystemRole := model.NewSystemRole(req)
 	if err := s.DB.Omit("is_show").
 		Where("id = ?", role.Id).
-		Updates(updateSystemUser).Error; err != nil {
+		Updates(updateSystemRole).Error; err != nil {
 		return xerr.WithStack(err)
 	}
 
@@ -309,20 +343,7 @@ func (s *StoreEntry) SearchSystemRoleList(ctx context.Context, req *operationPb.
 
 // CreateSystemMenu 添加系统菜单权限
 func (s *StoreEntry) CreateSystemMenu(ctx context.Context, req *operationPb.AddMenuRequest) error {
-	systemMenu := &model.SystemMenu{
-		Name:      req.Name,
-		MenuType:  req.MenuType,
-		Title:     req.Title,
-		Path:      req.Path,
-		Component: req.Component,
-		Icon:      req.Icon,
-		Sort:      req.Sort,
-		Redirect:  req.Redirect,
-		ParentId:  req.ParentId,
-		IsShow:    operationPb.IsShow_OK,
-		IsDelete:  operationPb.IsShow_OK,
-	}
-
+	systemMenu := model.NewSystemMenu(req)
 	if err := s.DB.Create(systemMenu).Error; err != nil {
 		return xerr.WithStack(err)
 	}

+ 87 - 65
proto/go/backend/operation/system.pb.go

@@ -764,19 +764,21 @@ type AddMenuRequest struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Id             int64       `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
-	Name           string      `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`                                                       // 名称
-	ParentId       int64       `protobuf:"varint,3,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"`                              // 父id
-	MenuType       int32       `protobuf:"varint,4,opt,name=menu_type,json=menuType,proto3" json:"menu_type,omitempty"`                              // 菜单类型 1 菜单 2 按钮
-	Title          string      `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"`                                                     // 标题
-	Path           string      `protobuf:"bytes,6,opt,name=path,proto3" json:"path,omitempty"`                                                       // 路径 path
-	IsShow         IsShow_Kind `protobuf:"varint,7,opt,name=is_show,json=isShow,proto3,enum=backend.operation.IsShow_Kind" json:"is_show,omitempty"` // 是否显示
-	Component      string      `protobuf:"bytes,8,opt,name=component,proto3" json:"component,omitempty"`                                             // 组件
-	Icon           string      `protobuf:"bytes,9,opt,name=icon,proto3" json:"icon,omitempty"`                                                       // 图标
-	Sort           int32       `protobuf:"varint,10,opt,name=sort,proto3" json:"sort,omitempty"`                                                     // 排序
-	Redirect       string      `protobuf:"bytes,11,opt,name=redirect,proto3" json:"redirect,omitempty"`                                              // 重定向
-	CreatedAt      int64       `protobuf:"varint,12,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`                          // 创建时间
-	CratedAtFormat string      `protobuf:"bytes,13,opt,name=crated_at_format,json=cratedAtFormat,proto3" json:"crated_at_format,omitempty"`          // 创建时间格式化
+	Id             int64             `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+	Name           string            `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`                                                       // 名称
+	ParentId       int64             `protobuf:"varint,3,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"`                              // 父id
+	MenuType       int32             `protobuf:"varint,4,opt,name=menu_type,json=menuType,proto3" json:"menu_type,omitempty"`                              // 菜单类型 1 菜单 2 按钮
+	Title          string            `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"`                                                     // 标题
+	Path           string            `protobuf:"bytes,6,opt,name=path,proto3" json:"path,omitempty"`                                                       // 路径 path
+	IsShow         IsShow_Kind       `protobuf:"varint,7,opt,name=is_show,json=isShow,proto3,enum=backend.operation.IsShow_Kind" json:"is_show,omitempty"` // 是否显示
+	Component      string            `protobuf:"bytes,8,opt,name=component,proto3" json:"component,omitempty"`                                             // 组件
+	Icon           string            `protobuf:"bytes,9,opt,name=icon,proto3" json:"icon,omitempty"`                                                       // 图标
+	Sort           int32             `protobuf:"varint,10,opt,name=sort,proto3" json:"sort,omitempty"`                                                     // 排序
+	Redirect       string            `protobuf:"bytes,11,opt,name=redirect,proto3" json:"redirect,omitempty"`                                              // 重定向
+	CreatedAt      int64             `protobuf:"varint,12,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`                          // 创建时间
+	CratedAtFormat string            `protobuf:"bytes,13,opt,name=crated_at_format,json=cratedAtFormat,proto3" json:"crated_at_format,omitempty"`          // 创建时间格式化
+	Level          int32             `protobuf:"varint,14,opt,name=level,proto3" json:"level,omitempty"`                                                   // 菜单等级
+	Children       []*AddMenuRequest `protobuf:"bytes,15,rep,name=children,proto3" json:"children,omitempty"`                                              // 子分类
 }
 
 func (x *AddMenuRequest) Reset() {
@@ -902,6 +904,20 @@ func (x *AddMenuRequest) GetCratedAtFormat() string {
 	return ""
 }
 
+func (x *AddMenuRequest) GetLevel() int32 {
+	if x != nil {
+		return x.Level
+	}
+	return 0
+}
+
+func (x *AddMenuRequest) GetChildren() []*AddMenuRequest {
+	if x != nil {
+		return x.Children
+	}
+	return nil
+}
+
 type IsShowSystemMenuRequest struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -1312,7 +1328,7 @@ var file_backend_operation_system_proto_rawDesc = []byte{
 	0x64, 0x12, 0x37, 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x73, 0x68, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01,
 	0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2e, 0x6f, 0x70, 0x65,
 	0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x49, 0x73, 0x53, 0x68, 0x6f, 0x77, 0x2e, 0x4b, 0x69,
-	0x6e, 0x64, 0x52, 0x06, 0x69, 0x73, 0x53, 0x68, 0x6f, 0x77, 0x22, 0xfc, 0x02, 0x0a, 0x0e, 0x41,
+	0x6e, 0x64, 0x52, 0x06, 0x69, 0x73, 0x53, 0x68, 0x6f, 0x77, 0x22, 0xd1, 0x03, 0x0a, 0x0e, 0x41,
 	0x64, 0x64, 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a,
 	0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a,
 	0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
@@ -1336,48 +1352,53 @@ var file_backend_operation_system_proto_rawDesc = []byte{
 	0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12,
 	0x28, 0x0a, 0x10, 0x63, 0x72, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x5f, 0x66, 0x6f, 0x72,
 	0x6d, 0x61, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x72, 0x61, 0x74, 0x65,
-	0x64, 0x41, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x6b, 0x0a, 0x17, 0x49, 0x73, 0x53,
-	0x68, 0x6f, 0x77, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x71,
-	0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x65, 0x6e, 0x75, 0x5f, 0x69, 0x64, 0x18,
-	0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6d, 0x65, 0x6e, 0x75, 0x49, 0x64, 0x12, 0x37, 0x0a,
-	0x07, 0x69, 0x73, 0x5f, 0x73, 0x68, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e,
-	0x2e, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2e, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
-	0x6f, 0x6e, 0x2e, 0x49, 0x73, 0x53, 0x68, 0x6f, 0x77, 0x2e, 0x4b, 0x69, 0x6e, 0x64, 0x52, 0x06,
-	0x69, 0x73, 0x53, 0x68, 0x6f, 0x77, 0x22, 0x6b, 0x0a, 0x11, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68,
-	0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e,
-	0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
-	0x42, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20,
-	0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2e, 0x6f, 0x70,
-	0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69,
-	0x6f, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74,
-	0x69, 0x6f, 0x6e, 0x22, 0x75, 0x0a, 0x12, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4d, 0x65, 0x6e,
-	0x75, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67,
-	0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a,
-	0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f,
-	0x74, 0x61, 0x6c, 0x12, 0x35, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28,
+	0x64, 0x41, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76,
+	0x65, 0x6c, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12,
+	0x3d, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x0f, 0x20, 0x03, 0x28,
 	0x0b, 0x32, 0x21, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2e, 0x6f, 0x70, 0x65, 0x72,
 	0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x64, 0x64, 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x71,
-	0x75, 0x65, 0x73, 0x74, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0xea, 0x01, 0x0a, 0x19, 0x53,
-	0x79, 0x73, 0x74, 0x65, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x6e, 0x75, 0x50, 0x65, 0x72,
-	0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x47, 0x0a, 0x0c, 0x70, 0x61, 0x73, 0x74,
-	0x75, 0x72, 0x65, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24,
-	0x2e, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2e, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
-	0x6f, 0x6e, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x61, 0x73, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71,
-	0x75, 0x65, 0x73, 0x74, 0x52, 0x0b, 0x70, 0x61, 0x73, 0x74, 0x75, 0x72, 0x65, 0x4c, 0x69, 0x73,
-	0x74, 0x12, 0x3e, 0x0a, 0x09, 0x6d, 0x65, 0x6e, 0x75, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02,
-	0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2e, 0x6f,
-	0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x64, 0x64, 0x4d, 0x65, 0x6e, 0x75,
-	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x08, 0x6d, 0x65, 0x6e, 0x75, 0x4c, 0x69, 0x73,
-	0x74, 0x12, 0x44, 0x0a, 0x0b, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x5f, 0x6c, 0x69, 0x73, 0x74,
-	0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64,
-	0x2e, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x64, 0x64, 0x4d, 0x6f,
-	0x62, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x6d, 0x6f, 0x62,
-	0x69, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x36, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x4d, 0x6f,
-	0x62, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69,
-	0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e,
-	0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x42,
-	0x0f, 0x5a, 0x0d, 0x2e, 0x3b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x62,
-	0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x75, 0x65, 0x73, 0x74, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x22, 0x6b,
+	0x0a, 0x17, 0x49, 0x73, 0x53, 0x68, 0x6f, 0x77, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x4d, 0x65,
+	0x6e, 0x75, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x65, 0x6e,
+	0x75, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6d, 0x65, 0x6e, 0x75,
+	0x49, 0x64, 0x12, 0x37, 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x73, 0x68, 0x6f, 0x77, 0x18, 0x02, 0x20,
+	0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2e, 0x6f, 0x70,
+	0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x49, 0x73, 0x53, 0x68, 0x6f, 0x77, 0x2e, 0x4b,
+	0x69, 0x6e, 0x64, 0x52, 0x06, 0x69, 0x73, 0x53, 0x68, 0x6f, 0x77, 0x22, 0x6b, 0x0a, 0x11, 0x53,
+	0x65, 0x61, 0x72, 0x63, 0x68, 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+	0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
+	0x6e, 0x61, 0x6d, 0x65, 0x12, 0x42, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69,
+	0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x65,
+	0x6e, 0x64, 0x2e, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x61, 0x67,
+	0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x0a, 0x70, 0x61,
+	0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x75, 0x0a, 0x12, 0x53, 0x65, 0x61, 0x72,
+	0x63, 0x68, 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12,
+	0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61,
+	0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28,
+	0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x35, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74,
+	0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64,
+	0x2e, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x64, 0x64, 0x4d, 0x65,
+	0x6e, 0x75, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22,
+	0xea, 0x01, 0x0a, 0x19, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65,
+	0x6e, 0x75, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x47, 0x0a,
+	0x0c, 0x70, 0x61, 0x73, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20,
+	0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2e, 0x6f, 0x70,
+	0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x61, 0x73, 0x74, 0x75,
+	0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0b, 0x70, 0x61, 0x73, 0x74, 0x75,
+	0x72, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x6d, 0x65, 0x6e, 0x75, 0x5f, 0x6c,
+	0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x62, 0x61, 0x63, 0x6b,
+	0x65, 0x6e, 0x64, 0x2e, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x64,
+	0x64, 0x4d, 0x65, 0x6e, 0x75, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x08, 0x6d, 0x65,
+	0x6e, 0x75, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x44, 0x0a, 0x0b, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65,
+	0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62, 0x61,
+	0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2e, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
+	0x41, 0x64, 0x64, 0x4d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+	0x52, 0x0a, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x36, 0x0a, 0x10,
+	0x41, 0x64, 0x64, 0x4d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+	0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64,
+	0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
+	0x6e, 0x61, 0x6d, 0x65, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, 0x3b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74,
+	0x69, 0x6f, 0x6e, 0x50, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -1426,17 +1447,18 @@ var file_backend_operation_system_proto_depIdxs = []int32{
 	6,  // 8: backend.operation.SearchUserResponse.list:type_name -> backend.operation.AddSystemUser
 	16, // 9: backend.operation.IsShowSystemUserRequest.is_show:type_name -> backend.operation.IsShow.Kind
 	16, // 10: backend.operation.AddMenuRequest.is_show:type_name -> backend.operation.IsShow.Kind
-	16, // 11: backend.operation.IsShowSystemMenuRequest.is_show:type_name -> backend.operation.IsShow.Kind
-	17, // 12: backend.operation.SearchMenuRequest.pagination:type_name -> backend.operation.PaginationModel
-	10, // 13: backend.operation.SearchMenuResponse.list:type_name -> backend.operation.AddMenuRequest
-	18, // 14: backend.operation.SystemUserMenuPermissions.pasture_list:type_name -> backend.operation.AddPastureRequest
-	10, // 15: backend.operation.SystemUserMenuPermissions.menu_list:type_name -> backend.operation.AddMenuRequest
-	15, // 16: backend.operation.SystemUserMenuPermissions.mobile_list:type_name -> backend.operation.AddMobileRequest
-	17, // [17:17] is the sub-list for method output_type
-	17, // [17:17] is the sub-list for method input_type
-	17, // [17:17] is the sub-list for extension type_name
-	17, // [17:17] is the sub-list for extension extendee
-	0,  // [0:17] is the sub-list for field type_name
+	10, // 11: backend.operation.AddMenuRequest.children:type_name -> backend.operation.AddMenuRequest
+	16, // 12: backend.operation.IsShowSystemMenuRequest.is_show:type_name -> backend.operation.IsShow.Kind
+	17, // 13: backend.operation.SearchMenuRequest.pagination:type_name -> backend.operation.PaginationModel
+	10, // 14: backend.operation.SearchMenuResponse.list:type_name -> backend.operation.AddMenuRequest
+	18, // 15: backend.operation.SystemUserMenuPermissions.pasture_list:type_name -> backend.operation.AddPastureRequest
+	10, // 16: backend.operation.SystemUserMenuPermissions.menu_list:type_name -> backend.operation.AddMenuRequest
+	15, // 17: backend.operation.SystemUserMenuPermissions.mobile_list:type_name -> backend.operation.AddMobileRequest
+	18, // [18:18] is the sub-list for method output_type
+	18, // [18:18] is the sub-list for method input_type
+	18, // [18:18] is the sub-list for extension type_name
+	18, // [18:18] is the sub-list for extension extendee
+	0,  // [0:18] is the sub-list for field type_name
 }
 
 func init() { file_backend_operation_system_proto_init() }