// ==========================================================================
// 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"
)

// ROrderCompeleteStageToTypeDao is the manager for logic model data accessing and custom defined data operations functions management.
type ROrderCompeleteStageToTypeDao 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 ROrderCompeleteStageToTypeColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
}

// ROrderCompeleteStageToTypeColumns defines and stores column names for table r_order_compelete_stage_to_type.
type ROrderCompeleteStageToTypeColumns struct {
	RId                  string //                                                                       
    OrderProcedureStage  string // 任务流程的阶段(对应workflow_node_container表中的procedure_stage字段)  
    OrderProcedureStep   string // 任务流程的步骤(对应workflow_node_container表中的step_in_stage字段)    
    CompleteType         string // 任务步骤如果存在结束任务的可能，则这里是对应的结束任务的方式
}

//  rOrderCompeleteStageToTypeColumns holds the columns for table r_order_compelete_stage_to_type.
var rOrderCompeleteStageToTypeColumns = ROrderCompeleteStageToTypeColumns{
	RId:                 "r_id",                   
            OrderProcedureStage: "order_procedure_stage",  
            OrderProcedureStep:  "order_procedure_step",   
            CompleteType:        "complete_type",
}

// NewROrderCompeleteStageToTypeDao creates and returns a new DAO object for table data access.
func NewROrderCompeleteStageToTypeDao() *ROrderCompeleteStageToTypeDao {
	return &ROrderCompeleteStageToTypeDao{
		Group:   "default",
		Table:   "r_order_compelete_stage_to_type",
		Columns: rOrderCompeleteStageToTypeColumns,
	}
}

// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *ROrderCompeleteStageToTypeDao) 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 *ROrderCompeleteStageToTypeDao) 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 *ROrderCompeleteStageToTypeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
	return dao.Ctx(ctx).Transaction(ctx, f)
}