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.

getdictitemlogic.go 991 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package dictionary
  2. import (
  3. "context"
  4. "github.com/pkg/errors"
  5. tool "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
  7. "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type GetDictItemLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewGetDictItemLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDictItemLogic {
  16. return &GetDictItemLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *GetDictItemLogic) GetDictItem(req *types.CId) (resp *types.DictItemResp, err error) {
  23. resp = &types.DictItemResp{}
  24. item := &types.DictItemInfo{}
  25. db := l.svcCtx.DbEngin.Table("t_dict_item").Where("id = ?", req.Id).First(&item)
  26. if db.Error != nil {
  27. logx.Errorf("err %v", db.Error.Error())
  28. return nil, errors.New("Dictionary item does not exist")
  29. }
  30. tool.Convert(item, &resp)
  31. return
  32. }

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.