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.

editdictlogic.go 1.1 kB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package dictionary
  2. import (
  3. "context"
  4. "fmt"
  5. "github.com/pkg/errors"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
  7. "gorm.io/gorm"
  8. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
  9. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
  10. "github.com/zeromicro/go-zero/core/logx"
  11. )
  12. type EditDictLogic struct {
  13. logx.Logger
  14. ctx context.Context
  15. svcCtx *svc.ServiceContext
  16. }
  17. func NewEditDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EditDictLogic {
  18. return &EditDictLogic{
  19. Logger: logx.WithContext(ctx),
  20. ctx: ctx,
  21. svcCtx: svcCtx,
  22. }
  23. }
  24. func (l *EditDictLogic) EditDict(req *types.DictEditReq) (resp *types.DictResp, err error) {
  25. dict := &types.DictInfo{}
  26. result := l.svcCtx.DbEngin.Table("t_dict").First(&dict, req.Id)
  27. if errors.Is(result.Error, gorm.ErrRecordNotFound) {
  28. logx.Errorf("Dictionary editing failure. errors: %s", result.Error)
  29. return nil, errors.New("Dict does not exist")
  30. }
  31. utils.Convert(req, &dict)
  32. tx := l.svcCtx.DbEngin.Table("t_dict").Model(&dict).Updates(&dict)
  33. fmt.Println(tx)
  34. return
  35. }

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.