fusenapi/model/gmodel/fs_refund_reason_logic.go

27 lines
689 B
Go
Raw Normal View History

2023-06-19 18:27:31 +08:00
package gmodel
2023-06-20 17:29:02 +08:00
2023-06-20 19:36:28 +08:00
import (
"context"
"gorm.io/gorm"
)
2023-06-20 17:29:02 +08:00
// TODO: 使用model的属性做你想做的
2023-06-20 19:36:28 +08:00
func (m *FsRefundReasonModel) Create(ctx context.Context, obj *FsRefundReason) error {
return m.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
2023-06-20 19:52:38 +08:00
tx.Create(obj)
2023-06-20 19:36:28 +08:00
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
}
2023-06-20 17:29:02 +08:00
2023-06-20 19:36:28 +08:00
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
2023-06-20 17:29:02 +08:00
}