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

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

// TaskProcedureDecisionConditionColumns defines and stores column names for table task_procedure_decision_condition.
type TaskProcedureDecisionConditionColumns struct {
	TpdId               string //                                                                             
    TaskBaseId          string // 任务id(对应task_base_info表id字段)                                          
    BuySamplesType      string // 拍单方式 1样叽拍单 2，不拍单                                                
    BuySamplesStage     string // 拍单对应的工作流步骤stage(workflow_node_template表procedure_stage字段)      
    ExamineDraft        string // 是否需要审核初稿 0不审核 1审核                                              
    ExamineDraftStage   string // 审核初稿对应的工作流步骤stage(workflow_node_template表procedure_stage字段)  
    ReviewArticle       string // 是否需要审核作品 0不审核 1审核                                              
    ReviewArticleStage  string // 审核作品对应的工作流步骤stage(workflow_node_template表procedure_stage字段)  
    IsTestQulity        string // 是否质检目前不可选，值固定为1                                               
    QuilityTestStage    string // 质检对应的工作流步骤stage(workflow_node_template表procedure_stage字段)      
    IsTestData          string // 是否进行数据检测，目前不可选，值固定为1                                     
    DataTestStage       string // 数据质检对应的工作流步骤stage(workflow_node_template表procedure_stage字段)  
    ReturnSamples       string // 是否返还样品 0不返还 1返还                                                  
    ReturnSamplesStage  string // 返还样品对应的工作流步骤stage(workflow_node_template表procedure_stage字段)  
    IsAddTaskFinish     string // 是否添加任务完成步骤，目前固定为1                                           
    TaskFisnishStage    string // 任务完成对应的工作流步骤stage(workflow_node_template表procedure_stage字段)  
    BuySamplesCost      string // 拍单费用                                                                    
    SyncLogistics       string // 是否同步物流信息 1不同步 2同步                                              
    BuySamplesRefund    string // 拍单退费
}

//  taskProcedureDecisionConditionColumns holds the columns for table task_procedure_decision_condition.
var taskProcedureDecisionConditionColumns = TaskProcedureDecisionConditionColumns{
	TpdId:              "tpd_id",                
            TaskBaseId:         "task_base_id",          
            BuySamplesType:     "buy_samples_type",      
            BuySamplesStage:    "buy_samples_stage",     
            ExamineDraft:       "examine_draft",         
            ExamineDraftStage:  "examine_draft_stage",   
            ReviewArticle:      "review_article",        
            ReviewArticleStage: "review_article_stage",  
            IsTestQulity:       "is_test_qulity",        
            QuilityTestStage:   "quility_test_stage",    
            IsTestData:         "is_test_data",          
            DataTestStage:      "data_test_stage",       
            ReturnSamples:      "return_samples",        
            ReturnSamplesStage: "return_samples_stage",  
            IsAddTaskFinish:    "is_add_task_finish",    
            TaskFisnishStage:   "task_fisnish_stage",    
            BuySamplesCost:     "buy_samples_cost",      
            SyncLogistics:      "sync_logistics",        
            BuySamplesRefund:   "buy_samples_refund",
}

// NewTaskProcedureDecisionConditionDao creates and returns a new DAO object for table data access.
func NewTaskProcedureDecisionConditionDao() *TaskProcedureDecisionConditionDao {
	return &TaskProcedureDecisionConditionDao{
		Group:   "default",
		Table:   "task_procedure_decision_condition",
		Columns: taskProcedureDecisionConditionColumns,
	}
}

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