|
|
@@ -0,0 +1,54 @@ |
|
|
|
package implement |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" |
|
|
|
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" |
|
|
|
zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
type HappyOrchardUserWatchRecordsDb struct { |
|
|
|
Db *xorm.Engine |
|
|
|
} |
|
|
|
|
|
|
|
func NewHappyOrchardUserWatchRecordsDb(engine *xorm.Engine) dao.HappyOrchardUserWatchRecordsDao { |
|
|
|
return &HappyOrchardUserWatchRecordsDb{Db: engine} |
|
|
|
} |
|
|
|
|
|
|
|
func (h HappyOrchardUserWatchRecordsDb) GetHappyOrchardUserWatchRecords(uid int) (m *models.HappyOrchardUserWatchRecords, err error) { |
|
|
|
m = new(models.HappyOrchardUserWatchRecords) |
|
|
|
has, err := h.Db.Where("uid=? ", uid).Get(m) |
|
|
|
if err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
if has == false { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
return m, nil |
|
|
|
} |
|
|
|
func (h HappyOrchardUserWatchRecordsDb) GetHappyOrchardUserWatchRecordsSess(sess *xorm.Session, uid int) (m *models.HappyOrchardUserWatchRecords, err error) { |
|
|
|
m = new(models.HappyOrchardUserWatchRecords) |
|
|
|
has, err := sess.Where("uid=? ", uid).Get(m) |
|
|
|
if err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
if has == false { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
return m, nil |
|
|
|
} |
|
|
|
func (h HappyOrchardUserWatchRecordsDb) HappyOrchardUserWatchRecordsUpdate(id interface{}, OneCirclesUserWatchRecords *models.HappyOrchardUserWatchRecords, forceColums ...string) (int64, error) { |
|
|
|
var ( |
|
|
|
affected int64 |
|
|
|
err error |
|
|
|
) |
|
|
|
if forceColums != nil { |
|
|
|
affected, err = h.Db.Where("id=?", id).Cols(forceColums...).Update(OneCirclesUserWatchRecords) |
|
|
|
} else { |
|
|
|
affected, err = h.Db.Where("id=?", id).Update(OneCirclesUserWatchRecords) |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return affected, nil |
|
|
|
} |