Browse Source

'fix'

master
u 2 years ago
parent
commit
a253799a89
  1. 10
      hasaki-gen-crud/template.go

10
hasaki-gen-crud/template.go

@ -108,7 +108,7 @@ func (TempLowHead3A60 *Temp3A60) queueEvent() error {
// ----------------------------temp------------------------------------ // ----------------------------temp------------------------------------
// Save 保存或者新增,通过wherePrimaryKey查不到数据时,新增数据,否则修改数据,参数:isAllCols... // Save 保存或者新增,通过wherePrimaryKey查不到数据时,新增数据,否则修改数据,参数:isAllCols...
func (TempLowHead3A60 *Temp3A60) Save(isAllCols ...bool) (err error) {
func (TempLowHead3A60 *Temp3A60) Save(mustCols ...string) (err error) {
if TempLowHead3A60.service == "" { if TempLowHead3A60.service == "" {
TempLowHead3A60.service = "none" TempLowHead3A60.service = "none"
} }
@ -141,12 +141,8 @@ func (TempLowHead3A60 *Temp3A60) Save(isAllCols ...bool) (err error) {
if err != nil { if err != nil {
return 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 { } else {
if TempLowHead3A60.isSaveAllCols() { if TempLowHead3A60.isSaveAllCols() {
_, err = TempLowHead3A60.getXorm().AllCols().Where(whereQuery, whereArgs...).Update(TempLowHead3A60) _, err = TempLowHead3A60.getXorm().AllCols().Where(whereQuery, whereArgs...).Update(TempLowHead3A60)

Loading…
Cancel
Save