1/*
2 * Copyright (C) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { query } from '../SqlLite';
17// import { XpowerStruct } from '../ui-worker/ProcedureWorkerXpower';
18export const queryXpowerMeasureData = (traceId?: string): Promise<
19  Array<{
20    filter_id: number;
21  }>
22> =>
23  query(
24    'queryXpowerMeasureData',
25    `
26    select 
27        name 
28    from     
29        measure_filter mf
30    where
31        mf.type = 'xpower_filter'
32;
33`, {}, {traceId: traceId}
34  );
35export const queryXpowerData = (traceId?: string): Promise<
36  Array<{
37    name: string;
38    num: number;
39    maxValue?: number;
40  }>
41> =>
42  query(
43    'queryXpowerData',
44    `
45    select 
46        name,
47        COUNT(*) num 
48    from     
49        measure_filter mf
50    left join
51        xpower_measure xm
52    on
53        mf.id = xm.filter_id
54    where 
55        mf.type = 'xpower_filter'
56    group by name
57;
58`, {}, {traceId: traceId}
59  );
60
61
62
63