init: init refactor
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
Name: system.rpc
|
||||
ListenOn: 0.0.0.0:9103
|
||||
Etcd:
|
||||
Hosts:
|
||||
- 192.168.100.127:2379
|
||||
Key: system.rpc
|
||||
|
||||
# MySQL
|
||||
DB:
|
||||
DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
import "github.com/zeromicro/go-zero/zrpc"
|
||||
|
||||
type Config struct {
|
||||
zrpc.RpcServerConf
|
||||
DB struct {
|
||||
DataSource string
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/internal/svc"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type GetClientByIdLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetClientByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetClientByIdLogic {
|
||||
return &GetClientByIdLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// 获取客户端信息
|
||||
func (l *GetClientByIdLogic) GetClientById(in *system.GetClientByIdReq) (*system.GetClientByIdResp, error) {
|
||||
var client sysModel.SundynixClient
|
||||
err := l.svcCtx.DB.Where("client_id = ?", in.ClientId).First(&client).Error
|
||||
if err != nil {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
return nil, status.Error(codes.NotFound, "客户端不存在")
|
||||
}
|
||||
l.Errorf("查询客户端失败: %v", err)
|
||||
return nil, status.Error(codes.Internal, "查询客户端失败")
|
||||
}
|
||||
|
||||
return &system.GetClientByIdResp{
|
||||
Client: &system.ClientInfo{
|
||||
Id: client.ID,
|
||||
ClientId: client.ClientID,
|
||||
Name: client.Name,
|
||||
GrantType: client.GrantType,
|
||||
AdditionalInfo: client.AdditionalInfo,
|
||||
ActiveTimeout: client.ActiveTimeout,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/internal/svc"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
type GetMenusByRoleIdLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetMenusByRoleIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMenusByRoleIdLogic {
|
||||
return &GetMenusByRoleIdLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// 获取角色菜单列表
|
||||
func (l *GetMenusByRoleIdLogic) GetMenusByRoleId(in *system.GetMenusByRoleIdReq) (*system.GetMenusByRoleIdResp, error) {
|
||||
// 查询角色菜单关联
|
||||
var roleMenus []sysModel.SundynixRoleMenu
|
||||
if err := l.svcCtx.DB.Where("role_id = ?", in.RoleId).Find(&roleMenus).Error; err != nil {
|
||||
l.Errorf("查询角色菜单失败: %v", err)
|
||||
return nil, status.Error(codes.Internal, "查询角色菜单失败")
|
||||
}
|
||||
|
||||
if len(roleMenus) == 0 {
|
||||
return &system.GetMenusByRoleIdResp{Menus: []*system.MenuInfo{}}, nil
|
||||
}
|
||||
|
||||
menuIds := make([]string, 0, len(roleMenus))
|
||||
for _, rm := range roleMenus {
|
||||
menuIds = append(menuIds, rm.MenuID)
|
||||
}
|
||||
|
||||
// 查询菜单信息
|
||||
var menus []sysModel.SundynixMenu
|
||||
if err := l.svcCtx.DB.Where("id IN ?", menuIds).Order("sort").Find(&menus).Error; err != nil {
|
||||
l.Errorf("查询菜单信息失败: %v", err)
|
||||
return nil, status.Error(codes.Internal, "查询菜单信息失败")
|
||||
}
|
||||
|
||||
// 构建树形结构
|
||||
menuMap := make(map[string]*system.MenuInfo)
|
||||
var rootMenus []*system.MenuInfo
|
||||
|
||||
for _, m := range menus {
|
||||
menuInfo := &system.MenuInfo{
|
||||
Id: m.ID,
|
||||
ParentId: m.ParentID,
|
||||
Category: int32(m.Category),
|
||||
Name: m.Name,
|
||||
Title: m.Title,
|
||||
Code: m.Code,
|
||||
Path: m.Path,
|
||||
Permission: m.Permission,
|
||||
Locale: m.Locale,
|
||||
Icon: m.Icon,
|
||||
Sort: int32(m.Sort),
|
||||
Children: []*system.MenuInfo{},
|
||||
}
|
||||
menuMap[m.ID] = menuInfo
|
||||
}
|
||||
|
||||
for _, menuInfo := range menuMap {
|
||||
if menuInfo.ParentId == "0" || menuInfo.ParentId == "" {
|
||||
rootMenus = append(rootMenus, menuInfo)
|
||||
} else {
|
||||
if parent, ok := menuMap[menuInfo.ParentId]; ok {
|
||||
parent.Children = append(parent.Children, menuInfo)
|
||||
} else {
|
||||
rootMenus = append(rootMenus, menuInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &system.GetMenusByRoleIdResp{Menus: rootMenus}, nil
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/internal/svc"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
type GetRolesByUserIdLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetRolesByUserIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRolesByUserIdLogic {
|
||||
return &GetRolesByUserIdLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// 获取用户角色列表
|
||||
func (l *GetRolesByUserIdLogic) GetRolesByUserId(in *system.GetRolesByUserIdReq) (*system.GetRolesByUserIdResp, error) {
|
||||
// 查询用户角色关联
|
||||
var userRoles []sysModel.SundynixUserRole
|
||||
if err := l.svcCtx.DB.Where("user_id = ?", in.UserId).Find(&userRoles).Error; err != nil {
|
||||
l.Errorf("查询用户角色失败: %v", err)
|
||||
return nil, status.Error(codes.Internal, "查询用户角色失败")
|
||||
}
|
||||
|
||||
if len(userRoles) == 0 {
|
||||
return &system.GetRolesByUserIdResp{Roles: []*system.RoleInfo{}}, nil
|
||||
}
|
||||
|
||||
roleIds := make([]string, 0, len(userRoles))
|
||||
for _, ur := range userRoles {
|
||||
roleIds = append(roleIds, ur.RoleID)
|
||||
}
|
||||
|
||||
var roles []sysModel.SundynixRole
|
||||
if err := l.svcCtx.DB.Where("id IN ?", roleIds).Find(&roles).Error; err != nil {
|
||||
l.Errorf("查询角色信息失败: %v", err)
|
||||
return nil, status.Error(codes.Internal, "查询角色信息失败")
|
||||
}
|
||||
|
||||
roleInfos := make([]*system.RoleInfo, 0, len(roles))
|
||||
for _, r := range roles {
|
||||
roleInfos = append(roleInfos, &system.RoleInfo{
|
||||
Id: r.ID,
|
||||
Name: r.Name,
|
||||
Code: r.Code,
|
||||
Sort: int32(r.Sort),
|
||||
})
|
||||
}
|
||||
|
||||
return &system.GetRolesByUserIdResp{Roles: roleInfos}, nil
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.10.1
|
||||
// Source: system.proto
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/system/rpc/internal/logic"
|
||||
"sundynix-micro-go/app/system/rpc/internal/svc"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type SystemServiceServer struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
system.UnimplementedSystemServiceServer
|
||||
}
|
||||
|
||||
func NewSystemServiceServer(svcCtx *svc.ServiceContext) *SystemServiceServer {
|
||||
return &SystemServiceServer{
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
// 获取用户角色列表
|
||||
func (s *SystemServiceServer) GetRolesByUserId(ctx context.Context, in *system.GetRolesByUserIdReq) (*system.GetRolesByUserIdResp, error) {
|
||||
l := logic.NewGetRolesByUserIdLogic(ctx, s.svcCtx)
|
||||
return l.GetRolesByUserId(in)
|
||||
}
|
||||
|
||||
// 获取角色菜单列表
|
||||
func (s *SystemServiceServer) GetMenusByRoleId(ctx context.Context, in *system.GetMenusByRoleIdReq) (*system.GetMenusByRoleIdResp, error) {
|
||||
l := logic.NewGetMenusByRoleIdLogic(ctx, s.svcCtx)
|
||||
return l.GetMenusByRoleId(in)
|
||||
}
|
||||
|
||||
// 获取客户端信息
|
||||
func (s *SystemServiceServer) GetClientById(ctx context.Context, in *system.GetClientByIdReq) (*system.GetClientByIdResp, error) {
|
||||
l := logic.NewGetClientByIdLogic(ctx, s.svcCtx)
|
||||
return l.GetClientById(in)
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/internal/config"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
DB *gorm.DB
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
db, err := gorm.Open(mysql.Open(c.DB.DataSource), &gorm.Config{})
|
||||
if err != nil {
|
||||
logx.Errorf("连接数据库失败: %v", err)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// 自动迁移
|
||||
if err := db.AutoMigrate(
|
||||
&sysModel.SundynixClient{},
|
||||
&sysModel.SundynixRole{},
|
||||
&sysModel.SundynixMenu{},
|
||||
&sysModel.SundynixRoleMenu{},
|
||||
&sysModel.SundynixOperationRecord{},
|
||||
&sysModel.SundynixDict{},
|
||||
); err != nil {
|
||||
logx.Errorf("数据库迁移失败: %v", err)
|
||||
}
|
||||
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
DB: db,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package system;
|
||||
|
||||
option go_package = "./system";
|
||||
|
||||
// ---------- 通用消息 ----------
|
||||
|
||||
message CommonResp {
|
||||
int64 code = 1;
|
||||
string msg = 2;
|
||||
}
|
||||
|
||||
// ---------- 角色信息 ----------
|
||||
|
||||
message RoleInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string code = 3;
|
||||
int32 sort = 4;
|
||||
}
|
||||
|
||||
// ---------- 菜单信息 ----------
|
||||
|
||||
message MenuInfo {
|
||||
string id = 1;
|
||||
string parentId = 2;
|
||||
int32 category = 3;
|
||||
string name = 4;
|
||||
string title = 5;
|
||||
string code = 6;
|
||||
string path = 7;
|
||||
string permission = 8;
|
||||
string locale = 9;
|
||||
string icon = 10;
|
||||
int32 sort = 11;
|
||||
repeated MenuInfo children = 12;
|
||||
}
|
||||
|
||||
// ---------- 客户端信息 ----------
|
||||
|
||||
message ClientInfo {
|
||||
string id = 1;
|
||||
string clientId = 2;
|
||||
string name = 3;
|
||||
string grantType = 4;
|
||||
string additionalInfo = 5;
|
||||
int64 activeTimeout = 6;
|
||||
}
|
||||
|
||||
// ---------- 请求/响应 ----------
|
||||
|
||||
message GetRolesByUserIdReq {
|
||||
string userId = 1;
|
||||
}
|
||||
|
||||
message GetRolesByUserIdResp {
|
||||
repeated RoleInfo roles = 1;
|
||||
}
|
||||
|
||||
message GetMenusByRoleIdReq {
|
||||
string roleId = 1;
|
||||
}
|
||||
|
||||
message GetMenusByRoleIdResp {
|
||||
repeated MenuInfo menus = 1;
|
||||
}
|
||||
|
||||
message GetClientByIdReq {
|
||||
string clientId = 1;
|
||||
}
|
||||
|
||||
message GetClientByIdResp {
|
||||
ClientInfo client = 1;
|
||||
}
|
||||
|
||||
// ---------- 服务定义 ----------
|
||||
|
||||
service SystemService {
|
||||
// 获取用户角色列表
|
||||
rpc GetRolesByUserId(GetRolesByUserIdReq) returns (GetRolesByUserIdResp);
|
||||
// 获取角色菜单列表
|
||||
rpc GetMenusByRoleId(GetMenusByRoleIdReq) returns (GetMenusByRoleIdResp);
|
||||
// 获取客户端信息
|
||||
rpc GetClientById(GetClientByIdReq) returns (GetClientByIdResp);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
"sundynix-micro-go/app/system/rpc/internal/config"
|
||||
"sundynix-micro-go/app/system/rpc/internal/server"
|
||||
"sundynix-micro-go/app/system/rpc/internal/svc"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "etc/system.yaml", "the config file")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
ctx := svc.NewServiceContext(c)
|
||||
|
||||
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||
system.RegisterSystemServiceServer(grpcServer, server.NewSystemServiceServer(ctx))
|
||||
|
||||
if c.Mode == service.DevMode || c.Mode == service.TestMode {
|
||||
reflection.Register(grpcServer)
|
||||
}
|
||||
})
|
||||
defer s.Stop()
|
||||
|
||||
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
|
||||
s.Start()
|
||||
}
|
||||
@@ -0,0 +1,745 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v7.34.1
|
||||
// source: pb/system.proto
|
||||
|
||||
package system
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type CommonResp struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
|
||||
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CommonResp) Reset() {
|
||||
*x = CommonResp{}
|
||||
mi := &file_pb_system_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CommonResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CommonResp) ProtoMessage() {}
|
||||
|
||||
func (x *CommonResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_system_proto_msgTypes[0]
|
||||
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 CommonResp.ProtoReflect.Descriptor instead.
|
||||
func (*CommonResp) Descriptor() ([]byte, []int) {
|
||||
return file_pb_system_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *CommonResp) GetCode() int64 {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *CommonResp) GetMsg() string {
|
||||
if x != nil {
|
||||
return x.Msg
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type RoleInfo struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"`
|
||||
Sort int32 `protobuf:"varint,4,opt,name=sort,proto3" json:"sort,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *RoleInfo) Reset() {
|
||||
*x = RoleInfo{}
|
||||
mi := &file_pb_system_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RoleInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RoleInfo) ProtoMessage() {}
|
||||
|
||||
func (x *RoleInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_system_proto_msgTypes[1]
|
||||
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 RoleInfo.ProtoReflect.Descriptor instead.
|
||||
func (*RoleInfo) Descriptor() ([]byte, []int) {
|
||||
return file_pb_system_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *RoleInfo) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RoleInfo) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RoleInfo) GetCode() string {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RoleInfo) GetSort() int32 {
|
||||
if x != nil {
|
||||
return x.Sort
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type MenuInfo struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
ParentId string `protobuf:"bytes,2,opt,name=parentId,proto3" json:"parentId,omitempty"`
|
||||
Category int32 `protobuf:"varint,3,opt,name=category,proto3" json:"category,omitempty"`
|
||||
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"`
|
||||
Code string `protobuf:"bytes,6,opt,name=code,proto3" json:"code,omitempty"`
|
||||
Path string `protobuf:"bytes,7,opt,name=path,proto3" json:"path,omitempty"`
|
||||
Permission string `protobuf:"bytes,8,opt,name=permission,proto3" json:"permission,omitempty"`
|
||||
Locale string `protobuf:"bytes,9,opt,name=locale,proto3" json:"locale,omitempty"`
|
||||
Icon string `protobuf:"bytes,10,opt,name=icon,proto3" json:"icon,omitempty"`
|
||||
Sort int32 `protobuf:"varint,11,opt,name=sort,proto3" json:"sort,omitempty"`
|
||||
Children []*MenuInfo `protobuf:"bytes,12,rep,name=children,proto3" json:"children,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *MenuInfo) Reset() {
|
||||
*x = MenuInfo{}
|
||||
mi := &file_pb_system_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *MenuInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*MenuInfo) ProtoMessage() {}
|
||||
|
||||
func (x *MenuInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_system_proto_msgTypes[2]
|
||||
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 MenuInfo.ProtoReflect.Descriptor instead.
|
||||
func (*MenuInfo) Descriptor() ([]byte, []int) {
|
||||
return file_pb_system_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *MenuInfo) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MenuInfo) GetParentId() string {
|
||||
if x != nil {
|
||||
return x.ParentId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MenuInfo) GetCategory() int32 {
|
||||
if x != nil {
|
||||
return x.Category
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *MenuInfo) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MenuInfo) GetTitle() string {
|
||||
if x != nil {
|
||||
return x.Title
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MenuInfo) GetCode() string {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MenuInfo) GetPath() string {
|
||||
if x != nil {
|
||||
return x.Path
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MenuInfo) GetPermission() string {
|
||||
if x != nil {
|
||||
return x.Permission
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MenuInfo) GetLocale() string {
|
||||
if x != nil {
|
||||
return x.Locale
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MenuInfo) GetIcon() string {
|
||||
if x != nil {
|
||||
return x.Icon
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MenuInfo) GetSort() int32 {
|
||||
if x != nil {
|
||||
return x.Sort
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *MenuInfo) GetChildren() []*MenuInfo {
|
||||
if x != nil {
|
||||
return x.Children
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ClientInfo struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
ClientId string `protobuf:"bytes,2,opt,name=clientId,proto3" json:"clientId,omitempty"`
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||
GrantType string `protobuf:"bytes,4,opt,name=grantType,proto3" json:"grantType,omitempty"`
|
||||
AdditionalInfo string `protobuf:"bytes,5,opt,name=additionalInfo,proto3" json:"additionalInfo,omitempty"`
|
||||
ActiveTimeout int64 `protobuf:"varint,6,opt,name=activeTimeout,proto3" json:"activeTimeout,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ClientInfo) Reset() {
|
||||
*x = ClientInfo{}
|
||||
mi := &file_pb_system_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ClientInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ClientInfo) ProtoMessage() {}
|
||||
|
||||
func (x *ClientInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_system_proto_msgTypes[3]
|
||||
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 ClientInfo.ProtoReflect.Descriptor instead.
|
||||
func (*ClientInfo) Descriptor() ([]byte, []int) {
|
||||
return file_pb_system_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *ClientInfo) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ClientInfo) GetClientId() string {
|
||||
if x != nil {
|
||||
return x.ClientId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ClientInfo) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ClientInfo) GetGrantType() string {
|
||||
if x != nil {
|
||||
return x.GrantType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ClientInfo) GetAdditionalInfo() string {
|
||||
if x != nil {
|
||||
return x.AdditionalInfo
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ClientInfo) GetActiveTimeout() int64 {
|
||||
if x != nil {
|
||||
return x.ActiveTimeout
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetRolesByUserIdReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetRolesByUserIdReq) Reset() {
|
||||
*x = GetRolesByUserIdReq{}
|
||||
mi := &file_pb_system_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetRolesByUserIdReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetRolesByUserIdReq) ProtoMessage() {}
|
||||
|
||||
func (x *GetRolesByUserIdReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_system_proto_msgTypes[4]
|
||||
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 GetRolesByUserIdReq.ProtoReflect.Descriptor instead.
|
||||
func (*GetRolesByUserIdReq) Descriptor() ([]byte, []int) {
|
||||
return file_pb_system_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *GetRolesByUserIdReq) GetUserId() string {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetRolesByUserIdResp struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Roles []*RoleInfo `protobuf:"bytes,1,rep,name=roles,proto3" json:"roles,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetRolesByUserIdResp) Reset() {
|
||||
*x = GetRolesByUserIdResp{}
|
||||
mi := &file_pb_system_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetRolesByUserIdResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetRolesByUserIdResp) ProtoMessage() {}
|
||||
|
||||
func (x *GetRolesByUserIdResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_system_proto_msgTypes[5]
|
||||
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 GetRolesByUserIdResp.ProtoReflect.Descriptor instead.
|
||||
func (*GetRolesByUserIdResp) Descriptor() ([]byte, []int) {
|
||||
return file_pb_system_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *GetRolesByUserIdResp) GetRoles() []*RoleInfo {
|
||||
if x != nil {
|
||||
return x.Roles
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetMenusByRoleIdReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
RoleId string `protobuf:"bytes,1,opt,name=roleId,proto3" json:"roleId,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetMenusByRoleIdReq) Reset() {
|
||||
*x = GetMenusByRoleIdReq{}
|
||||
mi := &file_pb_system_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetMenusByRoleIdReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetMenusByRoleIdReq) ProtoMessage() {}
|
||||
|
||||
func (x *GetMenusByRoleIdReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_system_proto_msgTypes[6]
|
||||
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 GetMenusByRoleIdReq.ProtoReflect.Descriptor instead.
|
||||
func (*GetMenusByRoleIdReq) Descriptor() ([]byte, []int) {
|
||||
return file_pb_system_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *GetMenusByRoleIdReq) GetRoleId() string {
|
||||
if x != nil {
|
||||
return x.RoleId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetMenusByRoleIdResp struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Menus []*MenuInfo `protobuf:"bytes,1,rep,name=menus,proto3" json:"menus,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetMenusByRoleIdResp) Reset() {
|
||||
*x = GetMenusByRoleIdResp{}
|
||||
mi := &file_pb_system_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetMenusByRoleIdResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetMenusByRoleIdResp) ProtoMessage() {}
|
||||
|
||||
func (x *GetMenusByRoleIdResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_system_proto_msgTypes[7]
|
||||
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 GetMenusByRoleIdResp.ProtoReflect.Descriptor instead.
|
||||
func (*GetMenusByRoleIdResp) Descriptor() ([]byte, []int) {
|
||||
return file_pb_system_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *GetMenusByRoleIdResp) GetMenus() []*MenuInfo {
|
||||
if x != nil {
|
||||
return x.Menus
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetClientByIdReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
ClientId string `protobuf:"bytes,1,opt,name=clientId,proto3" json:"clientId,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetClientByIdReq) Reset() {
|
||||
*x = GetClientByIdReq{}
|
||||
mi := &file_pb_system_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetClientByIdReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetClientByIdReq) ProtoMessage() {}
|
||||
|
||||
func (x *GetClientByIdReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_system_proto_msgTypes[8]
|
||||
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 GetClientByIdReq.ProtoReflect.Descriptor instead.
|
||||
func (*GetClientByIdReq) Descriptor() ([]byte, []int) {
|
||||
return file_pb_system_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *GetClientByIdReq) GetClientId() string {
|
||||
if x != nil {
|
||||
return x.ClientId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetClientByIdResp struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Client *ClientInfo `protobuf:"bytes,1,opt,name=client,proto3" json:"client,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetClientByIdResp) Reset() {
|
||||
*x = GetClientByIdResp{}
|
||||
mi := &file_pb_system_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetClientByIdResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetClientByIdResp) ProtoMessage() {}
|
||||
|
||||
func (x *GetClientByIdResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pb_system_proto_msgTypes[9]
|
||||
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 GetClientByIdResp.ProtoReflect.Descriptor instead.
|
||||
func (*GetClientByIdResp) Descriptor() ([]byte, []int) {
|
||||
return file_pb_system_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *GetClientByIdResp) GetClient() *ClientInfo {
|
||||
if x != nil {
|
||||
return x.Client
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_pb_system_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_pb_system_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x0fpb/system.proto\x12\x06system\"2\n" +
|
||||
"\n" +
|
||||
"CommonResp\x12\x12\n" +
|
||||
"\x04code\x18\x01 \x01(\x03R\x04code\x12\x10\n" +
|
||||
"\x03msg\x18\x02 \x01(\tR\x03msg\"V\n" +
|
||||
"\bRoleInfo\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" +
|
||||
"\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" +
|
||||
"\x04code\x18\x03 \x01(\tR\x04code\x12\x12\n" +
|
||||
"\x04sort\x18\x04 \x01(\x05R\x04sort\"\xb2\x02\n" +
|
||||
"\bMenuInfo\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\tR\x02id\x12\x1a\n" +
|
||||
"\bparentId\x18\x02 \x01(\tR\bparentId\x12\x1a\n" +
|
||||
"\bcategory\x18\x03 \x01(\x05R\bcategory\x12\x12\n" +
|
||||
"\x04name\x18\x04 \x01(\tR\x04name\x12\x14\n" +
|
||||
"\x05title\x18\x05 \x01(\tR\x05title\x12\x12\n" +
|
||||
"\x04code\x18\x06 \x01(\tR\x04code\x12\x12\n" +
|
||||
"\x04path\x18\a \x01(\tR\x04path\x12\x1e\n" +
|
||||
"\n" +
|
||||
"permission\x18\b \x01(\tR\n" +
|
||||
"permission\x12\x16\n" +
|
||||
"\x06locale\x18\t \x01(\tR\x06locale\x12\x12\n" +
|
||||
"\x04icon\x18\n" +
|
||||
" \x01(\tR\x04icon\x12\x12\n" +
|
||||
"\x04sort\x18\v \x01(\x05R\x04sort\x12,\n" +
|
||||
"\bchildren\x18\f \x03(\v2\x10.system.MenuInfoR\bchildren\"\xb8\x01\n" +
|
||||
"\n" +
|
||||
"ClientInfo\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\tR\x02id\x12\x1a\n" +
|
||||
"\bclientId\x18\x02 \x01(\tR\bclientId\x12\x12\n" +
|
||||
"\x04name\x18\x03 \x01(\tR\x04name\x12\x1c\n" +
|
||||
"\tgrantType\x18\x04 \x01(\tR\tgrantType\x12&\n" +
|
||||
"\x0eadditionalInfo\x18\x05 \x01(\tR\x0eadditionalInfo\x12$\n" +
|
||||
"\ractiveTimeout\x18\x06 \x01(\x03R\ractiveTimeout\"-\n" +
|
||||
"\x13GetRolesByUserIdReq\x12\x16\n" +
|
||||
"\x06userId\x18\x01 \x01(\tR\x06userId\">\n" +
|
||||
"\x14GetRolesByUserIdResp\x12&\n" +
|
||||
"\x05roles\x18\x01 \x03(\v2\x10.system.RoleInfoR\x05roles\"-\n" +
|
||||
"\x13GetMenusByRoleIdReq\x12\x16\n" +
|
||||
"\x06roleId\x18\x01 \x01(\tR\x06roleId\">\n" +
|
||||
"\x14GetMenusByRoleIdResp\x12&\n" +
|
||||
"\x05menus\x18\x01 \x03(\v2\x10.system.MenuInfoR\x05menus\".\n" +
|
||||
"\x10GetClientByIdReq\x12\x1a\n" +
|
||||
"\bclientId\x18\x01 \x01(\tR\bclientId\"?\n" +
|
||||
"\x11GetClientByIdResp\x12*\n" +
|
||||
"\x06client\x18\x01 \x01(\v2\x12.system.ClientInfoR\x06client2\xf3\x01\n" +
|
||||
"\rSystemService\x12M\n" +
|
||||
"\x10GetRolesByUserId\x12\x1b.system.GetRolesByUserIdReq\x1a\x1c.system.GetRolesByUserIdResp\x12M\n" +
|
||||
"\x10GetMenusByRoleId\x12\x1b.system.GetMenusByRoleIdReq\x1a\x1c.system.GetMenusByRoleIdResp\x12D\n" +
|
||||
"\rGetClientById\x12\x18.system.GetClientByIdReq\x1a\x19.system.GetClientByIdRespB\n" +
|
||||
"Z\b./systemb\x06proto3"
|
||||
|
||||
var (
|
||||
file_pb_system_proto_rawDescOnce sync.Once
|
||||
file_pb_system_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_pb_system_proto_rawDescGZIP() []byte {
|
||||
file_pb_system_proto_rawDescOnce.Do(func() {
|
||||
file_pb_system_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_pb_system_proto_rawDesc), len(file_pb_system_proto_rawDesc)))
|
||||
})
|
||||
return file_pb_system_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_pb_system_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||
var file_pb_system_proto_goTypes = []any{
|
||||
(*CommonResp)(nil), // 0: system.CommonResp
|
||||
(*RoleInfo)(nil), // 1: system.RoleInfo
|
||||
(*MenuInfo)(nil), // 2: system.MenuInfo
|
||||
(*ClientInfo)(nil), // 3: system.ClientInfo
|
||||
(*GetRolesByUserIdReq)(nil), // 4: system.GetRolesByUserIdReq
|
||||
(*GetRolesByUserIdResp)(nil), // 5: system.GetRolesByUserIdResp
|
||||
(*GetMenusByRoleIdReq)(nil), // 6: system.GetMenusByRoleIdReq
|
||||
(*GetMenusByRoleIdResp)(nil), // 7: system.GetMenusByRoleIdResp
|
||||
(*GetClientByIdReq)(nil), // 8: system.GetClientByIdReq
|
||||
(*GetClientByIdResp)(nil), // 9: system.GetClientByIdResp
|
||||
}
|
||||
var file_pb_system_proto_depIdxs = []int32{
|
||||
2, // 0: system.MenuInfo.children:type_name -> system.MenuInfo
|
||||
1, // 1: system.GetRolesByUserIdResp.roles:type_name -> system.RoleInfo
|
||||
2, // 2: system.GetMenusByRoleIdResp.menus:type_name -> system.MenuInfo
|
||||
3, // 3: system.GetClientByIdResp.client:type_name -> system.ClientInfo
|
||||
4, // 4: system.SystemService.GetRolesByUserId:input_type -> system.GetRolesByUserIdReq
|
||||
6, // 5: system.SystemService.GetMenusByRoleId:input_type -> system.GetMenusByRoleIdReq
|
||||
8, // 6: system.SystemService.GetClientById:input_type -> system.GetClientByIdReq
|
||||
5, // 7: system.SystemService.GetRolesByUserId:output_type -> system.GetRolesByUserIdResp
|
||||
7, // 8: system.SystemService.GetMenusByRoleId:output_type -> system.GetMenusByRoleIdResp
|
||||
9, // 9: system.SystemService.GetClientById:output_type -> system.GetClientByIdResp
|
||||
7, // [7:10] is the sub-list for method output_type
|
||||
4, // [4:7] is the sub-list for method input_type
|
||||
4, // [4:4] is the sub-list for extension type_name
|
||||
4, // [4:4] is the sub-list for extension extendee
|
||||
0, // [0:4] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_pb_system_proto_init() }
|
||||
func file_pb_system_proto_init() {
|
||||
if File_pb_system_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_pb_system_proto_rawDesc), len(file_pb_system_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 10,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_pb_system_proto_goTypes,
|
||||
DependencyIndexes: file_pb_system_proto_depIdxs,
|
||||
MessageInfos: file_pb_system_proto_msgTypes,
|
||||
}.Build()
|
||||
File_pb_system_proto = out.File
|
||||
file_pb_system_proto_goTypes = nil
|
||||
file_pb_system_proto_depIdxs = nil
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.1
|
||||
// - protoc v7.34.1
|
||||
// source: pb/system.proto
|
||||
|
||||
package system
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
SystemService_GetRolesByUserId_FullMethodName = "/system.SystemService/GetRolesByUserId"
|
||||
SystemService_GetMenusByRoleId_FullMethodName = "/system.SystemService/GetMenusByRoleId"
|
||||
SystemService_GetClientById_FullMethodName = "/system.SystemService/GetClientById"
|
||||
)
|
||||
|
||||
// SystemServiceClient is the client API for SystemService service.
|
||||
//
|
||||
// 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 SystemServiceClient interface {
|
||||
// 获取用户角色列表
|
||||
GetRolesByUserId(ctx context.Context, in *GetRolesByUserIdReq, opts ...grpc.CallOption) (*GetRolesByUserIdResp, error)
|
||||
// 获取角色菜单列表
|
||||
GetMenusByRoleId(ctx context.Context, in *GetMenusByRoleIdReq, opts ...grpc.CallOption) (*GetMenusByRoleIdResp, error)
|
||||
// 获取客户端信息
|
||||
GetClientById(ctx context.Context, in *GetClientByIdReq, opts ...grpc.CallOption) (*GetClientByIdResp, error)
|
||||
}
|
||||
|
||||
type systemServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewSystemServiceClient(cc grpc.ClientConnInterface) SystemServiceClient {
|
||||
return &systemServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *systemServiceClient) GetRolesByUserId(ctx context.Context, in *GetRolesByUserIdReq, opts ...grpc.CallOption) (*GetRolesByUserIdResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetRolesByUserIdResp)
|
||||
err := c.cc.Invoke(ctx, SystemService_GetRolesByUserId_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *systemServiceClient) GetMenusByRoleId(ctx context.Context, in *GetMenusByRoleIdReq, opts ...grpc.CallOption) (*GetMenusByRoleIdResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetMenusByRoleIdResp)
|
||||
err := c.cc.Invoke(ctx, SystemService_GetMenusByRoleId_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *systemServiceClient) GetClientById(ctx context.Context, in *GetClientByIdReq, opts ...grpc.CallOption) (*GetClientByIdResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetClientByIdResp)
|
||||
err := c.cc.Invoke(ctx, SystemService_GetClientById_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// SystemServiceServer is the server API for SystemService service.
|
||||
// All implementations must embed UnimplementedSystemServiceServer
|
||||
// for forward compatibility.
|
||||
type SystemServiceServer interface {
|
||||
// 获取用户角色列表
|
||||
GetRolesByUserId(context.Context, *GetRolesByUserIdReq) (*GetRolesByUserIdResp, error)
|
||||
// 获取角色菜单列表
|
||||
GetMenusByRoleId(context.Context, *GetMenusByRoleIdReq) (*GetMenusByRoleIdResp, error)
|
||||
// 获取客户端信息
|
||||
GetClientById(context.Context, *GetClientByIdReq) (*GetClientByIdResp, error)
|
||||
mustEmbedUnimplementedSystemServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedSystemServiceServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedSystemServiceServer struct{}
|
||||
|
||||
func (UnimplementedSystemServiceServer) GetRolesByUserId(context.Context, *GetRolesByUserIdReq) (*GetRolesByUserIdResp, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetRolesByUserId not implemented")
|
||||
}
|
||||
func (UnimplementedSystemServiceServer) GetMenusByRoleId(context.Context, *GetMenusByRoleIdReq) (*GetMenusByRoleIdResp, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetMenusByRoleId not implemented")
|
||||
}
|
||||
func (UnimplementedSystemServiceServer) GetClientById(context.Context, *GetClientByIdReq) (*GetClientByIdResp, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetClientById not implemented")
|
||||
}
|
||||
func (UnimplementedSystemServiceServer) mustEmbedUnimplementedSystemServiceServer() {}
|
||||
func (UnimplementedSystemServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeSystemServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to SystemServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeSystemServiceServer interface {
|
||||
mustEmbedUnimplementedSystemServiceServer()
|
||||
}
|
||||
|
||||
func RegisterSystemServiceServer(s grpc.ServiceRegistrar, srv SystemServiceServer) {
|
||||
// If the following call panics, it indicates UnimplementedSystemServiceServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&SystemService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _SystemService_GetRolesByUserId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetRolesByUserIdReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SystemServiceServer).GetRolesByUserId(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: SystemService_GetRolesByUserId_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SystemServiceServer).GetRolesByUserId(ctx, req.(*GetRolesByUserIdReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _SystemService_GetMenusByRoleId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetMenusByRoleIdReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SystemServiceServer).GetMenusByRoleId(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: SystemService_GetMenusByRoleId_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SystemServiceServer).GetMenusByRoleId(ctx, req.(*GetMenusByRoleIdReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _SystemService_GetClientById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetClientByIdReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SystemServiceServer).GetClientById(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: SystemService_GetClientById_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SystemServiceServer).GetClientById(ctx, req.(*GetClientByIdReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// SystemService_ServiceDesc is the grpc.ServiceDesc for SystemService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var SystemService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "system.SystemService",
|
||||
HandlerType: (*SystemServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetRolesByUserId",
|
||||
Handler: _SystemService_GetRolesByUserId_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMenusByRoleId",
|
||||
Handler: _SystemService_GetMenusByRoleId_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetClientById",
|
||||
Handler: _SystemService_GetClientById_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "pb/system.proto",
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.10.1
|
||||
// Source: system.proto
|
||||
|
||||
package systemservice
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type (
|
||||
ClientInfo = system.ClientInfo
|
||||
CommonResp = system.CommonResp
|
||||
GetClientByIdReq = system.GetClientByIdReq
|
||||
GetClientByIdResp = system.GetClientByIdResp
|
||||
GetMenusByRoleIdReq = system.GetMenusByRoleIdReq
|
||||
GetMenusByRoleIdResp = system.GetMenusByRoleIdResp
|
||||
GetRolesByUserIdReq = system.GetRolesByUserIdReq
|
||||
GetRolesByUserIdResp = system.GetRolesByUserIdResp
|
||||
MenuInfo = system.MenuInfo
|
||||
RoleInfo = system.RoleInfo
|
||||
|
||||
SystemService interface {
|
||||
// 获取用户角色列表
|
||||
GetRolesByUserId(ctx context.Context, in *GetRolesByUserIdReq, opts ...grpc.CallOption) (*GetRolesByUserIdResp, error)
|
||||
// 获取角色菜单列表
|
||||
GetMenusByRoleId(ctx context.Context, in *GetMenusByRoleIdReq, opts ...grpc.CallOption) (*GetMenusByRoleIdResp, error)
|
||||
// 获取客户端信息
|
||||
GetClientById(ctx context.Context, in *GetClientByIdReq, opts ...grpc.CallOption) (*GetClientByIdResp, error)
|
||||
}
|
||||
|
||||
defaultSystemService struct {
|
||||
cli zrpc.Client
|
||||
}
|
||||
)
|
||||
|
||||
func NewSystemService(cli zrpc.Client) SystemService {
|
||||
return &defaultSystemService{
|
||||
cli: cli,
|
||||
}
|
||||
}
|
||||
|
||||
// 获取用户角色列表
|
||||
func (m *defaultSystemService) GetRolesByUserId(ctx context.Context, in *GetRolesByUserIdReq, opts ...grpc.CallOption) (*GetRolesByUserIdResp, error) {
|
||||
client := system.NewSystemServiceClient(m.cli.Conn())
|
||||
return client.GetRolesByUserId(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 获取角色菜单列表
|
||||
func (m *defaultSystemService) GetMenusByRoleId(ctx context.Context, in *GetMenusByRoleIdReq, opts ...grpc.CallOption) (*GetMenusByRoleIdResp, error) {
|
||||
client := system.NewSystemServiceClient(m.cli.Conn())
|
||||
return client.GetMenusByRoleId(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 获取客户端信息
|
||||
func (m *defaultSystemService) GetClientById(ctx context.Context, in *GetClientByIdReq, opts ...grpc.CallOption) (*GetClientByIdResp, error) {
|
||||
client := system.NewSystemServiceClient(m.cli.Conn())
|
||||
return client.GetClientById(ctx, in, opts...)
|
||||
}
|
||||
Reference in New Issue
Block a user