增加添加部门接口

This commit is contained in:
laodaming
2023-11-16 14:15:45 +08:00
parent def6990eba
commit 6fb16aa12c
5 changed files with 19 additions and 59 deletions

View File

@@ -11,7 +11,7 @@ import (
"fusenapi/server/ldap-admin/internal/types"
)
func GetDepartmentsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
func GetOrganizationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
@@ -21,12 +21,12 @@ func GetDepartmentsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
}
// 创建一个业务逻辑层实例
l := logic.NewGetDepartmentsLogic(r.Context(), svcCtx)
l := logic.NewGetOrganizationsLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.GetDepartments(&req, userinfo)
resp := l.GetOrganizations(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)

View File

@@ -44,8 +44,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
},
{
Method: http.MethodGet,
Path: "/api/ldap-admin/get_departments",
Handler: GetDepartmentsHandler(serverCtx),
Path: "/api/ldap-admin/get_organizations",
Handler: GetOrganizationsHandler(serverCtx),
},
{
Method: http.MethodPost,