142 lines
5.1 KiB
Go
142 lines
5.1 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"
|
|
)
|
|
|
|
// TOrderItemDao is the data access object for the table t_order_item.
|
|
type TOrderItemDao 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 TOrderItemColumns // columns contains all the column names of Table for convenient usage.
|
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
|
}
|
|
|
|
// TOrderItemColumns defines and stores column names for the table t_order_item.
|
|
type TOrderItemColumns struct {
|
|
ItemId string // 订单商品信息自增id
|
|
OrderId string // 订单ID
|
|
OrderSn string // 订单编号
|
|
CustomerType string // 客户类型 枚举
|
|
CustomerAgentId string // 渠道编号(购买方)
|
|
EndUserId string // 客户编号
|
|
Price string // 商品最终单价
|
|
Quantity string // 商品的购买数量
|
|
ProductId string // 商品ID
|
|
ProductName string // 商品的名称
|
|
ProductSn string // 商品的唯一货号
|
|
PicThumb string // 商品缩略图
|
|
SkuId string // 规格ID
|
|
SkuData string // 【JSON】sku信息[{sku_id,sku_value,sku_name}]
|
|
DeliveryQuantity string // 发货数量
|
|
ProductType string // 商品类型 枚举
|
|
IsGift string // 是否为赠品 枚举:yesno_enum
|
|
AgentId string // 渠道编号(销售方)
|
|
PrepayPrice string // 预售价格
|
|
Commission string // 佣金数据
|
|
OriginPrice string // 商品初始价格
|
|
PromotionData string // 优惠信息
|
|
ExtraSkuData string // 附加属性
|
|
PayMode string // 付费方式 枚举
|
|
ServiceBeginTime string // 服务开始时间
|
|
ServiceEndTime string // 服务结束时间
|
|
TenantId string // 租户ID
|
|
CreatedDept string // 创建部门
|
|
CreatedBy string // 创建者
|
|
CreatedAt string // 创建时间
|
|
UpdatedBy string // 更新者
|
|
UpdatedAt string // 更新时间
|
|
}
|
|
|
|
// tOrderItemColumns holds the columns for the table t_order_item.
|
|
var tOrderItemColumns = TOrderItemColumns{
|
|
ItemId: "item_id",
|
|
OrderId: "order_id",
|
|
OrderSn: "order_sn",
|
|
CustomerType: "customer_type",
|
|
CustomerAgentId: "customer_agent_id",
|
|
EndUserId: "end_user_id",
|
|
Price: "price",
|
|
Quantity: "quantity",
|
|
ProductId: "product_id",
|
|
ProductName: "product_name",
|
|
ProductSn: "product_sn",
|
|
PicThumb: "pic_thumb",
|
|
SkuId: "sku_id",
|
|
SkuData: "sku_data",
|
|
DeliveryQuantity: "delivery_quantity",
|
|
ProductType: "product_type",
|
|
IsGift: "is_gift",
|
|
AgentId: "agent_id",
|
|
PrepayPrice: "prepay_price",
|
|
Commission: "commission",
|
|
OriginPrice: "origin_price",
|
|
PromotionData: "promotion_data",
|
|
ExtraSkuData: "extra_sku_data",
|
|
PayMode: "pay_mode",
|
|
ServiceBeginTime: "service_begin_time",
|
|
ServiceEndTime: "service_end_time",
|
|
TenantId: "tenant_id",
|
|
CreatedDept: "created_dept",
|
|
CreatedBy: "created_by",
|
|
CreatedAt: "created_at",
|
|
UpdatedBy: "updated_by",
|
|
UpdatedAt: "updated_at",
|
|
}
|
|
|
|
// NewTOrderItemDao creates and returns a new DAO object for table data access.
|
|
func NewTOrderItemDao(handlers ...gdb.ModelHandler) *TOrderItemDao {
|
|
return &TOrderItemDao{
|
|
group: "default",
|
|
table: "t_order_item",
|
|
columns: tOrderItemColumns,
|
|
handlers: handlers,
|
|
}
|
|
}
|
|
|
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
|
func (dao *TOrderItemDao) DB() gdb.DB {
|
|
return g.DB(dao.group)
|
|
}
|
|
|
|
// Table returns the table name of the current DAO.
|
|
func (dao *TOrderItemDao) Table() string {
|
|
return dao.table
|
|
}
|
|
|
|
// Columns returns all column names of the current DAO.
|
|
func (dao *TOrderItemDao) Columns() TOrderItemColumns {
|
|
return dao.columns
|
|
}
|
|
|
|
// Group returns the database configuration group name of the current DAO.
|
|
func (dao *TOrderItemDao) 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 *TOrderItemDao) 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 *TOrderItemDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
|
}
|