feat: 初次启动

This commit is contained in:
Blizzard
2026-04-27 21:23:13 +08:00
parent e515f6a287
commit bb8ad4d515
148 changed files with 8602 additions and 5678 deletions
+3
View File
@@ -1,4 +1,7 @@
Name: system.rpc
Log:
Encoding: plain
ListenOn: 0.0.0.0:9103
Etcd:
Hosts:
@@ -0,0 +1,33 @@
package logic
import (
"context"
"fmt"
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"
)
type CreateClientLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewCreateClientLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateClientLogic {
return &CreateClientLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *CreateClientLogic) CreateClient(in *system.ClientReq) (*system.CommonResp, error) {
client := sysModel.SundynixClient{
ClientID: in.ClientId, Name: in.Name, GrantType: in.GrantType,
AdditionalInfo: in.AdditionalInfo, ActiveTimeout: in.ActiveTimeout,
}
if err := l.svcCtx.DB.Create(&client).Error; err != nil {
return nil, fmt.Errorf("创建客户端失败: %v", err)
}
return &system.CommonResp{Code: 200, Msg: "success"}, nil
}
@@ -0,0 +1,28 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type CreateDictLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewCreateDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateDictLogic {
return &CreateDictLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *CreateDictLogic) CreateDict(in *system.DictReq) (*system.CommonResp, error) {
dict := sysModel.SundynixDict{Type: in.Type, Label: in.Label, Value: in.Value, Sort: int(in.Sort), Desc: in.Desc}
if err := l.svcCtx.DB.Create(&dict).Error; err != nil {
return nil, fmt.Errorf("创建字典失败")
}
return &system.CommonResp{Code: 200, Msg: "success"}, nil
}
@@ -0,0 +1,32 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type CreateMenuLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewCreateMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateMenuLogic {
return &CreateMenuLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *CreateMenuLogic) CreateMenu(in *system.MenuReq) (*system.CommonResp, error) {
menu := sysModel.SundynixMenu{
ParentID: in.ParentId, Category: int(in.Category), Name: in.Name, Title: in.Title,
Code: in.Code, Path: in.Path, Permission: in.Permission, Locale: in.Locale,
Icon: in.Icon, Sort: int(in.Sort),
}
if err := l.svcCtx.DB.Create(&menu).Error; err != nil {
return nil, fmt.Errorf("创建菜单失败")
}
return &system.CommonResp{Code: 200, Msg: "success"}, nil
}
@@ -0,0 +1,34 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type CreateRoleLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewCreateRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateRoleLogic {
return &CreateRoleLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *CreateRoleLogic) CreateRole(in *system.RoleReq) (*system.CommonResp, error) {
role := sysModel.SundynixRole{Name: in.Name, Code: in.Code, Sort: int(in.Sort)}
if err := l.svcCtx.DB.Create(&role).Error; err != nil {
return nil, fmt.Errorf("创建角色失败")
}
// 关联菜单
if len(in.MenuIds) > 0 {
for _, mid := range in.MenuIds {
l.svcCtx.DB.Create(&sysModel.SundynixRoleMenu{RoleID: role.ID, MenuID: mid})
}
}
return &system.CommonResp{Code: 200, Msg: "success"}, nil
}
@@ -0,0 +1,27 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type DeleteClientLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewDeleteClientLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteClientLogic {
return &DeleteClientLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *DeleteClientLogic) DeleteClient(in *system.IdsReq) (*system.CommonResp, error) {
if err := l.svcCtx.DB.Where("id IN ?", in.Ids).Delete(&sysModel.SundynixClient{}).Error; err != nil {
return nil, fmt.Errorf("删除客户端失败")
}
return &system.CommonResp{Code: 200, Msg: "success"}, nil
}
@@ -0,0 +1,27 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type DeleteDictLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewDeleteDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteDictLogic {
return &DeleteDictLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *DeleteDictLogic) DeleteDict(in *system.IdsReq) (*system.CommonResp, error) {
if err := l.svcCtx.DB.Where("id IN ?", in.Ids).Delete(&sysModel.SundynixDict{}).Error; err != nil {
return nil, fmt.Errorf("删除字典失败")
}
return &system.CommonResp{Code: 200, Msg: "success"}, nil
}
@@ -0,0 +1,28 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type DeleteMenuLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewDeleteMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteMenuLogic {
return &DeleteMenuLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *DeleteMenuLogic) DeleteMenu(in *system.IdsReq) (*system.CommonResp, error) {
if err := l.svcCtx.DB.Where("id IN ?", in.Ids).Delete(&sysModel.SundynixMenu{}).Error; err != nil {
return nil, fmt.Errorf("删除菜单失败")
}
l.svcCtx.DB.Where("menu_id IN ?", in.Ids).Delete(&sysModel.SundynixRoleMenu{})
return &system.CommonResp{Code: 200, Msg: "success"}, nil
}
@@ -0,0 +1,27 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type DeleteOperationRecordLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewDeleteOperationRecordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteOperationRecordLogic {
return &DeleteOperationRecordLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *DeleteOperationRecordLogic) DeleteOperationRecord(in *system.IdsReq) (*system.CommonResp, error) {
if err := l.svcCtx.DB.Where("id IN ?", in.Ids).Delete(&sysModel.SundynixOperationRecord{}).Error; err != nil {
return nil, fmt.Errorf("删除操作日志失败")
}
return &system.CommonResp{Code: 200, Msg: "success"}, nil
}
@@ -0,0 +1,28 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type DeleteRoleLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewDeleteRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteRoleLogic {
return &DeleteRoleLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *DeleteRoleLogic) DeleteRole(in *system.IdsReq) (*system.CommonResp, error) {
if err := l.svcCtx.DB.Where("id IN ?", in.Ids).Delete(&sysModel.SundynixRole{}).Error; err != nil {
return nil, fmt.Errorf("删除角色失败")
}
l.svcCtx.DB.Where("role_id IN ?", in.Ids).Delete(&sysModel.SundynixRoleMenu{})
return &system.CommonResp{Code: 200, Msg: "success"}, nil
}
@@ -0,0 +1,48 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type GetClientListLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetClientListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetClientListLogic {
return &GetClientListLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *GetClientListLogic) GetClientList(in *system.ClientListReq) (*system.ClientListResp, error) {
var list []sysModel.SundynixClient
var total int64
db := l.svcCtx.DB.Model(&sysModel.SundynixClient{})
if in.Name != "" {
db = db.Where("name LIKE ?", "%"+in.Name+"%")
}
db.Count(&total)
current, pageSize := int(in.Current), int(in.PageSize)
if current <= 0 {
current = 1
}
if pageSize <= 0 {
pageSize = 10
}
if err := db.Offset((current - 1) * pageSize).Limit(pageSize).Order("created_at DESC").Find(&list).Error; err != nil {
return nil, fmt.Errorf("查询客户端列表失败")
}
var items []*system.ClientInfo
for _, c := range list {
items = append(items, &system.ClientInfo{
Id: c.ID, ClientId: c.ClientID, Name: c.Name, GrantType: c.GrantType,
AdditionalInfo: c.AdditionalInfo, ActiveTimeout: int64(c.ActiveTimeout),
})
}
return &system.ClientListResp{List: items, Total: total}, nil
}
@@ -0,0 +1,45 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type GetDictListLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetDictListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDictListLogic {
return &GetDictListLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *GetDictListLogic) GetDictList(in *system.DictListReq) (*system.DictListResp, error) {
var list []sysModel.SundynixDict
var total int64
db := l.svcCtx.DB.Model(&sysModel.SundynixDict{})
if in.Type != "" {
db = db.Where("type = ?", in.Type)
}
db.Count(&total)
current, pageSize := int(in.Current), int(in.PageSize)
if current <= 0 {
current = 1
}
if pageSize <= 0 {
pageSize = 10
}
if err := db.Offset((current - 1) * pageSize).Limit(pageSize).Order("sort ASC").Find(&list).Error; err != nil {
return nil, fmt.Errorf("查询字典列表失败")
}
var items []*system.DictInfo
for _, d := range list {
items = append(items, &system.DictInfo{Id: d.ID, Type: d.Type, Label: d.Label, Value: d.Value, Sort: int32(d.Sort), Desc: d.Desc})
}
return &system.DictListResp{List: items, Total: total}, nil
}
@@ -0,0 +1,45 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type GetMenuListLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetMenuListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMenuListLogic {
return &GetMenuListLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *GetMenuListLogic) GetMenuList(in *system.IdReq) (*system.MenuListResp, error) {
var menus []sysModel.SundynixMenu
if err := l.svcCtx.DB.Order("sort ASC").Find(&menus).Error; err != nil {
return nil, fmt.Errorf("查询菜单列表失败")
}
tree := buildMenuTree(menus, "")
return &system.MenuListResp{Menus: tree}, nil
}
func buildMenuTree(menus []sysModel.SundynixMenu, parentID string) []*system.MenuInfo {
var result []*system.MenuInfo
for _, m := range menus {
if m.ParentID == parentID {
info := &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: buildMenuTree(menus, m.ID),
}
result = append(result, info)
}
}
return result
}
@@ -0,0 +1,56 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type GetOperationRecordListLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetOperationRecordListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetOperationRecordListLogic {
return &GetOperationRecordListLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *GetOperationRecordListLogic) GetOperationRecordList(in *system.OperationRecordListReq) (*system.OperationRecordListResp, error) {
var list []sysModel.SundynixOperationRecord
var total int64
db := l.svcCtx.DB.Model(&sysModel.SundynixOperationRecord{})
if in.Method != "" {
db = db.Where("method = ?", in.Method)
}
if in.Path != "" {
db = db.Where("path LIKE ?", "%"+in.Path+"%")
}
if in.Status > 0 {
db = db.Where("status = ?", in.Status)
}
db.Count(&total)
current, pageSize := int(in.Current), int(in.PageSize)
if current <= 0 {
current = 1
}
if pageSize <= 0 {
pageSize = 10
}
if err := db.Offset((current - 1) * pageSize).Limit(pageSize).Order("created_at DESC").Find(&list).Error; err != nil {
return nil, fmt.Errorf("查询操作日志失败")
}
var items []*system.OperationRecordInfo
for _, r := range list {
items = append(items, &system.OperationRecordInfo{
Id: r.ID, Ip: r.IP, Method: r.Method, Path: r.Path,
Status: int32(r.Status), Agent: r.Agent, ErrorMessage: r.ErrorMessage,
Body: r.Body, Resp: r.Resp, UserId: r.UserID,
CreatedAt: r.CreatedAt.Unix(),
})
}
return &system.OperationRecordListResp{List: items, Total: total}, nil
}
@@ -0,0 +1,45 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type GetRoleListLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetRoleListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRoleListLogic {
return &GetRoleListLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *GetRoleListLogic) GetRoleList(in *system.RoleListReq) (*system.RoleListResp, error) {
var list []sysModel.SundynixRole
var total int64
db := l.svcCtx.DB.Model(&sysModel.SundynixRole{})
if in.Name != "" {
db = db.Where("name LIKE ?", "%"+in.Name+"%")
}
db.Count(&total)
current, pageSize := int(in.Current), int(in.PageSize)
if current <= 0 {
current = 1
}
if pageSize <= 0 {
pageSize = 10
}
if err := db.Offset((current - 1) * pageSize).Limit(pageSize).Order("sort ASC").Find(&list).Error; err != nil {
return nil, fmt.Errorf("查询角色列表失败")
}
var items []*system.RoleInfo
for _, r := range list {
items = append(items, &system.RoleInfo{Id: r.ID, Name: r.Name, Code: r.Code, Sort: int32(r.Sort)})
}
return &system.RoleListResp{List: items, Total: total}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type UpdateClientLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewUpdateClientLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateClientLogic {
return &UpdateClientLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *UpdateClientLogic) UpdateClient(in *system.ClientUpdateReq) (*system.CommonResp, error) {
if err := l.svcCtx.DB.Model(&sysModel.SundynixClient{}).Where("id = ?", in.Id).Updates(map[string]interface{}{
"client_id": in.ClientId, "name": in.Name, "grant_type": in.GrantType,
"additional_info": in.AdditionalInfo, "active_timeout": in.ActiveTimeout,
}).Error; err != nil {
return nil, fmt.Errorf("更新客户端失败")
}
return &system.CommonResp{Code: 200, Msg: "success"}, nil
}
@@ -0,0 +1,29 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type UpdateDictLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewUpdateDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateDictLogic {
return &UpdateDictLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *UpdateDictLogic) UpdateDict(in *system.DictUpdateReq) (*system.CommonResp, error) {
if err := l.svcCtx.DB.Model(&sysModel.SundynixDict{}).Where("id = ?", in.Id).Updates(map[string]interface{}{
"type": in.Type, "label": in.Label, "value": in.Value, "sort": in.Sort, "desc": in.Desc,
}).Error; err != nil {
return nil, fmt.Errorf("更新字典失败")
}
return &system.CommonResp{Code: 200, Msg: "success"}, nil
}
@@ -0,0 +1,31 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type UpdateMenuLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewUpdateMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateMenuLogic {
return &UpdateMenuLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *UpdateMenuLogic) UpdateMenu(in *system.MenuUpdateReq) (*system.CommonResp, error) {
if err := l.svcCtx.DB.Model(&sysModel.SundynixMenu{}).Where("id = ?", in.Id).Updates(map[string]interface{}{
"parent_id": in.ParentId, "category": in.Category, "name": in.Name, "title": in.Title,
"code": in.Code, "path": in.Path, "permission": in.Permission, "locale": in.Locale,
"icon": in.Icon, "sort": in.Sort,
}).Error; err != nil {
return nil, fmt.Errorf("更新菜单失败")
}
return &system.CommonResp{Code: 200, Msg: "success"}, nil
}
@@ -0,0 +1,34 @@
package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/internal/svc"
"sundynix-micro-go/app/system/rpc/system"
)
type UpdateRoleLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewUpdateRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateRoleLogic {
return &UpdateRoleLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
}
func (l *UpdateRoleLogic) UpdateRole(in *system.RoleUpdateReq) (*system.CommonResp, error) {
if err := l.svcCtx.DB.Model(&sysModel.SundynixRole{}).Where("id = ?", in.Id).Updates(map[string]interface{}{
"name": in.Name, "code": in.Code, "sort": in.Sort,
}).Error; err != nil {
return nil, fmt.Errorf("更新角色失败")
}
// 更新菜单关联
l.svcCtx.DB.Where("role_id = ?", in.Id).Delete(&sysModel.SundynixRoleMenu{})
for _, mid := range in.MenuIds {
l.svcCtx.DB.Create(&sysModel.SundynixRoleMenu{RoleID: in.Id, MenuID: mid})
}
return &system.CommonResp{Code: 200, Msg: "success"}, nil
}
@@ -23,20 +23,112 @@ func NewSystemServiceServer(svcCtx *svc.ServiceContext) *SystemServiceServer {
}
}
// 获取用户角色列表
// --- 角色 ---
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) CreateRole(ctx context.Context, in *system.RoleReq) (*system.CommonResp, error) {
l := logic.NewCreateRoleLogic(ctx, s.svcCtx)
return l.CreateRole(in)
}
func (s *SystemServiceServer) UpdateRole(ctx context.Context, in *system.RoleUpdateReq) (*system.CommonResp, error) {
l := logic.NewUpdateRoleLogic(ctx, s.svcCtx)
return l.UpdateRole(in)
}
func (s *SystemServiceServer) DeleteRole(ctx context.Context, in *system.IdsReq) (*system.CommonResp, error) {
l := logic.NewDeleteRoleLogic(ctx, s.svcCtx)
return l.DeleteRole(in)
}
func (s *SystemServiceServer) GetRoleList(ctx context.Context, in *system.RoleListReq) (*system.RoleListResp, error) {
l := logic.NewGetRoleListLogic(ctx, s.svcCtx)
return l.GetRoleList(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) CreateMenu(ctx context.Context, in *system.MenuReq) (*system.CommonResp, error) {
l := logic.NewCreateMenuLogic(ctx, s.svcCtx)
return l.CreateMenu(in)
}
func (s *SystemServiceServer) UpdateMenu(ctx context.Context, in *system.MenuUpdateReq) (*system.CommonResp, error) {
l := logic.NewUpdateMenuLogic(ctx, s.svcCtx)
return l.UpdateMenu(in)
}
func (s *SystemServiceServer) DeleteMenu(ctx context.Context, in *system.IdsReq) (*system.CommonResp, error) {
l := logic.NewDeleteMenuLogic(ctx, s.svcCtx)
return l.DeleteMenu(in)
}
func (s *SystemServiceServer) GetMenuList(ctx context.Context, in *system.IdReq) (*system.MenuListResp, error) {
l := logic.NewGetMenuListLogic(ctx, s.svcCtx)
return l.GetMenuList(in)
}
// --- 客户端 ---
func (s *SystemServiceServer) GetClientById(ctx context.Context, in *system.GetClientByIdReq) (*system.GetClientByIdResp, error) {
l := logic.NewGetClientByIdLogic(ctx, s.svcCtx)
return l.GetClientById(in)
}
func (s *SystemServiceServer) CreateClient(ctx context.Context, in *system.ClientReq) (*system.CommonResp, error) {
l := logic.NewCreateClientLogic(ctx, s.svcCtx)
return l.CreateClient(in)
}
func (s *SystemServiceServer) UpdateClient(ctx context.Context, in *system.ClientUpdateReq) (*system.CommonResp, error) {
l := logic.NewUpdateClientLogic(ctx, s.svcCtx)
return l.UpdateClient(in)
}
func (s *SystemServiceServer) DeleteClient(ctx context.Context, in *system.IdsReq) (*system.CommonResp, error) {
l := logic.NewDeleteClientLogic(ctx, s.svcCtx)
return l.DeleteClient(in)
}
func (s *SystemServiceServer) GetClientList(ctx context.Context, in *system.ClientListReq) (*system.ClientListResp, error) {
l := logic.NewGetClientListLogic(ctx, s.svcCtx)
return l.GetClientList(in)
}
// --- 字典 ---
func (s *SystemServiceServer) CreateDict(ctx context.Context, in *system.DictReq) (*system.CommonResp, error) {
l := logic.NewCreateDictLogic(ctx, s.svcCtx)
return l.CreateDict(in)
}
func (s *SystemServiceServer) UpdateDict(ctx context.Context, in *system.DictUpdateReq) (*system.CommonResp, error) {
l := logic.NewUpdateDictLogic(ctx, s.svcCtx)
return l.UpdateDict(in)
}
func (s *SystemServiceServer) DeleteDict(ctx context.Context, in *system.IdsReq) (*system.CommonResp, error) {
l := logic.NewDeleteDictLogic(ctx, s.svcCtx)
return l.DeleteDict(in)
}
func (s *SystemServiceServer) GetDictList(ctx context.Context, in *system.DictListReq) (*system.DictListResp, error) {
l := logic.NewGetDictListLogic(ctx, s.svcCtx)
return l.GetDictList(in)
}
// --- 操作日志 ---
func (s *SystemServiceServer) DeleteOperationRecord(ctx context.Context, in *system.IdsReq) (*system.CommonResp, error) {
l := logic.NewDeleteOperationRecordLogic(ctx, s.svcCtx)
return l.DeleteOperationRecord(in)
}
func (s *SystemServiceServer) GetOperationRecordList(ctx context.Context, in *system.OperationRecordListReq) (*system.OperationRecordListResp, error) {
l := logic.NewGetOperationRecordListLogic(ctx, s.svcCtx)
return l.GetOperationRecordList(in)
}
+195 -9
View File
@@ -4,23 +4,58 @@ 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;
@@ -37,7 +72,38 @@ message MenuInfo {
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;
@@ -48,7 +114,103 @@ message ClientInfo {
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;
@@ -74,13 +236,37 @@ 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);
}
File diff suppressed because it is too large Load Diff
+697 -9
View File
@@ -19,21 +19,59 @@ import (
const _ = grpc.SupportPackageIsVersion9
const (
SystemService_GetRolesByUserId_FullMethodName = "/system.SystemService/GetRolesByUserId"
SystemService_GetMenusByRoleId_FullMethodName = "/system.SystemService/GetMenusByRoleId"
SystemService_GetClientById_FullMethodName = "/system.SystemService/GetClientById"
SystemService_GetRolesByUserId_FullMethodName = "/system.SystemService/GetRolesByUserId"
SystemService_CreateRole_FullMethodName = "/system.SystemService/CreateRole"
SystemService_UpdateRole_FullMethodName = "/system.SystemService/UpdateRole"
SystemService_DeleteRole_FullMethodName = "/system.SystemService/DeleteRole"
SystemService_GetRoleList_FullMethodName = "/system.SystemService/GetRoleList"
SystemService_GetMenusByRoleId_FullMethodName = "/system.SystemService/GetMenusByRoleId"
SystemService_CreateMenu_FullMethodName = "/system.SystemService/CreateMenu"
SystemService_UpdateMenu_FullMethodName = "/system.SystemService/UpdateMenu"
SystemService_DeleteMenu_FullMethodName = "/system.SystemService/DeleteMenu"
SystemService_GetMenuList_FullMethodName = "/system.SystemService/GetMenuList"
SystemService_GetClientById_FullMethodName = "/system.SystemService/GetClientById"
SystemService_CreateClient_FullMethodName = "/system.SystemService/CreateClient"
SystemService_UpdateClient_FullMethodName = "/system.SystemService/UpdateClient"
SystemService_DeleteClient_FullMethodName = "/system.SystemService/DeleteClient"
SystemService_GetClientList_FullMethodName = "/system.SystemService/GetClientList"
SystemService_CreateDict_FullMethodName = "/system.SystemService/CreateDict"
SystemService_UpdateDict_FullMethodName = "/system.SystemService/UpdateDict"
SystemService_DeleteDict_FullMethodName = "/system.SystemService/DeleteDict"
SystemService_GetDictList_FullMethodName = "/system.SystemService/GetDictList"
SystemService_DeleteOperationRecord_FullMethodName = "/system.SystemService/DeleteOperationRecord"
SystemService_GetOperationRecordList_FullMethodName = "/system.SystemService/GetOperationRecordList"
)
// 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)
// 获取角色菜单列表
CreateRole(ctx context.Context, in *RoleReq, opts ...grpc.CallOption) (*CommonResp, error)
UpdateRole(ctx context.Context, in *RoleUpdateReq, opts ...grpc.CallOption) (*CommonResp, error)
DeleteRole(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
GetRoleList(ctx context.Context, in *RoleListReq, opts ...grpc.CallOption) (*RoleListResp, error)
// --- 菜单 ---
GetMenusByRoleId(ctx context.Context, in *GetMenusByRoleIdReq, opts ...grpc.CallOption) (*GetMenusByRoleIdResp, error)
// 获取客户端信息
CreateMenu(ctx context.Context, in *MenuReq, opts ...grpc.CallOption) (*CommonResp, error)
UpdateMenu(ctx context.Context, in *MenuUpdateReq, opts ...grpc.CallOption) (*CommonResp, error)
DeleteMenu(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
GetMenuList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*MenuListResp, error)
// --- 客户端 ---
GetClientById(ctx context.Context, in *GetClientByIdReq, opts ...grpc.CallOption) (*GetClientByIdResp, error)
CreateClient(ctx context.Context, in *ClientReq, opts ...grpc.CallOption) (*CommonResp, error)
UpdateClient(ctx context.Context, in *ClientUpdateReq, opts ...grpc.CallOption) (*CommonResp, error)
DeleteClient(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
GetClientList(ctx context.Context, in *ClientListReq, opts ...grpc.CallOption) (*ClientListResp, error)
// --- 字典 ---
CreateDict(ctx context.Context, in *DictReq, opts ...grpc.CallOption) (*CommonResp, error)
UpdateDict(ctx context.Context, in *DictUpdateReq, opts ...grpc.CallOption) (*CommonResp, error)
DeleteDict(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
GetDictList(ctx context.Context, in *DictListReq, opts ...grpc.CallOption) (*DictListResp, error)
// --- 操作日志 ---
DeleteOperationRecord(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
GetOperationRecordList(ctx context.Context, in *OperationRecordListReq, opts ...grpc.CallOption) (*OperationRecordListResp, error)
}
type systemServiceClient struct {
@@ -54,6 +92,46 @@ func (c *systemServiceClient) GetRolesByUserId(ctx context.Context, in *GetRoles
return out, nil
}
func (c *systemServiceClient) CreateRole(ctx context.Context, in *RoleReq, opts ...grpc.CallOption) (*CommonResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CommonResp)
err := c.cc.Invoke(ctx, SystemService_CreateRole_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *systemServiceClient) UpdateRole(ctx context.Context, in *RoleUpdateReq, opts ...grpc.CallOption) (*CommonResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CommonResp)
err := c.cc.Invoke(ctx, SystemService_UpdateRole_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *systemServiceClient) DeleteRole(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CommonResp)
err := c.cc.Invoke(ctx, SystemService_DeleteRole_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *systemServiceClient) GetRoleList(ctx context.Context, in *RoleListReq, opts ...grpc.CallOption) (*RoleListResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RoleListResp)
err := c.cc.Invoke(ctx, SystemService_GetRoleList_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)
@@ -64,6 +142,46 @@ func (c *systemServiceClient) GetMenusByRoleId(ctx context.Context, in *GetMenus
return out, nil
}
func (c *systemServiceClient) CreateMenu(ctx context.Context, in *MenuReq, opts ...grpc.CallOption) (*CommonResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CommonResp)
err := c.cc.Invoke(ctx, SystemService_CreateMenu_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *systemServiceClient) UpdateMenu(ctx context.Context, in *MenuUpdateReq, opts ...grpc.CallOption) (*CommonResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CommonResp)
err := c.cc.Invoke(ctx, SystemService_UpdateMenu_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *systemServiceClient) DeleteMenu(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CommonResp)
err := c.cc.Invoke(ctx, SystemService_DeleteMenu_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *systemServiceClient) GetMenuList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*MenuListResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MenuListResp)
err := c.cc.Invoke(ctx, SystemService_GetMenuList_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)
@@ -74,16 +192,136 @@ func (c *systemServiceClient) GetClientById(ctx context.Context, in *GetClientBy
return out, nil
}
func (c *systemServiceClient) CreateClient(ctx context.Context, in *ClientReq, opts ...grpc.CallOption) (*CommonResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CommonResp)
err := c.cc.Invoke(ctx, SystemService_CreateClient_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *systemServiceClient) UpdateClient(ctx context.Context, in *ClientUpdateReq, opts ...grpc.CallOption) (*CommonResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CommonResp)
err := c.cc.Invoke(ctx, SystemService_UpdateClient_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *systemServiceClient) DeleteClient(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CommonResp)
err := c.cc.Invoke(ctx, SystemService_DeleteClient_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *systemServiceClient) GetClientList(ctx context.Context, in *ClientListReq, opts ...grpc.CallOption) (*ClientListResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ClientListResp)
err := c.cc.Invoke(ctx, SystemService_GetClientList_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *systemServiceClient) CreateDict(ctx context.Context, in *DictReq, opts ...grpc.CallOption) (*CommonResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CommonResp)
err := c.cc.Invoke(ctx, SystemService_CreateDict_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *systemServiceClient) UpdateDict(ctx context.Context, in *DictUpdateReq, opts ...grpc.CallOption) (*CommonResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CommonResp)
err := c.cc.Invoke(ctx, SystemService_UpdateDict_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *systemServiceClient) DeleteDict(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CommonResp)
err := c.cc.Invoke(ctx, SystemService_DeleteDict_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *systemServiceClient) GetDictList(ctx context.Context, in *DictListReq, opts ...grpc.CallOption) (*DictListResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DictListResp)
err := c.cc.Invoke(ctx, SystemService_GetDictList_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *systemServiceClient) DeleteOperationRecord(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CommonResp)
err := c.cc.Invoke(ctx, SystemService_DeleteOperationRecord_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *systemServiceClient) GetOperationRecordList(ctx context.Context, in *OperationRecordListReq, opts ...grpc.CallOption) (*OperationRecordListResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(OperationRecordListResp)
err := c.cc.Invoke(ctx, SystemService_GetOperationRecordList_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)
// 获取角色菜单列表
CreateRole(context.Context, *RoleReq) (*CommonResp, error)
UpdateRole(context.Context, *RoleUpdateReq) (*CommonResp, error)
DeleteRole(context.Context, *IdsReq) (*CommonResp, error)
GetRoleList(context.Context, *RoleListReq) (*RoleListResp, error)
// --- 菜单 ---
GetMenusByRoleId(context.Context, *GetMenusByRoleIdReq) (*GetMenusByRoleIdResp, error)
// 获取客户端信息
CreateMenu(context.Context, *MenuReq) (*CommonResp, error)
UpdateMenu(context.Context, *MenuUpdateReq) (*CommonResp, error)
DeleteMenu(context.Context, *IdsReq) (*CommonResp, error)
GetMenuList(context.Context, *IdReq) (*MenuListResp, error)
// --- 客户端 ---
GetClientById(context.Context, *GetClientByIdReq) (*GetClientByIdResp, error)
CreateClient(context.Context, *ClientReq) (*CommonResp, error)
UpdateClient(context.Context, *ClientUpdateReq) (*CommonResp, error)
DeleteClient(context.Context, *IdsReq) (*CommonResp, error)
GetClientList(context.Context, *ClientListReq) (*ClientListResp, error)
// --- 字典 ---
CreateDict(context.Context, *DictReq) (*CommonResp, error)
UpdateDict(context.Context, *DictUpdateReq) (*CommonResp, error)
DeleteDict(context.Context, *IdsReq) (*CommonResp, error)
GetDictList(context.Context, *DictListReq) (*DictListResp, error)
// --- 操作日志 ---
DeleteOperationRecord(context.Context, *IdsReq) (*CommonResp, error)
GetOperationRecordList(context.Context, *OperationRecordListReq) (*OperationRecordListResp, error)
mustEmbedUnimplementedSystemServiceServer()
}
@@ -97,12 +335,66 @@ type UnimplementedSystemServiceServer struct{}
func (UnimplementedSystemServiceServer) GetRolesByUserId(context.Context, *GetRolesByUserIdReq) (*GetRolesByUserIdResp, error) {
return nil, status.Error(codes.Unimplemented, "method GetRolesByUserId not implemented")
}
func (UnimplementedSystemServiceServer) CreateRole(context.Context, *RoleReq) (*CommonResp, error) {
return nil, status.Error(codes.Unimplemented, "method CreateRole not implemented")
}
func (UnimplementedSystemServiceServer) UpdateRole(context.Context, *RoleUpdateReq) (*CommonResp, error) {
return nil, status.Error(codes.Unimplemented, "method UpdateRole not implemented")
}
func (UnimplementedSystemServiceServer) DeleteRole(context.Context, *IdsReq) (*CommonResp, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteRole not implemented")
}
func (UnimplementedSystemServiceServer) GetRoleList(context.Context, *RoleListReq) (*RoleListResp, error) {
return nil, status.Error(codes.Unimplemented, "method GetRoleList not implemented")
}
func (UnimplementedSystemServiceServer) GetMenusByRoleId(context.Context, *GetMenusByRoleIdReq) (*GetMenusByRoleIdResp, error) {
return nil, status.Error(codes.Unimplemented, "method GetMenusByRoleId not implemented")
}
func (UnimplementedSystemServiceServer) CreateMenu(context.Context, *MenuReq) (*CommonResp, error) {
return nil, status.Error(codes.Unimplemented, "method CreateMenu not implemented")
}
func (UnimplementedSystemServiceServer) UpdateMenu(context.Context, *MenuUpdateReq) (*CommonResp, error) {
return nil, status.Error(codes.Unimplemented, "method UpdateMenu not implemented")
}
func (UnimplementedSystemServiceServer) DeleteMenu(context.Context, *IdsReq) (*CommonResp, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteMenu not implemented")
}
func (UnimplementedSystemServiceServer) GetMenuList(context.Context, *IdReq) (*MenuListResp, error) {
return nil, status.Error(codes.Unimplemented, "method GetMenuList not implemented")
}
func (UnimplementedSystemServiceServer) GetClientById(context.Context, *GetClientByIdReq) (*GetClientByIdResp, error) {
return nil, status.Error(codes.Unimplemented, "method GetClientById not implemented")
}
func (UnimplementedSystemServiceServer) CreateClient(context.Context, *ClientReq) (*CommonResp, error) {
return nil, status.Error(codes.Unimplemented, "method CreateClient not implemented")
}
func (UnimplementedSystemServiceServer) UpdateClient(context.Context, *ClientUpdateReq) (*CommonResp, error) {
return nil, status.Error(codes.Unimplemented, "method UpdateClient not implemented")
}
func (UnimplementedSystemServiceServer) DeleteClient(context.Context, *IdsReq) (*CommonResp, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteClient not implemented")
}
func (UnimplementedSystemServiceServer) GetClientList(context.Context, *ClientListReq) (*ClientListResp, error) {
return nil, status.Error(codes.Unimplemented, "method GetClientList not implemented")
}
func (UnimplementedSystemServiceServer) CreateDict(context.Context, *DictReq) (*CommonResp, error) {
return nil, status.Error(codes.Unimplemented, "method CreateDict not implemented")
}
func (UnimplementedSystemServiceServer) UpdateDict(context.Context, *DictUpdateReq) (*CommonResp, error) {
return nil, status.Error(codes.Unimplemented, "method UpdateDict not implemented")
}
func (UnimplementedSystemServiceServer) DeleteDict(context.Context, *IdsReq) (*CommonResp, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteDict not implemented")
}
func (UnimplementedSystemServiceServer) GetDictList(context.Context, *DictListReq) (*DictListResp, error) {
return nil, status.Error(codes.Unimplemented, "method GetDictList not implemented")
}
func (UnimplementedSystemServiceServer) DeleteOperationRecord(context.Context, *IdsReq) (*CommonResp, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteOperationRecord not implemented")
}
func (UnimplementedSystemServiceServer) GetOperationRecordList(context.Context, *OperationRecordListReq) (*OperationRecordListResp, error) {
return nil, status.Error(codes.Unimplemented, "method GetOperationRecordList not implemented")
}
func (UnimplementedSystemServiceServer) mustEmbedUnimplementedSystemServiceServer() {}
func (UnimplementedSystemServiceServer) testEmbeddedByValue() {}
@@ -142,6 +434,78 @@ func _SystemService_GetRolesByUserId_Handler(srv interface{}, ctx context.Contex
return interceptor(ctx, in, info, handler)
}
func _SystemService_CreateRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RoleReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).CreateRole(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_CreateRole_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).CreateRole(ctx, req.(*RoleReq))
}
return interceptor(ctx, in, info, handler)
}
func _SystemService_UpdateRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RoleUpdateReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).UpdateRole(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_UpdateRole_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).UpdateRole(ctx, req.(*RoleUpdateReq))
}
return interceptor(ctx, in, info, handler)
}
func _SystemService_DeleteRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IdsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).DeleteRole(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_DeleteRole_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).DeleteRole(ctx, req.(*IdsReq))
}
return interceptor(ctx, in, info, handler)
}
func _SystemService_GetRoleList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RoleListReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).GetRoleList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_GetRoleList_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).GetRoleList(ctx, req.(*RoleListReq))
}
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 {
@@ -160,6 +524,78 @@ func _SystemService_GetMenusByRoleId_Handler(srv interface{}, ctx context.Contex
return interceptor(ctx, in, info, handler)
}
func _SystemService_CreateMenu_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MenuReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).CreateMenu(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_CreateMenu_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).CreateMenu(ctx, req.(*MenuReq))
}
return interceptor(ctx, in, info, handler)
}
func _SystemService_UpdateMenu_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MenuUpdateReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).UpdateMenu(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_UpdateMenu_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).UpdateMenu(ctx, req.(*MenuUpdateReq))
}
return interceptor(ctx, in, info, handler)
}
func _SystemService_DeleteMenu_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IdsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).DeleteMenu(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_DeleteMenu_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).DeleteMenu(ctx, req.(*IdsReq))
}
return interceptor(ctx, in, info, handler)
}
func _SystemService_GetMenuList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IdReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).GetMenuList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_GetMenuList_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).GetMenuList(ctx, req.(*IdReq))
}
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 {
@@ -178,6 +614,186 @@ func _SystemService_GetClientById_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _SystemService_CreateClient_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ClientReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).CreateClient(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_CreateClient_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).CreateClient(ctx, req.(*ClientReq))
}
return interceptor(ctx, in, info, handler)
}
func _SystemService_UpdateClient_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ClientUpdateReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).UpdateClient(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_UpdateClient_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).UpdateClient(ctx, req.(*ClientUpdateReq))
}
return interceptor(ctx, in, info, handler)
}
func _SystemService_DeleteClient_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IdsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).DeleteClient(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_DeleteClient_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).DeleteClient(ctx, req.(*IdsReq))
}
return interceptor(ctx, in, info, handler)
}
func _SystemService_GetClientList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ClientListReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).GetClientList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_GetClientList_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).GetClientList(ctx, req.(*ClientListReq))
}
return interceptor(ctx, in, info, handler)
}
func _SystemService_CreateDict_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DictReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).CreateDict(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_CreateDict_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).CreateDict(ctx, req.(*DictReq))
}
return interceptor(ctx, in, info, handler)
}
func _SystemService_UpdateDict_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DictUpdateReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).UpdateDict(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_UpdateDict_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).UpdateDict(ctx, req.(*DictUpdateReq))
}
return interceptor(ctx, in, info, handler)
}
func _SystemService_DeleteDict_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IdsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).DeleteDict(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_DeleteDict_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).DeleteDict(ctx, req.(*IdsReq))
}
return interceptor(ctx, in, info, handler)
}
func _SystemService_GetDictList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DictListReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).GetDictList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_GetDictList_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).GetDictList(ctx, req.(*DictListReq))
}
return interceptor(ctx, in, info, handler)
}
func _SystemService_DeleteOperationRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IdsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).DeleteOperationRecord(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_DeleteOperationRecord_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).DeleteOperationRecord(ctx, req.(*IdsReq))
}
return interceptor(ctx, in, info, handler)
}
func _SystemService_GetOperationRecordList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(OperationRecordListReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SystemServiceServer).GetOperationRecordList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SystemService_GetOperationRecordList_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SystemServiceServer).GetOperationRecordList(ctx, req.(*OperationRecordListReq))
}
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)
@@ -189,14 +805,86 @@ var SystemService_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetRolesByUserId",
Handler: _SystemService_GetRolesByUserId_Handler,
},
{
MethodName: "CreateRole",
Handler: _SystemService_CreateRole_Handler,
},
{
MethodName: "UpdateRole",
Handler: _SystemService_UpdateRole_Handler,
},
{
MethodName: "DeleteRole",
Handler: _SystemService_DeleteRole_Handler,
},
{
MethodName: "GetRoleList",
Handler: _SystemService_GetRoleList_Handler,
},
{
MethodName: "GetMenusByRoleId",
Handler: _SystemService_GetMenusByRoleId_Handler,
},
{
MethodName: "CreateMenu",
Handler: _SystemService_CreateMenu_Handler,
},
{
MethodName: "UpdateMenu",
Handler: _SystemService_UpdateMenu_Handler,
},
{
MethodName: "DeleteMenu",
Handler: _SystemService_DeleteMenu_Handler,
},
{
MethodName: "GetMenuList",
Handler: _SystemService_GetMenuList_Handler,
},
{
MethodName: "GetClientById",
Handler: _SystemService_GetClientById_Handler,
},
{
MethodName: "CreateClient",
Handler: _SystemService_CreateClient_Handler,
},
{
MethodName: "UpdateClient",
Handler: _SystemService_UpdateClient_Handler,
},
{
MethodName: "DeleteClient",
Handler: _SystemService_DeleteClient_Handler,
},
{
MethodName: "GetClientList",
Handler: _SystemService_GetClientList_Handler,
},
{
MethodName: "CreateDict",
Handler: _SystemService_CreateDict_Handler,
},
{
MethodName: "UpdateDict",
Handler: _SystemService_UpdateDict_Handler,
},
{
MethodName: "DeleteDict",
Handler: _SystemService_DeleteDict_Handler,
},
{
MethodName: "GetDictList",
Handler: _SystemService_GetDictList_Handler,
},
{
MethodName: "DeleteOperationRecord",
Handler: _SystemService_DeleteOperationRecord_Handler,
},
{
MethodName: "GetOperationRecordList",
Handler: _SystemService_GetOperationRecordList_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "pb/system.proto",
+149 -16
View File
@@ -14,24 +14,65 @@ import (
)
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
ClientInfo = system.ClientInfo
ClientListReq = system.ClientListReq
ClientListResp = system.ClientListResp
ClientReq = system.ClientReq
ClientUpdateReq = system.ClientUpdateReq
CommonResp = system.CommonResp
DictInfo = system.DictInfo
DictListReq = system.DictListReq
DictListResp = system.DictListResp
DictReq = system.DictReq
DictUpdateReq = system.DictUpdateReq
GetClientByIdReq = system.GetClientByIdReq
GetClientByIdResp = system.GetClientByIdResp
GetMenusByRoleIdReq = system.GetMenusByRoleIdReq
GetMenusByRoleIdResp = system.GetMenusByRoleIdResp
GetRolesByUserIdReq = system.GetRolesByUserIdReq
GetRolesByUserIdResp = system.GetRolesByUserIdResp
IdReq = system.IdReq
IdsReq = system.IdsReq
MenuInfo = system.MenuInfo
MenuListResp = system.MenuListResp
MenuReq = system.MenuReq
MenuUpdateReq = system.MenuUpdateReq
OperationRecordInfo = system.OperationRecordInfo
OperationRecordListReq = system.OperationRecordListReq
OperationRecordListResp = system.OperationRecordListResp
RoleInfo = system.RoleInfo
RoleListReq = system.RoleListReq
RoleListResp = system.RoleListResp
RoleReq = system.RoleReq
RoleUpdateReq = system.RoleUpdateReq
SystemService interface {
// 获取用户角色列表
// --- 角色 ---
GetRolesByUserId(ctx context.Context, in *GetRolesByUserIdReq, opts ...grpc.CallOption) (*GetRolesByUserIdResp, error)
// 获取角色菜单列表
CreateRole(ctx context.Context, in *RoleReq, opts ...grpc.CallOption) (*CommonResp, error)
UpdateRole(ctx context.Context, in *RoleUpdateReq, opts ...grpc.CallOption) (*CommonResp, error)
DeleteRole(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
GetRoleList(ctx context.Context, in *RoleListReq, opts ...grpc.CallOption) (*RoleListResp, error)
// --- 菜单 ---
GetMenusByRoleId(ctx context.Context, in *GetMenusByRoleIdReq, opts ...grpc.CallOption) (*GetMenusByRoleIdResp, error)
// 获取客户端信息
CreateMenu(ctx context.Context, in *MenuReq, opts ...grpc.CallOption) (*CommonResp, error)
UpdateMenu(ctx context.Context, in *MenuUpdateReq, opts ...grpc.CallOption) (*CommonResp, error)
DeleteMenu(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
GetMenuList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*MenuListResp, error)
// --- 客户端 ---
GetClientById(ctx context.Context, in *GetClientByIdReq, opts ...grpc.CallOption) (*GetClientByIdResp, error)
CreateClient(ctx context.Context, in *ClientReq, opts ...grpc.CallOption) (*CommonResp, error)
UpdateClient(ctx context.Context, in *ClientUpdateReq, opts ...grpc.CallOption) (*CommonResp, error)
DeleteClient(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
GetClientList(ctx context.Context, in *ClientListReq, opts ...grpc.CallOption) (*ClientListResp, error)
// --- 字典 ---
CreateDict(ctx context.Context, in *DictReq, opts ...grpc.CallOption) (*CommonResp, error)
UpdateDict(ctx context.Context, in *DictUpdateReq, opts ...grpc.CallOption) (*CommonResp, error)
DeleteDict(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
GetDictList(ctx context.Context, in *DictListReq, opts ...grpc.CallOption) (*DictListResp, error)
// --- 操作日志 ---
DeleteOperationRecord(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
GetOperationRecordList(ctx context.Context, in *OperationRecordListReq, opts ...grpc.CallOption) (*OperationRecordListResp, error)
}
defaultSystemService struct {
@@ -45,20 +86,112 @@ func NewSystemService(cli zrpc.Client) SystemService {
}
}
// 获取用户角色列表
// --- 角色 ---
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) CreateRole(ctx context.Context, in *RoleReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.CreateRole(ctx, in, opts...)
}
func (m *defaultSystemService) UpdateRole(ctx context.Context, in *RoleUpdateReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.UpdateRole(ctx, in, opts...)
}
func (m *defaultSystemService) DeleteRole(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.DeleteRole(ctx, in, opts...)
}
func (m *defaultSystemService) GetRoleList(ctx context.Context, in *RoleListReq, opts ...grpc.CallOption) (*RoleListResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.GetRoleList(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) CreateMenu(ctx context.Context, in *MenuReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.CreateMenu(ctx, in, opts...)
}
func (m *defaultSystemService) UpdateMenu(ctx context.Context, in *MenuUpdateReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.UpdateMenu(ctx, in, opts...)
}
func (m *defaultSystemService) DeleteMenu(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.DeleteMenu(ctx, in, opts...)
}
func (m *defaultSystemService) GetMenuList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*MenuListResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.GetMenuList(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...)
}
func (m *defaultSystemService) CreateClient(ctx context.Context, in *ClientReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.CreateClient(ctx, in, opts...)
}
func (m *defaultSystemService) UpdateClient(ctx context.Context, in *ClientUpdateReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.UpdateClient(ctx, in, opts...)
}
func (m *defaultSystemService) DeleteClient(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.DeleteClient(ctx, in, opts...)
}
func (m *defaultSystemService) GetClientList(ctx context.Context, in *ClientListReq, opts ...grpc.CallOption) (*ClientListResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.GetClientList(ctx, in, opts...)
}
// --- 字典 ---
func (m *defaultSystemService) CreateDict(ctx context.Context, in *DictReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.CreateDict(ctx, in, opts...)
}
func (m *defaultSystemService) UpdateDict(ctx context.Context, in *DictUpdateReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.UpdateDict(ctx, in, opts...)
}
func (m *defaultSystemService) DeleteDict(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.DeleteDict(ctx, in, opts...)
}
func (m *defaultSystemService) GetDictList(ctx context.Context, in *DictListReq, opts ...grpc.CallOption) (*DictListResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.GetDictList(ctx, in, opts...)
}
// --- 操作日志 ---
func (m *defaultSystemService) DeleteOperationRecord(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.DeleteOperationRecord(ctx, in, opts...)
}
func (m *defaultSystemService) GetOperationRecordList(ctx context.Context, in *OperationRecordListReq, opts ...grpc.CallOption) (*OperationRecordListResp, error) {
client := system.NewSystemServiceClient(m.cli.Conn())
return client.GetOperationRecordList(ctx, in, opts...)
}