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

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

// WorkflowNodeContainerColumns defines and stores column names for table workflow_node_container.
type WorkflowNodeContainerColumns struct {
	ContainerId          string //                                                                                   
    NodeNameFirst        string // 首次执行时的节点名，前端显示                                                      
    NodeNameAfterSecond  string // 第二次之后执行时的节点名                                                          
    ProcedureStage       string // 订单处理流程阶段，如：拍单阶段、初稿阶段                                          
    StepInStage          string // 在阶段中的步骤，如提交初稿是初稿阶段的第一步                                      
    CurExecutionTimes    string // 当前执行次数                                                                      
    MaxExecutionTimes    string // 最大执行次数                                                                      
    Tip                  string // 此步骤在达人端的提示                                                              
    SucNextStep          string // 成功后在此阶段的后续步骤 0不处理 255进行后续阶段 其余数值为本阶段step_in_stage值  
    FailNextStep         string // 失败的后续步骤，数值同上                                                          
    State                string // 状态 1未开启 2进行中 3失败 4完成                                                  
    FailReason           string // 失败原因                                                                          
    StartDate            string // 开始日期                                                                          
    CompleteDate         string // 完成日期                                                                          
    CompleteUserName     string // 完成人名                                                                          
    LimitDays1           string // 限制天数                                                                          
    ReduceFeeRatio1      string // 超期扣费比率                                                                      
    LimitDays2           string // 第二次执行限制天数(修改操作限时）                                                 
    ReduceFeeRatio2      string // 第二次执行超期扣费率                                                              
    OperateRoleRestrict  string // 操作角色限制 1后端 2达人                                                          
    SortId               string // 在一个任务流程中的排序值                                                          
    OrderId              string // 关联的订单和任务id
}

//  workflowNodeContainerColumns holds the columns for table workflow_node_container.
var workflowNodeContainerColumns = WorkflowNodeContainerColumns{
	ContainerId:         "container_id",            
            NodeNameFirst:       "node_name_first",         
            NodeNameAfterSecond: "node_name_after_second",  
            ProcedureStage:      "procedure_stage",         
            StepInStage:         "step_in_stage",           
            CurExecutionTimes:   "cur_execution_times",     
            MaxExecutionTimes:   "max_execution_times",     
            Tip:                 "tip",                     
            SucNextStep:         "suc_next_step",           
            FailNextStep:        "fail_next_step",          
            State:               "state",                   
            FailReason:          "fail_reason",             
            StartDate:           "start_date",              
            CompleteDate:        "complete_date",           
            CompleteUserName:    "complete_user_name",      
            LimitDays1:          "limit_days_1",            
            ReduceFeeRatio1:     "reduce_fee_ratio_1",      
            LimitDays2:          "limit_days_2",            
            ReduceFeeRatio2:     "reduce_fee_ratio_2",      
            OperateRoleRestrict: "operate_role_restrict",   
            SortId:              "sort_id",                 
            OrderId:             "order_id",
}

// NewWorkflowNodeContainerDao creates and returns a new DAO object for table data access.
func NewWorkflowNodeContainerDao() *WorkflowNodeContainerDao {
	return &WorkflowNodeContainerDao{
		Group:   "default",
		Table:   "workflow_node_container",
		Columns: workflowNodeContainerColumns,
	}
}

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