-
-
Notifications
You must be signed in to change notification settings - Fork 263
/
update_department_logic.go
45 lines (39 loc) · 1.12 KB
/
update_department_logic.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package department
import (
"context"
"github.com/suyuan32/simple-admin-core/api/internal/svc"
"github.com/suyuan32/simple-admin-core/api/internal/types"
"github.com/suyuan32/simple-admin-core/rpc/types/core"
"github.com/zeromicro/go-zero/core/logx"
)
type UpdateDepartmentLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewUpdateDepartmentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateDepartmentLogic {
return &UpdateDepartmentLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *UpdateDepartmentLogic) UpdateDepartment(req *types.DepartmentInfo) (resp *types.BaseMsgResp, err error) {
data, err := l.svcCtx.CoreRpc.UpdateDepartment(l.ctx,
&core.DepartmentInfo{
Id: req.Id,
Status: req.Status,
Sort: req.Sort,
Name: req.Name,
Ancestors: req.Ancestors,
Leader: req.Leader,
Phone: req.Phone,
Email: req.Email,
Remark: req.Remark,
ParentId: req.ParentId,
})
if err != nil {
return nil, err
}
return &types.BaseMsgResp{Msg: l.svcCtx.Trans.Trans(l.ctx, data.Msg)}, nil
}