sqlmanagelogic.go 1019 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package logic
  2. import (
  3. "bp.jydev.jianyu360.cn/BaseService/biService/rpc/biservice"
  4. "context"
  5. "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/svc"
  6. "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/types"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type SqlManageLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewSqlManageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SqlManageLogic {
  15. return &SqlManageLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *SqlManageLogic) SqlManage(req *types.SqlManageReq) (resp *types.Resp, err error) {
  22. param := []*biservice.Param{}
  23. for _, v := range req.Params {
  24. param = append(param, &biservice.Param{
  25. Value: v.Value,
  26. Type: v.Type,
  27. })
  28. }
  29. res, err := l.svcCtx.BiServiceRpc.SqlManage(l.ctx, &biservice.SqlManageReq{
  30. Id: float32(req.Id),
  31. Params: param,
  32. })
  33. return &types.Resp{Error_code: res.ErrorCode, Error_msg: res.ErrorMsg, Data: res.Data}, err
  34. }