优化模型数据

This commit is contained in:
Yavolte 2025-06-23 10:55:30 +08:00
parent b8d5fce311
commit 9a665704b1
18 changed files with 982 additions and 255 deletions

View File

@ -14,9 +14,10 @@ import (
) )
type User struct { type User struct {
db *gorm.DB db *gorm.DB
cache cache.Cache cache cache.Cache
sqlDependency *dbcache.SqlDependency sqlDependency *dbcache.SqlDependency
roleDependency *dbcache.SqlDependency
} }
// GetPermissions 获取用户权限 // GetPermissions 获取用户权限
@ -30,7 +31,8 @@ func (u *User) GetPermissions(ctx context.Context, uid string) (permissions []st
Error Error
return ss, err return ss, err
}, },
dbcache.WithCacheDuration(time.Minute), dbcache.WithDependency(u.roleDependency),
dbcache.WithCacheDuration(time.Second*20),
dbcache.WithDB(u.db), dbcache.WithDB(u.db),
dbcache.WithCache(u.cache), dbcache.WithCache(u.cache),
) )
@ -65,8 +67,9 @@ func (u *User) GeUsers(ctx context.Context) (values []*models.User, err error) {
func NewUserLogic(db *gorm.DB, ch cache.Cache) *User { func NewUserLogic(db *gorm.DB, ch cache.Cache) *User {
return &User{ return &User{
db: db, db: db,
cache: ch, cache: ch,
sqlDependency: dbcache.NewSqlDependency("SELECT MAX(`updated_at`) FROM `users`"), roleDependency: dbcache.NewSqlDependency("SELECT COUNT(*) AS count FROM `role_permissions`"),
sqlDependency: dbcache.NewSqlDependency("SELECT MAX(`updated_at`) FROM `users`"),
} }
} }

View File

@ -48,6 +48,7 @@ func init() {
orgMenu.Name = "Organize" orgMenu.Name = "Organize"
orgMenu.Public = true orgMenu.Public = true
orgMenu.Uri = "/organize" orgMenu.Uri = "/organize"
orgMenu.Position = 1
profileMenu := &models.Menu{} profileMenu := &models.Menu{}
profileMenu.Label = "个人信息" profileMenu.Label = "个人信息"
@ -64,6 +65,7 @@ func init() {
settingMenu.Name = "System" settingMenu.Name = "System"
settingMenu.Public = true settingMenu.Public = true
settingMenu.Uri = "/system" settingMenu.Uri = "/system"
settingMenu.Position = 999
schemaMenu := &models.Menu{} schemaMenu := &models.Menu{}
schemaMenu.Label = "字段设置" schemaMenu.Label = "字段设置"

View File

@ -1,9 +1,12 @@
package models package models
import ( import (
"errors"
"git.nobla.cn/golang/aeus-admin/pb" "git.nobla.cn/golang/aeus-admin/pb"
"git.nobla.cn/golang/aeus-admin/types" "git.nobla.cn/golang/aeus-admin/types"
restTypes "git.nobla.cn/golang/rest/types" restTypes "git.nobla.cn/golang/rest/types"
"gorm.io/gorm"
) )
type ( type (
@ -53,7 +56,7 @@ func (m *Login) GetMenu() *types.Menu {
} }
func (m *Login) Scenario() []string { func (m *Login) Scenario() []string {
return []string{restTypes.ScenarioList} return []string{restTypes.ScenarioList, restTypes.ScenarioExport}
} }
func (m *Menu) GetMenu() *types.Menu { func (m *Menu) GetMenu() *types.Menu {
@ -63,6 +66,17 @@ func (m *Menu) GetMenu() *types.Menu {
} }
} }
func (m *Menu) BeforeDelete(tx *gorm.DB) (err error) {
var count int64
if err = tx.Model(&Menu{}).Where("`parent` = ?", m.Name).Count(&count).Error; err != nil {
return
}
if count > 0 {
err = errors.New("please delete sub menus first")
}
return
}
func (m *Menu) ModelPermissions() map[string]string { func (m *Menu) ModelPermissions() map[string]string {
return map[string]string{ return map[string]string{
"organize:permission:list": "权限", "organize:permission:list": "权限",
@ -76,6 +90,23 @@ func (m *Department) GetMenu() *types.Menu {
} }
} }
func (m *Department) BeforeDelete(tx *gorm.DB) (err error) {
var count int64
if err = tx.Model(&Department{}).Where("`parent_id` = ?", m.Id).Count(&count).Error; err != nil {
return
}
if count > 0 {
return errors.New("please delete sub department first")
}
if err = tx.Model(&User{}).Where("`dept_id` = ?", m.Id).Count(&count).Error; err != nil {
return
}
if count > 0 {
err = errors.New("please delete user first")
}
return
}
func (m *Role) GetMenu() *types.Menu { func (m *Role) GetMenu() *types.Menu {
return &types.Menu{ return &types.Menu{
Name: "OrganizeRole", Name: "OrganizeRole",
@ -89,6 +120,17 @@ func (m *Role) ModelPermissions() map[string]string {
} }
} }
func (m *Role) BeforeDelete(tx *gorm.DB) (err error) {
var count int64
if err = tx.Model(&User{}).Where("`role` = ?", m.Name).Count(&count).Error; err != nil {
return
}
if count > 0 {
err = errors.New("please delete user first")
}
return
}
func (m *Permission) GetMenu() *types.Menu { func (m *Permission) GetMenu() *types.Menu {
return &types.Menu{ return &types.Menu{
Name: "OrganizePermission", Name: "OrganizePermission",
@ -136,7 +178,7 @@ func (m *Activity) GetMenu() *types.Menu {
} }
func (m *Activity) Scenario() []string { func (m *Activity) Scenario() []string {
return []string{restTypes.ScenarioList} return []string{restTypes.ScenarioList, restTypes.ScenarioExport}
} }
func (m *Activity) ModuleName() string { func (m *Activity) ModuleName() string {

View File

@ -961,27 +961,27 @@ func (x *MenuItem) GetChildren() []*MenuItem {
} }
// 获取菜单的请求 // 获取菜单的请求
type GetMenuRequest struct { type GetUserMenuRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Permission bool `protobuf:"varint,1,opt,name=permission,proto3" json:"permission,omitempty"` Permission bool `protobuf:"varint,1,opt,name=permission,proto3" json:"permission,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
func (x *GetMenuRequest) Reset() { func (x *GetUserMenuRequest) Reset() {
*x = GetMenuRequest{} *x = GetUserMenuRequest{}
mi := &file_organize_proto_msgTypes[10] mi := &file_organize_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
func (x *GetMenuRequest) String() string { func (x *GetUserMenuRequest) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*GetMenuRequest) ProtoMessage() {} func (*GetUserMenuRequest) ProtoMessage() {}
func (x *GetMenuRequest) ProtoReflect() protoreflect.Message { func (x *GetUserMenuRequest) ProtoReflect() protoreflect.Message {
mi := &file_organize_proto_msgTypes[10] mi := &file_organize_proto_msgTypes[10]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -993,12 +993,12 @@ func (x *GetMenuRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use GetMenuRequest.ProtoReflect.Descriptor instead. // Deprecated: Use GetUserMenuRequest.ProtoReflect.Descriptor instead.
func (*GetMenuRequest) Descriptor() ([]byte, []int) { func (*GetUserMenuRequest) Descriptor() ([]byte, []int) {
return file_organize_proto_rawDescGZIP(), []int{10} return file_organize_proto_rawDescGZIP(), []int{10}
} }
func (x *GetMenuRequest) GetPermission() bool { func (x *GetUserMenuRequest) GetPermission() bool {
if x != nil { if x != nil {
return x.Permission return x.Permission
} }
@ -1006,27 +1006,27 @@ func (x *GetMenuRequest) GetPermission() bool {
} }
// 获取菜单的响应 // 获取菜单的响应
type GetMenuResponse struct { type GetUserMenuResponse struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Data []*MenuItem `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` Data []*MenuItem `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
func (x *GetMenuResponse) Reset() { func (x *GetUserMenuResponse) Reset() {
*x = GetMenuResponse{} *x = GetUserMenuResponse{}
mi := &file_organize_proto_msgTypes[11] mi := &file_organize_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
func (x *GetMenuResponse) String() string { func (x *GetUserMenuResponse) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*GetMenuResponse) ProtoMessage() {} func (*GetUserMenuResponse) ProtoMessage() {}
func (x *GetMenuResponse) ProtoReflect() protoreflect.Message { func (x *GetUserMenuResponse) ProtoReflect() protoreflect.Message {
mi := &file_organize_proto_msgTypes[11] mi := &file_organize_proto_msgTypes[11]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -1038,12 +1038,12 @@ func (x *GetMenuResponse) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use GetMenuResponse.ProtoReflect.Descriptor instead. // Deprecated: Use GetUserMenuResponse.ProtoReflect.Descriptor instead.
func (*GetMenuResponse) Descriptor() ([]byte, []int) { func (*GetUserMenuResponse) Descriptor() ([]byte, []int) {
return file_organize_proto_rawDescGZIP(), []int{11} return file_organize_proto_rawDescGZIP(), []int{11}
} }
func (x *GetMenuResponse) GetData() []*MenuItem { func (x *GetUserMenuResponse) GetData() []*MenuItem {
if x != nil { if x != nil {
return x.Data return x.Data
} }
@ -2500,6 +2500,162 @@ func (x *GetMenuLevelLabelsResponse) GetData() []*MenuLevelValue {
return nil return nil
} }
type MenuValue struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Parent string `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
Label string `protobuf:"bytes,4,opt,name=label,proto3" json:"label,omitempty"`
Children []*MenuValue `protobuf:"bytes,5,rep,name=children,proto3" json:"children,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *MenuValue) Reset() {
*x = MenuValue{}
mi := &file_organize_proto_msgTypes[42]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *MenuValue) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MenuValue) ProtoMessage() {}
func (x *MenuValue) ProtoReflect() protoreflect.Message {
mi := &file_organize_proto_msgTypes[42]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MenuValue.ProtoReflect.Descriptor instead.
func (*MenuValue) Descriptor() ([]byte, []int) {
return file_organize_proto_rawDescGZIP(), []int{42}
}
func (x *MenuValue) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *MenuValue) GetParent() string {
if x != nil {
return x.Parent
}
return ""
}
func (x *MenuValue) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *MenuValue) GetLabel() string {
if x != nil {
return x.Label
}
return ""
}
func (x *MenuValue) GetChildren() []*MenuValue {
if x != nil {
return x.Children
}
return nil
}
type GetMenuRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetMenuRequest) Reset() {
*x = GetMenuRequest{}
mi := &file_organize_proto_msgTypes[43]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetMenuRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetMenuRequest) ProtoMessage() {}
func (x *GetMenuRequest) ProtoReflect() protoreflect.Message {
mi := &file_organize_proto_msgTypes[43]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetMenuRequest.ProtoReflect.Descriptor instead.
func (*GetMenuRequest) Descriptor() ([]byte, []int) {
return file_organize_proto_rawDescGZIP(), []int{43}
}
type GetMenuResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Data []*MenuValue `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetMenuResponse) Reset() {
*x = GetMenuResponse{}
mi := &file_organize_proto_msgTypes[44]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetMenuResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetMenuResponse) ProtoMessage() {}
func (x *GetMenuResponse) ProtoReflect() protoreflect.Message {
mi := &file_organize_proto_msgTypes[44]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetMenuResponse.ProtoReflect.Descriptor instead.
func (*GetMenuResponse) Descriptor() ([]byte, []int) {
return file_organize_proto_rawDescGZIP(), []int{44}
}
func (x *GetMenuResponse) GetData() []*MenuValue {
if x != nil {
return x.Data
}
return nil
}
type LoginRequest struct { type LoginRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
@ -2511,7 +2667,7 @@ type LoginRequest struct {
func (x *LoginRequest) Reset() { func (x *LoginRequest) Reset() {
*x = LoginRequest{} *x = LoginRequest{}
mi := &file_organize_proto_msgTypes[42] mi := &file_organize_proto_msgTypes[45]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -2523,7 +2679,7 @@ func (x *LoginRequest) String() string {
func (*LoginRequest) ProtoMessage() {} func (*LoginRequest) ProtoMessage() {}
func (x *LoginRequest) ProtoReflect() protoreflect.Message { func (x *LoginRequest) ProtoReflect() protoreflect.Message {
mi := &file_organize_proto_msgTypes[42] mi := &file_organize_proto_msgTypes[45]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -2536,7 +2692,7 @@ func (x *LoginRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead. // Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.
func (*LoginRequest) Descriptor() ([]byte, []int) { func (*LoginRequest) Descriptor() ([]byte, []int) {
return file_organize_proto_rawDescGZIP(), []int{42} return file_organize_proto_rawDescGZIP(), []int{45}
} }
func (x *LoginRequest) GetUsername() string { func (x *LoginRequest) GetUsername() string {
@ -2572,7 +2728,7 @@ type LoginResponse struct {
func (x *LoginResponse) Reset() { func (x *LoginResponse) Reset() {
*x = LoginResponse{} *x = LoginResponse{}
mi := &file_organize_proto_msgTypes[43] mi := &file_organize_proto_msgTypes[46]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -2584,7 +2740,7 @@ func (x *LoginResponse) String() string {
func (*LoginResponse) ProtoMessage() {} func (*LoginResponse) ProtoMessage() {}
func (x *LoginResponse) ProtoReflect() protoreflect.Message { func (x *LoginResponse) ProtoReflect() protoreflect.Message {
mi := &file_organize_proto_msgTypes[43] mi := &file_organize_proto_msgTypes[46]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -2597,7 +2753,7 @@ func (x *LoginResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead. // Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead.
func (*LoginResponse) Descriptor() ([]byte, []int) { func (*LoginResponse) Descriptor() ([]byte, []int) {
return file_organize_proto_rawDescGZIP(), []int{43} return file_organize_proto_rawDescGZIP(), []int{46}
} }
func (x *LoginResponse) GetUid() string { func (x *LoginResponse) GetUid() string {
@ -2637,7 +2793,7 @@ type LogoutRequest struct {
func (x *LogoutRequest) Reset() { func (x *LogoutRequest) Reset() {
*x = LogoutRequest{} *x = LogoutRequest{}
mi := &file_organize_proto_msgTypes[44] mi := &file_organize_proto_msgTypes[47]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -2649,7 +2805,7 @@ func (x *LogoutRequest) String() string {
func (*LogoutRequest) ProtoMessage() {} func (*LogoutRequest) ProtoMessage() {}
func (x *LogoutRequest) ProtoReflect() protoreflect.Message { func (x *LogoutRequest) ProtoReflect() protoreflect.Message {
mi := &file_organize_proto_msgTypes[44] mi := &file_organize_proto_msgTypes[47]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -2662,7 +2818,7 @@ func (x *LogoutRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use LogoutRequest.ProtoReflect.Descriptor instead. // Deprecated: Use LogoutRequest.ProtoReflect.Descriptor instead.
func (*LogoutRequest) Descriptor() ([]byte, []int) { func (*LogoutRequest) Descriptor() ([]byte, []int) {
return file_organize_proto_rawDescGZIP(), []int{44} return file_organize_proto_rawDescGZIP(), []int{47}
} }
func (x *LogoutRequest) GetToken() string { func (x *LogoutRequest) GetToken() string {
@ -2681,7 +2837,7 @@ type LogoutResponse struct {
func (x *LogoutResponse) Reset() { func (x *LogoutResponse) Reset() {
*x = LogoutResponse{} *x = LogoutResponse{}
mi := &file_organize_proto_msgTypes[45] mi := &file_organize_proto_msgTypes[48]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -2693,7 +2849,7 @@ func (x *LogoutResponse) String() string {
func (*LogoutResponse) ProtoMessage() {} func (*LogoutResponse) ProtoMessage() {}
func (x *LogoutResponse) ProtoReflect() protoreflect.Message { func (x *LogoutResponse) ProtoReflect() protoreflect.Message {
mi := &file_organize_proto_msgTypes[45] mi := &file_organize_proto_msgTypes[48]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -2706,7 +2862,7 @@ func (x *LogoutResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use LogoutResponse.ProtoReflect.Descriptor instead. // Deprecated: Use LogoutResponse.ProtoReflect.Descriptor instead.
func (*LogoutResponse) Descriptor() ([]byte, []int) { func (*LogoutResponse) Descriptor() ([]byte, []int) {
return file_organize_proto_rawDescGZIP(), []int{45} return file_organize_proto_rawDescGZIP(), []int{48}
} }
func (x *LogoutResponse) GetUid() string { func (x *LogoutResponse) GetUid() string {
@ -2720,7 +2876,7 @@ var File_organize_proto protoreflect.FileDescriptor
const file_organize_proto_rawDesc = "" + const file_organize_proto_rawDesc = "" +
"\n" + "\n" +
"\x0eorganize.proto\x12\borganize\x1a\x0faeus/rest.proto\x1a\x17validate/validate.proto\x1a google/protobuf/descriptor.proto\x1a\x1cgoogle/api/annotations.proto\"\xab\b\n" + "\x0eorganize.proto\x12\borganize\x1a\x0faeus/rest.proto\x1a\x17validate/validate.proto\x1a google/protobuf/descriptor.proto\x1a\x1cgoogle/api/annotations.proto\"\xc2\b\n" +
"\x04Menu\x12*\n" + "\x04Menu\x12*\n" +
"\x02id\x18\x01 \x01(\x03B\x1a\xb2\xb9\x19\x16\n" + "\x02id\x18\x01 \x01(\x03B\x1a\xb2\xb9\x19\x16\n" +
"\n" + "\n" +
@ -2729,9 +2885,9 @@ const file_organize_proto_rawDesc = "" +
"created_at\x18\x02 \x01(\x03B\x1f\xb2\xb9\x19\x1b\x12\f创建时间\x1a\vview;exportR\tcreatedAt\x12E\n" + "created_at\x18\x02 \x01(\x03B\x1f\xb2\xb9\x19\x1b\x12\f创建时间\x1a\vview;exportR\tcreatedAt\x12E\n" +
"\n" + "\n" +
"updated_at\x18\x03 \x01(\x03B&\xb2\xb9\x19\"\n" + "updated_at\x18\x03 \x01(\x03B&\xb2\xb9\x19\"\n" +
"\x05index\x12\f更新时间\x1a\vview;exportR\tupdatedAt\x12v\n" + "\x05index\x12\f更新时间\x1a\vview;exportR\tupdatedAt\x12\x91\x01\n" +
"\x06parent\x18\x04 \x01(\tB^\xb2\xb9\x19Z\n" + "\x06parent\x18\x04 \x01(\tBy\xb2\xb9\x19u\n" +
"\rindex;size:60\x12\f父级菜单*\x04menu2\x0freadonly:updateB$type:dropdown;url:/menu/level-labelsR\x06parent\x12^\n" + "\rindex;size:60\x12\f父级菜单\x1a\x19create;update;view;export*\x04menu2\x0freadonly:updateB$type:dropdown;url:/menu/level-labelsR\x06parent\x12^\n" +
"\x04name\x18\x05 \x01(\tBJ\xfaB\x04r\x02\x18<\xb2\xb9\x19?\n" + "\x04name\x18\x05 \x01(\tBJ\xfaB\x04r\x02\x18<\xb2\xb9\x19?\n" +
"\rindex;size:60\x12\f组件名称2\x0freadonly:update:\x0funique;requiredR\x04name\x12C\n" + "\rindex;size:60\x12\f组件名称2\x0freadonly:update:\x0funique;requiredR\x04name\x12C\n" +
"\x05label\x18\x06 \x01(\tB-\xfaB\x04r\x02\x18x\xb2\xb9\x19\"\n" + "\x05label\x18\x06 \x01(\tB-\xfaB\x04r\x02\x18x\xb2\xb9\x19\"\n" +
@ -2744,9 +2900,9 @@ const file_organize_proto_rawDesc = "" +
"\asize:60\x12\f菜单图标\x1a\x19create;update;view;exportR\x04icon\x12E\n" + "\asize:60\x12\f菜单图标\x1a\x19create;update;view;exportR\x04icon\x12E\n" +
"\x06hidden\x18\n" + "\x06hidden\x18\n" +
" \x01(\bB-\xb2\xb9\x19)\x12\f是否隐藏\x1a\x19create;update;view;exportR\x06hidden\x12E\n" + " \x01(\bB-\xb2\xb9\x19)\x12\f是否隐藏\x1a\x19create;update;view;exportR\x06hidden\x12E\n" +
"\x06public\x18\v \x01(\bB-\xb2\xb9\x19)\x12\f是否公开\x1a\x19create;update;view;exportR\x06public\x12q\n" + "\x06public\x18\v \x01(\bB-\xb2\xb9\x19)\x12\f是否公开\x1a\x19create;update;view;exportR\x06public\x12l\n" +
"\vdescription\x18\f \x01(\tBO\xfaB\x05r\x03\x18\x80\b\xb2\xb9\x19C\n" + "\vdescription\x18\f \x01(\tBJ\xfaB\x05r\x03\x18\x80\b\xb2\xb9\x19>\n" +
"\tsize:1024\x12\f备注说明\x1a\x1ecreate;update;view;export;list*\btextareaR\vdescription\x127\n" + "\tsize:1024\x12\f备注说明\x1a\x19create;update;view;export*\btextareaR\vdescription\x127\n" +
"\bposition\x18\r \x01(\x03B\x1b\xb2\xb9\x19\x17\x12\x06排序\x1a\rcreate;updateR\bposition:\v\xba\xb9\x19\a\n" + "\bposition\x18\r \x01(\x03B\x1b\xb2\xb9\x19\x17\x12\x06排序\x1a\rcreate;updateR\bposition:\v\xba\xb9\x19\a\n" +
"\x05menus\"\xd1\x03\n" + "\x05menus\"\xd1\x03\n" +
"\x04Role\x12*\n" + "\x04Role\x12*\n" +
@ -2886,12 +3042,12 @@ const file_organize_proto_rawDesc = "" +
"\x05route\x18\x06 \x01(\tR\x05route\x12\x12\n" + "\x05route\x18\x06 \x01(\tR\x05route\x12\x12\n" +
"\x04view\x18\a \x01(\tR\x04view\x12:\n" + "\x04view\x18\a \x01(\tR\x04view\x12:\n" +
"\vpermissions\x18\b \x03(\v2\x18.organize.PermissionItemR\vpermissions\x12.\n" + "\vpermissions\x18\b \x03(\v2\x18.organize.PermissionItemR\vpermissions\x12.\n" +
"\bchildren\x18\t \x03(\v2\x12.organize.MenuItemR\bchildren\"0\n" + "\bchildren\x18\t \x03(\v2\x12.organize.MenuItemR\bchildren\"4\n" +
"\x0eGetMenuRequest\x12\x1e\n" + "\x12GetUserMenuRequest\x12\x1e\n" +
"\n" + "\n" +
"permission\x18\x01 \x01(\bR\n" + "permission\x18\x01 \x01(\bR\n" +
"permission\"9\n" + "permission\"=\n" +
"\x0fGetMenuResponse\x12&\n" + "\x13GetUserMenuResponse\x12&\n" +
"\x04data\x18\x01 \x03(\v2\x12.organize.MenuItemR\x04data\"%\n" + "\x04data\x18\x01 \x03(\v2\x12.organize.MenuItemR\x04data\"%\n" +
"\x11GetProfileRequest\x12\x10\n" + "\x11GetProfileRequest\x12\x10\n" +
"\x03uid\x18\x01 \x01(\tR\x03uid\"\xbc\x01\n" + "\x03uid\x18\x01 \x01(\tR\x03uid\"\xbc\x01\n" +
@ -2968,7 +3124,16 @@ const file_organize_proto_rawDesc = "" +
"\bchildren\x18\x04 \x03(\v2\x18.organize.MenuLevelValueR\bchildren\"\x1b\n" + "\bchildren\x18\x04 \x03(\v2\x18.organize.MenuLevelValueR\bchildren\"\x1b\n" +
"\x19GetMenuLevelLabelsRequest\"J\n" + "\x19GetMenuLevelLabelsRequest\"J\n" +
"\x1aGetMenuLevelLabelsResponse\x12,\n" + "\x1aGetMenuLevelLabelsResponse\x12,\n" +
"\x04data\x18\x01 \x03(\v2\x18.organize.MenuLevelValueR\x04data\"\\\n" + "\x04data\x18\x01 \x03(\v2\x18.organize.MenuLevelValueR\x04data\"\x8e\x01\n" +
"\tMenuValue\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" +
"\x06parent\x18\x02 \x01(\tR\x06parent\x12\x12\n" +
"\x04name\x18\x03 \x01(\tR\x04name\x12\x14\n" +
"\x05label\x18\x04 \x01(\tR\x05label\x12/\n" +
"\bchildren\x18\x05 \x03(\v2\x13.organize.MenuValueR\bchildren\"\x10\n" +
"\x0eGetMenuRequest\":\n" +
"\x0fGetMenuResponse\x12'\n" +
"\x04data\x18\x01 \x03(\v2\x13.organize.MenuValueR\x04data\"\\\n" +
"\fLoginRequest\x12\x1a\n" + "\fLoginRequest\x12\x1a\n" +
"\busername\x18\x01 \x01(\tR\busername\x12\x1a\n" + "\busername\x18\x01 \x01(\tR\busername\x12\x1a\n" +
"\bpassword\x18\x02 \x01(\tR\bpassword\x12\x14\n" + "\bpassword\x18\x02 \x01(\tR\bpassword\x12\x14\n" +
@ -2981,9 +3146,9 @@ const file_organize_proto_rawDesc = "" +
"\rLogoutRequest\x12\x14\n" + "\rLogoutRequest\x12\x14\n" +
"\x05token\x18\x01 \x01(\tR\x05token\"\"\n" + "\x05token\x18\x01 \x01(\tR\x05token\"\"\n" +
"\x0eLogoutResponse\x12\x10\n" + "\x0eLogoutResponse\x12\x10\n" +
"\x03uid\x18\x01 \x01(\tR\x03uid2\xd4\x05\n" + "\x03uid\x18\x01 \x01(\tR\x03uid2\xdc\x05\n" +
"\vUserService\x12T\n" + "\vUserService\x12\\\n" +
"\bGetMenus\x12\x18.organize.GetMenuRequest\x1a\x19.organize.GetMenuResponse\"\x13\x82\xd3\xe4\x93\x02\r\x12\v/user/menus\x12^\n" + "\bGetMenus\x12\x1c.organize.GetUserMenuRequest\x1a\x1d.organize.GetUserMenuResponse\"\x13\x82\xd3\xe4\x93\x02\r\x12\v/user/menus\x12^\n" +
"\n" + "\n" +
"GetProfile\x12\x1b.organize.GetProfileRequest\x1a\x1c.organize.GetProfileResponse\"\x15\x82\xd3\xe4\x93\x02\x0f\x12\r/user/profile\x12j\n" + "GetProfile\x12\x1b.organize.GetProfileRequest\x1a\x1c.organize.GetProfileResponse\"\x15\x82\xd3\xe4\x93\x02\x0f\x12\r/user/profile\x12j\n" +
"\rUpdateProfile\x12\x1e.organize.UpdateProfileRequest\x1a\x1f.organize.UpdateProfileResponse\"\x18\x82\xd3\xe4\x93\x02\x12:\x01*\x1a\r/user/profile\x12q\n" + "\rUpdateProfile\x12\x1e.organize.UpdateProfileRequest\x1a\x1f.organize.UpdateProfileResponse\"\x18\x82\xd3\xe4\x93\x02\x12:\x01*\x1a\r/user/profile\x12q\n" +
@ -2999,8 +3164,10 @@ const file_organize_proto_rawDesc = "" +
"\vRoleService\x12d\n" + "\vRoleService\x12d\n" +
"\rGetRoleLabels\x12\x1d.organize.GetRoleLabelRequest\x1a\x1e.organize.GetRoleLabelResponse\"\x14\x82\xd3\xe4\x93\x02\x0e\x12\f/role/labels\x12x\n" + "\rGetRoleLabels\x12\x1d.organize.GetRoleLabelRequest\x1a\x1e.organize.GetRoleLabelResponse\"\x14\x82\xd3\xe4\x93\x02\x0e\x12\f/role/labels\x12x\n" +
"\x12GetRolePermissions\x12\".organize.GetRolePermissionRequest\x1a#.organize.GetRolePermissionResponse\"\x19\x82\xd3\xe4\x93\x02\x13\x12\x11/role/permissions\x12}\n" + "\x12GetRolePermissions\x12\".organize.GetRolePermissionRequest\x1a#.organize.GetRolePermissionResponse\"\x19\x82\xd3\xe4\x93\x02\x13\x12\x11/role/permissions\x12}\n" +
"\x12SaveRolePermission\x12#.organize.SaveRolePermissionRequest\x1a$.organize.SaveRolePermissionResponse\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/role/permissions2\x8a\x01\n" + "\x12SaveRolePermission\x12#.organize.SaveRolePermissionRequest\x1a$.organize.SaveRolePermissionResponse\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/role/permissions2\xdf\x01\n" +
"\vMenuService\x12{\n" + "\vMenuService\x12S\n" +
"\bGetMenus\x12\x18.organize.GetMenuRequest\x1a\x19.organize.GetMenuResponse\"\x12\x82\xd3\xe4\x93\x02\f\x12\n" +
"/menu/list\x12{\n" +
"\x12GetMenuLevelLabels\x12#.organize.GetMenuLevelLabelsRequest\x1a$.organize.GetMenuLevelLabelsResponse\"\x1a\x82\xd3\xe4\x93\x02\x14\x12\x12/menu/level-labels2\xbd\x01\n" + "\x12GetMenuLevelLabels\x12#.organize.GetMenuLevelLabelsRequest\x1a$.organize.GetMenuLevelLabelsResponse\"\x1a\x82\xd3\xe4\x93\x02\x14\x12\x12/menu/level-labels2\xbd\x01\n" +
"\vAuthService\x12T\n" + "\vAuthService\x12T\n" +
"\x05Login\x12\x16.organize.LoginRequest\x1a\x17.organize.LoginResponse\"\x1a\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/passport/login\x12X\n" + "\x05Login\x12\x16.organize.LoginRequest\x1a\x17.organize.LoginResponse\"\x1a\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/passport/login\x12X\n" +
@ -3018,7 +3185,7 @@ func file_organize_proto_rawDescGZIP() []byte {
return file_organize_proto_rawDescData return file_organize_proto_rawDescData
} }
var file_organize_proto_msgTypes = make([]protoimpl.MessageInfo, 46) var file_organize_proto_msgTypes = make([]protoimpl.MessageInfo, 49)
var file_organize_proto_goTypes = []any{ var file_organize_proto_goTypes = []any{
(*Menu)(nil), // 0: organize.Menu (*Menu)(nil), // 0: organize.Menu
(*Role)(nil), // 1: organize.Role (*Role)(nil), // 1: organize.Role
@ -3030,8 +3197,8 @@ var file_organize_proto_goTypes = []any{
(*LabelValue)(nil), // 7: organize.LabelValue (*LabelValue)(nil), // 7: organize.LabelValue
(*PermissionItem)(nil), // 8: organize.PermissionItem (*PermissionItem)(nil), // 8: organize.PermissionItem
(*MenuItem)(nil), // 9: organize.MenuItem (*MenuItem)(nil), // 9: organize.MenuItem
(*GetMenuRequest)(nil), // 10: organize.GetMenuRequest (*GetUserMenuRequest)(nil), // 10: organize.GetUserMenuRequest
(*GetMenuResponse)(nil), // 11: organize.GetMenuResponse (*GetUserMenuResponse)(nil), // 11: organize.GetUserMenuResponse
(*GetProfileRequest)(nil), // 12: organize.GetProfileRequest (*GetProfileRequest)(nil), // 12: organize.GetProfileRequest
(*GetProfileResponse)(nil), // 13: organize.GetProfileResponse (*GetProfileResponse)(nil), // 13: organize.GetProfileResponse
(*ResetPasswordRequest)(nil), // 14: organize.ResetPasswordRequest (*ResetPasswordRequest)(nil), // 14: organize.ResetPasswordRequest
@ -3062,15 +3229,18 @@ var file_organize_proto_goTypes = []any{
(*MenuLevelValue)(nil), // 39: organize.MenuLevelValue (*MenuLevelValue)(nil), // 39: organize.MenuLevelValue
(*GetMenuLevelLabelsRequest)(nil), // 40: organize.GetMenuLevelLabelsRequest (*GetMenuLevelLabelsRequest)(nil), // 40: organize.GetMenuLevelLabelsRequest
(*GetMenuLevelLabelsResponse)(nil), // 41: organize.GetMenuLevelLabelsResponse (*GetMenuLevelLabelsResponse)(nil), // 41: organize.GetMenuLevelLabelsResponse
(*LoginRequest)(nil), // 42: organize.LoginRequest (*MenuValue)(nil), // 42: organize.MenuValue
(*LoginResponse)(nil), // 43: organize.LoginResponse (*GetMenuRequest)(nil), // 43: organize.GetMenuRequest
(*LogoutRequest)(nil), // 44: organize.LogoutRequest (*GetMenuResponse)(nil), // 44: organize.GetMenuResponse
(*LogoutResponse)(nil), // 45: organize.LogoutResponse (*LoginRequest)(nil), // 45: organize.LoginRequest
(*LoginResponse)(nil), // 46: organize.LoginResponse
(*LogoutRequest)(nil), // 47: organize.LogoutRequest
(*LogoutResponse)(nil), // 48: organize.LogoutResponse
} }
var file_organize_proto_depIdxs = []int32{ var file_organize_proto_depIdxs = []int32{
8, // 0: organize.MenuItem.permissions:type_name -> organize.PermissionItem 8, // 0: organize.MenuItem.permissions:type_name -> organize.PermissionItem
9, // 1: organize.MenuItem.children:type_name -> organize.MenuItem 9, // 1: organize.MenuItem.children:type_name -> organize.MenuItem
9, // 2: organize.GetMenuResponse.data:type_name -> organize.MenuItem 9, // 2: organize.GetUserMenuResponse.data:type_name -> organize.MenuItem
7, // 3: organize.GetUserLabelResponse.data:type_name -> organize.LabelValue 7, // 3: organize.GetUserLabelResponse.data:type_name -> organize.LabelValue
7, // 4: organize.GetUserTagResponse.data:type_name -> organize.LabelValue 7, // 4: organize.GetUserTagResponse.data:type_name -> organize.LabelValue
25, // 5: organize.DepartmentUserValue.children:type_name -> organize.DepartmentUserValue 25, // 5: organize.DepartmentUserValue.children:type_name -> organize.DepartmentUserValue
@ -3081,43 +3251,47 @@ var file_organize_proto_depIdxs = []int32{
7, // 10: organize.GetRoleLabelResponse.data:type_name -> organize.LabelValue 7, // 10: organize.GetRoleLabelResponse.data:type_name -> organize.LabelValue
39, // 11: organize.MenuLevelValue.children:type_name -> organize.MenuLevelValue 39, // 11: organize.MenuLevelValue.children:type_name -> organize.MenuLevelValue
39, // 12: organize.GetMenuLevelLabelsResponse.data:type_name -> organize.MenuLevelValue 39, // 12: organize.GetMenuLevelLabelsResponse.data:type_name -> organize.MenuLevelValue
10, // 13: organize.UserService.GetMenus:input_type -> organize.GetMenuRequest 42, // 13: organize.MenuValue.children:type_name -> organize.MenuValue
12, // 14: organize.UserService.GetProfile:input_type -> organize.GetProfileRequest 42, // 14: organize.GetMenuResponse.data:type_name -> organize.MenuValue
16, // 15: organize.UserService.UpdateProfile:input_type -> organize.UpdateProfileRequest 10, // 15: organize.UserService.GetMenus:input_type -> organize.GetUserMenuRequest
14, // 16: organize.UserService.ResetPassword:input_type -> organize.ResetPasswordRequest 12, // 16: organize.UserService.GetProfile:input_type -> organize.GetProfileRequest
18, // 17: organize.UserService.GetPermissions:input_type -> organize.GetPermissionRequest 16, // 17: organize.UserService.UpdateProfile:input_type -> organize.UpdateProfileRequest
20, // 18: organize.UserService.GetUserLabels:input_type -> organize.GetUserLabelRequest 14, // 18: organize.UserService.ResetPassword:input_type -> organize.ResetPasswordRequest
22, // 19: organize.UserService.GetUserTags:input_type -> organize.GetUserTagRequest 18, // 19: organize.UserService.GetPermissions:input_type -> organize.GetPermissionRequest
26, // 20: organize.DepartmentService.GetDepartmentLabels:input_type -> organize.GetDepartmentLabelRequest 20, // 20: organize.UserService.GetUserLabels:input_type -> organize.GetUserLabelRequest
28, // 21: organize.DepartmentService.GetDepartmentUsers:input_type -> organize.GetDepartmentUserRequest 22, // 21: organize.UserService.GetUserTags:input_type -> organize.GetUserTagRequest
31, // 22: organize.DepartmentService.GetDepartmentLevelLabels:input_type -> organize.GetDepartmentLevelLabelsRequest 26, // 22: organize.DepartmentService.GetDepartmentLabels:input_type -> organize.GetDepartmentLabelRequest
33, // 23: organize.RoleService.GetRoleLabels:input_type -> organize.GetRoleLabelRequest 28, // 23: organize.DepartmentService.GetDepartmentUsers:input_type -> organize.GetDepartmentUserRequest
35, // 24: organize.RoleService.GetRolePermissions:input_type -> organize.GetRolePermissionRequest 31, // 24: organize.DepartmentService.GetDepartmentLevelLabels:input_type -> organize.GetDepartmentLevelLabelsRequest
37, // 25: organize.RoleService.SaveRolePermission:input_type -> organize.SaveRolePermissionRequest 33, // 25: organize.RoleService.GetRoleLabels:input_type -> organize.GetRoleLabelRequest
40, // 26: organize.MenuService.GetMenuLevelLabels:input_type -> organize.GetMenuLevelLabelsRequest 35, // 26: organize.RoleService.GetRolePermissions:input_type -> organize.GetRolePermissionRequest
42, // 27: organize.AuthService.Login:input_type -> organize.LoginRequest 37, // 27: organize.RoleService.SaveRolePermission:input_type -> organize.SaveRolePermissionRequest
44, // 28: organize.AuthService.Logout:input_type -> organize.LogoutRequest 43, // 28: organize.MenuService.GetMenus:input_type -> organize.GetMenuRequest
11, // 29: organize.UserService.GetMenus:output_type -> organize.GetMenuResponse 40, // 29: organize.MenuService.GetMenuLevelLabels:input_type -> organize.GetMenuLevelLabelsRequest
13, // 30: organize.UserService.GetProfile:output_type -> organize.GetProfileResponse 45, // 30: organize.AuthService.Login:input_type -> organize.LoginRequest
17, // 31: organize.UserService.UpdateProfile:output_type -> organize.UpdateProfileResponse 47, // 31: organize.AuthService.Logout:input_type -> organize.LogoutRequest
15, // 32: organize.UserService.ResetPassword:output_type -> organize.ResetPasswordResponse 11, // 32: organize.UserService.GetMenus:output_type -> organize.GetUserMenuResponse
19, // 33: organize.UserService.GetPermissions:output_type -> organize.GetPermissionResponse 13, // 33: organize.UserService.GetProfile:output_type -> organize.GetProfileResponse
21, // 34: organize.UserService.GetUserLabels:output_type -> organize.GetUserLabelResponse 17, // 34: organize.UserService.UpdateProfile:output_type -> organize.UpdateProfileResponse
23, // 35: organize.UserService.GetUserTags:output_type -> organize.GetUserTagResponse 15, // 35: organize.UserService.ResetPassword:output_type -> organize.ResetPasswordResponse
27, // 36: organize.DepartmentService.GetDepartmentLabels:output_type -> organize.GetDepartmentLabelResponse 19, // 36: organize.UserService.GetPermissions:output_type -> organize.GetPermissionResponse
29, // 37: organize.DepartmentService.GetDepartmentUsers:output_type -> organize.GetDepartmentUserResponse 21, // 37: organize.UserService.GetUserLabels:output_type -> organize.GetUserLabelResponse
32, // 38: organize.DepartmentService.GetDepartmentLevelLabels:output_type -> organize.GetDepartmentLevelLabelsResponse 23, // 38: organize.UserService.GetUserTags:output_type -> organize.GetUserTagResponse
34, // 39: organize.RoleService.GetRoleLabels:output_type -> organize.GetRoleLabelResponse 27, // 39: organize.DepartmentService.GetDepartmentLabels:output_type -> organize.GetDepartmentLabelResponse
36, // 40: organize.RoleService.GetRolePermissions:output_type -> organize.GetRolePermissionResponse 29, // 40: organize.DepartmentService.GetDepartmentUsers:output_type -> organize.GetDepartmentUserResponse
38, // 41: organize.RoleService.SaveRolePermission:output_type -> organize.SaveRolePermissionResponse 32, // 41: organize.DepartmentService.GetDepartmentLevelLabels:output_type -> organize.GetDepartmentLevelLabelsResponse
41, // 42: organize.MenuService.GetMenuLevelLabels:output_type -> organize.GetMenuLevelLabelsResponse 34, // 42: organize.RoleService.GetRoleLabels:output_type -> organize.GetRoleLabelResponse
43, // 43: organize.AuthService.Login:output_type -> organize.LoginResponse 36, // 43: organize.RoleService.GetRolePermissions:output_type -> organize.GetRolePermissionResponse
45, // 44: organize.AuthService.Logout:output_type -> organize.LogoutResponse 38, // 44: organize.RoleService.SaveRolePermission:output_type -> organize.SaveRolePermissionResponse
29, // [29:45] is the sub-list for method output_type 44, // 45: organize.MenuService.GetMenus:output_type -> organize.GetMenuResponse
13, // [13:29] is the sub-list for method input_type 41, // 46: organize.MenuService.GetMenuLevelLabels:output_type -> organize.GetMenuLevelLabelsResponse
13, // [13:13] is the sub-list for extension type_name 46, // 47: organize.AuthService.Login:output_type -> organize.LoginResponse
13, // [13:13] is the sub-list for extension extendee 48, // 48: organize.AuthService.Logout:output_type -> organize.LogoutResponse
0, // [0:13] is the sub-list for field type_name 32, // [32:49] is the sub-list for method output_type
15, // [15:32] is the sub-list for method input_type
15, // [15:15] is the sub-list for extension type_name
15, // [15:15] is the sub-list for extension extendee
0, // [0:15] is the sub-list for field type_name
} }
func init() { file_organize_proto_init() } func init() { file_organize_proto_init() }
@ -3131,7 +3305,7 @@ func file_organize_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_organize_proto_rawDesc), len(file_organize_proto_rawDesc)), RawDescriptor: unsafe.Slice(unsafe.StringData(file_organize_proto_rawDesc), len(file_organize_proto_rawDesc)),
NumEnums: 0, NumEnums: 0,
NumMessages: 46, NumMessages: 49,
NumExtensions: 0, NumExtensions: 0,
NumServices: 5, NumServices: 5,
}, },

View File

@ -1445,22 +1445,22 @@ var _ interface {
ErrorName() string ErrorName() string
} = MenuItemValidationError{} } = MenuItemValidationError{}
// Validate checks the field values on GetMenuRequest with the rules defined in // Validate checks the field values on GetUserMenuRequest with the rules
// the proto definition for this message. If any rules are violated, the first // defined in the proto definition for this message. If any rules are
// error encountered is returned, or nil if there are no violations. // violated, the first error encountered is returned, or nil if there are no violations.
func (m *GetMenuRequest) Validate() error { func (m *GetUserMenuRequest) Validate() error {
return m.validate(false) return m.validate(false)
} }
// ValidateAll checks the field values on GetMenuRequest with the rules defined // ValidateAll checks the field values on GetUserMenuRequest with the rules
// in the proto definition for this message. If any rules are violated, the // defined in the proto definition for this message. If any rules are
// result is a list of violation errors wrapped in GetMenuRequestMultiError, // violated, the result is a list of violation errors wrapped in
// or nil if none found. // GetUserMenuRequestMultiError, or nil if none found.
func (m *GetMenuRequest) ValidateAll() error { func (m *GetUserMenuRequest) ValidateAll() error {
return m.validate(true) return m.validate(true)
} }
func (m *GetMenuRequest) validate(all bool) error { func (m *GetUserMenuRequest) validate(all bool) error {
if m == nil { if m == nil {
return nil return nil
} }
@ -1470,19 +1470,19 @@ func (m *GetMenuRequest) validate(all bool) error {
// no validation rules for Permission // no validation rules for Permission
if len(errors) > 0 { if len(errors) > 0 {
return GetMenuRequestMultiError(errors) return GetUserMenuRequestMultiError(errors)
} }
return nil return nil
} }
// GetMenuRequestMultiError is an error wrapping multiple validation errors // GetUserMenuRequestMultiError is an error wrapping multiple validation errors
// returned by GetMenuRequest.ValidateAll() if the designated constraints // returned by GetUserMenuRequest.ValidateAll() if the designated constraints
// aren't met. // aren't met.
type GetMenuRequestMultiError []error type GetUserMenuRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps. // Error returns a concatenation of all the error messages it wraps.
func (m GetMenuRequestMultiError) Error() string { func (m GetUserMenuRequestMultiError) Error() string {
msgs := make([]string, 0, len(m)) msgs := make([]string, 0, len(m))
for _, err := range m { for _, err := range m {
msgs = append(msgs, err.Error()) msgs = append(msgs, err.Error())
@ -1491,11 +1491,11 @@ func (m GetMenuRequestMultiError) Error() string {
} }
// AllErrors returns a list of validation violation errors. // AllErrors returns a list of validation violation errors.
func (m GetMenuRequestMultiError) AllErrors() []error { return m } func (m GetUserMenuRequestMultiError) AllErrors() []error { return m }
// GetMenuRequestValidationError is the validation error returned by // GetUserMenuRequestValidationError is the validation error returned by
// GetMenuRequest.Validate if the designated constraints aren't met. // GetUserMenuRequest.Validate if the designated constraints aren't met.
type GetMenuRequestValidationError struct { type GetUserMenuRequestValidationError struct {
field string field string
reason string reason string
cause error cause error
@ -1503,22 +1503,24 @@ type GetMenuRequestValidationError struct {
} }
// Field function returns field value. // Field function returns field value.
func (e GetMenuRequestValidationError) Field() string { return e.field } func (e GetUserMenuRequestValidationError) Field() string { return e.field }
// Reason function returns reason value. // Reason function returns reason value.
func (e GetMenuRequestValidationError) Reason() string { return e.reason } func (e GetUserMenuRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value. // Cause function returns cause value.
func (e GetMenuRequestValidationError) Cause() error { return e.cause } func (e GetUserMenuRequestValidationError) Cause() error { return e.cause }
// Key function returns key value. // Key function returns key value.
func (e GetMenuRequestValidationError) Key() bool { return e.key } func (e GetUserMenuRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name. // ErrorName returns error name.
func (e GetMenuRequestValidationError) ErrorName() string { return "GetMenuRequestValidationError" } func (e GetUserMenuRequestValidationError) ErrorName() string {
return "GetUserMenuRequestValidationError"
}
// Error satisfies the builtin error interface // Error satisfies the builtin error interface
func (e GetMenuRequestValidationError) Error() string { func (e GetUserMenuRequestValidationError) Error() string {
cause := "" cause := ""
if e.cause != nil { if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause) cause = fmt.Sprintf(" | caused by: %v", e.cause)
@ -1530,14 +1532,14 @@ func (e GetMenuRequestValidationError) Error() string {
} }
return fmt.Sprintf( return fmt.Sprintf(
"invalid %sGetMenuRequest.%s: %s%s", "invalid %sGetUserMenuRequest.%s: %s%s",
key, key,
e.field, e.field,
e.reason, e.reason,
cause) cause)
} }
var _ error = GetMenuRequestValidationError{} var _ error = GetUserMenuRequestValidationError{}
var _ interface { var _ interface {
Field() string Field() string
@ -1545,24 +1547,24 @@ var _ interface {
Key() bool Key() bool
Cause() error Cause() error
ErrorName() string ErrorName() string
} = GetMenuRequestValidationError{} } = GetUserMenuRequestValidationError{}
// Validate checks the field values on GetMenuResponse with the rules defined // Validate checks the field values on GetUserMenuResponse with the rules
// in the proto definition for this message. If any rules are violated, the // defined in the proto definition for this message. If any rules are
// first error encountered is returned, or nil if there are no violations. // violated, the first error encountered is returned, or nil if there are no violations.
func (m *GetMenuResponse) Validate() error { func (m *GetUserMenuResponse) Validate() error {
return m.validate(false) return m.validate(false)
} }
// ValidateAll checks the field values on GetMenuResponse with the rules // ValidateAll checks the field values on GetUserMenuResponse with the rules
// defined in the proto definition for this message. If any rules are // defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in // violated, the result is a list of violation errors wrapped in
// GetMenuResponseMultiError, or nil if none found. // GetUserMenuResponseMultiError, or nil if none found.
func (m *GetMenuResponse) ValidateAll() error { func (m *GetUserMenuResponse) ValidateAll() error {
return m.validate(true) return m.validate(true)
} }
func (m *GetMenuResponse) validate(all bool) error { func (m *GetUserMenuResponse) validate(all bool) error {
if m == nil { if m == nil {
return nil return nil
} }
@ -1576,7 +1578,7 @@ func (m *GetMenuResponse) validate(all bool) error {
switch v := interface{}(item).(type) { switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }: case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil { if err := v.ValidateAll(); err != nil {
errors = append(errors, GetMenuResponseValidationError{ errors = append(errors, GetUserMenuResponseValidationError{
field: fmt.Sprintf("Data[%v]", idx), field: fmt.Sprintf("Data[%v]", idx),
reason: "embedded message failed validation", reason: "embedded message failed validation",
cause: err, cause: err,
@ -1584,7 +1586,7 @@ func (m *GetMenuResponse) validate(all bool) error {
} }
case interface{ Validate() error }: case interface{ Validate() error }:
if err := v.Validate(); err != nil { if err := v.Validate(); err != nil {
errors = append(errors, GetMenuResponseValidationError{ errors = append(errors, GetUserMenuResponseValidationError{
field: fmt.Sprintf("Data[%v]", idx), field: fmt.Sprintf("Data[%v]", idx),
reason: "embedded message failed validation", reason: "embedded message failed validation",
cause: err, cause: err,
@ -1593,7 +1595,7 @@ func (m *GetMenuResponse) validate(all bool) error {
} }
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil { if err := v.Validate(); err != nil {
return GetMenuResponseValidationError{ return GetUserMenuResponseValidationError{
field: fmt.Sprintf("Data[%v]", idx), field: fmt.Sprintf("Data[%v]", idx),
reason: "embedded message failed validation", reason: "embedded message failed validation",
cause: err, cause: err,
@ -1604,19 +1606,19 @@ func (m *GetMenuResponse) validate(all bool) error {
} }
if len(errors) > 0 { if len(errors) > 0 {
return GetMenuResponseMultiError(errors) return GetUserMenuResponseMultiError(errors)
} }
return nil return nil
} }
// GetMenuResponseMultiError is an error wrapping multiple validation errors // GetUserMenuResponseMultiError is an error wrapping multiple validation
// returned by GetMenuResponse.ValidateAll() if the designated constraints // errors returned by GetUserMenuResponse.ValidateAll() if the designated
// aren't met. // constraints aren't met.
type GetMenuResponseMultiError []error type GetUserMenuResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps. // Error returns a concatenation of all the error messages it wraps.
func (m GetMenuResponseMultiError) Error() string { func (m GetUserMenuResponseMultiError) Error() string {
msgs := make([]string, 0, len(m)) msgs := make([]string, 0, len(m))
for _, err := range m { for _, err := range m {
msgs = append(msgs, err.Error()) msgs = append(msgs, err.Error())
@ -1625,11 +1627,11 @@ func (m GetMenuResponseMultiError) Error() string {
} }
// AllErrors returns a list of validation violation errors. // AllErrors returns a list of validation violation errors.
func (m GetMenuResponseMultiError) AllErrors() []error { return m } func (m GetUserMenuResponseMultiError) AllErrors() []error { return m }
// GetMenuResponseValidationError is the validation error returned by // GetUserMenuResponseValidationError is the validation error returned by
// GetMenuResponse.Validate if the designated constraints aren't met. // GetUserMenuResponse.Validate if the designated constraints aren't met.
type GetMenuResponseValidationError struct { type GetUserMenuResponseValidationError struct {
field string field string
reason string reason string
cause error cause error
@ -1637,22 +1639,24 @@ type GetMenuResponseValidationError struct {
} }
// Field function returns field value. // Field function returns field value.
func (e GetMenuResponseValidationError) Field() string { return e.field } func (e GetUserMenuResponseValidationError) Field() string { return e.field }
// Reason function returns reason value. // Reason function returns reason value.
func (e GetMenuResponseValidationError) Reason() string { return e.reason } func (e GetUserMenuResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value. // Cause function returns cause value.
func (e GetMenuResponseValidationError) Cause() error { return e.cause } func (e GetUserMenuResponseValidationError) Cause() error { return e.cause }
// Key function returns key value. // Key function returns key value.
func (e GetMenuResponseValidationError) Key() bool { return e.key } func (e GetUserMenuResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name. // ErrorName returns error name.
func (e GetMenuResponseValidationError) ErrorName() string { return "GetMenuResponseValidationError" } func (e GetUserMenuResponseValidationError) ErrorName() string {
return "GetUserMenuResponseValidationError"
}
// Error satisfies the builtin error interface // Error satisfies the builtin error interface
func (e GetMenuResponseValidationError) Error() string { func (e GetUserMenuResponseValidationError) Error() string {
cause := "" cause := ""
if e.cause != nil { if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause) cause = fmt.Sprintf(" | caused by: %v", e.cause)
@ -1664,14 +1668,14 @@ func (e GetMenuResponseValidationError) Error() string {
} }
return fmt.Sprintf( return fmt.Sprintf(
"invalid %sGetMenuResponse.%s: %s%s", "invalid %sGetUserMenuResponse.%s: %s%s",
key, key,
e.field, e.field,
e.reason, e.reason,
cause) cause)
} }
var _ error = GetMenuResponseValidationError{} var _ error = GetUserMenuResponseValidationError{}
var _ interface { var _ interface {
Field() string Field() string
@ -1679,7 +1683,7 @@ var _ interface {
Key() bool Key() bool
Cause() error Cause() error
ErrorName() string ErrorName() string
} = GetMenuResponseValidationError{} } = GetUserMenuResponseValidationError{}
// Validate checks the field values on GetProfileRequest with the rules defined // Validate checks the field values on GetProfileRequest with the rules defined
// in the proto definition for this message. If any rules are violated, the // in the proto definition for this message. If any rules are violated, the
@ -5149,6 +5153,381 @@ var _ interface {
ErrorName() string ErrorName() string
} = GetMenuLevelLabelsResponseValidationError{} } = GetMenuLevelLabelsResponseValidationError{}
// Validate checks the field values on MenuValue with the rules defined in the
// proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *MenuValue) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on MenuValue with the rules defined in
// the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in MenuValueMultiError, or nil
// if none found.
func (m *MenuValue) ValidateAll() error {
return m.validate(true)
}
func (m *MenuValue) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Id
// no validation rules for Parent
// no validation rules for Name
// no validation rules for Label
for idx, item := range m.GetChildren() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, MenuValueValidationError{
field: fmt.Sprintf("Children[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, MenuValueValidationError{
field: fmt.Sprintf("Children[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return MenuValueValidationError{
field: fmt.Sprintf("Children[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return MenuValueMultiError(errors)
}
return nil
}
// MenuValueMultiError is an error wrapping multiple validation errors returned
// by MenuValue.ValidateAll() if the designated constraints aren't met.
type MenuValueMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m MenuValueMultiError) Error() string {
msgs := make([]string, 0, len(m))
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m MenuValueMultiError) AllErrors() []error { return m }
// MenuValueValidationError is the validation error returned by
// MenuValue.Validate if the designated constraints aren't met.
type MenuValueValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e MenuValueValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e MenuValueValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e MenuValueValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e MenuValueValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e MenuValueValidationError) ErrorName() string { return "MenuValueValidationError" }
// Error satisfies the builtin error interface
func (e MenuValueValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sMenuValue.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = MenuValueValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = MenuValueValidationError{}
// Validate checks the field values on GetMenuRequest with the rules defined in
// the proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *GetMenuRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on GetMenuRequest with the rules defined
// in the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in GetMenuRequestMultiError,
// or nil if none found.
func (m *GetMenuRequest) ValidateAll() error {
return m.validate(true)
}
func (m *GetMenuRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(errors) > 0 {
return GetMenuRequestMultiError(errors)
}
return nil
}
// GetMenuRequestMultiError is an error wrapping multiple validation errors
// returned by GetMenuRequest.ValidateAll() if the designated constraints
// aren't met.
type GetMenuRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m GetMenuRequestMultiError) Error() string {
msgs := make([]string, 0, len(m))
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m GetMenuRequestMultiError) AllErrors() []error { return m }
// GetMenuRequestValidationError is the validation error returned by
// GetMenuRequest.Validate if the designated constraints aren't met.
type GetMenuRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetMenuRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetMenuRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetMenuRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetMenuRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetMenuRequestValidationError) ErrorName() string { return "GetMenuRequestValidationError" }
// Error satisfies the builtin error interface
func (e GetMenuRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sGetMenuRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetMenuRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetMenuRequestValidationError{}
// Validate checks the field values on GetMenuResponse with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *GetMenuResponse) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on GetMenuResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// GetMenuResponseMultiError, or nil if none found.
func (m *GetMenuResponse) ValidateAll() error {
return m.validate(true)
}
func (m *GetMenuResponse) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetData() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, GetMenuResponseValidationError{
field: fmt.Sprintf("Data[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, GetMenuResponseValidationError{
field: fmt.Sprintf("Data[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GetMenuResponseValidationError{
field: fmt.Sprintf("Data[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return GetMenuResponseMultiError(errors)
}
return nil
}
// GetMenuResponseMultiError is an error wrapping multiple validation errors
// returned by GetMenuResponse.ValidateAll() if the designated constraints
// aren't met.
type GetMenuResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m GetMenuResponseMultiError) Error() string {
msgs := make([]string, 0, len(m))
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m GetMenuResponseMultiError) AllErrors() []error { return m }
// GetMenuResponseValidationError is the validation error returned by
// GetMenuResponse.Validate if the designated constraints aren't met.
type GetMenuResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetMenuResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetMenuResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetMenuResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetMenuResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetMenuResponseValidationError) ErrorName() string { return "GetMenuResponseValidationError" }
// Error satisfies the builtin error interface
func (e GetMenuResponseValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sGetMenuResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetMenuResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetMenuResponseValidationError{}
// Validate checks the field values on LoginRequest with the rules defined in // Validate checks the field values on LoginRequest with the rules defined in
// the proto definition for this message. If any rules are violated, the first // the proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations. // error encountered is returned, or nil if there are no violations.

View File

@ -17,7 +17,7 @@ message Menu {
int64 id = 1 [(aeus.field) = {gorm:"primaryKey",comment:"菜单ID"}]; int64 id = 1 [(aeus.field) = {gorm:"primaryKey",comment:"菜单ID"}];
int64 created_at = 2 [(aeus.field)={scenarios:"view;export",comment:"创建时间"}]; int64 created_at = 2 [(aeus.field)={scenarios:"view;export",comment:"创建时间"}];
int64 updated_at = 3 [(aeus.field)={gorm:"index",scenarios:"view;export",comment:"更新时间"}]; int64 updated_at = 3 [(aeus.field)={gorm:"index",scenarios:"view;export",comment:"更新时间"}];
string parent = 4 [(aeus.field)={gorm:"index;size:60",props:"readonly:update",live:"type:dropdown;url:/menu/level-labels",format:"menu",comment:"父级菜单"}]; string parent = 4 [(aeus.field)={gorm:"index;size:60",scenarios:"create;update;view;export",props:"readonly:update",live:"type:dropdown;url:/menu/level-labels",format:"menu",comment:"父级菜单"}];
string name = 5 [(aeus.field)={gorm:"index;size:60",props:"readonly:update",rule:"unique;required",comment: "组件名称"},(validate.rules).string = {max_len: 60}]; string name = 5 [(aeus.field)={gorm:"index;size:60",props:"readonly:update",rule:"unique;required",comment: "组件名称"},(validate.rules).string = {max_len: 60}];
string label = 6 [(aeus.field)={gorm:"size:120",rule:"required",comment: "菜单标题"},(validate.rules).string = {max_len: 120}]; string label = 6 [(aeus.field)={gorm:"size:120",rule:"required",comment: "菜单标题"},(validate.rules).string = {max_len: 120}];
string uri = 7 [(aeus.field)={gorm:"size:512",rule:"required",scenarios:"create;update;view;export",comment: "菜单链接"},(validate.rules).string = {max_len: 512}]; string uri = 7 [(aeus.field)={gorm:"size:512",rule:"required",scenarios:"create;update;view;export",comment: "菜单链接"},(validate.rules).string = {max_len: 512}];
@ -25,7 +25,7 @@ message Menu {
string icon = 9 [(aeus.field)={gorm:"size:60",scenarios:"create;update;view;export",comment: "菜单图标"},(validate.rules).string = {max_len: 60}]; string icon = 9 [(aeus.field)={gorm:"size:60",scenarios:"create;update;view;export",comment: "菜单图标"},(validate.rules).string = {max_len: 60}];
bool hidden = 10 [(aeus.field)={scenarios:"create;update;view;export",comment:"是否隐藏"}]; bool hidden = 10 [(aeus.field)={scenarios:"create;update;view;export",comment:"是否隐藏"}];
bool public = 11 [(aeus.field)={scenarios:"create;update;view;export",comment:"是否公开"}]; bool public = 11 [(aeus.field)={scenarios:"create;update;view;export",comment:"是否公开"}];
string description = 12 [(aeus.field)={gorm:"size:1024",scenarios:"create;update;view;export;list",format:"textarea",comment: "备注说明"},(validate.rules).string = {max_len: 1024}]; string description = 12 [(aeus.field)={gorm:"size:1024",scenarios:"create;update;view;export",format:"textarea",comment: "备注说明"},(validate.rules).string = {max_len: 1024}];
int64 position = 13 [(aeus.field)={comment:"排序",scenarios:"create;update"}]; int64 position = 13 [(aeus.field)={comment:"排序",scenarios:"create;update"}];
} }
@ -139,12 +139,12 @@ message MenuItem {
} }
// //
message GetMenuRequest { message GetUserMenuRequest {
bool permission = 1; bool permission = 1;
} }
// //
message GetMenuResponse { message GetUserMenuResponse {
repeated MenuItem data = 1; repeated MenuItem data = 1;
} }
@ -213,7 +213,7 @@ message GetUserTagResponse {
// //
service UserService { service UserService {
// //
rpc GetMenus(GetMenuRequest) returns (GetMenuResponse) { rpc GetMenus(GetUserMenuRequest) returns (GetUserMenuResponse) {
option (google.api.http) = { option (google.api.http) = {
get: "/user/menus" get: "/user/menus"
}; };
@ -377,7 +377,28 @@ message GetMenuLevelLabelsResponse {
repeated MenuLevelValue data = 1; repeated MenuLevelValue data = 1;
} }
message MenuValue {
int64 id = 1;
string parent = 2;
string name = 3;
string label = 4;
repeated MenuValue children = 5;
}
message GetMenuRequest{
}
message GetMenuResponse{
repeated MenuValue data = 1;
}
service MenuService { service MenuService {
rpc GetMenus(GetMenuRequest) returns (GetMenuResponse) {
option (google.api.http) = {
get: "/menu/list"
};
}
rpc GetMenuLevelLabels(GetMenuLevelLabelsRequest) returns (GetMenuLevelLabelsResponse) { rpc GetMenuLevelLabels(GetMenuLevelLabelsRequest) returns (GetMenuLevelLabelsResponse) {
option (google.api.http) = { option (google.api.http) = {
get: "/menu/level-labels" get: "/menu/level-labels"

View File

@ -35,7 +35,7 @@ const (
// 用户服务 // 用户服务
type UserServiceClient interface { type UserServiceClient interface {
// 获取用户菜单 // 获取用户菜单
GetMenus(ctx context.Context, in *GetMenuRequest, opts ...grpc.CallOption) (*GetMenuResponse, error) GetMenus(ctx context.Context, in *GetUserMenuRequest, opts ...grpc.CallOption) (*GetUserMenuResponse, error)
// 获取用户信息 // 获取用户信息
GetProfile(ctx context.Context, in *GetProfileRequest, opts ...grpc.CallOption) (*GetProfileResponse, error) GetProfile(ctx context.Context, in *GetProfileRequest, opts ...grpc.CallOption) (*GetProfileResponse, error)
// 更新用户信息 // 更新用户信息
@ -58,9 +58,9 @@ func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient {
return &userServiceClient{cc} return &userServiceClient{cc}
} }
func (c *userServiceClient) GetMenus(ctx context.Context, in *GetMenuRequest, opts ...grpc.CallOption) (*GetMenuResponse, error) { func (c *userServiceClient) GetMenus(ctx context.Context, in *GetUserMenuRequest, opts ...grpc.CallOption) (*GetUserMenuResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetMenuResponse) out := new(GetUserMenuResponse)
err := c.cc.Invoke(ctx, UserService_GetMenus_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, UserService_GetMenus_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -135,7 +135,7 @@ func (c *userServiceClient) GetUserTags(ctx context.Context, in *GetUserTagReque
// 用户服务 // 用户服务
type UserServiceServer interface { type UserServiceServer interface {
// 获取用户菜单 // 获取用户菜单
GetMenus(context.Context, *GetMenuRequest) (*GetMenuResponse, error) GetMenus(context.Context, *GetUserMenuRequest) (*GetUserMenuResponse, error)
// 获取用户信息 // 获取用户信息
GetProfile(context.Context, *GetProfileRequest) (*GetProfileResponse, error) GetProfile(context.Context, *GetProfileRequest) (*GetProfileResponse, error)
// 更新用户信息 // 更新用户信息
@ -158,7 +158,7 @@ type UserServiceServer interface {
// pointer dereference when methods are called. // pointer dereference when methods are called.
type UnimplementedUserServiceServer struct{} type UnimplementedUserServiceServer struct{}
func (UnimplementedUserServiceServer) GetMenus(context.Context, *GetMenuRequest) (*GetMenuResponse, error) { func (UnimplementedUserServiceServer) GetMenus(context.Context, *GetUserMenuRequest) (*GetUserMenuResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetMenus not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetMenus not implemented")
} }
func (UnimplementedUserServiceServer) GetProfile(context.Context, *GetProfileRequest) (*GetProfileResponse, error) { func (UnimplementedUserServiceServer) GetProfile(context.Context, *GetProfileRequest) (*GetProfileResponse, error) {
@ -201,7 +201,7 @@ func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) {
} }
func _UserService_GetMenus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _UserService_GetMenus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetMenuRequest) in := new(GetUserMenuRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
@ -213,7 +213,7 @@ func _UserService_GetMenus_Handler(srv interface{}, ctx context.Context, dec fun
FullMethod: UserService_GetMenus_FullMethodName, FullMethod: UserService_GetMenus_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).GetMenus(ctx, req.(*GetMenuRequest)) return srv.(UserServiceServer).GetMenus(ctx, req.(*GetUserMenuRequest))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
@ -729,6 +729,7 @@ var RoleService_ServiceDesc = grpc.ServiceDesc{
} }
const ( const (
MenuService_GetMenus_FullMethodName = "/organize.MenuService/GetMenus"
MenuService_GetMenuLevelLabels_FullMethodName = "/organize.MenuService/GetMenuLevelLabels" MenuService_GetMenuLevelLabels_FullMethodName = "/organize.MenuService/GetMenuLevelLabels"
) )
@ -736,6 +737,7 @@ const (
// //
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type MenuServiceClient interface { type MenuServiceClient interface {
GetMenus(ctx context.Context, in *GetMenuRequest, opts ...grpc.CallOption) (*GetMenuResponse, error)
GetMenuLevelLabels(ctx context.Context, in *GetMenuLevelLabelsRequest, opts ...grpc.CallOption) (*GetMenuLevelLabelsResponse, error) GetMenuLevelLabels(ctx context.Context, in *GetMenuLevelLabelsRequest, opts ...grpc.CallOption) (*GetMenuLevelLabelsResponse, error)
} }
@ -747,6 +749,16 @@ func NewMenuServiceClient(cc grpc.ClientConnInterface) MenuServiceClient {
return &menuServiceClient{cc} return &menuServiceClient{cc}
} }
func (c *menuServiceClient) GetMenus(ctx context.Context, in *GetMenuRequest, opts ...grpc.CallOption) (*GetMenuResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetMenuResponse)
err := c.cc.Invoke(ctx, MenuService_GetMenus_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *menuServiceClient) GetMenuLevelLabels(ctx context.Context, in *GetMenuLevelLabelsRequest, opts ...grpc.CallOption) (*GetMenuLevelLabelsResponse, error) { func (c *menuServiceClient) GetMenuLevelLabels(ctx context.Context, in *GetMenuLevelLabelsRequest, opts ...grpc.CallOption) (*GetMenuLevelLabelsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetMenuLevelLabelsResponse) out := new(GetMenuLevelLabelsResponse)
@ -761,6 +773,7 @@ func (c *menuServiceClient) GetMenuLevelLabels(ctx context.Context, in *GetMenuL
// All implementations must embed UnimplementedMenuServiceServer // All implementations must embed UnimplementedMenuServiceServer
// for forward compatibility. // for forward compatibility.
type MenuServiceServer interface { type MenuServiceServer interface {
GetMenus(context.Context, *GetMenuRequest) (*GetMenuResponse, error)
GetMenuLevelLabels(context.Context, *GetMenuLevelLabelsRequest) (*GetMenuLevelLabelsResponse, error) GetMenuLevelLabels(context.Context, *GetMenuLevelLabelsRequest) (*GetMenuLevelLabelsResponse, error)
mustEmbedUnimplementedMenuServiceServer() mustEmbedUnimplementedMenuServiceServer()
} }
@ -772,6 +785,9 @@ type MenuServiceServer interface {
// pointer dereference when methods are called. // pointer dereference when methods are called.
type UnimplementedMenuServiceServer struct{} type UnimplementedMenuServiceServer struct{}
func (UnimplementedMenuServiceServer) GetMenus(context.Context, *GetMenuRequest) (*GetMenuResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetMenus not implemented")
}
func (UnimplementedMenuServiceServer) GetMenuLevelLabels(context.Context, *GetMenuLevelLabelsRequest) (*GetMenuLevelLabelsResponse, error) { func (UnimplementedMenuServiceServer) GetMenuLevelLabels(context.Context, *GetMenuLevelLabelsRequest) (*GetMenuLevelLabelsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetMenuLevelLabels not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetMenuLevelLabels not implemented")
} }
@ -796,6 +812,24 @@ func RegisterMenuServiceServer(s grpc.ServiceRegistrar, srv MenuServiceServer) {
s.RegisterService(&MenuService_ServiceDesc, srv) s.RegisterService(&MenuService_ServiceDesc, srv)
} }
func _MenuService_GetMenus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetMenuRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MenuServiceServer).GetMenus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: MenuService_GetMenus_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MenuServiceServer).GetMenus(ctx, req.(*GetMenuRequest))
}
return interceptor(ctx, in, info, handler)
}
func _MenuService_GetMenuLevelLabels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _MenuService_GetMenuLevelLabels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetMenuLevelLabelsRequest) in := new(GetMenuLevelLabelsRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -821,6 +855,10 @@ var MenuService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "organize.MenuService", ServiceName: "organize.MenuService",
HandlerType: (*MenuServiceServer)(nil), HandlerType: (*MenuServiceServer)(nil),
Methods: []grpc.MethodDesc{ Methods: []grpc.MethodDesc{
{
MethodName: "GetMenus",
Handler: _MenuService_GetMenus_Handler,
},
{ {
MethodName: "GetMenuLevelLabels", MethodName: "GetMenuLevelLabels",
Handler: _MenuService_GetMenuLevelLabels_Handler, Handler: _MenuService_GetMenuLevelLabels_Handler,

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-aeus. DO NOT EDIT. // Code generated by protoc-gen-go-aeus. DO NOT EDIT.
// source: organize.proto // source: organize.proto
// date: 2025-06-19 11:06:34 // date: 2025-06-22 11:09:05
package pb package pb
@ -11,57 +11,69 @@ import (
) )
type UserServiceHttpServer interface { type UserServiceHttpServer interface {
GetMenus(context.Context, *GetMenuRequest) (*GetMenuResponse, error)
GetProfile(context.Context, *GetProfileRequest) (*GetProfileResponse, error) // 获取用户菜单
GetMenus(ctx context.Context, req *GetUserMenuRequest) (res *GetUserMenuResponse, err error)
UpdateProfile(context.Context, *UpdateProfileRequest) (*UpdateProfileResponse, error) // 获取用户信息
GetProfile(ctx context.Context, req *GetProfileRequest) (res *GetProfileResponse, err error)
ResetPassword(context.Context, *ResetPasswordRequest) (*ResetPasswordResponse, error) // 更新用户信息
UpdateProfile(ctx context.Context, req *UpdateProfileRequest) (res *UpdateProfileResponse, err error)
GetPermissions(context.Context, *GetPermissionRequest) (*GetPermissionResponse, error) // 重置用户密码
ResetPassword(ctx context.Context, req *ResetPasswordRequest) (res *ResetPasswordResponse, err error)
GetUserLabels(context.Context, *GetUserLabelRequest) (*GetUserLabelResponse, error) // 获取用户权限
GetPermissions(ctx context.Context, req *GetPermissionRequest) (res *GetPermissionResponse, err error)
GetUserTags(context.Context, *GetUserTagRequest) (*GetUserTagResponse, error) // 获取用户标签
GetUserLabels(ctx context.Context, req *GetUserLabelRequest) (res *GetUserLabelResponse, err error)
// 获取用户标签
GetUserTags(ctx context.Context, req *GetUserTagRequest) (res *GetUserTagResponse, err error)
} }
type DepartmentServiceHttpServer interface { type DepartmentServiceHttpServer interface {
GetDepartmentLabels(context.Context, *GetDepartmentLabelRequest) (*GetDepartmentLabelResponse, error)
GetDepartmentUsers(context.Context, *GetDepartmentUserRequest) (*GetDepartmentUserResponse, error) // 获取部门标签
GetDepartmentLabels(ctx context.Context, req *GetDepartmentLabelRequest) (res *GetDepartmentLabelResponse, err error)
GetDepartmentLevelLabels(context.Context, *GetDepartmentLevelLabelsRequest) (*GetDepartmentLevelLabelsResponse, error) GetDepartmentUsers(ctx context.Context, req *GetDepartmentUserRequest) (res *GetDepartmentUserResponse, err error)
GetDepartmentLevelLabels(ctx context.Context, req *GetDepartmentLevelLabelsRequest) (res *GetDepartmentLevelLabelsResponse, err error)
} }
type RoleServiceHttpServer interface { type RoleServiceHttpServer interface {
GetRoleLabels(context.Context, *GetRoleLabelRequest) (*GetRoleLabelResponse, error)
GetRolePermissions(context.Context, *GetRolePermissionRequest) (*GetRolePermissionResponse, error) // 获取角色标签
GetRoleLabels(ctx context.Context, req *GetRoleLabelRequest) (res *GetRoleLabelResponse, err error)
SaveRolePermission(context.Context, *SaveRolePermissionRequest) (*SaveRolePermissionResponse, error) // 获取角色权限
GetRolePermissions(ctx context.Context, req *GetRolePermissionRequest) (res *GetRolePermissionResponse, err error)
SaveRolePermission(ctx context.Context, req *SaveRolePermissionRequest) (res *SaveRolePermissionResponse, err error)
} }
type MenuServiceHttpServer interface { type MenuServiceHttpServer interface {
GetMenuLevelLabels(context.Context, *GetMenuLevelLabelsRequest) (*GetMenuLevelLabelsResponse, error) GetMenus(ctx context.Context, req *GetMenuRequest) (res *GetMenuResponse, err error)
GetMenuLevelLabels(ctx context.Context, req *GetMenuLevelLabelsRequest) (res *GetMenuLevelLabelsResponse, err error)
} }
type AuthServiceHttpServer interface { type AuthServiceHttpServer interface {
Login(context.Context, *LoginRequest) (*LoginResponse, error) Login(ctx context.Context, req *LoginRequest) (res *LoginResponse, err error)
Logout(context.Context, *LogoutRequest) (*LogoutResponse, error) Logout(ctx context.Context, req *LogoutRequest) (res *LogoutResponse, err error)
} }
// 获取用户菜单 // 获取用户菜单
func handleUserServiceGetMenus(s UserServiceHttpServer) http.HandleFunc { func handleUserServiceGetMenus(s UserServiceHttpServer) http.HandleFunc {
return func(ctx *http.Context) (err error) { return func(ctx *http.Context) (err error) {
req := &GetMenuRequest{} req := &GetUserMenuRequest{}
if err := ctx.Bind(req); err != nil { if err := ctx.Bind(req); err != nil {
return ctx.Error(errors.Invalid, err.Error()) return ctx.Error(errors.Invalid, err.Error())
} }
if res, err := s.GetMenus(ctx.Context(), req); err != nil { if res, err := s.GetMenus(ctx.Context(), req); err != nil {
if er, ok := err.(*errors.Error); ok { if er, ok := err.(*errors.Error); ok {
return ctx.Error(er.Code, er.Message) return ctx.Error(er.Code, er.Message)
@ -75,15 +87,12 @@ func handleUserServiceGetMenus(s UserServiceHttpServer) http.HandleFunc {
} }
// 获取用户信息 // 获取用户信息
func handleUserServiceGetProfile(s UserServiceHttpServer) http.HandleFunc { func handleUserServiceGetProfile(s UserServiceHttpServer) http.HandleFunc {
return func(ctx *http.Context) (err error) { return func(ctx *http.Context) (err error) {
req := &GetProfileRequest{} req := &GetProfileRequest{}
if err := ctx.Bind(req); err != nil { if err := ctx.Bind(req); err != nil {
return ctx.Error(errors.Invalid, err.Error()) return ctx.Error(errors.Invalid, err.Error())
} }
if res, err := s.GetProfile(ctx.Context(), req); err != nil { if res, err := s.GetProfile(ctx.Context(), req); err != nil {
if er, ok := err.(*errors.Error); ok { if er, ok := err.(*errors.Error); ok {
return ctx.Error(er.Code, er.Message) return ctx.Error(er.Code, er.Message)
@ -97,15 +106,12 @@ func handleUserServiceGetProfile(s UserServiceHttpServer) http.HandleFunc {
} }
// 更新用户信息 // 更新用户信息
func handleUserServiceUpdateProfile(s UserServiceHttpServer) http.HandleFunc { func handleUserServiceUpdateProfile(s UserServiceHttpServer) http.HandleFunc {
return func(ctx *http.Context) (err error) { return func(ctx *http.Context) (err error) {
req := &UpdateProfileRequest{} req := &UpdateProfileRequest{}
if err := ctx.Bind(req); err != nil { if err := ctx.Bind(req); err != nil {
return ctx.Error(errors.Invalid, err.Error()) return ctx.Error(errors.Invalid, err.Error())
} }
if res, err := s.UpdateProfile(ctx.Context(), req); err != nil { if res, err := s.UpdateProfile(ctx.Context(), req); err != nil {
if er, ok := err.(*errors.Error); ok { if er, ok := err.(*errors.Error); ok {
return ctx.Error(er.Code, er.Message) return ctx.Error(er.Code, er.Message)
@ -119,15 +125,12 @@ func handleUserServiceUpdateProfile(s UserServiceHttpServer) http.HandleFunc {
} }
// 重置用户密码 // 重置用户密码
func handleUserServiceResetPassword(s UserServiceHttpServer) http.HandleFunc { func handleUserServiceResetPassword(s UserServiceHttpServer) http.HandleFunc {
return func(ctx *http.Context) (err error) { return func(ctx *http.Context) (err error) {
req := &ResetPasswordRequest{} req := &ResetPasswordRequest{}
if err := ctx.Bind(req); err != nil { if err := ctx.Bind(req); err != nil {
return ctx.Error(errors.Invalid, err.Error()) return ctx.Error(errors.Invalid, err.Error())
} }
if res, err := s.ResetPassword(ctx.Context(), req); err != nil { if res, err := s.ResetPassword(ctx.Context(), req); err != nil {
if er, ok := err.(*errors.Error); ok { if er, ok := err.(*errors.Error); ok {
return ctx.Error(er.Code, er.Message) return ctx.Error(er.Code, er.Message)
@ -141,15 +144,12 @@ func handleUserServiceResetPassword(s UserServiceHttpServer) http.HandleFunc {
} }
// 获取用户权限 // 获取用户权限
func handleUserServiceGetPermissions(s UserServiceHttpServer) http.HandleFunc { func handleUserServiceGetPermissions(s UserServiceHttpServer) http.HandleFunc {
return func(ctx *http.Context) (err error) { return func(ctx *http.Context) (err error) {
req := &GetPermissionRequest{} req := &GetPermissionRequest{}
if err := ctx.Bind(req); err != nil { if err := ctx.Bind(req); err != nil {
return ctx.Error(errors.Invalid, err.Error()) return ctx.Error(errors.Invalid, err.Error())
} }
if res, err := s.GetPermissions(ctx.Context(), req); err != nil { if res, err := s.GetPermissions(ctx.Context(), req); err != nil {
if er, ok := err.(*errors.Error); ok { if er, ok := err.(*errors.Error); ok {
return ctx.Error(er.Code, er.Message) return ctx.Error(er.Code, er.Message)
@ -163,7 +163,6 @@ func handleUserServiceGetPermissions(s UserServiceHttpServer) http.HandleFunc {
} }
// 获取用户标签 // 获取用户标签
func handleUserServiceGetUserLabels(s UserServiceHttpServer) http.HandleFunc { func handleUserServiceGetUserLabels(s UserServiceHttpServer) http.HandleFunc {
return func(ctx *http.Context) (err error) { return func(ctx *http.Context) (err error) {
req := &GetUserLabelRequest{} req := &GetUserLabelRequest{}
@ -181,7 +180,6 @@ func handleUserServiceGetUserLabels(s UserServiceHttpServer) http.HandleFunc {
} }
// 获取用户标签 // 获取用户标签
func handleUserServiceGetUserTags(s UserServiceHttpServer) http.HandleFunc { func handleUserServiceGetUserTags(s UserServiceHttpServer) http.HandleFunc {
return func(ctx *http.Context) (err error) { return func(ctx *http.Context) (err error) {
req := &GetUserTagRequest{} req := &GetUserTagRequest{}
@ -199,7 +197,6 @@ func handleUserServiceGetUserTags(s UserServiceHttpServer) http.HandleFunc {
} }
// 获取部门标签 // 获取部门标签
func handleDepartmentServiceGetDepartmentLabels(s DepartmentServiceHttpServer) http.HandleFunc { func handleDepartmentServiceGetDepartmentLabels(s DepartmentServiceHttpServer) http.HandleFunc {
return func(ctx *http.Context) (err error) { return func(ctx *http.Context) (err error) {
req := &GetDepartmentLabelRequest{} req := &GetDepartmentLabelRequest{}
@ -249,7 +246,6 @@ func handleDepartmentServiceGetDepartmentLevelLabels(s DepartmentServiceHttpServ
} }
// 获取角色标签 // 获取角色标签
func handleRoleServiceGetRoleLabels(s RoleServiceHttpServer) http.HandleFunc { func handleRoleServiceGetRoleLabels(s RoleServiceHttpServer) http.HandleFunc {
return func(ctx *http.Context) (err error) { return func(ctx *http.Context) (err error) {
req := &GetRoleLabelRequest{} req := &GetRoleLabelRequest{}
@ -267,15 +263,12 @@ func handleRoleServiceGetRoleLabels(s RoleServiceHttpServer) http.HandleFunc {
} }
// 获取角色权限 // 获取角色权限
func handleRoleServiceGetRolePermissions(s RoleServiceHttpServer) http.HandleFunc { func handleRoleServiceGetRolePermissions(s RoleServiceHttpServer) http.HandleFunc {
return func(ctx *http.Context) (err error) { return func(ctx *http.Context) (err error) {
req := &GetRolePermissionRequest{} req := &GetRolePermissionRequest{}
if err := ctx.Bind(req); err != nil { if err := ctx.Bind(req); err != nil {
return ctx.Error(errors.Invalid, err.Error()) return ctx.Error(errors.Invalid, err.Error())
} }
if res, err := s.GetRolePermissions(ctx.Context(), req); err != nil { if res, err := s.GetRolePermissions(ctx.Context(), req); err != nil {
if er, ok := err.(*errors.Error); ok { if er, ok := err.(*errors.Error); ok {
return ctx.Error(er.Code, er.Message) return ctx.Error(er.Code, er.Message)
@ -291,11 +284,9 @@ func handleRoleServiceGetRolePermissions(s RoleServiceHttpServer) http.HandleFun
func handleRoleServiceSaveRolePermission(s RoleServiceHttpServer) http.HandleFunc { func handleRoleServiceSaveRolePermission(s RoleServiceHttpServer) http.HandleFunc {
return func(ctx *http.Context) (err error) { return func(ctx *http.Context) (err error) {
req := &SaveRolePermissionRequest{} req := &SaveRolePermissionRequest{}
if err := ctx.Bind(req); err != nil { if err := ctx.Bind(req); err != nil {
return ctx.Error(errors.Invalid, err.Error()) return ctx.Error(errors.Invalid, err.Error())
} }
if res, err := s.SaveRolePermission(ctx.Context(), req); err != nil { if res, err := s.SaveRolePermission(ctx.Context(), req); err != nil {
if er, ok := err.(*errors.Error); ok { if er, ok := err.(*errors.Error); ok {
return ctx.Error(er.Code, er.Message) return ctx.Error(er.Code, er.Message)
@ -308,6 +299,22 @@ func handleRoleServiceSaveRolePermission(s RoleServiceHttpServer) http.HandleFun
} }
} }
func handleMenuServiceGetMenus(s MenuServiceHttpServer) http.HandleFunc {
return func(ctx *http.Context) (err error) {
req := &GetMenuRequest{}
if res, err := s.GetMenus(ctx.Context(), req); err != nil {
if er, ok := err.(*errors.Error); ok {
return ctx.Error(er.Code, er.Message)
} else {
return ctx.Error(errors.Unavailable, err.Error())
}
} else {
return ctx.Success(res)
}
}
}
func handleMenuServiceGetMenuLevelLabels(s MenuServiceHttpServer) http.HandleFunc { func handleMenuServiceGetMenuLevelLabels(s MenuServiceHttpServer) http.HandleFunc {
return func(ctx *http.Context) (err error) { return func(ctx *http.Context) (err error) {
req := &GetMenuLevelLabelsRequest{} req := &GetMenuLevelLabelsRequest{}
@ -327,11 +334,9 @@ func handleMenuServiceGetMenuLevelLabels(s MenuServiceHttpServer) http.HandleFun
func handleAuthServiceLogin(s AuthServiceHttpServer) http.HandleFunc { func handleAuthServiceLogin(s AuthServiceHttpServer) http.HandleFunc {
return func(ctx *http.Context) (err error) { return func(ctx *http.Context) (err error) {
req := &LoginRequest{} req := &LoginRequest{}
if err := ctx.Bind(req); err != nil { if err := ctx.Bind(req); err != nil {
return ctx.Error(errors.Invalid, err.Error()) return ctx.Error(errors.Invalid, err.Error())
} }
if res, err := s.Login(ctx.Context(), req); err != nil { if res, err := s.Login(ctx.Context(), req); err != nil {
if er, ok := err.(*errors.Error); ok { if er, ok := err.(*errors.Error); ok {
return ctx.Error(er.Code, er.Message) return ctx.Error(er.Code, er.Message)
@ -347,11 +352,9 @@ func handleAuthServiceLogin(s AuthServiceHttpServer) http.HandleFunc {
func handleAuthServiceLogout(s AuthServiceHttpServer) http.HandleFunc { func handleAuthServiceLogout(s AuthServiceHttpServer) http.HandleFunc {
return func(ctx *http.Context) (err error) { return func(ctx *http.Context) (err error) {
req := &LogoutRequest{} req := &LogoutRequest{}
if err := ctx.Bind(req); err != nil { if err := ctx.Bind(req); err != nil {
return ctx.Error(errors.Invalid, err.Error()) return ctx.Error(errors.Invalid, err.Error())
} }
if res, err := s.Logout(ctx.Context(), req); err != nil { if res, err := s.Logout(ctx.Context(), req); err != nil {
if er, ok := err.(*errors.Error); ok { if er, ok := err.(*errors.Error); ok {
return ctx.Error(er.Code, er.Message) return ctx.Error(er.Code, er.Message)
@ -417,6 +420,9 @@ func RegisterRoleServiceRouter(hs *http.Server, s RoleServiceHttpServer) {
func RegisterMenuServiceRouter(hs *http.Server, s MenuServiceHttpServer) { func RegisterMenuServiceRouter(hs *http.Server, s MenuServiceHttpServer) {
// Register handle GetMenus route
hs.GET("/menu/list", handleMenuServiceGetMenus(s))
// Register handle GetMenuLevelLabels route // Register handle GetMenuLevelLabels route
hs.GET("/menu/level-labels", handleMenuServiceGetMenuLevelLabels(s)) hs.GET("/menu/level-labels", handleMenuServiceGetMenuLevelLabels(s))

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-aeus. DO NOT EDIT. // Code generated by protoc-gen-go-aeus. DO NOT EDIT.
// source: organize.proto // source: organize.proto
// date: 2025-06-19 11:06:34 // date: 2025-06-22 11:09:05
package pb package pb
@ -12,7 +12,7 @@ type MenuModel struct {
Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"菜单ID"` Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"菜单ID"`
CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"创建时间" scenarios:"view;export"` CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"创建时间" scenarios:"view;export"`
UpdatedAt int64 `json:"updated_at" yaml:"updatedAt" xml:"updatedAt" gorm:"index;column:updated_at" comment:"更新时间" scenarios:"view;export"` UpdatedAt int64 `json:"updated_at" yaml:"updatedAt" xml:"updatedAt" gorm:"index;column:updated_at" comment:"更新时间" scenarios:"view;export"`
Parent string `json:"parent" yaml:"parent" xml:"parent" gorm:"index;size:60;column:parent" comment:"父级菜单" format:"menu" props:"readonly:update" live:"type:dropdown;url:/menu/level-labels"` Parent string `json:"parent" yaml:"parent" xml:"parent" gorm:"index;size:60;column:parent" comment:"父级菜单" scenarios:"create;update;view;export" format:"menu" props:"readonly:update" live:"type:dropdown;url:/menu/level-labels"`
Name string `json:"name" yaml:"name" xml:"name" gorm:"index;size:60;column:name" comment:"组件名称" props:"readonly:update" rule:"unique;required"` Name string `json:"name" yaml:"name" xml:"name" gorm:"index;size:60;column:name" comment:"组件名称" props:"readonly:update" rule:"unique;required"`
Label string `json:"label" yaml:"label" xml:"label" gorm:"size:120;column:label" comment:"菜单标题" rule:"required"` Label string `json:"label" yaml:"label" xml:"label" gorm:"size:120;column:label" comment:"菜单标题" rule:"required"`
Uri string `json:"uri" yaml:"uri" xml:"uri" gorm:"size:512;column:uri" comment:"菜单链接" scenarios:"create;update;view;export" rule:"required"` Uri string `json:"uri" yaml:"uri" xml:"uri" gorm:"size:512;column:uri" comment:"菜单链接" scenarios:"create;update;view;export" rule:"required"`
@ -20,7 +20,7 @@ type MenuModel struct {
Icon string `json:"icon" yaml:"icon" xml:"icon" gorm:"size:60;column:icon" comment:"菜单图标" scenarios:"create;update;view;export"` Icon string `json:"icon" yaml:"icon" xml:"icon" gorm:"size:60;column:icon" comment:"菜单图标" scenarios:"create;update;view;export"`
Hidden bool `json:"hidden" yaml:"hidden" xml:"hidden" gorm:"column:hidden" comment:"是否隐藏" scenarios:"create;update;view;export"` Hidden bool `json:"hidden" yaml:"hidden" xml:"hidden" gorm:"column:hidden" comment:"是否隐藏" scenarios:"create;update;view;export"`
Public bool `json:"public" yaml:"public" xml:"public" gorm:"column:public" comment:"是否公开" scenarios:"create;update;view;export"` Public bool `json:"public" yaml:"public" xml:"public" gorm:"column:public" comment:"是否公开" scenarios:"create;update;view;export"`
Description string `json:"description" yaml:"description" xml:"description" gorm:"size:1024;column:description" comment:"备注说明" scenarios:"create;update;view;export;list" format:"textarea"` Description string `json:"description" yaml:"description" xml:"description" gorm:"size:1024;column:description" comment:"备注说明" scenarios:"create;update;view;export" format:"textarea"`
Position int64 `json:"position" yaml:"position" xml:"position" gorm:"column:position" comment:"排序" scenarios:"create;update"` Position int64 `json:"position" yaml:"position" xml:"position" gorm:"column:position" comment:"排序" scenarios:"create;update"`
} }

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-aeus. DO NOT EDIT. // Code generated by protoc-gen-go-aeus. DO NOT EDIT.
// source: system.proto // source: system.proto
// date: 2025-06-19 11:06:34 // date: 2025-06-22 11:09:05
package pb package pb
@ -11,7 +11,7 @@ import (
) )
type SettingServiceHttpServer interface { type SettingServiceHttpServer interface {
GetSetting(context.Context, *GetSettingRequest) (*GetSettingResponse, error) GetSetting(ctx context.Context, req *GetSettingRequest) (res *GetSettingResponse, err error)
} }
func handleSettingServiceGetSetting(s SettingServiceHttpServer) http.HandleFunc { func handleSettingServiceGetSetting(s SettingServiceHttpServer) http.HandleFunc {

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-aeus. DO NOT EDIT. // Code generated by protoc-gen-go-aeus. DO NOT EDIT.
// source: system.proto // source: system.proto
// date: 2025-06-19 11:06:34 // date: 2025-06-22 11:09:05
package pb package pb

View File

@ -5,6 +5,8 @@ import (
"slices" "slices"
"git.nobla.cn/golang/aeus-admin/internal/logic" "git.nobla.cn/golang/aeus-admin/internal/logic"
"git.nobla.cn/golang/aeus-admin/models"
"git.nobla.cn/golang/aeus-admin/types"
"git.nobla.cn/golang/aeus/middleware/auth" "git.nobla.cn/golang/aeus/middleware/auth"
"git.nobla.cn/golang/aeus/pkg/cache" "git.nobla.cn/golang/aeus/pkg/cache"
"git.nobla.cn/golang/aeus/pkg/errors" "git.nobla.cn/golang/aeus/pkg/errors"
@ -12,8 +14,9 @@ import (
) )
type PermissionChecker struct { type PermissionChecker struct {
db *gorm.DB db *gorm.DB
logic *logic.User user *logic.User
role *logic.Role
} }
func (p *PermissionChecker) CheckPermission(ctx context.Context, permission string) (err error) { func (p *PermissionChecker) CheckPermission(ctx context.Context, permission string) (err error) {
@ -21,14 +24,30 @@ func (p *PermissionChecker) CheckPermission(ctx context.Context, permission stri
uid string uid string
ps []string ps []string
) )
if claims, ok := auth.FromContext(ctx); !ok { claims, ok := auth.FromContext(ctx)
if !ok {
return errors.ErrAccessDenied return errors.ErrAccessDenied
} else { }
if uid, err = claims.GetSubject(); err != nil { if cl, ok := claims.(*types.Claims); ok {
if cl.Admin {
return return
} else {
var pms []*models.Permission
if pms, err = p.role.GetPermissions(ctx, cl.Role); err == nil {
for _, pm := range pms {
if pm.Permission == permission {
return
}
}
} else {
return errors.ErrPermissionDenied
}
} }
} }
if ps, err = p.logic.GetPermissions(ctx, uid); err != nil { if uid, err = claims.GetSubject(); err != nil {
return
}
if ps, err = p.user.GetPermissions(ctx, uid); err != nil {
return return
} }
if !slices.Contains(ps, permission) { if !slices.Contains(ps, permission) {
@ -39,7 +58,8 @@ func (p *PermissionChecker) CheckPermission(ctx context.Context, permission stri
func NewPermissionChecker(db *gorm.DB, ch cache.Cache) *PermissionChecker { func NewPermissionChecker(db *gorm.DB, ch cache.Cache) *PermissionChecker {
return &PermissionChecker{ return &PermissionChecker{
db: db, db: db,
logic: logic.NewUserLogic(db, ch), user: logic.NewUserLogic(db, ch),
role: logic.NewRoleLogic(db, ch),
} }
} }

View File

@ -23,9 +23,9 @@ type (
CacheOption func(o *CacheOptions) CacheOption func(o *CacheOptions)
cacheEntry[T any] struct { cacheEntry[T any] struct {
Value T Value T `json:"v"`
CompareValue string CompareValue string `json:"d"`
CreatedAt int64 CreatedAt int64 `json:"t"`
} }
) )

View File

@ -250,23 +250,6 @@ func initModels(ctx context.Context, o *options) (err error) {
return return
} }
// AutoMigrate 自动生成一个模型的schema和权限的定义
func AutoMigrate(ctx context.Context, db *gorm.DB, model any, cbs ...Option) (err error) {
var (
mv *rest.Model
)
opts := newOptions(cbs...)
if mm, ok := model.(adminTypes.ModuleModel); ok {
moduleName := mm.ModuleName()
opts.restOpts = append(opts.restOpts, rest.WithModuleName(moduleName))
}
if mv, err = rest.AutoMigrate(ctx, model, opts.restOpts...); err != nil {
return
}
err = checkModel(opts, mv)
return
}
func registerRESTRoute(domain string, db *gorm.DB, hs *http.Server) { func registerRESTRoute(domain string, db *gorm.DB, hs *http.Server) {
handleListSchemas := func(ctx *http.Context) (err error) { handleListSchemas := func(ctx *http.Context) (err error) {
var ( var (
@ -357,6 +340,32 @@ func registerRESTRoute(domain string, db *gorm.DB, hs *http.Server) {
} }
// AutoMigrate 自动生成一个模型的schema和权限的定义
func AutoMigrate(ctx context.Context, db *gorm.DB, model any, cbs ...Option) (err error) {
var (
mv *rest.Model
)
opts := newOptions(cbs...)
if mm, ok := model.(adminTypes.ModuleModel); ok {
moduleName := mm.ModuleName()
opts.restOpts = append(opts.restOpts, rest.WithModuleName(moduleName))
}
if err = db.AutoMigrate(model); err != nil {
return
}
if mv, err = rest.AutoMigrate(ctx, model, opts.restOpts...); err != nil {
return
}
if err = checkModel(opts, mv); err == nil {
if opts.vuePath != "" {
if err = generateVueFile(opts.vuePath, opts.apiPrefix, mv); err != nil {
return
}
}
}
return
}
// Init 初始化模块 // Init 初始化模块
func Init(ctx context.Context, cbs ...Option) (err error) { func Init(ctx context.Context, cbs ...Option) (err error) {
opts := newOptions(cbs...) opts := newOptions(cbs...)

View File

@ -148,6 +148,7 @@ func (s *AuthService) Login(ctx context.Context, req *pb.LoginRequest) (res *pb.
claims := types.Claims{ claims := types.Claims{
Uid: model.Uid, Uid: model.Uid,
Role: model.Role, Role: model.Role,
Admin: model.Admin,
IssuedAt: time.Now().Unix(), IssuedAt: time.Now().Unix(),
ExpirationAt: time.Now().Add(time.Second * time.Duration(s.opts.ttl)).Unix(), ExpirationAt: time.Now().Add(time.Second * time.Duration(s.opts.ttl)).Unix(),
} }

View File

@ -35,6 +35,24 @@ func WithMenuDB(db *gorm.DB) MenuOption {
} }
} }
func (s *MenuService) recursiveMenuValue(parent string, items []*models.Menu) []*pb.MenuValue {
values := make([]*pb.MenuValue, 0, len(items))
for _, row := range items {
if row.Parent == parent {
item := &pb.MenuValue{
Id: row.Id,
Parent: row.Parent,
Name: row.Name,
Label: row.Label,
Children: make([]*pb.MenuValue, 0),
}
item.Children = append(item.Children, s.recursiveMenuValue(row.Name, items)...)
values = append(values, item)
}
}
return values
}
func (s *MenuService) recursiveMenuLevel(parent string, items []*models.Menu) []*pb.MenuLevelValue { func (s *MenuService) recursiveMenuLevel(parent string, items []*models.Menu) []*pb.MenuLevelValue {
values := make([]*pb.MenuLevelValue, 0, len(items)) values := make([]*pb.MenuLevelValue, 0, len(items))
for _, row := range items { for _, row := range items {
@ -51,6 +69,19 @@ func (s *MenuService) recursiveMenuLevel(parent string, items []*models.Menu) []
return values return values
} }
func (s *MenuService) GetMenus(ctx context.Context, req *pb.GetMenuRequest) (res *pb.GetMenuResponse, err error) {
var (
items []*models.Menu
)
if items, err = s.logic.GetMenus(ctx); err != nil {
return
}
res = &pb.GetMenuResponse{
Data: s.recursiveMenuValue("", items),
}
return
}
func (s *MenuService) GetMenuLevelLabels(ctx context.Context, req *pb.GetMenuLevelLabelsRequest) (res *pb.GetMenuLevelLabelsResponse, err error) { func (s *MenuService) GetMenuLevelLabels(ctx context.Context, req *pb.GetMenuLevelLabelsRequest) (res *pb.GetMenuLevelLabelsResponse, err error) {
var ( var (
items []*models.Menu items []*models.Menu

View File

@ -102,7 +102,7 @@ func (s *UserService) recursiveNestedMenu(ctx context.Context, parent string, pe
return values return values
} }
func (s *UserService) GetMenus(ctx context.Context, req *pb.GetMenuRequest) (res *pb.GetMenuResponse, err error) { func (s *UserService) GetMenus(ctx context.Context, req *pb.GetUserMenuRequest) (res *pb.GetUserMenuResponse, err error) {
var ( var (
uid string uid string
permissions []*models.Permission permissions []*models.Permission
@ -110,14 +110,14 @@ func (s *UserService) GetMenus(ctx context.Context, req *pb.GetMenuRequest) (res
if uid, err = s.getUidFromContext(ctx); err != nil { if uid, err = s.getUidFromContext(ctx); err != nil {
return return
} }
res = &pb.GetMenuResponse{} res = &pb.GetUserMenuResponse{}
res.Data, err = dbcache.TryCache(ctx, fmt.Sprintf("user:menu:%s:%v", uid, req.Permission), func(tx *gorm.DB) ([]*pb.MenuItem, error) { res.Data, err = dbcache.TryCache(ctx, fmt.Sprintf("user:menu:%s:%v", uid, req.Permission), func(tx *gorm.DB) ([]*pb.MenuItem, error) {
var ( var (
userModel *models.User userModel *models.User
menus []*models.Menu menus []*models.Menu
) )
userModel = &models.User{} userModel = &models.User{}
if err = tx.Where("uid=?", uid).First(userModel).Error; err != nil { if err = tx.Where("`uid`=?", uid).First(userModel).Error; err != nil {
return nil, err return nil, err
} }
if menus, err = s.menu.GetMenus(ctx); err != nil { if menus, err = s.menu.GetMenus(ctx); err != nil {

View File

@ -9,6 +9,7 @@ import (
type Claims struct { type Claims struct {
Uid string `json:"uid"` Uid string `json:"uid"`
Role string `json:"uro"` Role string `json:"uro"`
Admin bool `json:"uab"`
Issuer string `json:"iss"` Issuer string `json:"iss"`
IssuedAt int64 `json:"iat"` IssuedAt int64 `json:"iat"`
ExpirationAt int64 `json:"exp"` ExpirationAt int64 `json:"exp"`