package svc import ( "muyu-apiserver/model" "muyu-apiserver/rpc/purchase/internal/config" "github.com/zeromicro/go-zero/core/stores/sqlx" ) type ServiceContext struct { Config config.Config SupplierModel model.PurSupplierModel OrderModel model.PurPurchaseOrderModel OrderDetailModel model.PurPurchaseOrderDetailModel ReceiptModel model.PurPurchaseReceiptModel ReceiptDetailModel model.PurPurchaseReceiptDetailModel PaymentModel model.PurPurchasePaymentModel InventoryLogModel model.InvInventoryLogModel } func NewServiceContext(c config.Config) *ServiceContext { conn := sqlx.NewMysql(c.DataSource) return &ServiceContext{ Config: c, SupplierModel: model.NewPurSupplierModel(conn, c.Cache), OrderModel: model.NewPurPurchaseOrderModel(conn, c.Cache), OrderDetailModel: model.NewPurPurchaseOrderDetailModel(conn), ReceiptModel: model.NewPurPurchaseReceiptModel(conn), ReceiptDetailModel: model.NewPurPurchaseReceiptDetailModel(conn), PaymentModel: model.NewPurPurchasePaymentModel(conn), InventoryLogModel: model.NewInvInventoryLogModel(conn), } }