184 lines
6.9 KiB
Go
184 lines
6.9 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"
|
|
)
|
|
|
|
// TOrderDao is the data access object for the table t_order.
|
|
type TOrderDao 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 TOrderColumns // columns contains all the column names of Table for convenient usage.
|
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
|
}
|
|
|
|
// TOrderColumns defines and stores column names for the table t_order.
|
|
type TOrderColumns struct {
|
|
Id string // 主键ID
|
|
OrderSn string // 订单编号
|
|
ParentOrderId string // 父订单ID
|
|
ParentOrderSn string // 父订单编号
|
|
CustomerType string // 客户类型 枚举
|
|
CustomerAgentId string // 渠道编号(购买方)
|
|
EndUserId string // 终端客户编号
|
|
AgentId string // 渠道编号(销售方)
|
|
OrderType string // 订单类型 枚举
|
|
OrderStatus string // 订单状态 枚举
|
|
ShippingStatus string // 配送状态 枚举
|
|
ReturnStatus string // 退货状态 枚举
|
|
Consignee string // 收货人姓名
|
|
Mobile string // 收货人手机
|
|
Email string // 收货人邮箱
|
|
Address string // 详细地址
|
|
AreaCode string // 行政区域代码
|
|
BuyerNote string // 买家备注
|
|
AdminNote string // 商家备注
|
|
Remark string // 系统备注
|
|
ShippingMethod string // 发货方式 枚举
|
|
LogisticsId string // 快递公司ID
|
|
LogisticsName string // 物流公司名称
|
|
ShippingTypeId string // 配送类型ID
|
|
ShippingTypeName string // 配送类型名称
|
|
TrackingNo string // 物流单号
|
|
ShippingTime string // 发货时间
|
|
ReceivedTime string // 收货时间
|
|
PayType string // 支付类型 枚举
|
|
PayStatus string // 支付状态 枚举
|
|
PayOrderSn string // 支付订单编号
|
|
PayTime string // 支付时间
|
|
TotalAmount string // 订单总金额
|
|
ProductAmount string // 商品总金额
|
|
ShippingFee string // 运费金额
|
|
ServiceFee string // 服务费金额
|
|
InvoiceFee string // 发票费金额
|
|
CouponAmount string // 优惠券抵扣金额
|
|
DiscountAmount string // 活动优惠金额
|
|
Balance string // 余额抵扣金额
|
|
PaidAmount string // 已支付总金额
|
|
OnlinePaidAmount string // 线上支付金额
|
|
OfflinePaidAmount string // 线下支付金额
|
|
UnpaidAmount string // 未支付金额
|
|
UnrefundAmount string // 未退款金额
|
|
IsNeedCommission string // 是否需要分佣 枚举:yesno_enum
|
|
DistributionStatus string // 分销分成状态 枚举
|
|
TenantId string // 租户ID
|
|
CreatedDept string // 创建部门ID
|
|
CreatedBy string // 创建者ID
|
|
CreatedAt string // 创建时间
|
|
UpdatedBy string // 更新者ID
|
|
UpdatedAt string // 更新时间
|
|
}
|
|
|
|
// tOrderColumns holds the columns for the table t_order.
|
|
var tOrderColumns = TOrderColumns{
|
|
Id: "id",
|
|
OrderSn: "order_sn",
|
|
ParentOrderId: "parent_order_id",
|
|
ParentOrderSn: "parent_order_sn",
|
|
CustomerType: "customer_type",
|
|
CustomerAgentId: "customer_agent_id",
|
|
EndUserId: "end_user_id",
|
|
AgentId: "agent_id",
|
|
OrderType: "order_type",
|
|
OrderStatus: "order_status",
|
|
ShippingStatus: "shipping_status",
|
|
ReturnStatus: "return_status",
|
|
Consignee: "consignee",
|
|
Mobile: "mobile",
|
|
Email: "email",
|
|
Address: "address",
|
|
AreaCode: "area_code",
|
|
BuyerNote: "buyer_note",
|
|
AdminNote: "admin_note",
|
|
Remark: "remark",
|
|
ShippingMethod: "shipping_method",
|
|
LogisticsId: "logistics_id",
|
|
LogisticsName: "logistics_name",
|
|
ShippingTypeId: "shipping_type_id",
|
|
ShippingTypeName: "shipping_type_name",
|
|
TrackingNo: "tracking_no",
|
|
ShippingTime: "shipping_time",
|
|
ReceivedTime: "received_time",
|
|
PayType: "pay_type",
|
|
PayStatus: "pay_status",
|
|
PayOrderSn: "pay_order_sn",
|
|
PayTime: "pay_time",
|
|
TotalAmount: "total_amount",
|
|
ProductAmount: "product_amount",
|
|
ShippingFee: "shipping_fee",
|
|
ServiceFee: "service_fee",
|
|
InvoiceFee: "invoice_fee",
|
|
CouponAmount: "coupon_amount",
|
|
DiscountAmount: "discount_amount",
|
|
Balance: "balance",
|
|
PaidAmount: "paid_amount",
|
|
OnlinePaidAmount: "online_paid_amount",
|
|
OfflinePaidAmount: "offline_paid_amount",
|
|
UnpaidAmount: "unpaid_amount",
|
|
UnrefundAmount: "unrefund_amount",
|
|
IsNeedCommission: "is_need_commission",
|
|
DistributionStatus: "distribution_status",
|
|
TenantId: "tenant_id",
|
|
CreatedDept: "created_dept",
|
|
CreatedBy: "created_by",
|
|
CreatedAt: "created_at",
|
|
UpdatedBy: "updated_by",
|
|
UpdatedAt: "updated_at",
|
|
}
|
|
|
|
// NewTOrderDao creates and returns a new DAO object for table data access.
|
|
func NewTOrderDao(handlers ...gdb.ModelHandler) *TOrderDao {
|
|
return &TOrderDao{
|
|
group: "default",
|
|
table: "t_order",
|
|
columns: tOrderColumns,
|
|
handlers: handlers,
|
|
}
|
|
}
|
|
|
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
|
func (dao *TOrderDao) DB() gdb.DB {
|
|
return g.DB(dao.group)
|
|
}
|
|
|
|
// Table returns the table name of the current DAO.
|
|
func (dao *TOrderDao) Table() string {
|
|
return dao.table
|
|
}
|
|
|
|
// Columns returns all column names of the current DAO.
|
|
func (dao *TOrderDao) Columns() TOrderColumns {
|
|
return dao.columns
|
|
}
|
|
|
|
// Group returns the database configuration group name of the current DAO.
|
|
func (dao *TOrderDao) 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 *TOrderDao) 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 *TOrderDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
|
}
|