12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package logic
- import (
- "context"
- "bp.jydev.jianyu360.cn/BaseService/biService/rpc/biservice"
- "github.com/gogf/gf/v2/util/gconv"
- "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/svc"
- "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/types"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type SqlManageLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewSqlManageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SqlManageLogic {
- return &SqlManageLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *SqlManageLogic) SqlManage(req *types.SqlManageReq) (resp *types.BiResp, err error) {
- param := []*biservice.Param{}
- for _, v := range req.Params {
- param = append(param, &biservice.Param{
- Value: v.Value,
- Type: v.Type,
- })
- }
- res, err := l.svcCtx.BiServiceRpc.SqlManage(l.ctx, &biservice.SqlManageReq{
- Id: float32(req.Id),
- Params: param,
- })
- data := gconv.Map(gconv.UnsafeBytesToStr(res.Data))
- return &types.BiResp{Error_code: res.ErrorCode, Error_msg: res.ErrorMsg, Data: data}, err
- }
|