|
|
@@ -0,0 +1,38 @@
|
|
|
+package service
|
|
|
+
|
|
|
+import (
|
|
|
+ "git.sxidc.com/go-framework/baize/convenient/relation/one2one"
|
|
|
+ "git.sxidc.com/go-framework/baize/examples/examples/project/application/domain/family"
|
|
|
+ "git.sxidc.com/go-framework/baize/examples/examples/project/application/domain/student"
|
|
|
+ "git.sxidc.com/go-framework/baize/framwork/application"
|
|
|
+)
|
|
|
+
|
|
|
+type StudentAndFamily struct{}
|
|
|
+
|
|
|
+func (app *StudentAndFamily) Init(appInstance *application.App) error {
|
|
|
+ app.v1(appInstance)
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+func (app *StudentAndFamily) Destroy() error {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+func (app *StudentAndFamily) v1(appInstance *application.App) {
|
|
|
+ v1Binder := appInstance.Binder(application.RouterPrefix, "v1")
|
|
|
+
|
|
|
+ one2one.BindSimple(v1Binder, &one2one.Simple[student.Info, family.Info]{
|
|
|
+ Left: &student.Entity{},
|
|
|
+ Right: &family.Entity{},
|
|
|
+ LeftTableName: student.TableName,
|
|
|
+ RightTableName: family.TableName,
|
|
|
+ LeftDomainPath: student.DomainPath,
|
|
|
+ RightDomainPath: family.DomainPath,
|
|
|
+ LeftUpdateJsonBody: &student.UpdateFamilyOfStudentJsonBody{},
|
|
|
+ LeftQueryQueryParams: &student.QueryFamilyOfStudentQueryParams{},
|
|
|
+ LeftQueryWithRightQueryParams: &student.QueryStudentWithFamilyQueryParams{},
|
|
|
+ RightUpdateJsonBody: &family.UpdateStudentOfFamilyJsonBody{},
|
|
|
+ RightQueryQueryParams: &family.QueryStudentOfFamilyQueryParams{},
|
|
|
+ RightQueryWithLeftQueryParams: &family.QueryFamilyWithStudentQueryParams{},
|
|
|
+ })
|
|
|
+}
|