package svc import ( "muyu-apiserver/model" "muyu-apiserver/rpc/production/internal/config" "github.com/zeromicro/go-zero/core/stores/sqlx" ) type ServiceContext struct { Config config.Config Conn sqlx.SqlConn PlanModel model.ProProductionPlanModel YarnRatioModel model.ProPlanYarnRatioModel ProcessStepModel model.ProPlanProcessStepModel ShareLinkModel model.ProShareLinkModel PlanFactoryModel model.ProPlanFactoryModel InboundModel model.ProInboundRecordModel InventoryLogModel model.InvInventoryLogModel } func NewServiceContext(c config.Config) *ServiceContext { conn := sqlx.NewMysql(c.DataSource) return &ServiceContext{ Config: c, Conn: conn, PlanModel: model.NewProProductionPlanModel(conn, c.Cache), YarnRatioModel: model.NewProPlanYarnRatioModel(conn), ProcessStepModel: model.NewProPlanProcessStepModel(conn), ShareLinkModel: model.NewProShareLinkModel(conn), PlanFactoryModel: model.NewProPlanFactoryModel(conn), InboundModel: model.NewProInboundRecordModel(conn), InventoryLogModel: model.NewInvInventoryLogModel(conn), } }