|
|
@ -11,48 +11,48 @@ type Temp3A60 struct { |
|
|
|
|
|
|
|
// ----------------------------temp------------------------------------
|
|
|
|
|
|
|
|
func (that *Temp3A60) where() (q interface{}, args []interface{}) { |
|
|
|
func (TempLowHead3A60 *Temp3A60) where() (q interface{}, args []interface{}) { |
|
|
|
//todo 根据需求修改
|
|
|
|
return "`id`=?", []interface{}{ |
|
|
|
that.Id, |
|
|
|
TempLowHead3A60.Id, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (that *Temp3A60) Save(isAllCols ...bool) (err error) { |
|
|
|
func (TempLowHead3A60 *Temp3A60) Save(isAllCols ...bool) (err error) { |
|
|
|
tmp := Temp3A60{} |
|
|
|
whereQuery, whereArgs := that.where() |
|
|
|
whereQuery, whereArgs := TempLowHead3A60.where() |
|
|
|
hskdb.GetXormAuto().Where(whereQuery, whereArgs...).Get(&tmp) |
|
|
|
if tmp.Id == 0 { |
|
|
|
_, err = hskdb.GetXormAuto().Insert(that) |
|
|
|
_, err = hskdb.GetXormAuto().Insert(TempLowHead3A60) |
|
|
|
} else { |
|
|
|
if len(isAllCols) > 0 && isAllCols[0] { |
|
|
|
_, err = hskdb.GetXormAuto().AllCols().Where(whereQuery, whereArgs...).Update(that) |
|
|
|
_, err = hskdb.GetXormAuto().AllCols().Where(whereQuery, whereArgs...).Update(TempLowHead3A60) |
|
|
|
} else { |
|
|
|
_, err = hskdb.GetXormAuto().Where(whereQuery, whereArgs...).Update(that) |
|
|
|
_, err = hskdb.GetXormAuto().Where(whereQuery, whereArgs...).Update(TempLowHead3A60) |
|
|
|
} |
|
|
|
} |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
func (that *Temp3A60) Load() (err error) { |
|
|
|
whereQuery, whereArgs := that.where() |
|
|
|
_, err = hskdb.GetXormAuto().Where(whereQuery, whereArgs...).Get(&that) |
|
|
|
func (TempLowHead3A60 *Temp3A60) Load() (err error) { |
|
|
|
whereQuery, whereArgs := TempLowHead3A60.where() |
|
|
|
_, err = hskdb.GetXormAuto().Where(whereQuery, whereArgs...).Get(&TempLowHead3A60) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func (that *Temp3A60) Data() (data []Temp3A60) { |
|
|
|
func (TempLowHead3A60 *Temp3A60) Data() (data []Temp3A60) { |
|
|
|
hskdb.GetXormAuto().OrderBy("id desc").Find(&data) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func (that *Temp3A60) PageData(page, pageSize int) (data []Temp3A60, count int64) { |
|
|
|
func (TempLowHead3A60 *Temp3A60) PageData(page, pageSize int) (data []Temp3A60, count int64) { |
|
|
|
count, _ = hskdb.GetXormAuto().OrderBy("id desc").Limit(pageSize, page*pageSize).FindAndCount(&data) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func (that *Temp3A60) Delete() (err error) { |
|
|
|
whereQuery, whereArgs := that.where() |
|
|
|
_, err = hskdb.GetXormAuto().Where(whereQuery, whereArgs...).Delete(&that) |
|
|
|
func (TempLowHead3A60 *Temp3A60) Delete() (err error) { |
|
|
|
whereQuery, whereArgs := TempLowHead3A60.where() |
|
|
|
_, err = hskdb.GetXormAuto().Where(whereQuery, whereArgs...).Delete(&TempLowHead3A60) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|