From 5101728c8cef54e1ec0f27a3719e902662c3bc67 Mon Sep 17 00:00:00 2001 From: u Date: Thu, 6 Apr 2023 10:31:30 +0800 Subject: [PATCH] 'fix' --- hasaki-gen-crud/template.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/hasaki-gen-crud/template.go b/hasaki-gen-crud/template.go index a86ab87..c4929aa 100644 --- a/hasaki-gen-crud/template.go +++ b/hasaki-gen-crud/template.go @@ -56,6 +56,11 @@ func (TempLowHead3A60 *Temp3A60) init() { //todo } +func (TempLowHead3A60 *Temp3A60) joinTable() (types, sqlx, condition, alias string) { + //todo + return "LEFT", "", "Temp3A60.id=Temp3A60_id", "tmp" +} + // saveAllCols 保存时是否全量保存 func (TempLowHead3A60 *Temp3A60) isSaveAllCols() bool { return false @@ -164,6 +169,12 @@ func (TempLowHead3A60 *Temp3A60) Load() (err error) { whereCond := TempLowHead3A60.wherePrimaryKeyWithCond() session := TempLowHead3A60.getXorm().NewSession() defer session.Close() + + types, sqlx, condition, alias := TempLowHead3A60.joinTable() + if sqlx != "" { + session = session.Join(types, sqlx, condition, alias) + } + if whereQuery != "" { session = session.Where(whereQuery, whereArgs...) } @@ -194,6 +205,11 @@ func (TempLowHead3A60 *Temp3A60) Data() (data []Temp3A60) { session.Close() }() + types, sqlx, condition, alias := TempLowHead3A60.joinTable() + if sqlx != "" { + session = session.Join(types, sqlx, condition, alias) + } + if q != "" { session = session.Where(q, args...) } @@ -227,6 +243,12 @@ func (TempLowHead3A60 *Temp3A60) PageData(page, pageSize int) (data []Temp3A60, defer func() { session.Close() }() + + types, sqlx, condition, alias := TempLowHead3A60.joinTable() + if sqlx != "" { + session = session.Join(types, sqlx, condition, alias) + } + if q != "" { session = session.Where(q, args...) }