fusenapi/model/gmodel/fs_refund_reason_logic.go

27 lines
689 B
Go
Raw Normal View History

2023-06-19 10:27:31 +00:00
package gmodel
2023-06-20 09:29:02 +00:00
2023-06-20 11:36:28 +00:00
import (
"context"
"gorm.io/gorm"
)
2023-06-20 09:29:02 +00:00
// TODO: 使用model的属性做你想做的
2023-06-20 11:36:28 +00: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 11:52:38 +00:00
tx.Create(obj)
2023-06-20 11:36:28 +00: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 09:29:02 +00:00
2023-06-20 11:36:28 +00: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 09:29:02 +00:00
}