fusenapi/model/gmodel/fs_refund_reason_logic.go
2023-06-20 19:52:38 +08:00

27 lines
689 B
Go

package gmodel
import (
"context"
"gorm.io/gorm"
)
// TODO: 使用model的属性做你想做的
func (m *FsRefundReasonModel) Create(ctx context.Context, obj *FsRefundReason) error {
return m.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
tx.Create(obj)
return nil
})
}
func (m *FsRefundReasonModel) Update(ctx context.Context, obj *FsRefundReason) error {
return m.db.WithContext(ctx).Model(obj).Where("`id` = ?", obj.Id).Updates(obj).Error
}
func (m *FsRefundReasonModel) UpdateByRefundReasonId(ctx context.Context, obj *FsRefundReason) error {
return m.db.WithContext(ctx).Model(obj).Where("`refund_reason_id` = ?", obj.RefundReasonId).Updates(obj).Error
}