yjp 1 سال پیش
والد
کامیت
c64686ac0d

+ 1 - 1
convenient/relation/one2one/service.go

@@ -130,7 +130,7 @@ func Update(fromTableName string, fromRelationFieldName string, fromRelationColu
 	}
 }
 
-func Query[TI any](fromTableName string, fromRelationFieldName string, toTableName string, toRelationColumnName string) binding.ServiceFunc[TI] {
+func Query[TI any](fromTableName string, fromRelationFieldName string, toTableName string) binding.ServiceFunc[TI] {
 	return func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (TI, error) {
 		outputZero := reflectutils.Zero[TI]()
 

+ 2 - 2
convenient/relation/one2one/simple.go

@@ -79,7 +79,7 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 				ResponseFunc:  response.SendInfoResponse[RI],
 				RequestParams: simple.LeftQueryQueryParams,
 				Objects:       []domain.Object{simple.Left},
-				ServiceFunc:   Query[RI](leftTableName, leftRelationColumnName, rightTableName, rightRelationColumnName),
+				ServiceFunc:   Query[RI](leftTableName, leftRelationFieldName, rightTableName),
 			})
 		}
 
@@ -115,7 +115,7 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 				ResponseFunc:  response.SendInfoResponse[LI],
 				RequestParams: simple.RightQueryQueryParams,
 				Objects:       []domain.Object{simple.Right},
-				ServiceFunc:   Query[LI](rightTableName, rightRelationColumnName, leftTableName, leftRelationColumnName),
+				ServiceFunc:   Query[LI](rightTableName, rightRelationFieldName, leftTableName),
 			})
 		}
 

+ 1 - 1
examples/examples/project/application/domain/family/request_params.go

@@ -40,7 +40,7 @@ type (
 	}
 
 	QueryFamilyWithStudentQueryParams struct {
-		request.Query
+		request.BaseQuery
 		Father string `form:"father" assign:"toField:Father"`
 		Mother string `form:"mother" assign:"toField:Mother"`
 	}

+ 2 - 2
examples/examples/project/main.go

@@ -54,12 +54,12 @@ import (
 // Student-Family
 // curl -X POST -H "Content-Type: application/json" -d '{"id":"00254b4a7102429db35e6edc8e47a764", "familyId": "df3aeee04ce94c17878bbb5383d15f18"}' "http://localhost:31000/example/v1/student/family/update"
 // curl -X GET "http://localhost:31000/example/v1/student/family/query?id=00254b4a7102429db35e6edc8e47a764"
-// curl -X GET "http://localhost:31000/example/v1/student/family/queryWith?name=test"
+// curl -X GET "http://localhost:31000/example/v1/student/family/queryWith?father=test"
 
 // Family-Student
 // curl -X POST -H "Content-Type: application/json" -d '{"id":"df3aeee04ce94c17878bbb5383d15f18", "studentId": "00254b4a7102429db35e6edc8e47a764"}' "http://localhost:31000/example/v1/family/student/update"
 // curl -X GET "http://localhost:31000/example/v1/family/student/query?id=df3aeee04ce94c17878bbb5383d15f18"
-// curl -X GET "http://localhost:31000/example/v1/family/student/queryWith?name=test"
+// curl -X GET "http://localhost:31000/example/v1/family/student/queryWith?father=test"
 
 // Student-Identity
 // curl -X POST -H "Content-Type: application/json" -d '{"id":"00254b4a7102429db35e6edc8e47a764", "identityIds": ["4481fd110a5f46d2babe52b650981384"]}' "http://localhost:31000/example/v1/student/identity/update"