Chever John 379fb28d92 chore: sync codebase with upstream
Align origin/main with upstream/main (GitHub). The two branches
diverged due to pre-rebase vs post-rebase merge commits for the
k8s-amd64-dockerfiles feature.

Includes: multi-stage Go compilation Dockerfiles, pan-bolt
inventory features, CRM relations, Excel import tooling,
proto/gRPC updates, migration scripts, and tools/ directory.

Excludes deploy/bin/ pre-compiled binaries (arm64, not needed
for amd64 K3s cluster; builds use multi-stage Dockerfiles now).
2026-06-14 15:24:02 +08:00

53 lines
1.3 KiB
Go

package panbolt
import (
"context"
"muyu-apiserver/gateway/internal/svc"
"muyu-apiserver/gateway/internal/types"
"muyu-apiserver/rpc/inventory/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type ListPanViewLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewListPanViewLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListPanViewLogic {
return &ListPanViewLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *ListPanViewLogic) ListPanView(req *types.ListPanViewReq) (resp *types.ListPanViewResp, err error) {
rpcResp, err := l.svcCtx.InventoryRpc.ListPanView(l.ctx, &pb.ListPanViewReq{
Page: req.Page,
PageSize: req.PageSize,
ProductName: req.ProductName,
Position: req.Position,
})
if err != nil {
return nil, err
}
list := make([]types.PanListItem, 0, len(rpcResp.List))
for _, item := range rpcResp.List {
list = append(list, types.PanListItem{
PanId: item.PanId,
ProductId: item.ProductId,
Name: item.Name,
Position: item.Position,
ProductName: item.ProductName,
Colors: item.Colors,
BoltCount: item.BoltCount,
TotalLengthM: item.TotalLengthM,
})
}
return &types.ListPanViewResp{Total: rpcResp.Total, List: list}, nil
}