|
|
@ -3,6 +3,7 @@ package main |
|
|
|
import ( |
|
|
|
"git.ouxuan.net/hasaki-service/hasaki-sdk/hskdb" |
|
|
|
"git.ouxuan.net/hasaki-service/hasaki-sdk/hskgin" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
type Temp3A60 struct { |
|
|
@ -18,17 +19,21 @@ func (TempLowHead3A60 *Temp3A60) where() (q interface{}, args []interface{}) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (TempLowHead3A60 *Temp3A60) getXorm() *xorm.Engine { |
|
|
|
return hskdb.GetXormAuto() |
|
|
|
} |
|
|
|
|
|
|
|
func (TempLowHead3A60 *Temp3A60) Save(isAllCols ...bool) (err error) { |
|
|
|
tmp := Temp3A60{} |
|
|
|
whereQuery, whereArgs := TempLowHead3A60.where() |
|
|
|
hskdb.GetXormAuto().Where(whereQuery, whereArgs...).Get(&tmp) |
|
|
|
TempLowHead3A60.getXorm().Where(whereQuery, whereArgs...).Get(&tmp) |
|
|
|
if tmp.Id == 0 { |
|
|
|
_, err = hskdb.GetXormAuto().Insert(TempLowHead3A60) |
|
|
|
_, err = TempLowHead3A60.getXorm().Insert(TempLowHead3A60) |
|
|
|
} else { |
|
|
|
if len(isAllCols) > 0 && isAllCols[0] { |
|
|
|
_, err = hskdb.GetXormAuto().AllCols().Where(whereQuery, whereArgs...).Update(TempLowHead3A60) |
|
|
|
_, err = TempLowHead3A60.getXorm().AllCols().Where(whereQuery, whereArgs...).Update(TempLowHead3A60) |
|
|
|
} else { |
|
|
|
_, err = hskdb.GetXormAuto().Where(whereQuery, whereArgs...).Update(TempLowHead3A60) |
|
|
|
_, err = TempLowHead3A60.getXorm().Where(whereQuery, whereArgs...).Update(TempLowHead3A60) |
|
|
|
} |
|
|
|
} |
|
|
|
return err |
|
|
@ -36,23 +41,23 @@ func (TempLowHead3A60 *Temp3A60) Save(isAllCols ...bool) (err error) { |
|
|
|
|
|
|
|
func (TempLowHead3A60 *Temp3A60) Load() (err error) { |
|
|
|
whereQuery, whereArgs := TempLowHead3A60.where() |
|
|
|
_, err = hskdb.GetXormAuto().Where(whereQuery, whereArgs...).Get(&TempLowHead3A60) |
|
|
|
_, err = TempLowHead3A60.getXorm().Where(whereQuery, whereArgs...).Get(&TempLowHead3A60) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func (TempLowHead3A60 *Temp3A60) Data() (data []Temp3A60) { |
|
|
|
hskdb.GetXormAuto().OrderBy("id desc").Find(&data) |
|
|
|
TempLowHead3A60.getXorm().OrderBy("id desc").Find(&data) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func (TempLowHead3A60 *Temp3A60) PageData(page, pageSize int) (data []Temp3A60, count int64) { |
|
|
|
count, _ = hskdb.GetXormAuto().OrderBy("id desc").Limit(pageSize, page*pageSize).FindAndCount(&data) |
|
|
|
count, _ = TempLowHead3A60.getXorm().OrderBy("id desc").Limit(pageSize, page*pageSize).FindAndCount(&data) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func (TempLowHead3A60 *Temp3A60) Delete() (err error) { |
|
|
|
whereQuery, whereArgs := TempLowHead3A60.where() |
|
|
|
_, err = hskdb.GetXormAuto().Where(whereQuery, whereArgs...).Delete(&TempLowHead3A60) |
|
|
|
_, err = TempLowHead3A60.getXorm().Where(whereQuery, whereArgs...).Delete(&TempLowHead3A60) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|