You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
889 B
Go
38 lines
889 B
Go
package department_admin
|
|
|
|
import (
|
|
"context"
|
|
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core"
|
|
"github.com/jinzhu/copier"
|
|
|
|
"git.noahlan.cn/n-admin/n-admin-server/api/internal/svc"
|
|
"git.noahlan.cn/n-admin/n-admin-server/api/internal/types"
|
|
|
|
"net/http"
|
|
)
|
|
|
|
type UpdateDepartmentAdminLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
r *http.Request
|
|
}
|
|
|
|
func NewUpdateDepartmentAdminLogic(r *http.Request, ctx context.Context, svcCtx *svc.ServiceContext) *UpdateDepartmentAdminLogic {
|
|
return &UpdateDepartmentAdminLogic{
|
|
r: r,
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *UpdateDepartmentAdminLogic) UpdateDepartmentAdmin(req *types.DepartmentInfo) error {
|
|
var updateModel core.DepartmentInfo
|
|
_ = copier.Copy(&updateModel, req)
|
|
|
|
_, err := l.svcCtx.CoreRpc.UpdateDepartment(l.ctx, &updateModel)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|