yjp 1 год назад
Родитель
Сommit
597a7cea9f
1 измененных файлов с 7 добавлено и 20 удалено
  1. 7 20
      convenient/relation/one2one/service.go

+ 7 - 20
convenient/relation/one2one/service.go

@@ -10,7 +10,6 @@ import (
 	"git.sxidc.com/go-framework/baize/framwork/infrastructure/database/sql"
 	"git.sxidc.com/go-tools/utils/strutils"
 	"git.sxidc.com/service-supports/fserr"
-	"github.com/mitchellh/mapstructure"
 	"reflect"
 )
 
@@ -195,11 +194,6 @@ func Query[TI any](fromTableName string, toTableName string, toRelationColumnNam
 	}
 }
 
-type WithInfo[FI any, TI any] struct {
-	Self FI `json:"self" mapstructure:"self"`
-	With TI `json:"with" mapstructure:"with"`
-}
-
 func QueryWithOtherInfo[FI any, TI any](fromTableName string, toTableName string, toRelationColumnName string) binding.ServiceFunc[map[string]any] {
 	return func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (map[string]any, error) {
 		var outputFromZero FI
@@ -219,13 +213,9 @@ func QueryWithOtherInfo[FI any, TI any](fromTableName string, toTableName string
 
 		outputToZero = outputToZeroValue.Interface().(TI)
 
-		zeroRetMap := make(map[string]any)
-		err := mapstructure.Decode(WithInfo[FI, TI]{
-			Self: outputFromZero,
-			With: outputToZero,
-		}, &zeroRetMap)
-		if err != nil {
-			return nil, err
+		zeroRetMap := map[string]any{
+			"self": outputFromZero,
+			"with": outputToZero,
 		}
 
 		dbExecutor := i.DBExecutor()
@@ -295,12 +285,9 @@ func QueryWithOtherInfo[FI any, TI any](fromTableName string, toTableName string
 			return zeroRetMap, err
 		}
 
-		retMap := make(map[string]any)
-		err = mapstructure.Decode(WithInfo[FI, TI]{
-			Self: fromInfo,
-			With: toInfo,
-		}, &retMap)
-
-		return retMap, nil
+		return map[string]any{
+			"self": fromInfo,
+			"with": toInfo,
+		}, nil
 	}
 }