42 lines
1.4 KiB
Go
42 lines
1.4 KiB
Go
package data
|
|
|
|
import (
|
|
"PaymentCenter/app/http/entities"
|
|
"PaymentCenter/app/models/orderthirdpaylogmodel"
|
|
"PaymentCenter/app/utils/snowflake"
|
|
"xorm.io/builder"
|
|
"xorm.io/xorm"
|
|
)
|
|
|
|
type OrderThirdPayLogRepo struct {
|
|
repo xorm.Interface
|
|
}
|
|
|
|
func NewOrderThirdPayLogRepo(repo xorm.Interface) *OrderThirdPayLogRepo {
|
|
return &OrderThirdPayLogRepo{
|
|
repo: repo,
|
|
}
|
|
}
|
|
|
|
func (m *OrderThirdPayLogRepo) OrderThirdPayLogList(conn builder.Cond, pageFilter entities.PageRequest, orderLogList *[]orderthirdpaylogmodel.OrderThirdPayLog) (int64, error) {
|
|
repo := m.repo.Where(conn)
|
|
if pageFilter.Page > 0 {
|
|
repo = repo.Limit(pageFilter.PageSize, pageFilter.PageSize*(pageFilter.Page-1))
|
|
}
|
|
return repo.Desc("create_time").FindAndCount(orderLogList)
|
|
}
|
|
|
|
func (m *OrderThirdPayLogRepo) OrderThirdPayLogInsertOne(orderLog *orderthirdpaylogmodel.OrderThirdPayLog) (int64, error) {
|
|
orderLog.Id = snowflake.GetID()
|
|
return m.repo.InsertOne(orderLog)
|
|
}
|
|
|
|
func (m *OrderThirdPayLogRepo) OrderThirdPayLogDelete(orderLog *orderthirdpaylogmodel.OrderThirdPayLog, conn builder.Cond) (int64, error) {
|
|
return m.repo.Where(conn).Delete(orderLog)
|
|
}
|
|
|
|
// columns 参数为要更新的字段
|
|
func (m *OrderThirdPayLogRepo) OrderThirdPayLogUpdate(orderLog *orderthirdpaylogmodel.OrderThirdPayLog, conn builder.Cond, columns ...string) (int64, error) {
|
|
return m.repo.Where(conn).MustCols(columns...).Update(orderLog)
|
|
}
|