优化多租户的方案
This commit is contained in:
parent
9bbda7bfe3
commit
016ae8a014
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"git.nobla.cn/golang/aeus-admin/internal/logic"
|
"git.nobla.cn/golang/aeus-admin/internal/logic"
|
||||||
|
"git.nobla.cn/golang/aeus-admin/utils"
|
||||||
"git.nobla.cn/golang/aeus/pkg/cache"
|
"git.nobla.cn/golang/aeus/pkg/cache"
|
||||||
"git.nobla.cn/golang/rest"
|
"git.nobla.cn/golang/rest"
|
||||||
"git.nobla.cn/golang/rest/types"
|
"git.nobla.cn/golang/rest/types"
|
||||||
|
@ -20,7 +21,7 @@ type Formatter struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Formatter) FormatUser(ctx context.Context, value, model any, scm *types.Schema) any {
|
func (f *Formatter) FormatUser(ctx context.Context, value, model any, scm *types.Schema) any {
|
||||||
if values, err := f.user.GetLabels(ctx); err == nil {
|
if values, err := f.user.GetLabels(ctx, utils.GetDomainFromContext(ctx)); err == nil {
|
||||||
for _, row := range values {
|
for _, row := range values {
|
||||||
if row.Value == value {
|
if row.Value == value {
|
||||||
return fmt.Sprintf("%s(%s)", row.Label, row.Value)
|
return fmt.Sprintf("%s(%s)", row.Label, row.Value)
|
||||||
|
@ -31,7 +32,7 @@ func (f *Formatter) FormatUser(ctx context.Context, value, model any, scm *types
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Formatter) FormatDepartment(ctx context.Context, value, model any, scm *types.Schema) any {
|
func (f *Formatter) FormatDepartment(ctx context.Context, value, model any, scm *types.Schema) any {
|
||||||
if values, err := f.department.GetLabels(ctx); err == nil {
|
if values, err := f.department.GetLabels(ctx, utils.GetDomainFromContext(ctx)); err == nil {
|
||||||
for _, row := range values {
|
for _, row := range values {
|
||||||
if row.Value == value {
|
if row.Value == value {
|
||||||
return row.Label
|
return row.Label
|
||||||
|
@ -42,7 +43,7 @@ func (f *Formatter) FormatDepartment(ctx context.Context, value, model any, scm
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Formatter) FormatRole(ctx context.Context, value, model any, scm *types.Schema) any {
|
func (f *Formatter) FormatRole(ctx context.Context, value, model any, scm *types.Schema) any {
|
||||||
if values, err := f.role.GetLabels(ctx); err == nil {
|
if values, err := f.role.GetLabels(ctx, utils.GetDomainFromContext(ctx)); err == nil {
|
||||||
for _, row := range values {
|
for _, row := range values {
|
||||||
if row.Value == value {
|
if row.Value == value {
|
||||||
return row.Label
|
return row.Label
|
||||||
|
@ -53,7 +54,7 @@ func (f *Formatter) FormatRole(ctx context.Context, value, model any, scm *types
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Formatter) FormatMenu(ctx context.Context, value, model any, scm *types.Schema) any {
|
func (f *Formatter) FormatMenu(ctx context.Context, value, model any, scm *types.Schema) any {
|
||||||
if values, err := f.menu.GetLabels(ctx); err == nil {
|
if values, err := f.menu.GetLabels(ctx, utils.GetDomainFromContext(ctx)); err == nil {
|
||||||
for _, row := range values {
|
for _, row := range values {
|
||||||
if row.Value == value {
|
if row.Value == value {
|
||||||
return row.Label
|
return row.Label
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
||||||
// source: organize.proto
|
// source: organize.proto
|
||||||
// date: 2025-07-23 17:06:59
|
// date: 2025-07-23 17:11:27
|
||||||
|
|
||||||
package pb
|
package pb
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
||||||
// source: organize.proto
|
// source: organize.proto
|
||||||
// date: 2025-07-23 17:06:59
|
// date: 2025-07-23 17:11:27
|
||||||
|
|
||||||
package pb
|
package pb
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
||||||
// source: system.proto
|
// source: system.proto
|
||||||
// date: 2025-07-23 17:06:59
|
// date: 2025-07-23 17:11:27
|
||||||
|
|
||||||
package pb
|
package pb
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
||||||
// source: system.proto
|
// source: system.proto
|
||||||
// date: 2025-07-23 17:06:59
|
// date: 2025-07-23 17:11:27
|
||||||
|
|
||||||
package pb
|
package pb
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue