diff --git a/hasaki-gen-crud/template.go b/hasaki-gen-crud/template.go index 4b2c56f..9e94621 100644 --- a/hasaki-gen-crud/template.go +++ b/hasaki-gen-crud/template.go @@ -108,7 +108,7 @@ func (TempLowHead3A60 *Temp3A60) queueEvent() error { // ----------------------------temp------------------------------------ // Save 保存或者新增,通过wherePrimaryKey查不到数据时,新增数据,否则修改数据,参数:isAllCols... -func (TempLowHead3A60 *Temp3A60) Save(isAllCols ...bool) (err error) { +func (TempLowHead3A60 *Temp3A60) Save(mustCols ...string) (err error) { if TempLowHead3A60.service == "" { TempLowHead3A60.service = "none" } @@ -141,12 +141,8 @@ func (TempLowHead3A60 *Temp3A60) Save(isAllCols ...bool) (err error) { if err != nil { return } - if len(isAllCols) > 0 { - if isAllCols[0] { - _, err = TempLowHead3A60.getXorm().AllCols().Where(whereQuery, whereArgs...).Update(TempLowHead3A60) - } else { - _, err = TempLowHead3A60.getXorm().Where(whereQuery, whereArgs...).Update(TempLowHead3A60) - } + if len(mustCols) > 0 { + _, err = TempLowHead3A60.getXorm().MustCols(mustCols...).Where(whereQuery, whereArgs...).Update(TempLowHead3A60) } else { if TempLowHead3A60.isSaveAllCols() { _, err = TempLowHead3A60.getXorm().AllCols().Where(whereQuery, whereArgs...).Update(TempLowHead3A60)