231 lines
5.4 KiB
Go
231 lines
5.4 KiB
Go
// Code generated by goctl. DO NOT EDIT.
|
|
// goctl 1.10.1
|
|
|
|
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
client "sundynix-micro-go/app/system/api/internal/handler/client"
|
|
dict "sundynix-micro-go/app/system/api/internal/handler/dict"
|
|
menu "sundynix-micro-go/app/system/api/internal/handler/menu"
|
|
operationRecord "sundynix-micro-go/app/system/api/internal/handler/operationRecord"
|
|
role "sundynix-micro-go/app/system/api/internal/handler/role"
|
|
user "sundynix-micro-go/app/system/api/internal/handler/user"
|
|
"sundynix-micro-go/app/system/api/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
)
|
|
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 创建客户端
|
|
Method: http.MethodPost,
|
|
Path: "/client/create",
|
|
Handler: client.CreateClientHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除客户端
|
|
Method: http.MethodPost,
|
|
Path: "/client/delete",
|
|
Handler: client.DeleteClientHandler(serverCtx),
|
|
},
|
|
{
|
|
// 客户端列表
|
|
Method: http.MethodPost,
|
|
Path: "/client/list",
|
|
Handler: client.GetClientListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新客户端
|
|
Method: http.MethodPost,
|
|
Path: "/client/update",
|
|
Handler: client.UpdateClientHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/sys"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 创建字典
|
|
Method: http.MethodPost,
|
|
Path: "/dict/create",
|
|
Handler: dict.CreateDictHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除字典
|
|
Method: http.MethodPost,
|
|
Path: "/dict/delete",
|
|
Handler: dict.DeleteDictHandler(serverCtx),
|
|
},
|
|
{
|
|
// 字典列表
|
|
Method: http.MethodPost,
|
|
Path: "/dict/list",
|
|
Handler: dict.GetDictListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新字典
|
|
Method: http.MethodPost,
|
|
Path: "/dict/update",
|
|
Handler: dict.UpdateDictHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/sys"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 根据角色获取菜单
|
|
Method: http.MethodPost,
|
|
Path: "/menu/byRole",
|
|
Handler: menu.GetMenuByRoleHandler(serverCtx),
|
|
},
|
|
{
|
|
// 创建菜单
|
|
Method: http.MethodPost,
|
|
Path: "/menu/create",
|
|
Handler: menu.CreateMenuHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除菜单
|
|
Method: http.MethodPost,
|
|
Path: "/menu/delete",
|
|
Handler: menu.DeleteMenuHandler(serverCtx),
|
|
},
|
|
{
|
|
// 菜单列表(树形)
|
|
Method: http.MethodGet,
|
|
Path: "/menu/list",
|
|
Handler: menu.GetMenuListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新菜单
|
|
Method: http.MethodPost,
|
|
Path: "/menu/update",
|
|
Handler: menu.UpdateMenuHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/sys"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 删除操作日志
|
|
Method: http.MethodPost,
|
|
Path: "/log/delete",
|
|
Handler: operationRecord.DeleteOperationRecordHandler(serverCtx),
|
|
},
|
|
{
|
|
// 操作日志列表
|
|
Method: http.MethodPost,
|
|
Path: "/log/list",
|
|
Handler: operationRecord.GetOperationRecordListHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/sys"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 角色授权菜单
|
|
Method: http.MethodPost,
|
|
Path: "/role/assignMenus",
|
|
Handler: role.AssignRoleMenusHandler(serverCtx),
|
|
},
|
|
{
|
|
// 创建角色
|
|
Method: http.MethodPost,
|
|
Path: "/role/create",
|
|
Handler: role.CreateRoleHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除角色
|
|
Method: http.MethodPost,
|
|
Path: "/role/delete",
|
|
Handler: role.DeleteRoleHandler(serverCtx),
|
|
},
|
|
{
|
|
// 角色详情(含已授权菜单)
|
|
Method: http.MethodGet,
|
|
Path: "/role/detail",
|
|
Handler: role.GetRoleDetailHandler(serverCtx),
|
|
},
|
|
{
|
|
// 角色列表
|
|
Method: http.MethodPost,
|
|
Path: "/role/list",
|
|
Handler: role.GetRoleListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新角色
|
|
Method: http.MethodPost,
|
|
Path: "/role/update",
|
|
Handler: role.UpdateRoleHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/sys"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 用户授权角色
|
|
Method: http.MethodPost,
|
|
Path: "/user/assignRoles",
|
|
Handler: user.AssignUserRolesHandler(serverCtx),
|
|
},
|
|
{
|
|
// 创建用户
|
|
Method: http.MethodPost,
|
|
Path: "/user/create",
|
|
Handler: user.CreateUserHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除用户
|
|
Method: http.MethodPost,
|
|
Path: "/user/delete",
|
|
Handler: user.DeleteUserHandler(serverCtx),
|
|
},
|
|
{
|
|
// 用户详情(含角色信息)
|
|
Method: http.MethodGet,
|
|
Path: "/user/detail",
|
|
Handler: user.GetUserDetailHandler(serverCtx),
|
|
},
|
|
{
|
|
// 用户列表
|
|
Method: http.MethodPost,
|
|
Path: "/user/list",
|
|
Handler: user.GetUserListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 重置密码
|
|
Method: http.MethodPost,
|
|
Path: "/user/resetPassword",
|
|
Handler: user.ResetPasswordHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新用户
|
|
Method: http.MethodPost,
|
|
Path: "/user/update",
|
|
Handler: user.UpdateUserHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/sys"),
|
|
)
|
|
}
|