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

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

// TaskProcedureDraftInfoColumns defines and stores column names for table task_procedure_draft_info.
type TaskProcedureDraftInfoColumns struct {
	TaskPdId          string //                                     
    TaskBaseId        string // 任务id(对应task_base_info表id字段)  
    UploadLimitDay    string // 上传初稿天数限制                    
    UploadReduceRate  string // 上传初稿超时扣费比率(*100)          
    ReviseLimitDay    string // 修改初稿期限天数限制                
    ReviseReduceRate  string // 初稿超时扣费比率(*100)
}

//  taskProcedureDraftInfoColumns holds the columns for table task_procedure_draft_info.
var taskProcedureDraftInfoColumns = TaskProcedureDraftInfoColumns{
	TaskPdId:         "task_pd_id",          
            TaskBaseId:       "task_base_id",        
            UploadLimitDay:   "upload_limit_day",    
            UploadReduceRate: "upload_reduce_rate",  
            ReviseLimitDay:   "revise_limit_day",    
            ReviseReduceRate: "revise_reduce_rate",
}

// NewTaskProcedureDraftInfoDao creates and returns a new DAO object for table data access.
func NewTaskProcedureDraftInfoDao() *TaskProcedureDraftInfoDao {
	return &TaskProcedureDraftInfoDao{
		Group:   "default",
		Table:   "task_procedure_draft_info",
		Columns: taskProcedureDraftInfoColumns,
	}
}

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