Files
data-engine/saveWithFields-openapi.json
T
2026-07-02 10:23:07 +08:00

468 lines
14 KiB
JSON

{
"openapi": "3.0.0",
"info": {
"title": "报表引擎 - saveWithFields",
"version": "1.0.0"
},
"servers": [
{
"url": "http://localhost:3013",
"description": "本地开发"
}
],
"paths": {
"/report/report/saveWithFields": {
"post": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/dataengine.controller.report.saveReportWithFieldsReq",
"description": ""
},
"example": {
"id": null,
"businessCode": "KUAISHOU",
"reportCode": "shop_daily",
"reportName": "店铺日报",
"description": "快手电商店铺每日统计报表",
"status": "ACTIVE",
"statTableName": "stat_kuaishou_shop_daily",
"statTableComment": "快手电商-店铺日报",
"dateField": "stat_date",
"primaryKeys": [
"shop_id",
"stat_date"
],
"conflictKeys": [
"shop_id",
"stat_date"
],
"config": {
"sync_frequency": "daily",
"retention_days": 90
},
"fields": [
{
"id": null,
"businessCode": "KUAISHOU",
"reportCode": "shop_daily",
"fieldCode": "shop_id",
"fieldName": "店铺ID",
"fieldType": "STRING",
"dataType": "STRING",
"fieldRole": "DIMENSION",
"isAggregatable": false,
"isFilterable": true,
"isQueryable": true,
"isSortable": false,
"defaultAggregate": "",
"validAggregates": [],
"filterOperators": [
"=",
"!=",
"IN"
],
"expression": "",
"expressionType": "DIRECT",
"formatPattern": "",
"unit": "",
"dictCode": "",
"sortOrder": 1,
"groupName": "基本信息",
"status": "ACTIVE"
},
{
"id": null,
"businessCode": "KUAISHOU",
"reportCode": "shop_daily",
"fieldCode": "order_amount",
"fieldName": "订单金额",
"fieldType": "FLOAT",
"dataType": "STRING",
"fieldRole": "INDICATOR",
"isAggregatable": true,
"isFilterable": false,
"isQueryable": true,
"isSortable": true,
"defaultAggregate": "SUM",
"validAggregates": [
"SUM",
"COUNT",
"AVG",
"MAX",
"MIN"
],
"filterOperators": [],
"expression": "",
"expressionType": "DIRECT",
"formatPattern": "#,##0.00",
"unit": "元",
"dictCode": "",
"sortOrder": 2,
"groupName": "交易指标",
"status": "ACTIVE"
}
]
}
}
}
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/dataengine.controller.report.saveReportWithFieldsRes",
"description": ""
},
"example": {
"success": true,
"id": 1,
"message": "报表及字段保存成功"
}
}
},
"description": ""
}
},
"summary": "保存报表及字段配置(全量替换)",
"tags": [
"报表引擎"
]
}
}
},
"components": {
"schemas": {
"dataengine.controller.report.saveReportWithFieldsRes": {
"properties": {
"success": {
"format": "bool",
"type": "boolean",
"example": true
},
"id": {
"format": "int64",
"type": "integer",
"example": 1
},
"message": {
"format": "string",
"type": "string",
"example": "报表及字段保存成功"
}
},
"type": "object"
},
"dataengine.controller.report.saveReportWithFieldsReq": {
"properties": {
"id": {
"format": "*int64",
"type": "integer"
},
"businessCode": {
"description": "业务编码",
"format": "string",
"type": "string",
"example": "KUAISHOU"
},
"reportCode": {
"description": "报表编码",
"format": "string",
"type": "string",
"example": "shop_daily"
},
"reportName": {
"description": "报表名称",
"format": "string",
"type": "string",
"example": "店铺日报"
},
"description": {
"description": "描述",
"format": "string",
"type": "string",
"example": "快手电商店铺每日统计报表"
},
"status": {
"default": "ACTIVE",
"description": "状态",
"format": "string",
"type": "string",
"example": "ACTIVE"
},
"statTableName": {
"description": "统计宽表名",
"format": "string",
"type": "string",
"example": "stat_kuaishou_shop_daily"
},
"statTableComment": {
"description": "统计宽表注释",
"format": "string",
"type": "string",
"example": "快手电商-店铺日报"
},
"dateField": {
"default": "stat_date",
"description": "日期字段",
"format": "string",
"type": "string",
"example": "stat_date"
},
"primaryKeys": {
"description": "主键字段",
"format": "[]string",
"items": {
"format": "string",
"type": "string"
},
"type": "array",
"example": [
"shop_id",
"stat_date"
]
},
"conflictKeys": {
"description": "冲突键(唯一索引)",
"format": "[]string",
"items": {
"format": "string",
"type": "string"
},
"type": "array",
"example": [
"shop_id",
"stat_date"
]
},
"config": {
"additionalProperties": {
"$ref": "#/components/schemas/interface",
"description": ""
},
"description": "扩展配置",
"format": "map[string]interface {}",
"type": "object"
},
"fields": {
"description": "字段配置列表(全量替换,不在列表中的字段将被删除)",
"format": "[]model.SaveFieldReq",
"items": {
"$ref": "#/components/schemas/dataengine.common.report.model.SaveFieldReq",
"description": ""
},
"type": "array",
"example": [
{
"fieldCode": "shop_id",
"fieldName": "店铺ID",
"fieldType": "STRING",
"fieldRole": "DIMENSION",
"isFilterable": true,
"isQueryable": true,
"sortOrder": 1,
"status": "ACTIVE"
},
{
"fieldCode": "order_amount",
"fieldName": "订单金额",
"fieldType": "FLOAT",
"fieldRole": "INDICATOR",
"isAggregatable": true,
"defaultAggregate": "SUM",
"validAggregates": [
"SUM",
"COUNT",
"AVG"
],
"sortOrder": 2,
"status": "ACTIVE"
}
]
}
},
"required": [
"businessCode",
"reportCode",
"reportName",
"statTableName"
],
"type": "object"
},
"dataengine.common.report.model.SaveFieldReq": {
"properties": {
"id": {
"format": "*int64",
"type": "integer"
},
"businessCode": {
"description": "业务编码",
"format": "string",
"type": "string"
},
"reportCode": {
"description": "报表编码",
"format": "string",
"type": "string"
},
"fieldCode": {
"description": "字段编码",
"format": "string",
"type": "string",
"example": "order_amount"
},
"fieldName": {
"description": "字段名称",
"format": "string",
"type": "string",
"example": "订单金额"
},
"fieldType": {
"description": "字段类型 STRING/INT/FLOAT/DATE/DATETIME/JSONB",
"format": "string",
"type": "string",
"example": "FLOAT"
},
"dataType": {
"default": "STRING",
"description": "数据存储类型",
"format": "string",
"type": "string",
"example": "STRING"
},
"fieldRole": {
"description": "字段角色 DIMENSION/INDICATOR/FILTER/FILTER_ONLY",
"format": "string",
"type": "string",
"example": "INDICATOR"
},
"isAggregatable": {
"description": "是否可聚合",
"format": "bool",
"type": "boolean",
"example": true
},
"isFilterable": {
"default": true,
"description": "是否可筛选",
"format": "bool",
"type": "boolean",
"example": true
},
"isQueryable": {
"default": true,
"description": "是否可查询",
"format": "bool",
"type": "boolean",
"example": true
},
"isSortable": {
"default": true,
"description": "是否可排序",
"format": "bool",
"type": "boolean",
"example": true
},
"defaultAggregate": {
"description": "默认聚合方式",
"format": "string",
"type": "string",
"example": "SUM"
},
"validAggregates": {
"description": "可选聚合列表",
"format": "[]string",
"items": {
"format": "string",
"type": "string"
},
"type": "array",
"example": [
"SUM",
"COUNT",
"AVG"
]
},
"filterOperators": {
"description": "可选操作符列表",
"format": "[]string",
"items": {
"format": "string",
"type": "string"
},
"type": "array",
"example": [
"=",
"!=",
">",
"<",
"IN"
]
},
"expression": {
"description": "表达式(衍生字段)",
"format": "string",
"type": "string",
"example": ""
},
"expressionType": {
"description": "表达式类型 DIRECT/CALCULATED",
"format": "string",
"type": "string",
"example": "DIRECT"
},
"formatPattern": {
"description": "格式化模板",
"format": "string",
"type": "string",
"example": "#,##0.00"
},
"unit": {
"description": "单位",
"format": "string",
"type": "string",
"example": "元"
},
"dictCode": {
"description": "字典编码",
"format": "string",
"type": "string",
"example": ""
},
"sortOrder": {
"description": "排序",
"format": "int",
"type": "integer",
"example": 1
},
"groupName": {
"description": "分组名称",
"format": "string",
"type": "string",
"example": "交易指标"
},
"status": {
"default": "ACTIVE",
"description": "状态",
"format": "string",
"type": "string",
"example": "ACTIVE"
}
},
"required": [
"fieldCode",
"fieldName",
"fieldType",
"fieldRole"
],
"type": "object"
},
"interface": {
"properties": {},
"type": "object"
}
}
}
}