// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================

package internal

import (
	"context"
	"github.com/gogf/gf/database/gdb"
	"github.com/gogf/gf/frame/g"
)

// OrderDraftReviewDao is the manager for logic model data accessing and custom defined data operations functions management.
type OrderDraftReviewDao struct {
	Table   string          // Table is the underlying table name of the DAO.
	Group   string          // Group is the database configuration group name of current DAO.
	Columns OrderDraftReviewColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
}

// OrderDraftReviewColumns defines and stores column names for table order_draft_review.
type OrderDraftReviewColumns struct {
	OrderDraftId  string // 初稿审核id                            
    OrderId       string // 订单id                                
    OnlineLink    string // 在线链接                              
    AuditStatus   string // 审核状态 1待审核 2审核通过 3审核驳回  
    AuditOpinion  string // 审核意见                              
    CreatedAt     string // 创建时间                              
    ConfirmTime   string // 初稿通过时间
}

//  orderDraftReviewColumns holds the columns for table order_draft_review.
var orderDraftReviewColumns = OrderDraftReviewColumns{
	OrderDraftId: "order_draft_id",  
            OrderId:      "order_id",        
            OnlineLink:   "online_link",     
            AuditStatus:  "audit_status",    
            AuditOpinion: "audit_opinion",   
            CreatedAt:    "created_at",      
            ConfirmTime:  "confirm_time",
}

// NewOrderDraftReviewDao creates and returns a new DAO object for table data access.
func NewOrderDraftReviewDao() *OrderDraftReviewDao {
	return &OrderDraftReviewDao{
		Group:   "default",
		Table:   "order_draft_review",
		Columns: orderDraftReviewColumns,
	}
}

// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *OrderDraftReviewDao) DB() gdb.DB {
	return g.DB(dao.Group)
}

// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *OrderDraftReviewDao) Ctx(ctx context.Context) *gdb.Model {
	return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
}

// Transaction wraps the transaction logic using function f.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *OrderDraftReviewDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
	return dao.Ctx(ctx).Transaction(ctx, f)
}