feat: 初次启动
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
Name: system-api
|
||||
|
||||
Log:
|
||||
Encoding: plain
|
||||
Host: 0.0.0.0
|
||||
Port: 9003
|
||||
|
||||
Auth:
|
||||
AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872
|
||||
AccessExpire: 7200
|
||||
AccessSecret: sundynix-jwt-secret-2024
|
||||
AccessExpire: 604800
|
||||
|
||||
DB:
|
||||
DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local
|
||||
|
||||
# system-rpc 服务配置
|
||||
SystemRpc:
|
||||
Etcd:
|
||||
Hosts:
|
||||
|
||||
@@ -15,7 +15,4 @@ type Config struct {
|
||||
AccessExpire int64
|
||||
}
|
||||
SystemRpc zrpc.RpcClientConf
|
||||
DB struct {
|
||||
DataSource string
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type CreateClientLogic struct {
|
||||
@@ -21,24 +15,13 @@ type CreateClientLogic struct {
|
||||
}
|
||||
|
||||
func NewCreateClientLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateClientLogic {
|
||||
return &CreateClientLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
return &CreateClientLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
||||
}
|
||||
|
||||
func (l *CreateClientLogic) CreateClient(req *types.ClientReq) error {
|
||||
client := sysModel.SundynixClient{
|
||||
ClientID: req.ClientId,
|
||||
Name: req.Name,
|
||||
GrantType: req.GrantType,
|
||||
AdditionalInfo: req.AdditionalInfo,
|
||||
ActiveTimeout: req.ActiveTimeout,
|
||||
}
|
||||
if err := l.svcCtx.DB.Create(&client).Error; err != nil {
|
||||
l.Errorf("创建客户端失败: %v", err)
|
||||
return fmt.Errorf("创建客户端失败")
|
||||
}
|
||||
return nil
|
||||
_, err := l.svcCtx.SystemRpc.CreateClient(l.ctx, &system.ClientReq{
|
||||
ClientId: req.ClientId, Name: req.Name, GrantType: req.GrantType,
|
||||
AdditionalInfo: req.AdditionalInfo, ActiveTimeout: req.ActiveTimeout,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type DeleteClientLogic struct {
|
||||
@@ -21,17 +15,10 @@ type DeleteClientLogic struct {
|
||||
}
|
||||
|
||||
func NewDeleteClientLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteClientLogic {
|
||||
return &DeleteClientLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
return &DeleteClientLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
||||
}
|
||||
|
||||
func (l *DeleteClientLogic) DeleteClient(req *types.IdsReq) error {
|
||||
if err := l.svcCtx.DB.Where("id IN ?", req.Ids).Delete(&sysModel.SundynixClient{}).Error; err != nil {
|
||||
l.Errorf("删除客户端失败: %v", err)
|
||||
return fmt.Errorf("删除客户端失败")
|
||||
}
|
||||
return nil
|
||||
_, err := l.svcCtx.SystemRpc.DeleteClient(l.ctx, &system.IdsReq{Ids: req.Ids})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type GetClientListLogic struct {
|
||||
@@ -21,46 +15,15 @@ type GetClientListLogic struct {
|
||||
}
|
||||
|
||||
func NewGetClientListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetClientListLogic {
|
||||
return &GetClientListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
return &GetClientListLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
||||
}
|
||||
|
||||
func (l *GetClientListLogic) GetClientList(req *types.ClientListReq) (resp interface{}, err error) {
|
||||
var clients []sysModel.SundynixClient
|
||||
var total int64
|
||||
|
||||
db := l.svcCtx.DB.Model(&sysModel.SundynixClient{})
|
||||
if req.Name != "" {
|
||||
db = db.Where("name LIKE ?", "%"+req.Name+"%")
|
||||
func (l *GetClientListLogic) GetClientList(req *types.ClientListReq) (interface{}, error) {
|
||||
resp, err := l.svcCtx.SystemRpc.GetClientList(l.ctx, &system.ClientListReq{
|
||||
Current: int32(req.Current), PageSize: int32(req.PageSize), Name: req.Name,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := db.Count(&total).Error; err != nil {
|
||||
l.Errorf("查询客户端总数失败: %v", err)
|
||||
return nil, fmt.Errorf("查询失败")
|
||||
}
|
||||
|
||||
current := req.Current
|
||||
pageSize := req.PageSize
|
||||
if current <= 0 {
|
||||
current = 1
|
||||
}
|
||||
if pageSize <= 0 {
|
||||
pageSize = 10
|
||||
}
|
||||
|
||||
offset := (current - 1) * pageSize
|
||||
if err := db.Offset(offset).Limit(pageSize).Find(&clients).Error; err != nil {
|
||||
l.Errorf("查询客户端列表失败: %v", err)
|
||||
return nil, fmt.Errorf("查询失败")
|
||||
}
|
||||
|
||||
return map[string]interface{}{
|
||||
"list": clients,
|
||||
"total": total,
|
||||
"current": current,
|
||||
"size": pageSize,
|
||||
}, nil
|
||||
return map[string]interface{}{"list": resp.List, "total": resp.Total, "current": req.Current, "size": req.PageSize}, nil
|
||||
}
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type UpdateClientLogic struct {
|
||||
@@ -21,34 +15,13 @@ type UpdateClientLogic struct {
|
||||
}
|
||||
|
||||
func NewUpdateClientLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateClientLogic {
|
||||
return &UpdateClientLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
return &UpdateClientLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
||||
}
|
||||
|
||||
func (l *UpdateClientLogic) UpdateClient(req *types.ClientUpdateReq) error {
|
||||
updates := map[string]interface{}{}
|
||||
if req.ClientId != "" {
|
||||
updates["client_id"] = req.ClientId
|
||||
}
|
||||
if req.Name != "" {
|
||||
updates["name"] = req.Name
|
||||
}
|
||||
if req.GrantType != "" {
|
||||
updates["grant_type"] = req.GrantType
|
||||
}
|
||||
if req.AdditionalInfo != "" {
|
||||
updates["additional_info"] = req.AdditionalInfo
|
||||
}
|
||||
if req.ActiveTimeout > 0 {
|
||||
updates["active_timeout"] = req.ActiveTimeout
|
||||
}
|
||||
|
||||
if err := l.svcCtx.DB.Model(&sysModel.SundynixClient{}).Where("id = ?", req.Id).Updates(updates).Error; err != nil {
|
||||
l.Errorf("更新客户端失败: %v", err)
|
||||
return fmt.Errorf("更新客户端失败")
|
||||
}
|
||||
return nil
|
||||
_, err := l.svcCtx.SystemRpc.UpdateClient(l.ctx, &system.ClientUpdateReq{
|
||||
Id: req.Id, ClientId: req.ClientId, Name: req.Name, GrantType: req.GrantType,
|
||||
AdditionalInfo: req.AdditionalInfo, ActiveTimeout: req.ActiveTimeout,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package dict
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type CreateDictLogic struct {
|
||||
@@ -21,9 +19,8 @@ func NewCreateDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Create
|
||||
}
|
||||
|
||||
func (l *CreateDictLogic) CreateDict(req *types.DictReq) error {
|
||||
dict := sysModel.SundynixDict{Type: req.Type, Label: req.Label, Value: req.Value, Sort: req.Sort, Desc: req.Desc}
|
||||
if err := l.svcCtx.DB.Create(&dict).Error; err != nil {
|
||||
return fmt.Errorf("创建字典失败")
|
||||
}
|
||||
return nil
|
||||
_, err := l.svcCtx.SystemRpc.CreateDict(l.ctx, &system.DictReq{
|
||||
Type: req.Type, Label: req.Label, Value: req.Value, Sort: int32(req.Sort), Desc: req.Desc,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package dict
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type DeleteDictLogic struct {
|
||||
@@ -21,8 +19,6 @@ func NewDeleteDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete
|
||||
}
|
||||
|
||||
func (l *DeleteDictLogic) DeleteDict(req *types.IdsReq) error {
|
||||
if err := l.svcCtx.DB.Where("id IN ?", req.Ids).Delete(&sysModel.SundynixDict{}).Error; err != nil {
|
||||
return fmt.Errorf("删除字典失败")
|
||||
}
|
||||
return nil
|
||||
_, err := l.svcCtx.SystemRpc.DeleteDict(l.ctx, &system.IdsReq{Ids: req.Ids})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package dict
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type GetDictListLogic struct {
|
||||
@@ -20,23 +18,12 @@ func NewGetDictListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDi
|
||||
return &GetDictListLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
||||
}
|
||||
|
||||
func (l *GetDictListLogic) GetDictList(req *types.DictListReq) (resp interface{}, err error) {
|
||||
var dicts []sysModel.SundynixDict
|
||||
var total int64
|
||||
db := l.svcCtx.DB.Model(&sysModel.SundynixDict{})
|
||||
if req.Type != "" {
|
||||
db = db.Where("type = ?", req.Type)
|
||||
func (l *GetDictListLogic) GetDictList(req *types.DictListReq) (interface{}, error) {
|
||||
resp, err := l.svcCtx.SystemRpc.GetDictList(l.ctx, &system.DictListReq{
|
||||
Current: int32(req.Current), PageSize: int32(req.PageSize), Type: req.Type,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
db.Count(&total)
|
||||
current, pageSize := req.Current, req.PageSize
|
||||
if current <= 0 {
|
||||
current = 1
|
||||
}
|
||||
if pageSize <= 0 {
|
||||
pageSize = 10
|
||||
}
|
||||
if err := db.Offset((current - 1) * pageSize).Limit(pageSize).Order("sort").Find(&dicts).Error; err != nil {
|
||||
return nil, fmt.Errorf("查询字典列表失败")
|
||||
}
|
||||
return map[string]interface{}{"list": dicts, "total": total, "current": current, "size": pageSize}, nil
|
||||
return map[string]interface{}{"list": resp.List, "total": resp.Total}, nil
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package dict
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type UpdateDictLogic struct {
|
||||
@@ -21,26 +19,8 @@ func NewUpdateDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Update
|
||||
}
|
||||
|
||||
func (l *UpdateDictLogic) UpdateDict(req *types.DictUpdateReq) error {
|
||||
updates := map[string]interface{}{}
|
||||
if req.Type != "" {
|
||||
updates["type"] = req.Type
|
||||
}
|
||||
if req.Label != "" {
|
||||
updates["label"] = req.Label
|
||||
}
|
||||
if req.Value != "" {
|
||||
updates["value"] = req.Value
|
||||
}
|
||||
if req.Sort > 0 {
|
||||
updates["sort"] = req.Sort
|
||||
}
|
||||
if req.Desc != "" {
|
||||
updates["desc"] = req.Desc
|
||||
}
|
||||
if len(updates) > 0 {
|
||||
if err := l.svcCtx.DB.Model(&sysModel.SundynixDict{}).Where("id = ?", req.Id).Updates(updates).Error; err != nil {
|
||||
return fmt.Errorf("更新字典失败")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
_, err := l.svcCtx.SystemRpc.UpdateDict(l.ctx, &system.DictUpdateReq{
|
||||
Id: req.Id, Type: req.Type, Label: req.Label, Value: req.Value, Sort: int32(req.Sort), Desc: req.Desc,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package menu
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type CreateMenuLogic struct {
|
||||
@@ -21,16 +19,10 @@ func NewCreateMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Create
|
||||
}
|
||||
|
||||
func (l *CreateMenuLogic) CreateMenu(req *types.MenuReq) error {
|
||||
menu := sysModel.SundynixMenu{
|
||||
ParentID: req.ParentId, Category: req.Category, Name: req.Name, Title: req.Title,
|
||||
_, err := l.svcCtx.SystemRpc.CreateMenu(l.ctx, &system.MenuReq{
|
||||
ParentId: req.ParentId, Category: int32(req.Category), Name: req.Name, Title: req.Title,
|
||||
Code: req.Code, Path: req.Path, Permission: req.Permission, Locale: req.Locale,
|
||||
Icon: req.Icon, Sort: req.Sort,
|
||||
}
|
||||
if menu.ParentID == "" {
|
||||
menu.ParentID = "0"
|
||||
}
|
||||
if err := l.svcCtx.DB.Create(&menu).Error; err != nil {
|
||||
return fmt.Errorf("创建菜单失败")
|
||||
}
|
||||
return nil
|
||||
Icon: req.Icon, Sort: int32(req.Sort),
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package menu
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type DeleteMenuLogic struct {
|
||||
@@ -21,8 +19,6 @@ func NewDeleteMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete
|
||||
}
|
||||
|
||||
func (l *DeleteMenuLogic) DeleteMenu(req *types.IdsReq) error {
|
||||
if err := l.svcCtx.DB.Where("id IN ?", req.Ids).Delete(&sysModel.SundynixMenu{}).Error; err != nil {
|
||||
return fmt.Errorf("删除菜单失败")
|
||||
}
|
||||
return nil
|
||||
_, err := l.svcCtx.SystemRpc.DeleteMenu(l.ctx, &system.IdsReq{Ids: req.Ids})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package menu
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type GetMenuByRoleLogic struct {
|
||||
@@ -20,10 +18,10 @@ func NewGetMenuByRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Get
|
||||
return &GetMenuByRoleLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
||||
}
|
||||
|
||||
func (l *GetMenuByRoleLogic) GetMenuByRole(req *types.IdReq) (resp interface{}, err error) {
|
||||
var role sysModel.SundynixRole
|
||||
if err := l.svcCtx.DB.Preload("Menus").Where("id = ?", req.Id).First(&role).Error; err != nil {
|
||||
return nil, fmt.Errorf("查询角色菜单失败")
|
||||
func (l *GetMenuByRoleLogic) GetMenuByRole(req *types.IdReq) (interface{}, error) {
|
||||
resp, err := l.svcCtx.SystemRpc.GetMenusByRoleId(l.ctx, &system.GetMenusByRoleIdReq{RoleId: req.Id})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return role.Menus, nil
|
||||
return resp.Menus, nil
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package menu
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type GetMenuListLogic struct {
|
||||
@@ -19,26 +17,10 @@ func NewGetMenuListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMe
|
||||
return &GetMenuListLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
||||
}
|
||||
|
||||
func (l *GetMenuListLogic) GetMenuList() (resp interface{}, err error) {
|
||||
var menus []sysModel.SundynixMenu
|
||||
if err := l.svcCtx.DB.Order("sort").Find(&menus).Error; err != nil {
|
||||
return nil, fmt.Errorf("查询菜单列表失败")
|
||||
func (l *GetMenuListLogic) GetMenuList() (interface{}, error) {
|
||||
resp, err := l.svcCtx.SystemRpc.GetMenuList(l.ctx, &system.IdReq{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 构建树形结构
|
||||
menuMap := make(map[string]*sysModel.SundynixMenu)
|
||||
for i := range menus {
|
||||
menus[i].Children = []*sysModel.SundynixMenu{}
|
||||
menuMap[menus[i].ID] = &menus[i]
|
||||
}
|
||||
var tree []*sysModel.SundynixMenu
|
||||
for _, m := range menuMap {
|
||||
if m.ParentID == "0" || m.ParentID == "" {
|
||||
tree = append(tree, m)
|
||||
} else if parent, ok := menuMap[m.ParentID]; ok {
|
||||
parent.Children = append(parent.Children, m)
|
||||
} else {
|
||||
tree = append(tree, m)
|
||||
}
|
||||
}
|
||||
return tree, nil
|
||||
return resp.Menus, nil
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package menu
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type UpdateMenuLogic struct {
|
||||
@@ -21,41 +19,10 @@ func NewUpdateMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Update
|
||||
}
|
||||
|
||||
func (l *UpdateMenuLogic) UpdateMenu(req *types.MenuUpdateReq) error {
|
||||
updates := map[string]interface{}{}
|
||||
if req.ParentId != "" {
|
||||
updates["parent_id"] = req.ParentId
|
||||
}
|
||||
if req.Name != "" {
|
||||
updates["name"] = req.Name
|
||||
}
|
||||
if req.Title != "" {
|
||||
updates["title"] = req.Title
|
||||
}
|
||||
if req.Code != "" {
|
||||
updates["code"] = req.Code
|
||||
}
|
||||
if req.Path != "" {
|
||||
updates["path"] = req.Path
|
||||
}
|
||||
if req.Permission != "" {
|
||||
updates["permission"] = req.Permission
|
||||
}
|
||||
if req.Locale != "" {
|
||||
updates["locale"] = req.Locale
|
||||
}
|
||||
if req.Icon != "" {
|
||||
updates["icon"] = req.Icon
|
||||
}
|
||||
if req.Sort > 0 {
|
||||
updates["sort"] = req.Sort
|
||||
}
|
||||
if req.Category > 0 {
|
||||
updates["category"] = req.Category
|
||||
}
|
||||
if len(updates) > 0 {
|
||||
if err := l.svcCtx.DB.Model(&sysModel.SundynixMenu{}).Where("id = ?", req.Id).Updates(updates).Error; err != nil {
|
||||
return fmt.Errorf("更新菜单失败")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
_, err := l.svcCtx.SystemRpc.UpdateMenu(l.ctx, &system.MenuUpdateReq{
|
||||
Id: req.Id, ParentId: req.ParentId, Category: int32(req.Category), Name: req.Name, Title: req.Title,
|
||||
Code: req.Code, Path: req.Path, Permission: req.Permission, Locale: req.Locale,
|
||||
Icon: req.Icon, Sort: int32(req.Sort),
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package operationRecord
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type DeleteOperationRecordLogic struct {
|
||||
@@ -21,8 +19,6 @@ func NewDeleteOperationRecordLogic(ctx context.Context, svcCtx *svc.ServiceConte
|
||||
}
|
||||
|
||||
func (l *DeleteOperationRecordLogic) DeleteOperationRecord(req *types.IdsReq) error {
|
||||
if err := l.svcCtx.DB.Where("id IN ?", req.Ids).Delete(&sysModel.SundynixOperationRecord{}).Error; err != nil {
|
||||
return fmt.Errorf("删除操作日志失败")
|
||||
}
|
||||
return nil
|
||||
_, err := l.svcCtx.SystemRpc.DeleteOperationRecord(l.ctx, &system.IdsReq{Ids: req.Ids})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package operationRecord
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type GetOperationRecordListLogic struct {
|
||||
@@ -20,29 +18,13 @@ func NewGetOperationRecordListLogic(ctx context.Context, svcCtx *svc.ServiceCont
|
||||
return &GetOperationRecordListLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
||||
}
|
||||
|
||||
func (l *GetOperationRecordListLogic) GetOperationRecordList(req *types.OperationRecordListReq) (resp interface{}, err error) {
|
||||
var records []sysModel.SundynixOperationRecord
|
||||
var total int64
|
||||
db := l.svcCtx.DB.Model(&sysModel.SundynixOperationRecord{})
|
||||
if req.Method != "" {
|
||||
db = db.Where("method = ?", req.Method)
|
||||
func (l *GetOperationRecordListLogic) GetOperationRecordList(req *types.OperationRecordListReq) (interface{}, error) {
|
||||
resp, err := l.svcCtx.SystemRpc.GetOperationRecordList(l.ctx, &system.OperationRecordListReq{
|
||||
Current: int32(req.Current), PageSize: int32(req.PageSize),
|
||||
Method: req.Method, Path: req.Path, Status: int32(req.Status),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req.Path != "" {
|
||||
db = db.Where("path LIKE ?", "%"+req.Path+"%")
|
||||
}
|
||||
if req.Status > 0 {
|
||||
db = db.Where("status = ?", req.Status)
|
||||
}
|
||||
db.Count(&total)
|
||||
current, pageSize := req.Current, req.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(&records).Error; err != nil {
|
||||
return nil, fmt.Errorf("查询操作日志失败")
|
||||
}
|
||||
return map[string]interface{}{"list": records, "total": total, "current": current, "size": pageSize}, nil
|
||||
return map[string]interface{}{"list": resp.List, "total": resp.Total}, nil
|
||||
}
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package role
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type CreateRoleLogic struct {
|
||||
@@ -25,15 +19,8 @@ func NewCreateRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Create
|
||||
}
|
||||
|
||||
func (l *CreateRoleLogic) CreateRole(req *types.RoleReq) error {
|
||||
role := sysModel.SundynixRole{Name: req.Name, Code: req.Code, Sort: req.Sort}
|
||||
if err := l.svcCtx.DB.Create(&role).Error; err != nil {
|
||||
return fmt.Errorf("创建角色失败")
|
||||
}
|
||||
// 关联菜单
|
||||
if len(req.MenuIds) > 0 {
|
||||
for _, menuID := range req.MenuIds {
|
||||
l.svcCtx.DB.Create(&sysModel.SundynixRoleMenu{RoleID: role.ID, MenuID: menuID})
|
||||
}
|
||||
}
|
||||
return nil
|
||||
_, err := l.svcCtx.SystemRpc.CreateRole(l.ctx, &system.RoleReq{
|
||||
Name: req.Name, Code: req.Code, Sort: int32(req.Sort), MenuIds: req.MenuIds,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package role
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type DeleteRoleLogic struct {
|
||||
@@ -21,10 +19,6 @@ func NewDeleteRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete
|
||||
}
|
||||
|
||||
func (l *DeleteRoleLogic) DeleteRole(req *types.IdsReq) error {
|
||||
if err := l.svcCtx.DB.Where("id IN ?", req.Ids).Delete(&sysModel.SundynixRole{}).Error; err != nil {
|
||||
return fmt.Errorf("删除角色失败")
|
||||
}
|
||||
// 清理角色菜单关联
|
||||
l.svcCtx.DB.Where("role_id IN ?", req.Ids).Delete(&sysModel.SundynixRoleMenu{})
|
||||
return nil
|
||||
_, err := l.svcCtx.SystemRpc.DeleteRole(l.ctx, &system.IdsReq{Ids: req.Ids})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package role
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type GetRoleListLogic struct {
|
||||
@@ -20,23 +18,12 @@ func NewGetRoleListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRo
|
||||
return &GetRoleListLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
||||
}
|
||||
|
||||
func (l *GetRoleListLogic) GetRoleList(req *types.RoleListReq) (resp interface{}, err error) {
|
||||
var roles []sysModel.SundynixRole
|
||||
var total int64
|
||||
db := l.svcCtx.DB.Model(&sysModel.SundynixRole{})
|
||||
if req.Name != "" {
|
||||
db = db.Where("name LIKE ?", "%"+req.Name+"%")
|
||||
func (l *GetRoleListLogic) GetRoleList(req *types.RoleListReq) (interface{}, error) {
|
||||
resp, err := l.svcCtx.SystemRpc.GetRoleList(l.ctx, &system.RoleListReq{
|
||||
Current: int32(req.Current), PageSize: int32(req.PageSize), Name: req.Name,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
db.Count(&total)
|
||||
current, pageSize := req.Current, req.PageSize
|
||||
if current <= 0 {
|
||||
current = 1
|
||||
}
|
||||
if pageSize <= 0 {
|
||||
pageSize = 10
|
||||
}
|
||||
if err := db.Preload("Menus").Offset((current - 1) * pageSize).Limit(pageSize).Order("sort").Find(&roles).Error; err != nil {
|
||||
return nil, fmt.Errorf("查询角色列表失败")
|
||||
}
|
||||
return map[string]interface{}{"list": roles, "total": total, "current": current, "size": pageSize}, nil
|
||||
return map[string]interface{}{"list": resp.List, "total": resp.Total}, nil
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package role
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type UpdateRoleLogic struct {
|
||||
@@ -21,27 +19,8 @@ func NewUpdateRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Update
|
||||
}
|
||||
|
||||
func (l *UpdateRoleLogic) UpdateRole(req *types.RoleUpdateReq) error {
|
||||
updates := map[string]interface{}{}
|
||||
if req.Name != "" {
|
||||
updates["name"] = req.Name
|
||||
}
|
||||
if req.Code != "" {
|
||||
updates["code"] = req.Code
|
||||
}
|
||||
if req.Sort > 0 {
|
||||
updates["sort"] = req.Sort
|
||||
}
|
||||
if len(updates) > 0 {
|
||||
if err := l.svcCtx.DB.Model(&sysModel.SundynixRole{}).Where("id = ?", req.Id).Updates(updates).Error; err != nil {
|
||||
return fmt.Errorf("更新角色失败")
|
||||
}
|
||||
}
|
||||
// 更新菜单关联
|
||||
if len(req.MenuIds) > 0 {
|
||||
l.svcCtx.DB.Where("role_id = ?", req.Id).Delete(&sysModel.SundynixRoleMenu{})
|
||||
for _, menuID := range req.MenuIds {
|
||||
l.svcCtx.DB.Create(&sysModel.SundynixRoleMenu{RoleID: req.Id, MenuID: menuID})
|
||||
}
|
||||
}
|
||||
return nil
|
||||
_, err := l.svcCtx.SystemRpc.UpdateRole(l.ctx, &system.RoleUpdateReq{
|
||||
Id: req.Id, Name: req.Name, Code: req.Code, Sort: int32(req.Sort), MenuIds: req.MenuIds,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -5,26 +5,19 @@ package svc
|
||||
|
||||
import (
|
||||
"sundynix-micro-go/app/system/api/internal/config"
|
||||
"sundynix-micro-go/app/system/rpc/systemservice"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
DB *gorm.DB
|
||||
Config config.Config
|
||||
SystemRpc systemservice.SystemService
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
DB: db,
|
||||
Config: c,
|
||||
SystemRpc: systemservice.NewSystemService(zrpc.MustNewClient(c.SystemRpc)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+1790
-62
File diff suppressed because it is too large
Load Diff
@@ -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",
|
||||
|
||||
@@ -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...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user