140 lines
5.0 KiB
Go
140 lines
5.0 KiB
Go
// ==========================================================================
|
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
|
// ==========================================================================
|
|
|
|
package internal
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/gogf/gf/v2/database/gdb"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
)
|
|
|
|
// BatchMainDao is the data access object for the table batch_main.
|
|
type BatchMainDao struct {
|
|
table string // table is the underlying table name of the DAO.
|
|
group string // group is the database configuration group name of the current DAO.
|
|
columns BatchMainColumns // columns contains all the column names of Table for convenient usage.
|
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
|
}
|
|
|
|
// BatchMainColumns defines and stores column names for the table batch_main.
|
|
type BatchMainColumns struct {
|
|
Id string // 主键ID
|
|
BatchNo string // 批次编号
|
|
OrderSn string // 订单编号
|
|
BatchType string // 批次类型 枚举
|
|
BatchStatus string // 批次状态 枚举
|
|
BatchAsyncStatus string // 异步处理状态
|
|
SourceType string // 来源方式 枚举
|
|
SourceBatchNo string // 来源批次编号
|
|
SourceOssId string // 源文件OSS ID
|
|
ResultOssId string // 结果文件OSS ID
|
|
IsCrossDept string // 是否跨级操作机构
|
|
TargetDeptId string // 目标机构编号
|
|
DeptId string // 机构编号
|
|
TotalCount string // 总数量
|
|
ValidCount string // 有效数量
|
|
SuccessCount string // 成功数量
|
|
FailCount string // 失败数量
|
|
RunResult string // 运行结果
|
|
FailReason string // 失败原因
|
|
BatchInfo string // 批次信息:入库/出库展示字段
|
|
Remark string // 备注扩展字段
|
|
StartTime string // 开始时间
|
|
EndTime string // 结束时间
|
|
TenantId string // 租户ID
|
|
CreatedDept string // 创建部门ID
|
|
CreatedBy string // 创建者ID
|
|
CreatedAt string // 创建时间
|
|
UpdatedBy string // 更新者ID
|
|
UpdatedAt string // 更新时间
|
|
SourceChannel string // 发起渠道:console/mini_program/api/system/legacy
|
|
ExecutionMode string // 操作规模:0未知1单卡2批量
|
|
}
|
|
|
|
// batchMainColumns holds the columns for the table batch_main.
|
|
var batchMainColumns = BatchMainColumns{
|
|
Id: "id",
|
|
BatchNo: "batch_no",
|
|
OrderSn: "order_sn",
|
|
BatchType: "batch_type",
|
|
BatchStatus: "batch_status",
|
|
BatchAsyncStatus: "batch_async_status",
|
|
SourceType: "source_type",
|
|
SourceBatchNo: "source_batch_no",
|
|
SourceOssId: "source_oss_id",
|
|
ResultOssId: "result_oss_id",
|
|
IsCrossDept: "is_cross_dept",
|
|
TargetDeptId: "target_dept_id",
|
|
DeptId: "dept_id",
|
|
TotalCount: "total_count",
|
|
ValidCount: "valid_count",
|
|
SuccessCount: "success_count",
|
|
FailCount: "fail_count",
|
|
RunResult: "run_result",
|
|
FailReason: "fail_reason",
|
|
BatchInfo: "batch_info",
|
|
Remark: "remark",
|
|
StartTime: "start_time",
|
|
EndTime: "end_time",
|
|
TenantId: "tenant_id",
|
|
CreatedDept: "created_dept",
|
|
CreatedBy: "created_by",
|
|
CreatedAt: "created_at",
|
|
UpdatedBy: "updated_by",
|
|
UpdatedAt: "updated_at",
|
|
SourceChannel: "source_channel",
|
|
ExecutionMode: "execution_mode",
|
|
}
|
|
|
|
// NewBatchMainDao creates and returns a new DAO object for table data access.
|
|
func NewBatchMainDao(handlers ...gdb.ModelHandler) *BatchMainDao {
|
|
return &BatchMainDao{
|
|
group: "default",
|
|
table: "batch_main",
|
|
columns: batchMainColumns,
|
|
handlers: handlers,
|
|
}
|
|
}
|
|
|
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
|
func (dao *BatchMainDao) DB() gdb.DB {
|
|
return g.DB(dao.group)
|
|
}
|
|
|
|
// Table returns the table name of the current DAO.
|
|
func (dao *BatchMainDao) Table() string {
|
|
return dao.table
|
|
}
|
|
|
|
// Columns returns all column names of the current DAO.
|
|
func (dao *BatchMainDao) Columns() BatchMainColumns {
|
|
return dao.columns
|
|
}
|
|
|
|
// Group returns the database configuration group name of the current DAO.
|
|
func (dao *BatchMainDao) Group() string {
|
|
return dao.group
|
|
}
|
|
|
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
|
func (dao *BatchMainDao) Ctx(ctx context.Context) *gdb.Model {
|
|
model := dao.DB().Model(dao.table)
|
|
for _, handler := range dao.handlers {
|
|
model = handler(model)
|
|
}
|
|
return model.Safe().Ctx(ctx)
|
|
}
|
|
|
|
// Transaction wraps the transaction logic using function f.
|
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
|
// It commits the transaction and returns nil if function f returns nil.
|
|
//
|
|
// Note: Do not commit or roll back the transaction in function f,
|
|
// as it is automatically handled by this function.
|
|
func (dao *BatchMainDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
|
}
|