Pull latest changes from upstream/main (GitHub) including: - Purchase RPC service (proto, server, logic, models) - Gateway route updates for purchase endpoints - SQL migration and config updates Excludes deploy/bin/ pre-compiled arm64 binaries (builds use multi-stage Dockerfiles targeting amd64).
32 lines
789 B
Go
32 lines
789 B
Go
package logic
|
|
|
|
import (
|
|
"context"
|
|
|
|
"muyu-apiserver/rpc/purchase/internal/svc"
|
|
"muyu-apiserver/rpc/purchase/pb"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type DeleteSupplierLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
}
|
|
|
|
func NewDeleteSupplierLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteSupplierLogic {
|
|
return &DeleteSupplierLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
|
|
}
|
|
|
|
func (l *DeleteSupplierLogic) DeleteSupplier(in *pb.DeleteSupplierReq) (*pb.Empty, error) {
|
|
s, err := l.svcCtx.SupplierModel.FindOneBySupplierId(l.ctx, in.SupplierId)
|
|
if err != nil {
|
|
return nil, ErrSupplierNotFound
|
|
}
|
|
if err := l.svcCtx.SupplierModel.Delete(l.ctx, s.Id); err != nil {
|
|
return nil, err
|
|
}
|
|
return &pb.Empty{}, nil
|
|
}
|