28 lines
813 B
Go
28 lines
813 B
Go
package logic
|
|
|
|
import (
|
|
"context"
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
plantModel "sundynix-micro-go/app/plant/model"
|
|
"sundynix-micro-go/app/plant/rpc/internal/svc"
|
|
"sundynix-micro-go/app/plant/rpc/plant"
|
|
)
|
|
|
|
type GetExchangeItemDetailLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
}
|
|
|
|
func NewGetExchangeItemDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetExchangeItemDetailLogic {
|
|
return &GetExchangeItemDetailLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
|
|
}
|
|
|
|
func (l *GetExchangeItemDetailLogic) GetExchangeItemDetail(in *plant.IdReq) (*plant.ExchangeItemInfo, error) {
|
|
var item plantModel.ExchangeItem
|
|
if err := l.svcCtx.DB.First(&item, "id = ?", in.Id).Error; err != nil {
|
|
return nil, err
|
|
}
|
|
return exchangeItemInfo(item), nil
|
|
}
|