新增黄金指标统计展示
This commit is contained in:
@@ -8,7 +8,6 @@ import { parseObjLineToHump } from '@/utils/parse-utils';
|
||||
* @returns object
|
||||
*/
|
||||
export async function listgoldData(query: Record<string, any>) {
|
||||
//console.log(query);
|
||||
let totalSQL = 'select count(*) as total from gold_kpi where 1=1 ';
|
||||
let rowsSQL =
|
||||
'SELECT gold_kpi.*,kpi_title.en_title FROM gold_kpi LEFT JOIN kpi_title on gold_kpi.kpi_id=kpi_title.kpi_id where 1=1 ';
|
||||
@@ -88,12 +87,11 @@ export async function listgoldData(query: Record<string, any>) {
|
||||
* @returns object
|
||||
*/
|
||||
export async function goldData(query: Record<string, any>) {
|
||||
//console.log(query);
|
||||
// 发起请求
|
||||
let insertKpiId: string[]=[];
|
||||
let insertWhere: string[]=[];
|
||||
query.goldArr.forEach((item: any)=> {
|
||||
insertKpiId.push(`SUM(CASE WHEN kpi_id = '${item}' THEN value ELSE 0 END) AS ${item.split(".")[0]+'_'+item.split(".")[1]} `);
|
||||
insertKpiId.push(`SUM(CASE WHEN kpi_id = '${item}' THEN value ELSE 0 END) AS \`${item}\``);
|
||||
insertWhere.push(`'${item}'`);
|
||||
})
|
||||
const result = await request({
|
||||
@@ -103,7 +101,7 @@ export async function goldData(query: Record<string, any>) {
|
||||
rowsSQL:`SELECT CONCAT(DATE_FORMAT(start_time, '%Y-%m-%d %H:'), LPAD(FLOOR(MINUTE(start_time) / ${query.particle}) * ${query.particle}, 2, '0'), ':00') AS time_interval,`+
|
||||
insertKpiId.join(",")+
|
||||
" FROM gold_kpi"+
|
||||
` WHERE ne_type='UPF' and kpi_id in (${insertWhere.join(",")}) and start_time BETWEEN '${query.beginTime}' AND '${query.endTime}'`+
|
||||
` WHERE ne_type='${query.neType[0]}' and kpi_id in (${insertWhere.join(",")}) and start_time BETWEEN '${query.beginTime}' AND '${query.endTime}'`+
|
||||
` GROUP BY DATE_FORMAT(start_time, '%Y-%m-%d %H:'), FLOOR(MINUTE(start_time) / ${query.particle})`+
|
||||
" ORDER BY start_time",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user