diff --git a/hasaki-gen-crud/template.go b/hasaki-gen-crud/template.go index 355e973..c5f7c14 100644 --- a/hasaki-gen-crud/template.go +++ b/hasaki-gen-crud/template.go @@ -43,8 +43,15 @@ func (TempLowHead3A60 *Temp3A60) isSaveAllCols() bool { } //savePretreatment 保存前预处理 -func (TempLowHead3A60 *Temp3A60) savePretreatment() { +func (TempLowHead3A60 *Temp3A60) savePretreatment() error { //todo + return nil +} + +//savePretreatment 保存前预处理 +func (TempLowHead3A60 *Temp3A60) deletePretreatment() error { + //todo + return nil } func (TempLowHead3A60 *Temp3A60) getXorm() *xorm.Engine { @@ -59,7 +66,10 @@ func (TempLowHead3A60 *Temp3A60) Save(isAllCols ...bool) (err error) { tmp := Temp3A60{} whereQuery, whereArgs := TempLowHead3A60.wherePrimaryKey() TempLowHead3A60.getXorm().Where(whereQuery, whereArgs...).Get(&tmp) - TempLowHead3A60.savePretreatment() + err = TempLowHead3A60.savePretreatment() + if err != nil { + return + } if tmp.Id == 0 { _, err = TempLowHead3A60.getXorm().Insert(TempLowHead3A60) } else { @@ -131,6 +141,10 @@ func (TempLowHead3A60 *Temp3A60) PageData(page, pageSize int) (data []Temp3A60, //Delete 删除数据 func (TempLowHead3A60 *Temp3A60) Delete() (err error) { whereQuery, whereArgs := TempLowHead3A60.wherePrimaryKey() + err = TempLowHead3A60.deletePretreatment() + if err != nil { + return + } _, err = TempLowHead3A60.getXorm().Where(whereQuery, whereArgs...).Delete(TempLowHead3A60) return }