作者 庄敏学
... ... @@ -24,6 +24,7 @@ _testmain.go
.log
.idea
.vscode
cmd/chart-server/api/go_build_bchart
app.log
#go.sum
... ...
... ... @@ -82,6 +82,7 @@ type ChartItem struct {
Name string `json:"name,optional"` // 名称
Cover string `json:"cover,optional"` // 封面
ChartType string `json:"chartType,optional"` // 图表类型
UpdatedAt int `json:"updatedAt,optional"` // 更新时间
ChartProperty *ChartProperty `json:"property,optional,omitempty"` //属性
}
... ...
syntax = "v1"
info(
title: "天联字库图表模板"
desc: "图表模板"
author: "小火箭"
email: "email"
version: "v1"
title: "天联字库图表模板"
desc: "图表模板"
author: "小火箭"
email: "email"
version: "v1"
)
@server(
prefix: v1
group: chart
jwt: JwtAuth
//middleware: Authority
prefix: v1
group: chart
jwt: JwtAuth
//middleware: Authority
)
service Core {
@doc "保存图表"
@handler saveChart
post /chart (ChartSaveRequest) returns (ChartSaveResponse)
@doc "图表另存为"
@handler saveAsChart
post /chart/saveas (ChartSaveAsRequest) returns (ChartSaveAsResponse)
@doc "删除图表"
@handler deleteChart
delete /chart/:id (ChartDeleteRequest) returns (ChartDeleteResponse)
@doc "更新图表(配置)"
@handler updateChart
put /chart/:id (ChartUpdateRequest) returns (ChartUpdateResponse)
@doc "搜索图表"
@handler searchChart
post /chart/search (ChartSearchRequest) returns (ChartSearchResponse)
@doc "移动图表"
@handler updateChartSort
post /chart/move (ChartUpdateSortRequest) returns (ChartUpdateSortResponse)
@doc "重命名图表"
@handler renameChartSort
post /chart/rename (ChartRenameRequest) returns (ChartRenameResponse)
@doc "保存图表"
@handler saveChart
post /chart (ChartSaveRequest) returns (ChartSaveResponse)
@doc "图表另存为"
@handler saveAsChart
post /chart/saveas (ChartSaveAsRequest) returns (ChartSaveAsResponse)
@doc "删除图表"
@handler deleteChart
delete /chart/:id (ChartDeleteRequest) returns (ChartDeleteResponse)
@doc "更新图表(配置)"
@handler updateChart
put /chart/:id (ChartUpdateRequest) returns (ChartUpdateResponse)
@doc "搜索图表"
@handler searchChart
post /chart/search (ChartSearchRequest) returns (ChartSearchResponse)
@doc "移动图表"
@handler updateChartSort
post /chart/move (ChartUpdateSortRequest) returns (ChartUpdateSortResponse)
@doc "重命名图表"
@handler renameChartSort
post /chart/rename (ChartRenameRequest) returns (ChartRenameResponse)
@doc "搜索图表组件"
@handler searchChartComponents
post /chart/components/search(ChartComponentSearchRequest)returns(ChartComponentSearchResponse)
@doc "搜索图表组件"
@handler searchChartComponents
post /chart/components/search(ChartComponentSearchRequest)returns(ChartComponentSearchResponse)
}
@server(
prefix: v1
group: chart
prefix: v1
group: chart
)
service Core {
@doc "加载图表数据"
@handler loadChartData
post /chart/load-data (LoadChartDataRequest) returns (LoadChartDataResponse)
@doc "获取图表详情"
@handler getChart
get /chart/:id (ChartGetRequest) returns (ChartGetResponse)
@doc "加载图表数据"
@handler loadChartData
post /chart/load-data (LoadChartDataRequest) returns (LoadChartDataResponse)
@doc "获取图表详情"
@handler getChart
get /chart/:id (ChartGetRequest) returns (ChartGetResponse)
}
type (
ChartGetRequest {
ChartGetRequest {
Id int64 `path:"id"`
}
ChartGetResponse struct{
ChartGetResponse {
Chart ChartItem `json:"chart"`
}
ChartSaveRequest struct{
Pid int64 `json:"pid,optional"`// 父级ID
Type string `json:"type"`// 类型 report:报表 group:分组 chart:图表
Name string `json:"name,optional"`// 名称
ChartType string `json:"chartType"` // 图表类型
Cover string `json:"cover,optional"` // 封面
ChartProperty ChartProperty `json:"property"` // 图表属性
}
ChartSaveResponse struct{
Chart ChartItem `json:"chart"`
}
}
ChartSaveAsRequest struct{
ChartId int64 `json:"chartId"` // 图表Id
Name string `json:"name"`// 名称
}
ChartSaveAsResponse struct{
Chart ChartItem `json:"chart"`
}
ChartSaveRequest {
Pid int64 `json:"pid,optional"` // 父级ID
Type string `json:"type"` // 类型 report:报表 group:分组 chart:图表
Name string `json:"name,optional"` // 名称
ChartType string `json:"chartType"` // 图表类型
Cover string `json:"cover,optional"` // 封面
ChartProperty ChartProperty `json:"property"` // 图表属性
}
ChartSaveResponse {
Chart ChartItem `json:"chart"`
}
ChartDeleteRequest struct{
Id int64 `path:"id"`
}
ChartDeleteResponse struct{}
ChartSaveAsRequest {
ChartId int64 `json:"chartId"` // 图表Id
Name string `json:"name"` // 名称
}
ChartSaveAsResponse {
Chart ChartItem `json:"chart"`
}
ChartUpdateRequest struct{
ChartDeleteRequest {
Id int64 `path:"id"`
Cover string `json:"cover,optional"` // 封面
ChartProperty ChartProperty `json:"property"` // 图表属性
}
ChartUpdateResponse struct{}
}
ChartDeleteResponse struct{}
ChartSearchRequest struct {
IncludeTypes []string `json:"includeTypes,optional"` //包含的类型: 类型 report:报表 group:分组 chart:图表(未指定返回所有)
DataStyle string `json:"dataStyle,optional"` // 数据样式 tree:树形 flat:平铺
}
ChartSearchResponse{
List []ChartItem `json:"list"`
Total int64 `json:"total"`
}
ChartUpdateSortRequest struct{
Id int64 `json:"id"`
Pid int64 `json:"pid"`
Index int `json:"index"` // 元素下标
}
ChartUpdateSortResponse struct{}
ChartRenameRequest struct{
Id int64 `json:"id"`
Name string `json:"name"`// 名称
}
ChartRenameResponse struct{}
ChartItem struct{
Id int64 `json:"id,optional"`// ID
Pid int64 `json:"pid,optional"`// 父级ID
Type string `json:"type,optional"`// 类型 report:报表 group:分组 chart:图表
Sort int64 `json:"sort,optional"`// 排序
Name string `json:"name,optional"`// 名称
Cover string `json:"cover,optional"` // 封面
ChartType string `json:"chartType,optional"` // 图表类型
ChartProperty *ChartProperty `json:"property,optional,omitempty"` //属性
}
LoadChartDataRequest struct{
ChartId int64 `json:"chartId"`
}
LoadChartDataResponse struct{
ChartUpdateRequest {
Id int64 `path:"id"`
Cover string `json:"cover,optional"` // 封面
ChartProperty ChartProperty `json:"property"` // 图表属性
}
ChartUpdateResponse struct{}
}
ChartSearchRequest {
IncludeTypes []string `json:"includeTypes,optional"` //包含的类型: 类型 report:报表 group:分组 chart:图表(未指定返回所有)
DataStyle string `json:"dataStyle,optional"` // 数据样式 tree:树形 flat:平铺
}
ChartSearchResponse {
List []ChartItem `json:"list"`
Total int64 `json:"total"`
}
ChartUpdateSortRequest {
Id int64 `json:"id"`
Pid int64 `json:"pid"`
Index int `json:"index"` // 元素下标
}
ChartUpdateSortResponse struct{}
ChartRenameRequest {
Id int64 `json:"id"`
Name string `json:"name"` // 名称
}
ChartRenameResponse struct{}
ChartItem {
Id int64 `json:"id,optional"` // ID
Pid int64 `json:"pid,optional"` // 父级ID
Type string `json:"type,optional"` // 类型 report:报表 group:分组 chart:图表
Sort int64 `json:"sort,optional"` // 排序
Name string `json:"name,optional"` // 名称
Cover string `json:"cover,optional"` // 封面
ChartType string `json:"chartType,optional"` // 图表类型
UpdatedAt int `json:"updatedAt,optional"` // 更新时间
ChartProperty *ChartProperty `json:"property,optional,omitempty"` //属性
}
LoadChartDataRequest {
ChartId int64 `json:"chartId"`
}
LoadChartDataResponse {
}
)
type(
ChartComponentSearchRequest{
Name string `json:"name,optional"`
}
ChartComponentSearchResponse{
List []ChartComponentItem `json:"list"`
Total int64 `json:"total"`
}
ChartComponentItem struct{
Name string `json:"name,optional"`// 名称
Code string `json:"code,optional"`// 编码
Cover string `json:"cover,optional"` // 封面
Desc string `json:"desc,optional"`// 描述
}
type (
ChartComponentSearchRequest {
Name string `json:"name,optional"`
}
ChartComponentSearchResponse {
List []ChartComponentItem `json:"list"`
Total int64 `json:"total"`
}
ChartComponentItem {
Name string `json:"name,optional"` // 名称
Code string `json:"code,optional"` // 编码
Cover string `json:"cover,optional"` // 封面
Desc string `json:"desc,optional"` // 描述
}
)
type(
ChartProperty struct {
Title Title `json:"title,optional"` // 标题
TableAbility TableAbility `json:"table,optional"` // 表筛选功能
Series []Series `json:"series,optional"` // 系列(数据源)
Other Other `json:"other,optional"` // 其他额外配置
}
Other struct {
Quarter *Quarter `json:"quarter,optional,omitempty"` // 四分图
}
Quarter struct {
XAxisLabel string `json:"xAxisLabel"` // x轴标签名
XAxisFirstLabel string `json:"xAxisFirstLabel"` // 签名1
XAxisSecondLabel string `json:"xAxisSecondLabel"` // 签名2
YAxisLabel string `json:"yAxisLabel"` // y轴标签名
YAxisFirstLabel string `json:"yAxisFirstLabel"` // y标签1
YAxisSecondLabel string `json:"yAxisSecondLabel"` // y标签2
Area string `json:"area"` // 图形面积
AreaColor bool `json:"areaColor"` // 颜色
SeriesList []QuarterSeries `json:"seriesList"` // 图形系列
}
QuarterSeries struct {
SeriesValue string `json:"seriesValue"`
}
Title struct {
TitleSwitch bool `json:"titleSwitch,optional"` // 组件标题开关
IntroduceSwitch bool `json:"introduceSwitch,optional"` // 组件说明开关
TitleType string `json:"titleType"` // 标题类型
Heading string `json:"heading,optional"` // 主标题
SubTitle string `json:"subTitle,optional"` // 副标题
ExplainType string `json:"explainType,optional,options=[text,,file]"` // text file ,options=text||file
ExplainTxt string `json:"explainTxt,optional"` // 文字说明
FileName string `json:"fileName,optional"` // 文件名
FileUrl string `json:"fileUrl,optional"` // 组件图片/视频
Align string `json:"align,optional"` // 废弃 文本对齐方式 left center right
HeadingAlign string `json:"headingAlign,optional"` // 主标题 文本对齐方式 left center right
SubAlign string `json:"subAlign,optional"` // 副标题 文本对齐方式 left center right
}
TableAbility struct {
FilterSwitch bool `json:"filterSwitch,optional"` // 表筛选功能开关
DimensionList []Dimension `json:"dimensionList,optional"` // 维度列表
CardSwitch bool `json:"cardSwitch,optional"` // 顺序标识开关
CardIdent string `json:"cardIdent,optional"` // 顺序标识
CardOrderList []CardOrderItem `json:"cardOrderList,optional"` // 卡片列表顺序
}
CardOrderItem struct {
CardId string `json:"cardId,optional"`
}
Series struct {// 图表类型 (记录型表格:RecordTable-1 总体指标:MetricsCard-1 容器卡片:ContainerCard-1 四分图:QuarterChart-1)
Name string `json:"name"` // 名称 (例如 指标1、指标2)
SourceFrom string `json:"from,options=[ByteBank,User]"` // 数据源类型 ByteBank:字库 User:用户自定义
DataSourceId int64 `json:"dataSourceId,optional,omitempty"` // 数据源ID(from值为ByteBank时有值)
CustomText string `json:"customText,optional,omitempty"` // 自定义数据文本(from值为User时有值)
MatchExpressions []Expression `json:"matchExpressions,optional,omitempty"` // 条件匹配表达式(总体指标)
TargetText string `json:"targetText,optional,omitempty"` // 指标名文本
TargetNum string `json:"targetNum,optional,omitempty"` // 指标数值
TargetUnit string `json:"targetUnit,optional,omitempty"` // 指标单位
}
Expression struct {
Operator string `json:"operator"` // 操作符号 <,>,==,<>,<=,>=
CompareValue string `json:"compareValue"` // 比较值
ToValue string `json:"toValue"` // 显示值(转为)
}
Dimension struct{
Name string `json:"name,optional,omitempty"`
Value string `json:"dimensionVal,optional"`
}
type (
ChartProperty {
Title Title `json:"title,optional"` // 标题
TableAbility TableAbility `json:"table,optional"` // 表筛选功能
Series []Series `json:"series,optional"` // 系列(数据源)
Other Other `json:"other,optional"` // 其他额外配置
}
Other {
Quarter *Quarter `json:"quarter,optional,omitempty"` // 四分图
}
Quarter {
XAxisLabel string `json:"xAxisLabel"` // x轴标签名
XAxisFirstLabel string `json:"xAxisFirstLabel"` // 签名1
XAxisSecondLabel string `json:"xAxisSecondLabel"` // 签名2
YAxisLabel string `json:"yAxisLabel"` // y轴标签名
YAxisFirstLabel string `json:"yAxisFirstLabel"` // y标签1
YAxisSecondLabel string `json:"yAxisSecondLabel"` // y标签2
Area string `json:"area"` // 图形面积
AreaColor bool `json:"areaColor"` // 颜色
SeriesList []QuarterSeries `json:"seriesList"` // 图形系列
}
QuarterSeries {
SeriesValue string `json:"seriesValue"`
}
Title {
TitleSwitch bool `json:"titleSwitch,optional"` // 组件标题开关
IntroduceSwitch bool `json:"introduceSwitch,optional"` // 组件说明开关
TitleType string `json:"titleType"` // 标题类型
Heading string `json:"heading,optional"` // 主标题
SubTitle string `json:"subTitle,optional"` // 副标题
ExplainType string `json:"explainType,optional,options=[text,,file]"` // text file ,options=text||file
ExplainTxt string `json:"explainTxt,optional"` // 文字说明
FileName string `json:"fileName,optional"` // 文件名
FileUrl string `json:"fileUrl,optional"` // 组件图片/视频
Align string `json:"align,optional"` // 废弃 文本对齐方式 left center right
HeadingAlign string `json:"headingAlign,optional"` // 主标题 文本对齐方式 left center right
SubAlign string `json:"subAlign,optional"` // 副标题 文本对齐方式 left center right
}
TableAbility {
FilterSwitch bool `json:"filterSwitch,optional"` // 表筛选功能开关
DimensionList []Dimension `json:"dimensionList,optional"` // 维度列表
CardSwitch bool `json:"cardSwitch,optional"` // 顺序标识开关
CardIdent string `json:"cardIdent,optional"` // 顺序标识
CardOrderList []CardOrderItem `json:"cardOrderList,optional"` // 卡片列表顺序
}
CardOrderItem {
CardId string `json:"cardId,optional"`
}
Series { // 图表类型 (记录型表格:RecordTable-1 总体指标:MetricsCard-1 容器卡片:ContainerCard-1 四分图:QuarterChart-1)
Name string `json:"name"` // 名称 (例如 指标1、指标2)
SourceFrom string `json:"from,options=[ByteBank,User]"` // 数据源类型 ByteBank:字库 User:用户自定义
DataSourceId int64 `json:"dataSourceId,optional,omitempty"` // 数据源ID(from值为ByteBank时有值)
CustomText string `json:"customText,optional,omitempty"` // 自定义数据文本(from值为User时有值)
MatchExpressions []Expression `json:"matchExpressions,optional,omitempty"` // 条件匹配表达式(总体指标)
TargetText string `json:"targetText,optional,omitempty"` // 指标名文本
TargetNum string `json:"targetNum,optional,omitempty"` // 指标数值
TargetUnit string `json:"targetUnit,optional,omitempty"` // 指标单位
}
Expression {
Operator string `json:"operator"` // 操作符号 <,>,==,<>,<=,>=
CompareValue string `json:"compareValue"` // 比较值
ToValue string `json:"toValue"` // 显示值(转为)
}
Dimension {
Name string `json:"name,optional,omitempty"`
Value string `json:"dimensionVal,optional"`
}
)
\ No newline at end of file
... ...