Files
sundynix-micro-be/app/system/rpc/pb/system.proto
T
2026-04-27 21:23:13 +08:00

273 lines
5.1 KiB
Protocol Buffer

syntax = "proto3";
package system;
option go_package = "./system";
// ========== 通用消息 ==========
message CommonResp {
int64 code = 1;
string msg = 2;
}
message IdReq {
string id = 1;
}
message IdsReq {
repeated string ids = 1;
}
// ========== 角色 ==========
message RoleInfo {
string id = 1;
string name = 2;
string code = 3;
int32 sort = 4;
repeated string menuIds = 5;
}
message RoleReq {
string name = 1;
string code = 2;
int32 sort = 3;
repeated string menuIds = 4;
}
message RoleUpdateReq {
string id = 1;
string name = 2;
string code = 3;
int32 sort = 4;
repeated string menuIds = 5;
}
message RoleListReq {
int32 current = 1;
int32 pageSize = 2;
string name = 3;
}
message RoleListResp {
repeated RoleInfo list = 1;
int64 total = 2;
}
// ========== 菜单 ==========
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 MenuReq {
string parentId = 1;
int32 category = 2;
string name = 3;
string title = 4;
string code = 5;
string path = 6;
string permission = 7;
string locale = 8;
string icon = 9;
int32 sort = 10;
}
message MenuUpdateReq {
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;
}
message MenuListResp {
repeated MenuInfo menus = 1;
}
// ========== 客户端 ==========
message ClientInfo {
string id = 1;
string clientId = 2;
string name = 3;
string grantType = 4;
string additionalInfo = 5;
int64 activeTimeout = 6;
}
message ClientReq {
string clientId = 1;
string name = 2;
string grantType = 3;
string additionalInfo = 4;
int64 activeTimeout = 5;
}
message ClientUpdateReq {
string id = 1;
string clientId = 2;
string name = 3;
string grantType = 4;
string additionalInfo = 5;
int64 activeTimeout = 6;
}
message ClientListReq {
int32 current = 1;
int32 pageSize = 2;
string name = 3;
}
message ClientListResp {
repeated ClientInfo list = 1;
int64 total = 2;
}
// ========== 字典 ==========
message DictInfo {
string id = 1;
string type = 2;
string label = 3;
string value = 4;
int32 sort = 5;
string desc = 6;
}
message DictReq {
string type = 1;
string label = 2;
string value = 3;
int32 sort = 4;
string desc = 5;
}
message DictUpdateReq {
string id = 1;
string type = 2;
string label = 3;
string value = 4;
int32 sort = 5;
string desc = 6;
}
message DictListReq {
int32 current = 1;
int32 pageSize = 2;
string type = 3;
}
message DictListResp {
repeated DictInfo list = 1;
int64 total = 2;
}
// ========== 操作日志 ==========
message OperationRecordInfo {
string id = 1;
string ip = 2;
string method = 3;
string path = 4;
int32 status = 5;
string agent = 6;
string errorMessage = 7;
string body = 8;
string resp = 9;
string userId = 10;
int64 createdAt = 11;
}
message OperationRecordListReq {
int32 current = 1;
int32 pageSize = 2;
string method = 3;
string path = 4;
int32 status = 5;
}
message OperationRecordListResp {
repeated OperationRecordInfo list = 1;
int64 total = 2;
}
// ========== 请求/响应(原有) ==========
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 CreateRole(RoleReq) returns (CommonResp);
rpc UpdateRole(RoleUpdateReq) returns (CommonResp);
rpc DeleteRole(IdsReq) returns (CommonResp);
rpc GetRoleList(RoleListReq) returns (RoleListResp);
// --- 菜单 ---
rpc GetMenusByRoleId(GetMenusByRoleIdReq) returns (GetMenusByRoleIdResp);
rpc CreateMenu(MenuReq) returns (CommonResp);
rpc UpdateMenu(MenuUpdateReq) returns (CommonResp);
rpc DeleteMenu(IdsReq) returns (CommonResp);
rpc GetMenuList(IdReq) returns (MenuListResp); // 传空id返回全部树
// --- 客户端 ---
rpc GetClientById(GetClientByIdReq) returns (GetClientByIdResp);
rpc CreateClient(ClientReq) returns (CommonResp);
rpc UpdateClient(ClientUpdateReq) returns (CommonResp);
rpc DeleteClient(IdsReq) returns (CommonResp);
rpc GetClientList(ClientListReq) returns (ClientListResp);
// --- 字典 ---
rpc CreateDict(DictReq) returns (CommonResp);
rpc UpdateDict(DictUpdateReq) returns (CommonResp);
rpc DeleteDict(IdsReq) returns (CommonResp);
rpc GetDictList(DictListReq) returns (DictListResp);
// --- 操作日志 ---
rpc DeleteOperationRecord(IdsReq) returns (CommonResp);
rpc GetOperationRecordList(OperationRecordListReq) returns (OperationRecordListResp);
}