You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

getadapterinfologic.go 1.2 kB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package adapters
  2. import (
  3. "context"
  4. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
  5. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
  6. "github.com/zeromicro/go-zero/core/logx"
  7. )
  8. type GetAdapterInfoLogic struct {
  9. logx.Logger
  10. ctx context.Context
  11. svcCtx *svc.ServiceContext
  12. }
  13. func NewGetAdapterInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAdapterInfoLogic {
  14. return &GetAdapterInfoLogic{
  15. Logger: logx.WithContext(ctx),
  16. ctx: ctx,
  17. svcCtx: svcCtx,
  18. }
  19. }
  20. func (l *GetAdapterInfoLogic) GetAdapterInfo(req *types.AdapterInfoNameReq) (resp *types.AdapterInfoNameReqResp, err error) {
  21. // todo: add your logic here and delete this line
  22. resp = &types.AdapterInfoNameReqResp{}
  23. var infoNameReqResp types.AdapterInfoNameReqResp
  24. sql := `SELECT ta.type AS Type,ta.resource_type AS ResourceType,ta.name AS TName,tai.info_name AS InfoName FROM t_adapter ta LEFT JOIN t_adapter_info tai ON ta.id = tai.adapter_id WHERE ta.id = ?`
  25. tx := l.svcCtx.DbEngin.Raw(sql, req.AdapterId).Scan(&infoNameReqResp.InfoList)
  26. if tx.Error != nil {
  27. logx.Error(err)
  28. return nil, tx.Error
  29. }
  30. resp.Code = 200
  31. resp.Msg = "success"
  32. resp.InfoList = infoNameReqResp.InfoList
  33. return resp, nil
  34. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.