版本:1.3 WIN MYSQL
统计数值目前只支持显示一个度量结果,请把维度去掉试试。
环境变量设置 DB_LOGGING=on
看一下执行查询的时候执行的 SQL 是什么
2024-08-25 15:47:42 [debug] Executing (default): SELECT count(employee
.state
) AS 人数
FROM employee
AS employee
LEFT OUTER JOIN ( tradingpartnerorg
AS orgaffiliation->tradingpartnerorg
INNER JOIN organizational
AS orgaffili ation
ON orgaffiliation
.id
= orgaffiliation->tradingpartnerorg
.organizat ional_id
) ON employee
.id
= orgaffiliation->tradingpartnerorg
.employee_id
WHERE (employee
.state
IN (‘2’) AND (orgaffiliation
.fullcode
LIKE ‘%1%’
OR orgaffiliation
.fullcode
LIKE ‘%2%’ OR orgaffiliation
.fullcode
LIKE ’
%4%’ OR orgaffiliation
.fullcode
LIKE ‘%3%’) AND (employee
.delete
IS NULL
OR employee
.delete
= false)) LIMIT 2000; app=main reqId=5cdbef29-2edf-4ca8-
8e17-f8f2dce565de
2024-08-25 15:47:42 [info] response /api/charts:query method=
POST path=/api/charts:query res={“status”:200} action={“actionName”:“query”,“res
ourceName”:“charts”,“params”:{“resourceName”:“charts”,“actionName”:“query”,“valu
es”:{“data”:[{“人数”:2}],“fieldMap”:{“人数”:{“alias”:“人数”,“field”:“employee.st
ate”,“aggregation”:“count”,“name”:“state”,“type”:“string”}}},“filter”:{“$and”:[{
“state”:{“$in”:[“2”]}},{“orgaffiliation”:{“fullcode”:{“$includes”:[“1”,“2”,“4”,"
3"]}}},{“delete”:{“$isFalsy”:true}}]}}} userId=2 status=200 cost=56 app=main req
Id=5cdbef29-2edf-4ca8-8e17-f8f2dce565de
大概知道问题了,可以先把度量中的“在职状态”换成 ID 之类的非枚举字段。