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.0 kB

12345678910111213141516171819202122232425262728293031323334353637383940
  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/api/internal/svc"
  9. "gitlink.org.cn/JointCloud/pcm-coordinator/api/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. return nil, errors.New("Dict does not exist")
  29. }
  30. utils.Convert(req, &dict)
  31. tx := l.svcCtx.DbEngin.Table("t_dict").Model(&dict).Updates(&dict)
  32. fmt.Println(tx)
  33. return
  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.