|
@@ -256,7 +256,11 @@ func (s *StoreEntry) SystemUserRole(ctx context.Context, userId int64) (*pasture
|
|
|
return &pasturePb.SystemUserRoleResponse{
|
|
|
Code: http.StatusOK,
|
|
|
Msg: "ok",
|
|
|
- Data: int32(systemUser.RoleId),
|
|
|
+ Data: &pasturePb.UserRoleData{
|
|
|
+ RoleIds: []int32{
|
|
|
+ int32(systemUser.RoleId),
|
|
|
+ },
|
|
|
+ },
|
|
|
}, nil
|
|
|
}
|
|
|
|
|
@@ -269,14 +273,16 @@ func (s *StoreEntry) SystemUserRoleSave(ctx context.Context, req *pasturePb.Syst
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
|
|
|
|
- systemRole := &model.SystemRole{Id: int64(req.RoleId)}
|
|
|
+ // todo 用户觉得绑定单个还是多少q
|
|
|
+ systemRole := &model.SystemRole{Id: int64(req.RoleIds[0])}
|
|
|
if err := s.DB.First(systemRole).Error; err != nil {
|
|
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
|
return xerr.Custom("该角色不存在")
|
|
|
}
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
|
- if err := s.DB.Model(systemUser).Update("role_id", systemRole.Id).Error; err != nil {
|
|
|
+ if err := s.DB.Model(systemUser).
|
|
|
+ Update("role_id", systemRole.Id).Error; err != nil {
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
|
return nil
|
|
@@ -606,7 +612,10 @@ func (s *StoreEntry) SearchSystemDeptList(ctx context.Context, req *pasturePb.Se
|
|
|
pref.Where("is_show = ?", req.IsShow)
|
|
|
}
|
|
|
|
|
|
- if err := pref.Order("sort desc").Count(&count).Limit(int(pagination.PageSize)).Offset(int(pagination.PageOffset)).
|
|
|
+ if err := pref.Order("sort desc").
|
|
|
+ Count(&count).
|
|
|
+ Limit(int(pagination.PageSize)).
|
|
|
+ Offset(int(pagination.PageOffset)).
|
|
|
Find(&deptList).Error; err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
@@ -616,7 +625,12 @@ func (s *StoreEntry) SearchSystemDeptList(ctx context.Context, req *pasturePb.Se
|
|
|
return &pasturePb.SearchDeptResponse{
|
|
|
Code: http.StatusOK,
|
|
|
Msg: "ok",
|
|
|
- Data: model.SystemDeptSlice(deptList).ToPB(systemUserList),
|
|
|
+ Data: &pasturePb.DeptData{
|
|
|
+ List: model.SystemDeptSlice(deptList).ToPB(systemUserList),
|
|
|
+ Total: int32(count),
|
|
|
+ PageSize: pagination.PageSize,
|
|
|
+ Page: pagination.Page,
|
|
|
+ },
|
|
|
}, nil
|
|
|
}
|
|
|
|