package router import ( "fmt" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/conf" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/controller" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/constant" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/router/middleware/header" "github.com/gin-gonic/gin" ) // InitSystemRoleRouter 初始化角色相关路由 func InitSystemRoleRouter(e *gin.Engine) { base := e.Group(fmt.Sprintf("%s/role", conf.Options.Prefix), header.SetContext) { base.PUT("create", header.AddLogMiddleware("角色管理", "/role/create", constant.OpTypeIntMap[constant.Add]), controller.CreateSystemRole) // 添加系统角色 base.POST("update", header.AddLogMiddleware("角色管理", "/role/update", constant.OpTypeIntMap[constant.Edit]), controller.UpdateSystemRole) // 编辑系统角色 base.POST("state/:id/:state", header.AddLogMiddleware("角色管理", "/role/state", constant.OpTypeIntMap[constant.Edit]), controller.SystemRoleState) // 系统角色状态 base.GET("list", header.AddLogMiddleware("角色管理", "/role/list", constant.OpTypeIntMap[constant.Find]), controller.SystemRoleList) // 系统角色列表 base.GET("detail/:id", header.AddLogMiddleware("角色管理", "/role/detail", constant.OpTypeIntMap[constant.Find]), controller.SystemRoleDetail) // 系统角色详情 base.POST("allotment/user", header.AddLogMiddleware("角色管理", "/role/allotment/user", constant.OpTypeIntMap[constant.Find]), controller.SystemRoleAllotmentUser) // 角色分配账户 base.GET("allotment/list", header.AddLogMiddleware("角色管理", "/role/allotment/list", constant.OpTypeIntMap[constant.Find]), controller.SystemAllotUserList) // 角色可分配账户列表 base.DELETE("delete", header.AddLogMiddleware("角色管理", "/role/delete", constant.OpTypeIntMap[constant.AllDelete]), controller.DeleteSystemRole) // 删除系统角色 } }