正在显示
36 个修改的文件
包含
2009 行增加
和
2 行删除
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/result" | ||
| 5 | + "net/http" | ||
| 6 | + | ||
| 7 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/logic/page" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 11 | +) | ||
| 12 | + | ||
| 13 | +func CreateAppPageShareUrlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.AppPageCreateShareRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := page.NewCreateAppPageShareUrlLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.CreateAppPageShareUrl(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/result" | ||
| 5 | + "net/http" | ||
| 6 | + | ||
| 7 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/logic/page" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 11 | +) | ||
| 12 | + | ||
| 13 | +func DeleteAppPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.AppPageDeleteRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := page.NewDeleteAppPageLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.DeleteAppPage(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/result" | ||
| 5 | + "net/http" | ||
| 6 | + | ||
| 7 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/logic/page" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 11 | +) | ||
| 12 | + | ||
| 13 | +func GetAppPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.AppPageGetRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := page.NewGetAppPageLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.GetAppPage(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/result" | ||
| 5 | + "net/http" | ||
| 6 | + | ||
| 7 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/logic/page" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 11 | +) | ||
| 12 | + | ||
| 13 | +func GetAppPageShareDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.GetAppPageShareDetailRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := page.NewGetAppPageShareDetailLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.GetAppPageShareDetail(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/result" | ||
| 5 | + "net/http" | ||
| 6 | + | ||
| 7 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/logic/page" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 11 | +) | ||
| 12 | + | ||
| 13 | +func SaveAppPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.AppPageSaveRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := page.NewSaveAppPageLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.SaveAppPage(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/result" | ||
| 5 | + "net/http" | ||
| 6 | + | ||
| 7 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/logic/page" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 11 | +) | ||
| 12 | + | ||
| 13 | +func SaveAsAppPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.AppPageSaveAsRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := page.NewSaveAsAppPageLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.SaveAsAppPage(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/result" | ||
| 5 | + "net/http" | ||
| 6 | + | ||
| 7 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/logic/page" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 11 | +) | ||
| 12 | + | ||
| 13 | +func SearchAppPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.AppPageSearchRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := page.NewSearchAppPageLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.SearchAppPage(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/result" | ||
| 5 | + "net/http" | ||
| 6 | + | ||
| 7 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/logic/page" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 11 | +) | ||
| 12 | + | ||
| 13 | +func UpdateAppPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.AppPageUpdateRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := page.NewUpdateAppPageLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.UpdateAppPage(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| @@ -5,6 +5,7 @@ import ( | @@ -5,6 +5,7 @@ import ( | ||
| 5 | "net/http" | 5 | "net/http" |
| 6 | 6 | ||
| 7 | chart "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/handler/chart" | 7 | chart "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/handler/chart" |
| 8 | + page "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/handler/page" | ||
| 8 | table "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/handler/table" | 9 | table "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/handler/table" |
| 9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | 10 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" |
| 10 | 11 | ||
| @@ -107,4 +108,57 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -107,4 +108,57 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
| 107 | rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret), | 108 | rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret), |
| 108 | rest.WithPrefix("/v1"), | 109 | rest.WithPrefix("/v1"), |
| 109 | ) | 110 | ) |
| 111 | + | ||
| 112 | + server.AddRoutes( | ||
| 113 | + []rest.Route{ | ||
| 114 | + { | ||
| 115 | + Method: http.MethodGet, | ||
| 116 | + Path: "/app-page/:id", | ||
| 117 | + Handler: page.GetAppPageHandler(serverCtx), | ||
| 118 | + }, | ||
| 119 | + { | ||
| 120 | + Method: http.MethodPost, | ||
| 121 | + Path: "/app-page", | ||
| 122 | + Handler: page.SaveAppPageHandler(serverCtx), | ||
| 123 | + }, | ||
| 124 | + { | ||
| 125 | + Method: http.MethodPost, | ||
| 126 | + Path: "/app-page/saveas", | ||
| 127 | + Handler: page.SaveAsAppPageHandler(serverCtx), | ||
| 128 | + }, | ||
| 129 | + { | ||
| 130 | + Method: http.MethodDelete, | ||
| 131 | + Path: "/app-page/:id", | ||
| 132 | + Handler: page.DeleteAppPageHandler(serverCtx), | ||
| 133 | + }, | ||
| 134 | + { | ||
| 135 | + Method: http.MethodPut, | ||
| 136 | + Path: "/app-page/:id", | ||
| 137 | + Handler: page.UpdateAppPageHandler(serverCtx), | ||
| 138 | + }, | ||
| 139 | + { | ||
| 140 | + Method: http.MethodPost, | ||
| 141 | + Path: "/app-page/search", | ||
| 142 | + Handler: page.SearchAppPageHandler(serverCtx), | ||
| 143 | + }, | ||
| 144 | + { | ||
| 145 | + Method: http.MethodPost, | ||
| 146 | + Path: "/app-page/create-share", | ||
| 147 | + Handler: page.CreateAppPageShareUrlHandler(serverCtx), | ||
| 148 | + }, | ||
| 149 | + }, | ||
| 150 | + rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret), | ||
| 151 | + rest.WithPrefix("/v1"), | ||
| 152 | + ) | ||
| 153 | + | ||
| 154 | + server.AddRoutes( | ||
| 155 | + []rest.Route{ | ||
| 156 | + { | ||
| 157 | + Method: http.MethodGet, | ||
| 158 | + Path: "/api/app-page/get-share-detail/:key", | ||
| 159 | + Handler: page.GetAppPageShareDetailHandler(serverCtx), | ||
| 160 | + }, | ||
| 161 | + }, | ||
| 162 | + rest.WithPrefix("/v1"), | ||
| 163 | + ) | ||
| 110 | } | 164 | } |
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/db/transaction" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/domain" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/tool" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/xerr" | ||
| 9 | + | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 12 | + | ||
| 13 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 14 | +) | ||
| 15 | + | ||
| 16 | +type CreateAppPageShareUrlLogic struct { | ||
| 17 | + logx.Logger | ||
| 18 | + ctx context.Context | ||
| 19 | + svcCtx *svc.ServiceContext | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +func NewCreateAppPageShareUrlLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateAppPageShareUrlLogic { | ||
| 23 | + return &CreateAppPageShareUrlLogic{ | ||
| 24 | + Logger: logx.WithContext(ctx), | ||
| 25 | + ctx: ctx, | ||
| 26 | + svcCtx: svcCtx, | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +func (l *CreateAppPageShareUrlLogic) CreateAppPageShareUrl(req *types.AppPageCreateShareRequest) (resp *types.AppPageCreateShareResponse, err error) { | ||
| 31 | + var ( | ||
| 32 | + conn = l.svcCtx.DefaultDBConn() | ||
| 33 | + appPage *domain.AppPage | ||
| 34 | + ) | ||
| 35 | + if appPage, err = l.svcCtx.AppPageRepository.FindOne(l.ctx, conn, req.Id); err != nil { | ||
| 36 | + return nil, xerr.NewErr(err) | ||
| 37 | + } | ||
| 38 | + resp = &types.AppPageCreateShareResponse{} | ||
| 39 | + if appPage.Key != "" { | ||
| 40 | + return | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { | ||
| 44 | + appPage.Key = tool.Krand(18, tool.KC_RAND_KIND_ALL) | ||
| 45 | + if appPage, err = l.svcCtx.AppPageRepository.UpdateWithVersion(l.ctx, conn, appPage); err != nil { | ||
| 46 | + return err | ||
| 47 | + } | ||
| 48 | + return nil | ||
| 49 | + }, true); err != nil { | ||
| 50 | + return nil, xerr.NewErrMsgErr("创建页面分享链接失败", err) | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + resp = &types.AppPageCreateShareResponse{ | ||
| 54 | + Key: appPage.Key, | ||
| 55 | + } | ||
| 56 | + return | ||
| 57 | +} |
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/db/transaction" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/domain" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/xerr" | ||
| 8 | + | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 11 | + | ||
| 12 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 13 | +) | ||
| 14 | + | ||
| 15 | +type DeleteAppPageLogic struct { | ||
| 16 | + logx.Logger | ||
| 17 | + ctx context.Context | ||
| 18 | + svcCtx *svc.ServiceContext | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +func NewDeleteAppPageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteAppPageLogic { | ||
| 22 | + return &DeleteAppPageLogic{ | ||
| 23 | + Logger: logx.WithContext(ctx), | ||
| 24 | + ctx: ctx, | ||
| 25 | + svcCtx: svcCtx, | ||
| 26 | + } | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +func (l *DeleteAppPageLogic) DeleteAppPage(req *types.AppPageDeleteRequest) (resp *types.AppPageDeleteResponse, err error) { | ||
| 30 | + var ( | ||
| 31 | + conn = l.svcCtx.DefaultDBConn() | ||
| 32 | + appPage *domain.AppPage | ||
| 33 | + ) | ||
| 34 | + if appPage, err = l.svcCtx.AppPageRepository.FindOne(l.ctx, conn, req.Id); err != nil { | ||
| 35 | + return nil, xerr.NewErr(err) | ||
| 36 | + } | ||
| 37 | + resp = &types.AppPageDeleteResponse{} | ||
| 38 | + if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { | ||
| 39 | + if appPage, err = l.svcCtx.AppPageRepository.Delete(l.ctx, conn, appPage); err != nil { | ||
| 40 | + return err | ||
| 41 | + } | ||
| 42 | + return nil | ||
| 43 | + }, true); err != nil { | ||
| 44 | + return nil, xerr.NewErrMsgErr("删除页面失败", err) | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + return | ||
| 48 | +} |
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/domain" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/contextdata" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/xerr" | ||
| 8 | + | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 11 | + | ||
| 12 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 13 | +) | ||
| 14 | + | ||
| 15 | +type GetAppPageLogic struct { | ||
| 16 | + logx.Logger | ||
| 17 | + ctx context.Context | ||
| 18 | + svcCtx *svc.ServiceContext | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +func NewGetAppPageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAppPageLogic { | ||
| 22 | + return &GetAppPageLogic{ | ||
| 23 | + Logger: logx.WithContext(ctx), | ||
| 24 | + ctx: ctx, | ||
| 25 | + svcCtx: svcCtx, | ||
| 26 | + } | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +func (l *GetAppPageLogic) GetAppPage(req *types.AppPageGetRequest) (resp *types.AppPageGetResponse, err error) { | ||
| 30 | + var ( | ||
| 31 | + conn = l.svcCtx.DefaultDBConn() | ||
| 32 | + appPage *domain.AppPage | ||
| 33 | + charts []*domain.Chart | ||
| 34 | + tenantId = contextdata.GetTenantFromCtx(l.ctx) | ||
| 35 | + ) | ||
| 36 | + if appPage, err = l.svcCtx.AppPageRepository.FindOne(l.ctx, conn, req.Id); err != nil { | ||
| 37 | + return nil, xerr.NewErr(err) | ||
| 38 | + } | ||
| 39 | + queryOptions := domain.IndexTenantId(tenantId)().WithKV("ids", appPage.Charts) | ||
| 40 | + if _, charts, err = l.svcCtx.ChartRepository.Find(l.ctx, conn, queryOptions); err != nil { | ||
| 41 | + return nil, xerr.NewErr(err) | ||
| 42 | + } | ||
| 43 | + resp = &types.AppPageGetResponse{ | ||
| 44 | + AppPage: types.NewAppPageItem(appPage, charts), | ||
| 45 | + } | ||
| 46 | + return | ||
| 47 | +} |
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/domain" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/contextdata" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/xerr" | ||
| 8 | + | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 11 | + | ||
| 12 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 13 | +) | ||
| 14 | + | ||
| 15 | +type GetAppPageShareDetailLogic struct { | ||
| 16 | + logx.Logger | ||
| 17 | + ctx context.Context | ||
| 18 | + svcCtx *svc.ServiceContext | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +func NewGetAppPageShareDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAppPageShareDetailLogic { | ||
| 22 | + return &GetAppPageShareDetailLogic{ | ||
| 23 | + Logger: logx.WithContext(ctx), | ||
| 24 | + ctx: ctx, | ||
| 25 | + svcCtx: svcCtx, | ||
| 26 | + } | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +func (l *GetAppPageShareDetailLogic) GetAppPageShareDetail(req *types.GetAppPageShareDetailRequest) (resp *types.GetAppPageShareDetailResponse, err error) { | ||
| 30 | + var ( | ||
| 31 | + conn = l.svcCtx.DefaultDBConn() | ||
| 32 | + appPage *domain.AppPage | ||
| 33 | + charts []*domain.Chart | ||
| 34 | + tenantId = contextdata.GetTenantFromCtx(l.ctx) | ||
| 35 | + ) | ||
| 36 | + if appPage, err = l.svcCtx.AppPageRepository.FindOneByKey(l.ctx, conn, req.Key); err != nil { | ||
| 37 | + return nil, xerr.NewErr(err) | ||
| 38 | + } | ||
| 39 | + queryOptions := domain.IndexTenantId(tenantId)().WithKV("ids", appPage.Charts) | ||
| 40 | + if _, charts, err = l.svcCtx.ChartRepository.Find(l.ctx, conn, queryOptions); err != nil { | ||
| 41 | + return nil, xerr.NewErr(err) | ||
| 42 | + } | ||
| 43 | + resp = &types.GetAppPageShareDetailResponse{ | ||
| 44 | + AppPage: types.NewAppPageItem(appPage, charts), | ||
| 45 | + } | ||
| 46 | + return | ||
| 47 | +} |
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/db/transaction" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/domain" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/contextdata" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/xerr" | ||
| 9 | + | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 12 | + | ||
| 13 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 14 | +) | ||
| 15 | + | ||
| 16 | +type SaveAppPageLogic struct { | ||
| 17 | + logx.Logger | ||
| 18 | + ctx context.Context | ||
| 19 | + svcCtx *svc.ServiceContext | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +func NewSaveAppPageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SaveAppPageLogic { | ||
| 23 | + return &SaveAppPageLogic{ | ||
| 24 | + Logger: logx.WithContext(ctx), | ||
| 25 | + ctx: ctx, | ||
| 26 | + svcCtx: svcCtx, | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +func (l *SaveAppPageLogic) SaveAppPage(req *types.AppPageSaveRequest) (resp *types.AppPageSaveResponse, err error) { | ||
| 31 | + var ( | ||
| 32 | + //conn = l.svcCtx.DefaultDBConn() | ||
| 33 | + appPage *domain.AppPage | ||
| 34 | + tenantId = contextdata.GetTenantFromCtx(l.ctx) | ||
| 35 | + ) | ||
| 36 | + appPage = &domain.AppPage{ | ||
| 37 | + Name: req.Name, | ||
| 38 | + Charts: req.Charts, | ||
| 39 | + TenantId: tenantId, | ||
| 40 | + } | ||
| 41 | + if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { | ||
| 42 | + if appPage, err = l.svcCtx.AppPageRepository.Insert(l.ctx, conn, appPage); err != nil { | ||
| 43 | + return err | ||
| 44 | + } | ||
| 45 | + return nil | ||
| 46 | + }, true); err != nil { | ||
| 47 | + return nil, xerr.NewErrMsgErr("创建页面失败", err) | ||
| 48 | + } | ||
| 49 | + resp = &types.AppPageSaveResponse{ | ||
| 50 | + Id: appPage.Id, | ||
| 51 | + } | ||
| 52 | + return | ||
| 53 | +} |
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/db/transaction" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/domain" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/contextdata" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/xerr" | ||
| 9 | + | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 12 | + | ||
| 13 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 14 | +) | ||
| 15 | + | ||
| 16 | +type SaveAsAppPageLogic struct { | ||
| 17 | + logx.Logger | ||
| 18 | + ctx context.Context | ||
| 19 | + svcCtx *svc.ServiceContext | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +func NewSaveAsAppPageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SaveAsAppPageLogic { | ||
| 23 | + return &SaveAsAppPageLogic{ | ||
| 24 | + Logger: logx.WithContext(ctx), | ||
| 25 | + ctx: ctx, | ||
| 26 | + svcCtx: svcCtx, | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +func (l *SaveAsAppPageLogic) SaveAsAppPage(req *types.AppPageSaveAsRequest) (resp *types.AppPageSaveAsResponse, err error) { | ||
| 31 | + var ( | ||
| 32 | + conn = l.svcCtx.DefaultDBConn() | ||
| 33 | + appPage *domain.AppPage | ||
| 34 | + tenantId = contextdata.GetTenantFromCtx(l.ctx) | ||
| 35 | + fromAppPage *domain.AppPage | ||
| 36 | + ) | ||
| 37 | + if fromAppPage, err = l.svcCtx.AppPageRepository.FindOne(l.ctx, conn, req.Id); err != nil { | ||
| 38 | + return nil, xerr.NewErr(err) | ||
| 39 | + } | ||
| 40 | + appPage = &domain.AppPage{ | ||
| 41 | + Name: req.Name, | ||
| 42 | + Charts: fromAppPage.Charts, | ||
| 43 | + TenantId: tenantId, | ||
| 44 | + } | ||
| 45 | + if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { | ||
| 46 | + if appPage, err = l.svcCtx.AppPageRepository.Insert(l.ctx, conn, appPage); err != nil { | ||
| 47 | + return err | ||
| 48 | + } | ||
| 49 | + return nil | ||
| 50 | + }, true); err != nil { | ||
| 51 | + return nil, xerr.NewErrMsgErr("创建页面失败", err) | ||
| 52 | + } | ||
| 53 | + resp = &types.AppPageSaveAsResponse{ | ||
| 54 | + Id: appPage.Id, | ||
| 55 | + } | ||
| 56 | + return | ||
| 57 | +} |
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "github.com/samber/lo" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/domain" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/contextdata" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/xerr" | ||
| 9 | + | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 12 | + | ||
| 13 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 14 | +) | ||
| 15 | + | ||
| 16 | +type SearchAppPageLogic struct { | ||
| 17 | + logx.Logger | ||
| 18 | + ctx context.Context | ||
| 19 | + svcCtx *svc.ServiceContext | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +func NewSearchAppPageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SearchAppPageLogic { | ||
| 23 | + return &SearchAppPageLogic{ | ||
| 24 | + Logger: logx.WithContext(ctx), | ||
| 25 | + ctx: ctx, | ||
| 26 | + svcCtx: svcCtx, | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +func (l *SearchAppPageLogic) SearchAppPage(req *types.AppPageSearchRequest) (resp *types.AppPageSearchResponse, err error) { | ||
| 31 | + var ( | ||
| 32 | + conn = l.svcCtx.DefaultDBConn() | ||
| 33 | + appPages []*domain.AppPage | ||
| 34 | + charts []*domain.Chart | ||
| 35 | + tenantId = contextdata.GetTenantFromCtx(l.ctx) | ||
| 36 | + total int64 | ||
| 37 | + chartIds []int64 | ||
| 38 | + ) | ||
| 39 | + if total, appPages, err = l.svcCtx.AppPageRepository.Find(l.ctx, conn, domain.IndexTenantId(tenantId)().WithOffsetLimit(req.Page, req.Size)); err != nil { | ||
| 40 | + return nil, xerr.NewErr(err) | ||
| 41 | + } | ||
| 42 | + lo.ForEach(appPages, func(item *domain.AppPage, index int) { | ||
| 43 | + chartIds = append(chartIds, item.Charts...) | ||
| 44 | + }) | ||
| 45 | + | ||
| 46 | + queryOptions := domain.IndexTenantId(tenantId)().WithKV("ids", chartIds) | ||
| 47 | + if _, charts, err = l.svcCtx.ChartRepository.Find(l.ctx, conn, queryOptions); err != nil { | ||
| 48 | + return nil, xerr.NewErr(err) | ||
| 49 | + } | ||
| 50 | + resp = &types.AppPageSearchResponse{ | ||
| 51 | + Total: total, | ||
| 52 | + } | ||
| 53 | + for _, page := range appPages { | ||
| 54 | + resp.List = append(resp.List, types.NewAppPageItem(page, charts)) | ||
| 55 | + } | ||
| 56 | + return | ||
| 57 | +} |
| 1 | +package page | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/db/transaction" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/domain" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/xerr" | ||
| 8 | + | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types" | ||
| 11 | + | ||
| 12 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 13 | +) | ||
| 14 | + | ||
| 15 | +type UpdateAppPageLogic struct { | ||
| 16 | + logx.Logger | ||
| 17 | + ctx context.Context | ||
| 18 | + svcCtx *svc.ServiceContext | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +func NewUpdateAppPageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateAppPageLogic { | ||
| 22 | + return &UpdateAppPageLogic{ | ||
| 23 | + Logger: logx.WithContext(ctx), | ||
| 24 | + ctx: ctx, | ||
| 25 | + svcCtx: svcCtx, | ||
| 26 | + } | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +func (l *UpdateAppPageLogic) UpdateAppPage(req *types.AppPageUpdateRequest) (resp *types.AppPageUpdateResponse, err error) { | ||
| 30 | + var ( | ||
| 31 | + conn = l.svcCtx.DefaultDBConn() | ||
| 32 | + appPage *domain.AppPage | ||
| 33 | + ) | ||
| 34 | + if appPage, err = l.svcCtx.AppPageRepository.FindOne(l.ctx, conn, req.Id); err != nil { | ||
| 35 | + return nil, xerr.NewErr(err) | ||
| 36 | + } | ||
| 37 | + resp = &types.AppPageUpdateResponse{} | ||
| 38 | + if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { | ||
| 39 | + appPage.Name = req.Name | ||
| 40 | + appPage.Charts = req.Charts | ||
| 41 | + if appPage, err = l.svcCtx.AppPageRepository.UpdateWithVersion(l.ctx, conn, appPage); err != nil { | ||
| 42 | + return err | ||
| 43 | + } | ||
| 44 | + return nil | ||
| 45 | + }, true); err != nil { | ||
| 46 | + return nil, xerr.NewErrMsgErr("更新页面失败", err) | ||
| 47 | + } | ||
| 48 | + return | ||
| 49 | +} |
| @@ -21,6 +21,7 @@ type ServiceContext struct { | @@ -21,6 +21,7 @@ type ServiceContext struct { | ||
| 21 | RedisCache gzcache.GZCache | 21 | RedisCache gzcache.GZCache |
| 22 | ChartRepository domain.ChartRepository | 22 | ChartRepository domain.ChartRepository |
| 23 | ChartSettingRepository domain.ChartSettingRepository | 23 | ChartSettingRepository domain.ChartSettingRepository |
| 24 | + AppPageRepository domain.AppPageRepository | ||
| 24 | 25 | ||
| 25 | ByteMetadataService bytelib.ByteMetadataService | 26 | ByteMetadataService bytelib.ByteMetadataService |
| 26 | } | 27 | } |
| @@ -38,6 +39,7 @@ func NewServiceContext(c config.Config) *ServiceContext { | @@ -38,6 +39,7 @@ func NewServiceContext(c config.Config) *ServiceContext { | ||
| 38 | Redis: redis, | 39 | Redis: redis, |
| 39 | ChartRepository: repository.NewChartRepository(cache.NewCachedRepository(mlCache)), | 40 | ChartRepository: repository.NewChartRepository(cache.NewCachedRepository(mlCache)), |
| 40 | ChartSettingRepository: repository.NewChartSettingRepository(cache.NewCachedRepository(mlCache)), | 41 | ChartSettingRepository: repository.NewChartSettingRepository(cache.NewCachedRepository(mlCache)), |
| 42 | + AppPageRepository: repository.NewAppPageRepository(cache.NewCachedRepository(mlCache)), | ||
| 41 | 43 | ||
| 42 | ByteMetadataService: bytelib.ByteMetadataService{ | 44 | ByteMetadataService: bytelib.ByteMetadataService{ |
| 43 | Service: gateway.NewService(c.ByteMetadata.Name, c.ByteMetadata.Host, c.ByteMetadata.Timeout), | 45 | Service: gateway.NewService(c.ByteMetadata.Name, c.ByteMetadata.Host, c.ByteMetadata.Timeout), |
| @@ -2,6 +2,7 @@ package types | @@ -2,6 +2,7 @@ package types | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "github.com/jinzhu/copier" | 4 | "github.com/jinzhu/copier" |
| 5 | + "github.com/samber/lo" | ||
| 5 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/domain" | 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/domain" |
| 6 | ) | 7 | ) |
| 7 | 8 | ||
| @@ -32,3 +33,23 @@ func NewPropertyItem(property domain.ChartProperty) ChartProperty { | @@ -32,3 +33,23 @@ func NewPropertyItem(property domain.ChartProperty) ChartProperty { | ||
| 32 | copier.Copy(&chartProperty, property) | 33 | copier.Copy(&chartProperty, property) |
| 33 | return chartProperty | 34 | return chartProperty |
| 34 | } | 35 | } |
| 36 | + | ||
| 37 | +func NewAppPageItem(appPage *domain.AppPage, charts []*domain.Chart) AppPageItem { | ||
| 38 | + chartsMap := lo.SliceToMap(charts, func(item *domain.Chart) (int64, *domain.Chart) { | ||
| 39 | + return item.Id, item | ||
| 40 | + }) | ||
| 41 | + item := AppPageItem{ | ||
| 42 | + Id: appPage.Id, | ||
| 43 | + Name: appPage.Name, | ||
| 44 | + } | ||
| 45 | + for _, id := range appPage.Charts { | ||
| 46 | + if v, ok := chartsMap[id]; ok { | ||
| 47 | + item.Charts = append(item.Charts, AppPageChartItem{ | ||
| 48 | + ChartId: v.Id, | ||
| 49 | + Name: v.Name, | ||
| 50 | + Cover: v.Cover, | ||
| 51 | + }) | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + return item | ||
| 55 | +} |
| @@ -110,6 +110,20 @@ type ChartProperty struct { | @@ -110,6 +110,20 @@ type ChartProperty struct { | ||
| 110 | TableAbility TableAbility `json:"table,optional"` // 表筛选功能 | 110 | TableAbility TableAbility `json:"table,optional"` // 表筛选功能 |
| 111 | Series []Series `json:"series,optional"` // 系列(数据源) | 111 | Series []Series `json:"series,optional"` // 系列(数据源) |
| 112 | Cover string `json:"cover,optional"` // 封面 | 112 | Cover string `json:"cover,optional"` // 封面 |
| 113 | + Other Other `json:"other,optional"` // 其他额外配置 | ||
| 114 | +} | ||
| 115 | + | ||
| 116 | +type Other struct { | ||
| 117 | + Quarter *Quarter `json:"quarter,optional,omitempty"` // 四分图 | ||
| 118 | +} | ||
| 119 | + | ||
| 120 | +type Quarter struct { | ||
| 121 | + XAxisLabel string `json:"xAxisLabel"` // x轴标签名 | ||
| 122 | + XAxisLabelList []string `json:"xAxisLabelList"` // 标签名 | ||
| 123 | + YAxisLabel string `json:"yAxisLabel"` // x轴标签名 | ||
| 124 | + YAxisLabelList []string `json:"yAxisLabelList"` // 标签名 | ||
| 125 | + Area string `json:"area"` // 图形面积 | ||
| 126 | + SeriesList string `json:"seriesList"` // 图形系列 | ||
| 113 | } | 127 | } |
| 114 | 128 | ||
| 115 | type Title struct { | 129 | type Title struct { |
| @@ -121,6 +135,7 @@ type Title struct { | @@ -121,6 +135,7 @@ type Title struct { | ||
| 121 | ExplainType string `json:"explainType,optional,options=[text,file]"` // text file | 135 | ExplainType string `json:"explainType,optional,options=[text,file]"` // text file |
| 122 | ExplainTxt string `json:"explainTxt,optional"` // 文字说明 | 136 | ExplainTxt string `json:"explainTxt,optional"` // 文字说明 |
| 123 | FileUrl string `json:"fileUrl,optional"` // 组件图片/视频 | 137 | FileUrl string `json:"fileUrl,optional"` // 组件图片/视频 |
| 138 | + Align string `json:"align,optional"` // 文本对齐方式 left center right | ||
| 124 | } | 139 | } |
| 125 | 140 | ||
| 126 | type TableAbility struct { | 141 | type TableAbility struct { |
| @@ -134,6 +149,9 @@ type Series struct { | @@ -134,6 +149,9 @@ type Series struct { | ||
| 134 | DataSourceId int64 `json:"dataSourceId,optional,omitempty"` // 数据源ID(from值为ByteBank时有值) | 149 | DataSourceId int64 `json:"dataSourceId,optional,omitempty"` // 数据源ID(from值为ByteBank时有值) |
| 135 | CustomText string `json:"customText,optional,omitempty"` // 自定义数据文本(from值为User时有值) | 150 | CustomText string `json:"customText,optional,omitempty"` // 自定义数据文本(from值为User时有值) |
| 136 | MatchExpressions []Expression `json:"matchExpressions,optional,omitempty"` // 条件匹配表达式(总体指标) | 151 | MatchExpressions []Expression `json:"matchExpressions,optional,omitempty"` // 条件匹配表达式(总体指标) |
| 152 | + TargetText string `json:"targetText,optional,omitempty"` // 指标名文本 | ||
| 153 | + TargetNum string `json:"targetNum,optional,omitempty"` // 指标数值 | ||
| 154 | + TargetUnit string `json:"targetUnit,optional,omitempty"` // 指标单位 | ||
| 137 | } | 155 | } |
| 138 | 156 | ||
| 139 | type Expression struct { | 157 | type Expression struct { |
| @@ -193,3 +211,85 @@ type SearchTableDataRequest struct { | @@ -193,3 +211,85 @@ type SearchTableDataRequest struct { | ||
| 193 | 211 | ||
| 194 | type SearchTableDataResponse struct { | 212 | type SearchTableDataResponse struct { |
| 195 | } | 213 | } |
| 214 | + | ||
| 215 | +type AppPageGetRequest struct { | ||
| 216 | + Id int64 `path:"id"` | ||
| 217 | +} | ||
| 218 | + | ||
| 219 | +type AppPageGetResponse struct { | ||
| 220 | + AppPage AppPageItem `json:"page"` | ||
| 221 | +} | ||
| 222 | + | ||
| 223 | +type AppPageSaveRequest struct { | ||
| 224 | + Name string `json:"name"` // 名称 | ||
| 225 | + Charts []int64 `json:"charts"` // 图表 | ||
| 226 | +} | ||
| 227 | + | ||
| 228 | +type AppPageSaveResponse struct { | ||
| 229 | + Id int64 `json:"id"` | ||
| 230 | +} | ||
| 231 | + | ||
| 232 | +type AppPageSaveAsRequest struct { | ||
| 233 | + Id int64 `json:"id"` // 页面ID | ||
| 234 | + Name string `json:"name"` // 名称 | ||
| 235 | +} | ||
| 236 | + | ||
| 237 | +type AppPageSaveAsResponse struct { | ||
| 238 | + Id int64 `path:"id"` | ||
| 239 | + Name string `json:"name"` // 名称 | ||
| 240 | + Charts []int64 `json:"charts"` // 图表 | ||
| 241 | +} | ||
| 242 | + | ||
| 243 | +type AppPageCreateShareRequest struct { | ||
| 244 | + Id int64 `json:"id"` // 页面ID | ||
| 245 | +} | ||
| 246 | + | ||
| 247 | +type AppPageCreateShareResponse struct { | ||
| 248 | + Key string `json:"key,optional"` // 分享,预览时绑定映射到Id | ||
| 249 | +} | ||
| 250 | + | ||
| 251 | +type AppPageDeleteRequest struct { | ||
| 252 | + Id int64 `path:"id"` // 页面ID | ||
| 253 | +} | ||
| 254 | + | ||
| 255 | +type AppPageDeleteResponse struct { | ||
| 256 | +} | ||
| 257 | + | ||
| 258 | +type AppPageUpdateRequest struct { | ||
| 259 | + Id int64 `path:"id"` | ||
| 260 | + Name string `json:"name"` // 名称 | ||
| 261 | + Charts []int64 `json:"charts"` // 图表 | ||
| 262 | +} | ||
| 263 | + | ||
| 264 | +type AppPageUpdateResponse struct { | ||
| 265 | +} | ||
| 266 | + | ||
| 267 | +type AppPageSearchRequest struct { | ||
| 268 | + Page int `json:"page"` | ||
| 269 | + Size int `json:"size"` | ||
| 270 | +} | ||
| 271 | + | ||
| 272 | +type AppPageSearchResponse struct { | ||
| 273 | + List []AppPageItem `json:"list"` | ||
| 274 | + Total int64 `json:"total"` | ||
| 275 | +} | ||
| 276 | + | ||
| 277 | +type AppPageItem struct { | ||
| 278 | + Id int64 `json:"id,optional"` // 唯一标识 | ||
| 279 | + Name string `json:"name,optional"` // 名称 | ||
| 280 | + Charts []AppPageChartItem `json:"charts,optional"` // 图表 | ||
| 281 | +} | ||
| 282 | + | ||
| 283 | +type AppPageChartItem struct { | ||
| 284 | + ChartId int64 `json:"chartId"` // 图表ID | ||
| 285 | + Name string `json:"name"` // 图表名称 | ||
| 286 | + Cover string `json:"cover"` // 图表封面 | ||
| 287 | +} | ||
| 288 | + | ||
| 289 | +type GetAppPageShareDetailRequest struct { | ||
| 290 | + Key string `path:"key"` | ||
| 291 | +} | ||
| 292 | + | ||
| 293 | +type GetAppPageShareDetailResponse struct { | ||
| 294 | + AppPage AppPageItem `json:"page"` | ||
| 295 | +} |
cmd/chart-server/doc/dsl/api/app_page.api
0 → 100644
| 1 | + | ||
| 2 | +syntax = "v1" | ||
| 3 | + | ||
| 4 | +info( | ||
| 5 | + title: "xx实例" | ||
| 6 | + desc: "xx实例" | ||
| 7 | + author: "author" | ||
| 8 | + email: "email" | ||
| 9 | + version: "v1" | ||
| 10 | +) | ||
| 11 | + | ||
| 12 | +@server( | ||
| 13 | + prefix: app_page/v1 | ||
| 14 | + group: app_page | ||
| 15 | + jwt: JwtAuth | ||
| 16 | +) | ||
| 17 | +service Core { | ||
| 18 | + @handler getAppPage | ||
| 19 | + post /app_page/:id (AppPageGetRequest) returns (AppPageGetResponse) | ||
| 20 | + @handler saveAppPage | ||
| 21 | + post /app_page (AppPageSaveRequest) returns (AppPageSaveResponse) | ||
| 22 | + @handler deleteAppPage | ||
| 23 | + delete /app_page/:id (AppPageDeleteRequest) returns (AppPageDeleteResponse) | ||
| 24 | + @handler updateAppPage | ||
| 25 | + put /app_page/:id (AppPageUpdateRequest) returns (AppPageUpdateResponse) | ||
| 26 | + @handler searchAppPage | ||
| 27 | + post /app_page/search (AppPageSearchRequest) returns (AppPageSearchResponse) | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +type ( | ||
| 31 | + AppPageGetRequest { | ||
| 32 | + Id int64 `path:"id"` | ||
| 33 | + } | ||
| 34 | + AppPageGetResponse struct{ | ||
| 35 | + AppPage AppPageItem `json:"app_page"` | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + AppPageSaveRequest struct{ | ||
| 39 | + AppPage AppPageItem `json:"app_page"` | ||
| 40 | + } | ||
| 41 | + AppPageSaveResponse struct{} | ||
| 42 | + | ||
| 43 | + AppPageDeleteRequest struct{ | ||
| 44 | + Id int64 `path:"id"` | ||
| 45 | + } | ||
| 46 | + AppPageDeleteResponse struct{} | ||
| 47 | + | ||
| 48 | + AppPageUpdateRequest struct{ | ||
| 49 | + Id int64 `path:"id"` | ||
| 50 | + AppPage AppPageItem `json:"app_page"` | ||
| 51 | + } | ||
| 52 | + AppPageUpdateResponse struct{} | ||
| 53 | + | ||
| 54 | + AppPageSearchRequest struct{ | ||
| 55 | + Page int `json:"page"` | ||
| 56 | + Size int `json:"size"` | ||
| 57 | + } | ||
| 58 | + AppPageSearchResponse{ | ||
| 59 | + List []AppPageItem `json:"list"` | ||
| 60 | + Total int64 `json:"total"` | ||
| 61 | + } | ||
| 62 | + AppPageItem struct{ | ||
| 63 | + | ||
| 64 | + } | ||
| 65 | +) |
cmd/chart-server/doc/dsl/rpc/app_page.proto
0 → 100644
| 1 | + | ||
| 2 | +syntax = "proto3"; | ||
| 3 | + | ||
| 4 | +option go_package ="./pb"; | ||
| 5 | + | ||
| 6 | +package pb; | ||
| 7 | + | ||
| 8 | +message AppPageGetReq { | ||
| 9 | + int64 Id = 1; | ||
| 10 | +} | ||
| 11 | +message AppPageGetResp{ | ||
| 12 | + AppPageItem User = 1; | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | +message AppPageSaveReq { | ||
| 16 | + | ||
| 17 | +} | ||
| 18 | +message AppPageSaveResp{ | ||
| 19 | + | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +message AppPageDeleteReq { | ||
| 23 | + int64 Id = 1; | ||
| 24 | +} | ||
| 25 | +message AppPageDeleteResp{ | ||
| 26 | + | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +message AppPageUpdateReq { | ||
| 30 | + int64 Id = 1; | ||
| 31 | +} | ||
| 32 | +message AppPageUpdateResp{ | ||
| 33 | + | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | +message AppPageSearchReq { | ||
| 37 | + int64 PageNumber = 1; | ||
| 38 | + int64 PageSize = 2; | ||
| 39 | +} | ||
| 40 | +message AppPageSearchResp{ | ||
| 41 | + repeated AppPageItem List =1; | ||
| 42 | + int64 Total =2; | ||
| 43 | +} | ||
| 44 | +message AppPageItem { | ||
| 45 | + | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +service AppPageService { | ||
| 49 | + rpc AppPageGet(AppPageGetReq) returns(AppPageGetResp); | ||
| 50 | + rpc AppPageSave(AppPageSaveReq) returns(AppPageSaveResp); | ||
| 51 | + rpc AppPageDelete(AppPageDeleteReq) returns(AppPageDeleteResp); | ||
| 52 | + rpc AppPageUpdate(AppPageUpdateReq) returns(AppPageUpdateResp); | ||
| 53 | + rpc AppPageSearch(AppPageSearchReq) returns(AppPageSearchResp); | ||
| 54 | +} |
| 1 | +package models | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/domain" | ||
| 6 | + "gorm.io/gorm" | ||
| 7 | + "gorm.io/plugin/soft_delete" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type AppPage struct { | ||
| 11 | + Id int64 // 唯一标识 | ||
| 12 | + Name string // 名称 | ||
| 13 | + Charts []int64 `gorm:"serializer:json"` // 图表 | ||
| 14 | + Key string // 分享,预览时绑定映射到Id | ||
| 15 | + | ||
| 16 | + TenantId int64 // 租户ID | ||
| 17 | + CreatedAt int64 `json:",omitempty"` | ||
| 18 | + UpdatedAt int64 `json:",omitempty"` | ||
| 19 | + DeletedAt int64 `json:",omitempty"` | ||
| 20 | + Version int `json:",omitempty"` | ||
| 21 | + IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"` | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +func (m *AppPage) TableName() string { | ||
| 25 | + return "app_page" | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +func (m *AppPage) BeforeCreate(tx *gorm.DB) (err error) { | ||
| 29 | + // m.CreatedAt = time.Now().Unix() | ||
| 30 | + // m.UpdatedAt = time.Now().Unix() | ||
| 31 | + return | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +func (m *AppPage) BeforeUpdate(tx *gorm.DB) (err error) { | ||
| 35 | + // m.UpdatedAt = time.Now().Unix() | ||
| 36 | + return | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +func (m *AppPage) CacheKeyFunc() string { | ||
| 40 | + if m.Id == 0 { | ||
| 41 | + return "" | ||
| 42 | + } | ||
| 43 | + return fmt.Sprintf("%v:cache:%v:id:%v", domain.ProjectName, m.TableName(), m.Id) | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +func (m *AppPage) CacheKeyFuncByObject(obj interface{}) string { | ||
| 47 | + if v, ok := obj.(*AppPage); ok { | ||
| 48 | + return v.CacheKeyFunc() | ||
| 49 | + } | ||
| 50 | + return "" | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +func (m *AppPage) CachePrimaryKeyFunc() string { | ||
| 54 | + if len(m.Key) == 0 { | ||
| 55 | + return "" | ||
| 56 | + } | ||
| 57 | + return fmt.Sprintf("%v:cache:%v:primarykey:%v", domain.ProjectName, m.TableName(), m.Key) | ||
| 58 | +} |
| @@ -15,6 +15,7 @@ type Chart struct { | @@ -15,6 +15,7 @@ type Chart struct { | ||
| 15 | Sort int `gorm:"index:idx_chart_t_pid_sort"` // 排序 | 15 | Sort int `gorm:"index:idx_chart_t_pid_sort"` // 排序 |
| 16 | Name string // 名称 | 16 | Name string // 名称 |
| 17 | Group string `gorm:"index:idx_chart_group"` // 分组 | 17 | Group string `gorm:"index:idx_chart_group"` // 分组 |
| 18 | + Cover string // 封面 | ||
| 18 | ChartType string | 19 | ChartType string |
| 19 | 20 | ||
| 20 | TenantId int64 `gorm:"index:idx_chart_t_pid_sort"` // 租户ID | 21 | TenantId int64 `gorm:"index:idx_chart_t_pid_sort"` // 租户ID |
| @@ -17,6 +17,7 @@ type ChartSetting struct { | @@ -17,6 +17,7 @@ type ChartSetting struct { | ||
| 17 | Title domain.Title `gorm:"serializer:json"` | 17 | Title domain.Title `gorm:"serializer:json"` |
| 18 | TableAbility domain.TableAbility `gorm:"serializer:json"` // 表格能力 | 18 | TableAbility domain.TableAbility `gorm:"serializer:json"` // 表格能力 |
| 19 | Series []domain.Series `gorm:"serializer:json"` // 系列值-数据绑定 | 19 | Series []domain.Series `gorm:"serializer:json"` // 系列值-数据绑定 |
| 20 | + Other domain.Other `gorm:"serializer:json"` | ||
| 20 | 21 | ||
| 21 | TenantId int64 `gorm:"index:idx_chart_setting_t_id"` // 租户ID | 22 | TenantId int64 `gorm:"index:idx_chart_setting_t_id"` // 租户ID |
| 22 | CreatedAt int64 `json:",omitempty"` | 23 | CreatedAt int64 `json:",omitempty"` |
| 1 | +package repository | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "github.com/jinzhu/copier" | ||
| 6 | + "github.com/pkg/errors" | ||
| 7 | + "github.com/tiptok/gocomm/pkg/cache" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/db/models" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/db/transaction" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/domain" | ||
| 11 | + "gorm.io/gorm" | ||
| 12 | +) | ||
| 13 | + | ||
| 14 | +type AppPageRepository struct { | ||
| 15 | + *cache.CachedRepository | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +func (repository *AppPageRepository) Insert(ctx context.Context, conn transaction.Conn, dm *domain.AppPage) (*domain.AppPage, error) { | ||
| 19 | + var ( | ||
| 20 | + err error | ||
| 21 | + m = &models.AppPage{} | ||
| 22 | + tx = conn.DB() | ||
| 23 | + ) | ||
| 24 | + if m, err = repository.DomainModelToModel(dm); err != nil { | ||
| 25 | + return nil, err | ||
| 26 | + } | ||
| 27 | + if tx = tx.Model(m).Save(m); tx.Error != nil { | ||
| 28 | + return nil, tx.Error | ||
| 29 | + } | ||
| 30 | + dm.Id = m.Id | ||
| 31 | + return repository.ModelToDomainModel(m) | ||
| 32 | + | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +func (repository *AppPageRepository) Update(ctx context.Context, conn transaction.Conn, dm *domain.AppPage) (*domain.AppPage, error) { | ||
| 36 | + var ( | ||
| 37 | + err error | ||
| 38 | + m *models.AppPage | ||
| 39 | + tx = conn.DB() | ||
| 40 | + ) | ||
| 41 | + if m, err = repository.DomainModelToModel(dm); err != nil { | ||
| 42 | + return nil, err | ||
| 43 | + } | ||
| 44 | + queryFunc := func() (interface{}, error) { | ||
| 45 | + tx = tx.Model(m).Updates(m) | ||
| 46 | + return nil, tx.Error | ||
| 47 | + } | ||
| 48 | + if _, err = repository.Query(queryFunc, m.CacheKeyFunc()); err != nil { | ||
| 49 | + return nil, err | ||
| 50 | + } | ||
| 51 | + return repository.ModelToDomainModel(m) | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +func (repository *AppPageRepository) UpdateWithVersion(ctx context.Context, transaction transaction.Conn, dm *domain.AppPage) (*domain.AppPage, error) { | ||
| 55 | + var ( | ||
| 56 | + err error | ||
| 57 | + m *models.AppPage | ||
| 58 | + tx = transaction.DB() | ||
| 59 | + ) | ||
| 60 | + if m, err = repository.DomainModelToModel(dm); err != nil { | ||
| 61 | + return nil, err | ||
| 62 | + } | ||
| 63 | + oldVersion := dm.Version | ||
| 64 | + m.Version += 1 | ||
| 65 | + queryFunc := func() (interface{}, error) { | ||
| 66 | + tx = tx.Model(m).Select("*").Where("id = ?", m.Id).Where("version = ?", oldVersion).Updates(m) | ||
| 67 | + if tx.RowsAffected == 0 { | ||
| 68 | + return nil, domain.ErrUpdateFail | ||
| 69 | + } | ||
| 70 | + return nil, tx.Error | ||
| 71 | + } | ||
| 72 | + if _, err = repository.Query(queryFunc, m.CacheKeyFunc()); err != nil { | ||
| 73 | + return nil, err | ||
| 74 | + } | ||
| 75 | + return repository.ModelToDomainModel(m) | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +func (repository *AppPageRepository) Delete(ctx context.Context, conn transaction.Conn, dm *domain.AppPage) (*domain.AppPage, error) { | ||
| 79 | + var ( | ||
| 80 | + tx = conn.DB() | ||
| 81 | + m = &models.AppPage{Id: dm.Identify().(int64)} | ||
| 82 | + ) | ||
| 83 | + queryFunc := func() (interface{}, error) { | ||
| 84 | + tx = tx.Where("id = ?", m.Id).Delete(m) | ||
| 85 | + return m, tx.Error | ||
| 86 | + } | ||
| 87 | + if _, err := repository.Query(queryFunc, m.CacheKeyFunc()); err != nil { | ||
| 88 | + return dm, err | ||
| 89 | + } | ||
| 90 | + return repository.ModelToDomainModel(m) | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | +func (repository *AppPageRepository) FindOne(ctx context.Context, conn transaction.Conn, id int64) (*domain.AppPage, error) { | ||
| 94 | + var ( | ||
| 95 | + err error | ||
| 96 | + tx = conn.DB() | ||
| 97 | + m = new(models.AppPage) | ||
| 98 | + ) | ||
| 99 | + queryFunc := func() (interface{}, error) { | ||
| 100 | + tx = tx.Model(m).Where("id = ?", id).First(m) | ||
| 101 | + if errors.Is(tx.Error, gorm.ErrRecordNotFound) { | ||
| 102 | + return nil, domain.ErrNotFound | ||
| 103 | + } | ||
| 104 | + return m, tx.Error | ||
| 105 | + } | ||
| 106 | + cacheModel := new(models.AppPage) | ||
| 107 | + cacheModel.Id = id | ||
| 108 | + if err = repository.QueryCache(cacheModel.CacheKeyFunc, m, queryFunc); err != nil { | ||
| 109 | + return nil, err | ||
| 110 | + } | ||
| 111 | + return repository.ModelToDomainModel(m) | ||
| 112 | +} | ||
| 113 | + | ||
| 114 | +func (repository *AppPageRepository) FindOneByKey(ctx context.Context, conn transaction.Conn, key string) (*domain.AppPage, error) { | ||
| 115 | + var ( | ||
| 116 | + err error | ||
| 117 | + tx = conn.DB() | ||
| 118 | + m = new(models.AppPage) | ||
| 119 | + ) | ||
| 120 | + queryFunc := func() (interface{}, error) { | ||
| 121 | + tx = tx.Model(m).Where("key = ?", key).First(m) | ||
| 122 | + if errors.Is(tx.Error, gorm.ErrRecordNotFound) { | ||
| 123 | + return nil, domain.ErrNotFound | ||
| 124 | + } | ||
| 125 | + return m, tx.Error | ||
| 126 | + } | ||
| 127 | + cacheModel := new(models.AppPage) | ||
| 128 | + cacheModel.Key = key | ||
| 129 | + if err = repository.QueryUniqueIndexCache(cacheModel.CachePrimaryKeyFunc, m, m.CacheKeyFuncByObject, queryFunc); err != nil { | ||
| 130 | + return nil, err | ||
| 131 | + } | ||
| 132 | + return repository.ModelToDomainModel(m) | ||
| 133 | +} | ||
| 134 | + | ||
| 135 | +func (repository *AppPageRepository) Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*domain.AppPage, error) { | ||
| 136 | + var ( | ||
| 137 | + tx = conn.DB() | ||
| 138 | + ms []*models.AppPage | ||
| 139 | + dms = make([]*domain.AppPage, 0) | ||
| 140 | + total int64 | ||
| 141 | + ) | ||
| 142 | + queryFunc := func() (interface{}, error) { | ||
| 143 | + tx = tx.Model(&ms).Order("id desc") | ||
| 144 | + if v, ok := queryOptions["ids"]; ok { | ||
| 145 | + tx.Where("id in (?)", v) | ||
| 146 | + } | ||
| 147 | + if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { | ||
| 148 | + return dms, tx.Error | ||
| 149 | + } | ||
| 150 | + return dms, nil | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + if _, err := repository.Query(queryFunc); err != nil { | ||
| 154 | + return 0, nil, err | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + for _, item := range ms { | ||
| 158 | + if dm, err := repository.ModelToDomainModel(item); err != nil { | ||
| 159 | + return 0, dms, err | ||
| 160 | + } else { | ||
| 161 | + dms = append(dms, dm) | ||
| 162 | + } | ||
| 163 | + } | ||
| 164 | + return total, dms, nil | ||
| 165 | +} | ||
| 166 | + | ||
| 167 | +func (repository *AppPageRepository) ModelToDomainModel(from *models.AppPage) (*domain.AppPage, error) { | ||
| 168 | + to := &domain.AppPage{} | ||
| 169 | + err := copier.Copy(to, from) | ||
| 170 | + return to, err | ||
| 171 | +} | ||
| 172 | + | ||
| 173 | +func (repository *AppPageRepository) DomainModelToModel(from *domain.AppPage) (*models.AppPage, error) { | ||
| 174 | + to := &models.AppPage{} | ||
| 175 | + err := copier.Copy(to, from) | ||
| 176 | + return to, err | ||
| 177 | +} | ||
| 178 | + | ||
| 179 | +func NewAppPageRepository(cache *cache.CachedRepository) domain.AppPageRepository { | ||
| 180 | + return &AppPageRepository{CachedRepository: cache} | ||
| 181 | +} |
| @@ -120,6 +120,9 @@ func (repository *ChartRepository) Find(ctx context.Context, conn transaction.Co | @@ -120,6 +120,9 @@ func (repository *ChartRepository) Find(ctx context.Context, conn transaction.Co | ||
| 120 | ) | 120 | ) |
| 121 | queryFunc := func() (interface{}, error) { | 121 | queryFunc := func() (interface{}, error) { |
| 122 | tx = tx.Model(&ms).Order("id desc") //.Order("pid asc").Order("sort asc") | 122 | tx = tx.Model(&ms).Order("id desc") //.Order("pid asc").Order("sort asc") |
| 123 | + if v, ok := queryOptions["ids"]; ok { | ||
| 124 | + tx.Where("id in (?)", v) | ||
| 125 | + } | ||
| 123 | if v, ok := queryOptions["tenantId"]; ok { | 126 | if v, ok := queryOptions["tenantId"]; ok { |
| 124 | tx.Where("tenant_id = ?", v) | 127 | tx.Where("tenant_id = ?", v) |
| 125 | } | 128 | } |
| 1 | +package domain | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/db/transaction" | ||
| 6 | +) | ||
| 7 | + | ||
| 8 | +type AppPage struct { | ||
| 9 | + Id int64 // 唯一标识 | ||
| 10 | + Name string // 名称 | ||
| 11 | + Charts []int64 // 图表 | ||
| 12 | + Key string // 分享,预览时绑定映射到Id | ||
| 13 | + TenantId int64 // 租户ID | ||
| 14 | + CreatedAt int64 `json:",omitempty"` | ||
| 15 | + UpdatedAt int64 `json:",omitempty"` | ||
| 16 | + DeletedAt int64 `json:",omitempty"` | ||
| 17 | + Version int `json:",omitempty"` | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +type AppPageRepository interface { | ||
| 21 | + Insert(ctx context.Context, conn transaction.Conn, dm *AppPage) (*AppPage, error) | ||
| 22 | + Update(ctx context.Context, conn transaction.Conn, dm *AppPage) (*AppPage, error) | ||
| 23 | + UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *AppPage) (*AppPage, error) | ||
| 24 | + Delete(ctx context.Context, conn transaction.Conn, dm *AppPage) (*AppPage, error) | ||
| 25 | + FindOne(ctx context.Context, conn transaction.Conn, id int64) (*AppPage, error) | ||
| 26 | + FindOneByKey(ctx context.Context, conn transaction.Conn, key string) (*AppPage, error) | ||
| 27 | + Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*AppPage, error) | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +func (m *AppPage) Identify() interface{} { | ||
| 31 | + if m.Id == 0 { | ||
| 32 | + return nil | ||
| 33 | + } | ||
| 34 | + return m.Id | ||
| 35 | +} |
| @@ -19,10 +19,21 @@ type ChartProperty struct { | @@ -19,10 +19,21 @@ type ChartProperty struct { | ||
| 19 | TableAbility TableAbility `json:"table,optional"` // 表筛选功能 | 19 | TableAbility TableAbility `json:"table,optional"` // 表筛选功能 |
| 20 | Series []Series `json:"series,optional"` // 系列(数据源) | 20 | Series []Series `json:"series,optional"` // 系列(数据源) |
| 21 | Cover string `json:"cover,optional"` // 封面 | 21 | Cover string `json:"cover,optional"` // 封面 |
| 22 | - | 22 | + Other Other `json:"other,optional"` // 其他额外配置 |
| 23 | //XAxis interface{} `json:"xAxis"` // X轴 | 23 | //XAxis interface{} `json:"xAxis"` // X轴 |
| 24 | //YAxis interface{} `json:"yAxis"` // Y轴 | 24 | //YAxis interface{} `json:"yAxis"` // Y轴 |
| 25 | } | 25 | } |
| 26 | +type Other struct { | ||
| 27 | + Quarter *Quarter `json:"quarter,optional,omitempty"` // 四分图 | ||
| 28 | +} | ||
| 29 | +type Quarter struct { | ||
| 30 | + XAxisLabel string `json:"xAxisLabel"` // x轴标签名 | ||
| 31 | + XAxisLabelList []string `json:"xAxisLabelList"` // 标签名 | ||
| 32 | + YAxisLabel string `json:"yAxisLabel"` // x轴标签名 | ||
| 33 | + YAxisLabelList []string `json:"yAxisLabelList"` // 标签名 | ||
| 34 | + Area string `json:"area"` // 图形面积 | ||
| 35 | + SeriesList string `json:"seriesList"` // 图形系列 | ||
| 36 | +} | ||
| 26 | type Title struct { | 37 | type Title struct { |
| 27 | TitleSwitch bool `json:"titleSwitch,optional"` // 组件标题开关 | 38 | TitleSwitch bool `json:"titleSwitch,optional"` // 组件标题开关 |
| 28 | IntroduceSwitch bool `json:"introduceSwitch,optional"` // 组件说明开关 | 39 | IntroduceSwitch bool `json:"introduceSwitch,optional"` // 组件说明开关 |
| @@ -32,6 +43,7 @@ type Title struct { | @@ -32,6 +43,7 @@ type Title struct { | ||
| 32 | ExplainType string `json:"explainType,optional,options=[text,file]"` // text file | 43 | ExplainType string `json:"explainType,optional,options=[text,file]"` // text file |
| 33 | ExplainTxt string `json:"explainTxt,optional"` // 文字说明 | 44 | ExplainTxt string `json:"explainTxt,optional"` // 文字说明 |
| 34 | FileUrl string `json:"fileUrl,optional"` // 组件图片/视频 | 45 | FileUrl string `json:"fileUrl,optional"` // 组件图片/视频 |
| 46 | + Align string `json:"align,optional"` // 文本对齐方式 left center right | ||
| 35 | } | 47 | } |
| 36 | 48 | ||
| 37 | type TableAbility struct { | 49 | type TableAbility struct { |
| @@ -46,6 +58,9 @@ type Series struct { | @@ -46,6 +58,9 @@ type Series struct { | ||
| 46 | DataSourceId int64 `json:"dataSourceId,optional,omitempty"` // 数据源ID(from值为ByteBank时有值) | 58 | DataSourceId int64 `json:"dataSourceId,optional,omitempty"` // 数据源ID(from值为ByteBank时有值) |
| 47 | CustomText string `json:"customText,optional,omitempty"` // 自定义数据文本(from值为User时有值) | 59 | CustomText string `json:"customText,optional,omitempty"` // 自定义数据文本(from值为User时有值) |
| 48 | MatchExpressions []Expression `json:"matchExpressions,omitempty"` // 条件匹配表达式(总体指标) | 60 | MatchExpressions []Expression `json:"matchExpressions,omitempty"` // 条件匹配表达式(总体指标) |
| 61 | + TargetText string `json:"targetText,optional,omitempty"` // 指标名文本 | ||
| 62 | + TargetNum string `json:"targetNum,optional,omitempty"` // 指标数值 | ||
| 63 | + TargetUnit string `json:"targetUnit,optional,omitempty"` // 指标单位 | ||
| 49 | } | 64 | } |
| 50 | 65 | ||
| 51 | type Expression struct { | 66 | type Expression struct { |
| @@ -14,6 +14,7 @@ type ChartSetting struct { | @@ -14,6 +14,7 @@ type ChartSetting struct { | ||
| 14 | Title Title | 14 | Title Title |
| 15 | TableAbility TableAbility // 表格能力 | 15 | TableAbility TableAbility // 表格能力 |
| 16 | Series []Series // 系列值-数据绑定 | 16 | Series []Series // 系列值-数据绑定 |
| 17 | + Other Other | ||
| 17 | 18 | ||
| 18 | TenantId int64 // 租户ID | 19 | TenantId int64 // 租户ID |
| 19 | CreatedAt int64 `json:",omitempty"` | 20 | CreatedAt int64 `json:",omitempty"` |
| @@ -44,5 +45,6 @@ func (m *ChartSetting) ChartProperty(cover string) ChartProperty { | @@ -44,5 +45,6 @@ func (m *ChartSetting) ChartProperty(cover string) ChartProperty { | ||
| 44 | TableAbility: m.TableAbility, | 45 | TableAbility: m.TableAbility, |
| 45 | Series: m.Series, | 46 | Series: m.Series, |
| 46 | Cover: cover, | 47 | Cover: cover, |
| 48 | + Other: m.Other, | ||
| 47 | } | 49 | } |
| 48 | } | 50 | } |
| @@ -15,6 +15,234 @@ | @@ -15,6 +15,234 @@ | ||
| 15 | "application/json" | 15 | "application/json" |
| 16 | ], | 16 | ], |
| 17 | "paths": { | 17 | "paths": { |
| 18 | + "v1/api/app-page/get-share-detail/{key}": { | ||
| 19 | + "get": { | ||
| 20 | + "summary": "开放接口-获取应用页详情通过KEY", | ||
| 21 | + "operationId": "getAppPageShareDetail", | ||
| 22 | + "responses": { | ||
| 23 | + "200": { | ||
| 24 | + "description": "A successful response.", | ||
| 25 | + "schema": { | ||
| 26 | + "$ref": "#/definitions/GetAppPageShareDetailResponse" | ||
| 27 | + } | ||
| 28 | + } | ||
| 29 | + }, | ||
| 30 | + "parameters": [ | ||
| 31 | + { | ||
| 32 | + "name": "key", | ||
| 33 | + "in": "path", | ||
| 34 | + "required": true, | ||
| 35 | + "type": "string" | ||
| 36 | + } | ||
| 37 | + ], | ||
| 38 | + "requestBody": {}, | ||
| 39 | + "tags": [ | ||
| 40 | + "page" | ||
| 41 | + ] | ||
| 42 | + } | ||
| 43 | + }, | ||
| 44 | + "v1/app-page": { | ||
| 45 | + "post": { | ||
| 46 | + "summary": "保存应用页", | ||
| 47 | + "operationId": "saveAppPage", | ||
| 48 | + "responses": { | ||
| 49 | + "200": { | ||
| 50 | + "description": "A successful response.", | ||
| 51 | + "schema": { | ||
| 52 | + "$ref": "#/definitions/AppPageSaveResponse" | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + }, | ||
| 56 | + "parameters": [ | ||
| 57 | + { | ||
| 58 | + "name": "body", | ||
| 59 | + "in": "body", | ||
| 60 | + "required": true, | ||
| 61 | + "schema": { | ||
| 62 | + "$ref": "#/definitions/AppPageSaveRequest" | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + ], | ||
| 66 | + "requestBody": {}, | ||
| 67 | + "tags": [ | ||
| 68 | + "page" | ||
| 69 | + ] | ||
| 70 | + } | ||
| 71 | + }, | ||
| 72 | + "v1/app-page/create-share": { | ||
| 73 | + "post": { | ||
| 74 | + "summary": "创建应用页分享", | ||
| 75 | + "operationId": "createAppPageShareUrl", | ||
| 76 | + "responses": { | ||
| 77 | + "200": { | ||
| 78 | + "description": "A successful response.", | ||
| 79 | + "schema": { | ||
| 80 | + "$ref": "#/definitions/AppPageCreateShareResponse" | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | + }, | ||
| 84 | + "parameters": [ | ||
| 85 | + { | ||
| 86 | + "name": "body", | ||
| 87 | + "in": "body", | ||
| 88 | + "required": true, | ||
| 89 | + "schema": { | ||
| 90 | + "$ref": "#/definitions/AppPageCreateShareRequest" | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | + ], | ||
| 94 | + "requestBody": {}, | ||
| 95 | + "tags": [ | ||
| 96 | + "page" | ||
| 97 | + ] | ||
| 98 | + } | ||
| 99 | + }, | ||
| 100 | + "v1/app-page/saveas": { | ||
| 101 | + "post": { | ||
| 102 | + "summary": "应用页另存为", | ||
| 103 | + "operationId": "saveAsAppPage", | ||
| 104 | + "responses": { | ||
| 105 | + "200": { | ||
| 106 | + "description": "A successful response.", | ||
| 107 | + "schema": { | ||
| 108 | + "$ref": "#/definitions/AppPageSaveAsResponse" | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + }, | ||
| 112 | + "parameters": [ | ||
| 113 | + { | ||
| 114 | + "name": "body", | ||
| 115 | + "in": "body", | ||
| 116 | + "required": true, | ||
| 117 | + "schema": { | ||
| 118 | + "$ref": "#/definitions/AppPageSaveAsRequest" | ||
| 119 | + } | ||
| 120 | + } | ||
| 121 | + ], | ||
| 122 | + "requestBody": {}, | ||
| 123 | + "tags": [ | ||
| 124 | + "page" | ||
| 125 | + ] | ||
| 126 | + } | ||
| 127 | + }, | ||
| 128 | + "v1/app-page/search": { | ||
| 129 | + "post": { | ||
| 130 | + "summary": "搜索", | ||
| 131 | + "operationId": "searchAppPage", | ||
| 132 | + "responses": { | ||
| 133 | + "200": { | ||
| 134 | + "description": "A successful response.", | ||
| 135 | + "schema": { | ||
| 136 | + "$ref": "#/definitions/AppPageSearchResponse" | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + }, | ||
| 140 | + "parameters": [ | ||
| 141 | + { | ||
| 142 | + "name": "body", | ||
| 143 | + "in": "body", | ||
| 144 | + "required": true, | ||
| 145 | + "schema": { | ||
| 146 | + "$ref": "#/definitions/AppPageSearchRequest" | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + ], | ||
| 150 | + "requestBody": {}, | ||
| 151 | + "tags": [ | ||
| 152 | + "page" | ||
| 153 | + ] | ||
| 154 | + } | ||
| 155 | + }, | ||
| 156 | + "v1/app-page/{id}": { | ||
| 157 | + "get": { | ||
| 158 | + "summary": "获取应用页详情", | ||
| 159 | + "operationId": "getAppPage", | ||
| 160 | + "responses": { | ||
| 161 | + "200": { | ||
| 162 | + "description": "A successful response.", | ||
| 163 | + "schema": { | ||
| 164 | + "$ref": "#/definitions/AppPageGetResponse" | ||
| 165 | + } | ||
| 166 | + } | ||
| 167 | + }, | ||
| 168 | + "parameters": [ | ||
| 169 | + { | ||
| 170 | + "name": "id", | ||
| 171 | + "in": "path", | ||
| 172 | + "required": true, | ||
| 173 | + "type": "string" | ||
| 174 | + } | ||
| 175 | + ], | ||
| 176 | + "requestBody": {}, | ||
| 177 | + "tags": [ | ||
| 178 | + "page" | ||
| 179 | + ] | ||
| 180 | + }, | ||
| 181 | + "delete": { | ||
| 182 | + "summary": "删除应用页", | ||
| 183 | + "operationId": "deleteAppPage", | ||
| 184 | + "responses": { | ||
| 185 | + "200": { | ||
| 186 | + "description": "A successful response.", | ||
| 187 | + "schema": { | ||
| 188 | + "$ref": "#/definitions/AppPageDeleteResponse" | ||
| 189 | + } | ||
| 190 | + } | ||
| 191 | + }, | ||
| 192 | + "parameters": [ | ||
| 193 | + { | ||
| 194 | + "name": "id", | ||
| 195 | + "in": "path", | ||
| 196 | + "required": true, | ||
| 197 | + "type": "string" | ||
| 198 | + }, | ||
| 199 | + { | ||
| 200 | + "name": "body", | ||
| 201 | + "in": "body", | ||
| 202 | + "required": true, | ||
| 203 | + "schema": { | ||
| 204 | + "$ref": "#/definitions/AppPageDeleteRequest" | ||
| 205 | + } | ||
| 206 | + } | ||
| 207 | + ], | ||
| 208 | + "requestBody": {}, | ||
| 209 | + "tags": [ | ||
| 210 | + "page" | ||
| 211 | + ] | ||
| 212 | + }, | ||
| 213 | + "put": { | ||
| 214 | + "summary": "更新应用页", | ||
| 215 | + "operationId": "updateAppPage", | ||
| 216 | + "responses": { | ||
| 217 | + "200": { | ||
| 218 | + "description": "A successful response.", | ||
| 219 | + "schema": { | ||
| 220 | + "$ref": "#/definitions/AppPageUpdateResponse" | ||
| 221 | + } | ||
| 222 | + } | ||
| 223 | + }, | ||
| 224 | + "parameters": [ | ||
| 225 | + { | ||
| 226 | + "name": "id", | ||
| 227 | + "in": "path", | ||
| 228 | + "required": true, | ||
| 229 | + "type": "string" | ||
| 230 | + }, | ||
| 231 | + { | ||
| 232 | + "name": "body", | ||
| 233 | + "in": "body", | ||
| 234 | + "required": true, | ||
| 235 | + "schema": { | ||
| 236 | + "$ref": "#/definitions/AppPageUpdateRequest" | ||
| 237 | + } | ||
| 238 | + } | ||
| 239 | + ], | ||
| 240 | + "requestBody": {}, | ||
| 241 | + "tags": [ | ||
| 242 | + "page" | ||
| 243 | + ] | ||
| 244 | + } | ||
| 245 | + }, | ||
| 18 | "v1/chart": { | 246 | "v1/chart": { |
| 19 | "post": { | 247 | "post": { |
| 20 | "summary": "保存图表", | 248 | "summary": "保存图表", |
| @@ -155,6 +383,34 @@ | @@ -155,6 +383,34 @@ | ||
| 155 | ] | 383 | ] |
| 156 | } | 384 | } |
| 157 | }, | 385 | }, |
| 386 | + "v1/chart/saveas": { | ||
| 387 | + "post": { | ||
| 388 | + "summary": "图表另存为", | ||
| 389 | + "operationId": "saveAsChart", | ||
| 390 | + "responses": { | ||
| 391 | + "200": { | ||
| 392 | + "description": "A successful response.", | ||
| 393 | + "schema": { | ||
| 394 | + "$ref": "#/definitions/ChartSaveAsResponse" | ||
| 395 | + } | ||
| 396 | + } | ||
| 397 | + }, | ||
| 398 | + "parameters": [ | ||
| 399 | + { | ||
| 400 | + "name": "body", | ||
| 401 | + "in": "body", | ||
| 402 | + "required": true, | ||
| 403 | + "schema": { | ||
| 404 | + "$ref": "#/definitions/ChartSaveAsRequest" | ||
| 405 | + } | ||
| 406 | + } | ||
| 407 | + ], | ||
| 408 | + "requestBody": {}, | ||
| 409 | + "tags": [ | ||
| 410 | + "chart" | ||
| 411 | + ] | ||
| 412 | + } | ||
| 413 | + }, | ||
| 158 | "v1/chart/search": { | 414 | "v1/chart/search": { |
| 159 | "post": { | 415 | "post": { |
| 160 | "summary": "搜索图表", | 416 | "summary": "搜索图表", |
| @@ -391,6 +647,269 @@ | @@ -391,6 +647,269 @@ | ||
| 391 | } | 647 | } |
| 392 | }, | 648 | }, |
| 393 | "definitions": { | 649 | "definitions": { |
| 650 | + "AppPageChartItem": { | ||
| 651 | + "type": "object", | ||
| 652 | + "properties": { | ||
| 653 | + "chartId": { | ||
| 654 | + "type": "integer", | ||
| 655 | + "format": "int64", | ||
| 656 | + "description": " 图表ID" | ||
| 657 | + }, | ||
| 658 | + "name": { | ||
| 659 | + "type": "string", | ||
| 660 | + "description": " 图表名称" | ||
| 661 | + }, | ||
| 662 | + "cover": { | ||
| 663 | + "type": "string", | ||
| 664 | + "description": " 图表封面" | ||
| 665 | + } | ||
| 666 | + }, | ||
| 667 | + "title": "AppPageChartItem", | ||
| 668 | + "required": [ | ||
| 669 | + "chartId", | ||
| 670 | + "name", | ||
| 671 | + "cover" | ||
| 672 | + ] | ||
| 673 | + }, | ||
| 674 | + "AppPageCreateShareRequest": { | ||
| 675 | + "type": "object", | ||
| 676 | + "properties": { | ||
| 677 | + "id": { | ||
| 678 | + "type": "integer", | ||
| 679 | + "format": "int64", | ||
| 680 | + "description": " 页面ID" | ||
| 681 | + } | ||
| 682 | + }, | ||
| 683 | + "title": "AppPageCreateShareRequest", | ||
| 684 | + "required": [ | ||
| 685 | + "id" | ||
| 686 | + ] | ||
| 687 | + }, | ||
| 688 | + "AppPageCreateShareResponse": { | ||
| 689 | + "type": "object", | ||
| 690 | + "properties": { | ||
| 691 | + "key": { | ||
| 692 | + "type": "string", | ||
| 693 | + "description": " 分享,预览时绑定映射到Id" | ||
| 694 | + } | ||
| 695 | + }, | ||
| 696 | + "title": "AppPageCreateShareResponse" | ||
| 697 | + }, | ||
| 698 | + "AppPageDeleteRequest": { | ||
| 699 | + "type": "object", | ||
| 700 | + "properties": { | ||
| 701 | + "id": { | ||
| 702 | + "type": "integer", | ||
| 703 | + "format": "int64", | ||
| 704 | + "description": " 页面ID" | ||
| 705 | + } | ||
| 706 | + }, | ||
| 707 | + "title": "AppPageDeleteRequest", | ||
| 708 | + "required": [ | ||
| 709 | + "id" | ||
| 710 | + ] | ||
| 711 | + }, | ||
| 712 | + "AppPageDeleteResponse": { | ||
| 713 | + "type": "object", | ||
| 714 | + "title": "AppPageDeleteResponse" | ||
| 715 | + }, | ||
| 716 | + "AppPageGetRequest": { | ||
| 717 | + "type": "object", | ||
| 718 | + "properties": { | ||
| 719 | + "id": { | ||
| 720 | + "type": "integer", | ||
| 721 | + "format": "int64" | ||
| 722 | + } | ||
| 723 | + }, | ||
| 724 | + "title": "AppPageGetRequest", | ||
| 725 | + "required": [ | ||
| 726 | + "id" | ||
| 727 | + ] | ||
| 728 | + }, | ||
| 729 | + "AppPageGetResponse": { | ||
| 730 | + "type": "object", | ||
| 731 | + "properties": { | ||
| 732 | + "page": { | ||
| 733 | + "$ref": "#/definitions/AppPageItem" | ||
| 734 | + } | ||
| 735 | + }, | ||
| 736 | + "title": "AppPageGetResponse", | ||
| 737 | + "required": [ | ||
| 738 | + "page" | ||
| 739 | + ] | ||
| 740 | + }, | ||
| 741 | + "AppPageItem": { | ||
| 742 | + "type": "object", | ||
| 743 | + "properties": { | ||
| 744 | + "id": { | ||
| 745 | + "type": "integer", | ||
| 746 | + "format": "int64", | ||
| 747 | + "description": " 唯一标识" | ||
| 748 | + }, | ||
| 749 | + "name": { | ||
| 750 | + "type": "string", | ||
| 751 | + "description": " 名称" | ||
| 752 | + }, | ||
| 753 | + "charts": { | ||
| 754 | + "type": "array", | ||
| 755 | + "items": { | ||
| 756 | + "$ref": "#/definitions/AppPageChartItem" | ||
| 757 | + }, | ||
| 758 | + "description": " 图表" | ||
| 759 | + } | ||
| 760 | + }, | ||
| 761 | + "title": "AppPageItem" | ||
| 762 | + }, | ||
| 763 | + "AppPageSaveAsRequest": { | ||
| 764 | + "type": "object", | ||
| 765 | + "properties": { | ||
| 766 | + "id": { | ||
| 767 | + "type": "integer", | ||
| 768 | + "format": "int64", | ||
| 769 | + "description": " 页面ID" | ||
| 770 | + }, | ||
| 771 | + "name": { | ||
| 772 | + "type": "string", | ||
| 773 | + "description": " 名称" | ||
| 774 | + } | ||
| 775 | + }, | ||
| 776 | + "title": "AppPageSaveAsRequest", | ||
| 777 | + "required": [ | ||
| 778 | + "id", | ||
| 779 | + "name" | ||
| 780 | + ] | ||
| 781 | + }, | ||
| 782 | + "AppPageSaveAsResponse": { | ||
| 783 | + "type": "object", | ||
| 784 | + "properties": { | ||
| 785 | + "id": { | ||
| 786 | + "type": "integer", | ||
| 787 | + "format": "int64" | ||
| 788 | + }, | ||
| 789 | + "name": { | ||
| 790 | + "type": "string", | ||
| 791 | + "description": " 名称" | ||
| 792 | + }, | ||
| 793 | + "charts": { | ||
| 794 | + "type": "array", | ||
| 795 | + "items": { | ||
| 796 | + "type": "integer", | ||
| 797 | + "format": "int64" | ||
| 798 | + }, | ||
| 799 | + "description": " 图表" | ||
| 800 | + } | ||
| 801 | + }, | ||
| 802 | + "title": "AppPageSaveAsResponse", | ||
| 803 | + "required": [ | ||
| 804 | + "id", | ||
| 805 | + "name", | ||
| 806 | + "charts" | ||
| 807 | + ] | ||
| 808 | + }, | ||
| 809 | + "AppPageSaveRequest": { | ||
| 810 | + "type": "object", | ||
| 811 | + "properties": { | ||
| 812 | + "name": { | ||
| 813 | + "type": "string", | ||
| 814 | + "description": " 名称" | ||
| 815 | + }, | ||
| 816 | + "charts": { | ||
| 817 | + "type": "array", | ||
| 818 | + "items": { | ||
| 819 | + "type": "integer", | ||
| 820 | + "format": "int64" | ||
| 821 | + }, | ||
| 822 | + "description": " 图表" | ||
| 823 | + } | ||
| 824 | + }, | ||
| 825 | + "title": "AppPageSaveRequest", | ||
| 826 | + "required": [ | ||
| 827 | + "name", | ||
| 828 | + "charts" | ||
| 829 | + ] | ||
| 830 | + }, | ||
| 831 | + "AppPageSaveResponse": { | ||
| 832 | + "type": "object", | ||
| 833 | + "properties": { | ||
| 834 | + "id": { | ||
| 835 | + "type": "integer", | ||
| 836 | + "format": "int64" | ||
| 837 | + } | ||
| 838 | + }, | ||
| 839 | + "title": "AppPageSaveResponse", | ||
| 840 | + "required": [ | ||
| 841 | + "id" | ||
| 842 | + ] | ||
| 843 | + }, | ||
| 844 | + "AppPageSearchRequest": { | ||
| 845 | + "type": "object", | ||
| 846 | + "properties": { | ||
| 847 | + "page": { | ||
| 848 | + "type": "integer", | ||
| 849 | + "format": "int32" | ||
| 850 | + }, | ||
| 851 | + "size": { | ||
| 852 | + "type": "integer", | ||
| 853 | + "format": "int32" | ||
| 854 | + } | ||
| 855 | + }, | ||
| 856 | + "title": "AppPageSearchRequest", | ||
| 857 | + "required": [ | ||
| 858 | + "page", | ||
| 859 | + "size" | ||
| 860 | + ] | ||
| 861 | + }, | ||
| 862 | + "AppPageSearchResponse": { | ||
| 863 | + "type": "object", | ||
| 864 | + "properties": { | ||
| 865 | + "list": { | ||
| 866 | + "type": "array", | ||
| 867 | + "items": { | ||
| 868 | + "$ref": "#/definitions/AppPageItem" | ||
| 869 | + } | ||
| 870 | + }, | ||
| 871 | + "total": { | ||
| 872 | + "type": "integer", | ||
| 873 | + "format": "int64" | ||
| 874 | + } | ||
| 875 | + }, | ||
| 876 | + "title": "AppPageSearchResponse", | ||
| 877 | + "required": [ | ||
| 878 | + "list", | ||
| 879 | + "total" | ||
| 880 | + ] | ||
| 881 | + }, | ||
| 882 | + "AppPageUpdateRequest": { | ||
| 883 | + "type": "object", | ||
| 884 | + "properties": { | ||
| 885 | + "id": { | ||
| 886 | + "type": "integer", | ||
| 887 | + "format": "int64" | ||
| 888 | + }, | ||
| 889 | + "name": { | ||
| 890 | + "type": "string", | ||
| 891 | + "description": " 名称" | ||
| 892 | + }, | ||
| 893 | + "charts": { | ||
| 894 | + "type": "array", | ||
| 895 | + "items": { | ||
| 896 | + "type": "integer", | ||
| 897 | + "format": "int64" | ||
| 898 | + }, | ||
| 899 | + "description": " 图表" | ||
| 900 | + } | ||
| 901 | + }, | ||
| 902 | + "title": "AppPageUpdateRequest", | ||
| 903 | + "required": [ | ||
| 904 | + "id", | ||
| 905 | + "name", | ||
| 906 | + "charts" | ||
| 907 | + ] | ||
| 908 | + }, | ||
| 909 | + "AppPageUpdateResponse": { | ||
| 910 | + "type": "object", | ||
| 911 | + "title": "AppPageUpdateResponse" | ||
| 912 | + }, | ||
| 394 | "ChartComponentItem": { | 913 | "ChartComponentItem": { |
| 395 | "type": "object", | 914 | "type": "object", |
| 396 | "properties": { | 915 | "properties": { |
| @@ -541,6 +1060,10 @@ | @@ -541,6 +1060,10 @@ | ||
| 541 | "cover": { | 1060 | "cover": { |
| 542 | "type": "string", | 1061 | "type": "string", |
| 543 | "description": " 封面" | 1062 | "description": " 封面" |
| 1063 | + }, | ||
| 1064 | + "other": { | ||
| 1065 | + "$ref": "#/definitions/Other", | ||
| 1066 | + "description": " 其他额外配置" | ||
| 544 | } | 1067 | } |
| 545 | }, | 1068 | }, |
| 546 | "title": "ChartProperty" | 1069 | "title": "ChartProperty" |
| @@ -567,6 +1090,37 @@ | @@ -567,6 +1090,37 @@ | ||
| 567 | "type": "object", | 1090 | "type": "object", |
| 568 | "title": "ChartRenameResponse" | 1091 | "title": "ChartRenameResponse" |
| 569 | }, | 1092 | }, |
| 1093 | + "ChartSaveAsRequest": { | ||
| 1094 | + "type": "object", | ||
| 1095 | + "properties": { | ||
| 1096 | + "chartId": { | ||
| 1097 | + "type": "integer", | ||
| 1098 | + "format": "int64", | ||
| 1099 | + "description": " 图表Id" | ||
| 1100 | + }, | ||
| 1101 | + "name": { | ||
| 1102 | + "type": "string", | ||
| 1103 | + "description": " 名称" | ||
| 1104 | + } | ||
| 1105 | + }, | ||
| 1106 | + "title": "ChartSaveAsRequest", | ||
| 1107 | + "required": [ | ||
| 1108 | + "chartId", | ||
| 1109 | + "name" | ||
| 1110 | + ] | ||
| 1111 | + }, | ||
| 1112 | + "ChartSaveAsResponse": { | ||
| 1113 | + "type": "object", | ||
| 1114 | + "properties": { | ||
| 1115 | + "chart": { | ||
| 1116 | + "$ref": "#/definitions/ChartItem" | ||
| 1117 | + } | ||
| 1118 | + }, | ||
| 1119 | + "title": "ChartSaveAsResponse", | ||
| 1120 | + "required": [ | ||
| 1121 | + "chart" | ||
| 1122 | + ] | ||
| 1123 | + }, | ||
| 570 | "ChartSaveRequest": { | 1124 | "ChartSaveRequest": { |
| 571 | "type": "object", | 1125 | "type": "object", |
| 572 | "properties": { | 1126 | "properties": { |
| @@ -776,6 +1330,30 @@ | @@ -776,6 +1330,30 @@ | ||
| 776 | "toValue" | 1330 | "toValue" |
| 777 | ] | 1331 | ] |
| 778 | }, | 1332 | }, |
| 1333 | + "GetAppPageShareDetailRequest": { | ||
| 1334 | + "type": "object", | ||
| 1335 | + "properties": { | ||
| 1336 | + "key": { | ||
| 1337 | + "type": "string" | ||
| 1338 | + } | ||
| 1339 | + }, | ||
| 1340 | + "title": "GetAppPageShareDetailRequest", | ||
| 1341 | + "required": [ | ||
| 1342 | + "key" | ||
| 1343 | + ] | ||
| 1344 | + }, | ||
| 1345 | + "GetAppPageShareDetailResponse": { | ||
| 1346 | + "type": "object", | ||
| 1347 | + "properties": { | ||
| 1348 | + "page": { | ||
| 1349 | + "$ref": "#/definitions/AppPageItem" | ||
| 1350 | + } | ||
| 1351 | + }, | ||
| 1352 | + "title": "GetAppPageShareDetailResponse", | ||
| 1353 | + "required": [ | ||
| 1354 | + "page" | ||
| 1355 | + ] | ||
| 1356 | + }, | ||
| 779 | "GetTableDetailRequest": { | 1357 | "GetTableDetailRequest": { |
| 780 | "type": "object", | 1358 | "type": "object", |
| 781 | "properties": { | 1359 | "properties": { |
| @@ -814,6 +1392,63 @@ | @@ -814,6 +1392,63 @@ | ||
| 814 | "type": "object", | 1392 | "type": "object", |
| 815 | "title": "LoadChartDataResponse" | 1393 | "title": "LoadChartDataResponse" |
| 816 | }, | 1394 | }, |
| 1395 | + "Other": { | ||
| 1396 | + "type": "object", | ||
| 1397 | + "properties": { | ||
| 1398 | + "quarter": { | ||
| 1399 | + "$ref": "#/definitions/Quarter", | ||
| 1400 | + "description": " 四分图" | ||
| 1401 | + } | ||
| 1402 | + }, | ||
| 1403 | + "title": "Other", | ||
| 1404 | + "required": [ | ||
| 1405 | + "quarter" | ||
| 1406 | + ] | ||
| 1407 | + }, | ||
| 1408 | + "Quarter": { | ||
| 1409 | + "type": "object", | ||
| 1410 | + "properties": { | ||
| 1411 | + "xAxisLabel": { | ||
| 1412 | + "type": "string", | ||
| 1413 | + "description": " x轴标签名" | ||
| 1414 | + }, | ||
| 1415 | + "xAxisLabelList": { | ||
| 1416 | + "type": "array", | ||
| 1417 | + "items": { | ||
| 1418 | + "type": "string" | ||
| 1419 | + }, | ||
| 1420 | + "description": " 标签名" | ||
| 1421 | + }, | ||
| 1422 | + "yAxisLabel": { | ||
| 1423 | + "type": "string", | ||
| 1424 | + "description": " x轴标签名" | ||
| 1425 | + }, | ||
| 1426 | + "yAxisLabelList": { | ||
| 1427 | + "type": "array", | ||
| 1428 | + "items": { | ||
| 1429 | + "type": "string" | ||
| 1430 | + }, | ||
| 1431 | + "description": " 标签名" | ||
| 1432 | + }, | ||
| 1433 | + "area": { | ||
| 1434 | + "type": "string", | ||
| 1435 | + "description": " 图形面积" | ||
| 1436 | + }, | ||
| 1437 | + "seriesList": { | ||
| 1438 | + "type": "string", | ||
| 1439 | + "description": " 图形系列" | ||
| 1440 | + } | ||
| 1441 | + }, | ||
| 1442 | + "title": "Quarter", | ||
| 1443 | + "required": [ | ||
| 1444 | + "xAxisLabel", | ||
| 1445 | + "xAxisLabelList", | ||
| 1446 | + "yAxisLabel", | ||
| 1447 | + "yAxisLabelList", | ||
| 1448 | + "area", | ||
| 1449 | + "seriesList" | ||
| 1450 | + ] | ||
| 1451 | + }, | ||
| 817 | "SearchTableByModuleRequest": { | 1452 | "SearchTableByModuleRequest": { |
| 818 | "type": "object", | 1453 | "type": "object", |
| 819 | "properties": { | 1454 | "properties": { |
| @@ -945,6 +1580,18 @@ | @@ -945,6 +1580,18 @@ | ||
| 945 | "$ref": "#/definitions/Expression" | 1580 | "$ref": "#/definitions/Expression" |
| 946 | }, | 1581 | }, |
| 947 | "description": " 条件匹配表达式(总体指标)" | 1582 | "description": " 条件匹配表达式(总体指标)" |
| 1583 | + }, | ||
| 1584 | + "targetText": { | ||
| 1585 | + "type": "string", | ||
| 1586 | + "description": " 指标名文本" | ||
| 1587 | + }, | ||
| 1588 | + "targetNum": { | ||
| 1589 | + "type": "string", | ||
| 1590 | + "description": " 指标数值" | ||
| 1591 | + }, | ||
| 1592 | + "targetUnit": { | ||
| 1593 | + "type": "string", | ||
| 1594 | + "description": " 指标单位" | ||
| 948 | } | 1595 | } |
| 949 | }, | 1596 | }, |
| 950 | "title": "Series", | 1597 | "title": "Series", |
| @@ -953,7 +1600,10 @@ | @@ -953,7 +1600,10 @@ | ||
| 953 | "from", | 1600 | "from", |
| 954 | "dataSourceId", | 1601 | "dataSourceId", |
| 955 | "customText", | 1602 | "customText", |
| 956 | - "matchExpressions" | 1603 | + "matchExpressions", |
| 1604 | + "targetText", | ||
| 1605 | + "targetNum", | ||
| 1606 | + "targetUnit" | ||
| 957 | ] | 1607 | ] |
| 958 | }, | 1608 | }, |
| 959 | "TableAbility": { | 1609 | "TableAbility": { |
| @@ -1010,6 +1660,10 @@ | @@ -1010,6 +1660,10 @@ | ||
| 1010 | "fileUrl": { | 1660 | "fileUrl": { |
| 1011 | "type": "string", | 1661 | "type": "string", |
| 1012 | "description": " 组件图片/视频" | 1662 | "description": " 组件图片/视频" |
| 1663 | + }, | ||
| 1664 | + "align": { | ||
| 1665 | + "type": "string", | ||
| 1666 | + "description": " 文本对齐方式 left center right" | ||
| 1013 | } | 1667 | } |
| 1014 | }, | 1668 | }, |
| 1015 | "title": "Title", | 1669 | "title": "Title", |
doc/dsl/api/core/app_page.api
0 → 100644
| 1 | + | ||
| 2 | +syntax = "v1" | ||
| 3 | + | ||
| 4 | +info( | ||
| 5 | + title: "天联字库图表模板" | ||
| 6 | + desc: "图表模板" | ||
| 7 | + author: "小火箭" | ||
| 8 | + email: "email" | ||
| 9 | + version: "v1" | ||
| 10 | +) | ||
| 11 | + | ||
| 12 | +@server( | ||
| 13 | + prefix: v1 | ||
| 14 | + group: page | ||
| 15 | + jwt: JwtAuth | ||
| 16 | +) | ||
| 17 | +service Core { | ||
| 18 | + @doc "获取应用页详情" | ||
| 19 | + @handler getAppPage | ||
| 20 | + get /app-page/:id (AppPageGetRequest) returns (AppPageGetResponse) | ||
| 21 | + @doc "保存应用页" | ||
| 22 | + @handler saveAppPage | ||
| 23 | + post /app-page (AppPageSaveRequest) returns (AppPageSaveResponse) | ||
| 24 | + @doc "应用页另存为" | ||
| 25 | + @handler saveAsAppPage | ||
| 26 | + post /app-page/saveas (AppPageSaveAsRequest) returns (AppPageSaveAsResponse) | ||
| 27 | + @doc "删除应用页" | ||
| 28 | + @handler deleteAppPage | ||
| 29 | + delete /app-page/:id (AppPageDeleteRequest) returns (AppPageDeleteResponse) | ||
| 30 | + @doc "更新应用页" | ||
| 31 | + @handler updateAppPage | ||
| 32 | + put /app-page/:id (AppPageUpdateRequest) returns (AppPageUpdateResponse) | ||
| 33 | + @doc "搜索" | ||
| 34 | + @handler searchAppPage | ||
| 35 | + post /app-page/search (AppPageSearchRequest) returns (AppPageSearchResponse) | ||
| 36 | + @doc "创建应用页分享" | ||
| 37 | + @handler createAppPageShareUrl | ||
| 38 | + post /app-page/create-share (AppPageCreateShareRequest) returns (AppPageCreateShareResponse) | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | + | ||
| 42 | +type ( | ||
| 43 | + AppPageGetRequest { | ||
| 44 | + Id int64 `path:"id"` | ||
| 45 | + } | ||
| 46 | + AppPageGetResponse struct{ | ||
| 47 | + AppPage AppPageItem `json:"page"` | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + AppPageSaveRequest struct{ | ||
| 51 | + Name string `json:"name"` // 名称 | ||
| 52 | + Charts []int64 `json:"charts"`// 图表 | ||
| 53 | + } | ||
| 54 | + AppPageSaveResponse struct{ | ||
| 55 | + Id int64 `json:"id"` | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + AppPageSaveAsRequest struct{ | ||
| 59 | + Id int64 `json:"id"` // 页面ID | ||
| 60 | + Name string `json:"name"` // 名称 | ||
| 61 | + } | ||
| 62 | + AppPageSaveAsResponse struct{ | ||
| 63 | + Id int64 `path:"id"` | ||
| 64 | + Name string `json:"name"` // 名称 | ||
| 65 | + Charts []int64 `json:"charts"`// 图表 | ||
| 66 | + } | ||
| 67 | + AppPageCreateShareRequest struct{ | ||
| 68 | + Id int64 `json:"id"` // 页面ID | ||
| 69 | + } | ||
| 70 | + AppPageCreateShareResponse struct{ | ||
| 71 | + Key string `json:"key,optional"` // 分享,预览时绑定映射到Id | ||
| 72 | + } | ||
| 73 | + AppPageDeleteRequest struct{ | ||
| 74 | + Id int64 `path:"id"` // 页面ID | ||
| 75 | + } | ||
| 76 | + AppPageDeleteResponse struct{} | ||
| 77 | + | ||
| 78 | + AppPageUpdateRequest struct{ | ||
| 79 | + Id int64 `path:"id"` | ||
| 80 | + Name string `json:"name"` // 名称 | ||
| 81 | + Charts []int64 `json:"charts"`// 图表 | ||
| 82 | + } | ||
| 83 | + AppPageUpdateResponse struct{} | ||
| 84 | + | ||
| 85 | + AppPageSearchRequest struct{ | ||
| 86 | + Page int `json:"page"` | ||
| 87 | + Size int `json:"size"` | ||
| 88 | + } | ||
| 89 | + AppPageSearchResponse{ | ||
| 90 | + List []AppPageItem `json:"list"` | ||
| 91 | + Total int64 `json:"total"` | ||
| 92 | + } | ||
| 93 | + AppPageItem struct{ | ||
| 94 | + Id int64 `json:"id,optional"` // 唯一标识 | ||
| 95 | + Name string `json:"name,optional"` // 名称 | ||
| 96 | + Charts []AppPageChartItem `json:"charts,optional"`// 图表 | ||
| 97 | + } | ||
| 98 | + AppPageChartItem struct{ | ||
| 99 | + ChartId int64 `json:"chartId"` // 图表ID | ||
| 100 | + Name string `json:"name"` // 图表名称 | ||
| 101 | + Cover string `json:"cover"` // 图表封面 | ||
| 102 | + } | ||
| 103 | +) | ||
| 104 | + | ||
| 105 | + | ||
| 106 | +@server( | ||
| 107 | + prefix: v1 | ||
| 108 | + group: page | ||
| 109 | +) | ||
| 110 | +service Core { | ||
| 111 | + @doc "开放接口-获取应用页详情通过KEY" | ||
| 112 | + @handler getAppPageShareDetail | ||
| 113 | + get /api/app-page/get-share-detail/:key (GetAppPageShareDetailRequest) returns (GetAppPageShareDetailResponse) | ||
| 114 | +} | ||
| 115 | + | ||
| 116 | +type ( | ||
| 117 | + GetAppPageShareDetailRequest struct{ | ||
| 118 | + Key string `path:"key"` | ||
| 119 | + } | ||
| 120 | + GetAppPageShareDetailResponse struct{ | ||
| 121 | + AppPage AppPageItem `json:"page"` | ||
| 122 | + } | ||
| 123 | +) |
| @@ -155,6 +155,18 @@ type( | @@ -155,6 +155,18 @@ type( | ||
| 155 | TableAbility TableAbility `json:"table,optional"` // 表筛选功能 | 155 | TableAbility TableAbility `json:"table,optional"` // 表筛选功能 |
| 156 | Series []Series `json:"series,optional"` // 系列(数据源) | 156 | Series []Series `json:"series,optional"` // 系列(数据源) |
| 157 | Cover string `json:"cover,optional"` // 封面 | 157 | Cover string `json:"cover,optional"` // 封面 |
| 158 | + Other Other `json:"other,optional"` // 其他额外配置 | ||
| 159 | + } | ||
| 160 | + Other struct { | ||
| 161 | + Quarter *Quarter `json:"quarter,optional,omitempty"` // 四分图 | ||
| 162 | + } | ||
| 163 | + Quarter struct { | ||
| 164 | + XAxisLabel string `json:"xAxisLabel"` // x轴标签名 | ||
| 165 | + XAxisLabelList []string `json:"xAxisLabelList"` // 标签名 | ||
| 166 | + YAxisLabel string `json:"yAxisLabel"` // x轴标签名 | ||
| 167 | + YAxisLabelList []string `json:"yAxisLabelList"` // 标签名 | ||
| 168 | + Area string `json:"area"` // 图形面积 | ||
| 169 | + SeriesList string `json:"seriesList"` // 图形系列 | ||
| 158 | } | 170 | } |
| 159 | Title struct { | 171 | Title struct { |
| 160 | TitleSwitch bool `json:"titleSwitch,optional"` // 组件标题开关 | 172 | TitleSwitch bool `json:"titleSwitch,optional"` // 组件标题开关 |
| @@ -165,6 +177,7 @@ type( | @@ -165,6 +177,7 @@ type( | ||
| 165 | ExplainType string `json:"explainType,optional,options=[text,file]"` // text file | 177 | ExplainType string `json:"explainType,optional,options=[text,file]"` // text file |
| 166 | ExplainTxt string `json:"explainTxt,optional"` // 文字说明 | 178 | ExplainTxt string `json:"explainTxt,optional"` // 文字说明 |
| 167 | FileUrl string `json:"fileUrl,optional"` // 组件图片/视频 | 179 | FileUrl string `json:"fileUrl,optional"` // 组件图片/视频 |
| 180 | + Align string `json:"align,optional"` // 文本对齐方式 left center right | ||
| 168 | } | 181 | } |
| 169 | TableAbility struct { | 182 | TableAbility struct { |
| 170 | FilterSwitch bool `json:"filterSwitch,optional"` // 表筛选功能开关 | 183 | FilterSwitch bool `json:"filterSwitch,optional"` // 表筛选功能开关 |
| @@ -176,6 +189,9 @@ type( | @@ -176,6 +189,9 @@ type( | ||
| 176 | DataSourceId int64 `json:"dataSourceId,optional,omitempty"` // 数据源ID(from值为ByteBank时有值) | 189 | DataSourceId int64 `json:"dataSourceId,optional,omitempty"` // 数据源ID(from值为ByteBank时有值) |
| 177 | CustomText string `json:"customText,optional,omitempty"` // 自定义数据文本(from值为User时有值) | 190 | CustomText string `json:"customText,optional,omitempty"` // 自定义数据文本(from值为User时有值) |
| 178 | MatchExpressions []Expression `json:"matchExpressions,optional,omitempty"` // 条件匹配表达式(总体指标) | 191 | MatchExpressions []Expression `json:"matchExpressions,optional,omitempty"` // 条件匹配表达式(总体指标) |
| 192 | + TargetText string `json:"targetText,optional,omitempty"` // 指标名文本 | ||
| 193 | + TargetNum string `json:"targetNum,optional,omitempty"` // 指标数值 | ||
| 194 | + TargetUnit string `json:"targetUnit,optional,omitempty"` // 指标单位 | ||
| 179 | } | 195 | } |
| 180 | Expression struct { | 196 | Expression struct { |
| 181 | Operator string `json:"operator"` // 操作符号 <,>,==,<>,<=,>= | 197 | Operator string `json:"operator"` // 操作符号 <,>,==,<>,<=,>= |
| @@ -16,3 +16,8 @@ CREATE TABLE `chart_setting` ( | @@ -16,3 +16,8 @@ CREATE TABLE `chart_setting` ( | ||
| 16 | `series` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '系列值-数据绑定', | 16 | `series` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '系列值-数据绑定', |
| 17 | PRIMARY KEY (`id`) USING BTREE | 17 | PRIMARY KEY (`id`) USING BTREE |
| 18 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; | 18 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; |
| 19 | + | ||
| 20 | +CREATE TABLE `app_page` ( | ||
| 21 | + `id` int(0) NOT NULL COMMENT '唯一标识', | ||
| 22 | + PRIMARY KEY (`id`) USING BTREE | ||
| 23 | +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; |
-
请 注册 或 登录 后发表评论