From 955a517a868729f2dcfca997b7b41f42dab032b4 Mon Sep 17 00:00:00 2001 From: public_host Date: Tue, 20 Apr 2021 11:10:13 +0800 Subject: [PATCH] fix --- hasaki-gen-crud/template.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hasaki-gen-crud/template.go b/hasaki-gen-crud/template.go index b5241e8..297e14d 100644 --- a/hasaki-gen-crud/template.go +++ b/hasaki-gen-crud/template.go @@ -12,7 +12,7 @@ type Temp3A60 struct { // ----------------------------temp------------------------------------ -func (TempLowHead3A60 *Temp3A60) where() (q interface{}, args []interface{}) { +func (TempLowHead3A60 *Temp3A60) wherePrimaryKey() (q interface{}, args []interface{}) { //todo 根据需求修改 return "`id`=?", []interface{}{ TempLowHead3A60.Id, @@ -25,7 +25,7 @@ func (TempLowHead3A60 *Temp3A60) getXorm() *xorm.Engine { func (TempLowHead3A60 *Temp3A60) Save(isAllCols ...bool) (err error) { tmp := Temp3A60{} - whereQuery, whereArgs := TempLowHead3A60.where() + whereQuery, whereArgs := TempLowHead3A60.wherePrimaryKey() TempLowHead3A60.getXorm().Where(whereQuery, whereArgs...).Get(&tmp) if tmp.Id == 0 { _, err = TempLowHead3A60.getXorm().Insert(TempLowHead3A60) @@ -40,7 +40,7 @@ func (TempLowHead3A60 *Temp3A60) Save(isAllCols ...bool) (err error) { } func (TempLowHead3A60 *Temp3A60) Load() (err error) { - whereQuery, whereArgs := TempLowHead3A60.where() + whereQuery, whereArgs := TempLowHead3A60.wherePrimaryKey() _, err = TempLowHead3A60.getXorm().Where(whereQuery, whereArgs...).Get(&TempLowHead3A60) return } @@ -56,7 +56,7 @@ func (TempLowHead3A60 *Temp3A60) PageData(page, pageSize int) (data []Temp3A60, } func (TempLowHead3A60 *Temp3A60) Delete() (err error) { - whereQuery, whereArgs := TempLowHead3A60.where() + whereQuery, whereArgs := TempLowHead3A60.wherePrimaryKey() _, err = TempLowHead3A60.getXorm().Where(whereQuery, whereArgs...).Delete(&TempLowHead3A60) return }