gpt4 book ai didi

mysql - GraphQL BigDecimal 的值非法

转载 作者:行者123 更新时间:2023-11-29 18:10:31 25 4
gpt4 key购买 nike

我在下面编写了一个 mysql 查询:

select * from (select a.country country_name,a.country_logo,
count(driver_id) total_empl
,(select count(*) from job where primary_location=a.country) open_jobs
,(select count(*) from catalog_driver where ifnull(country,'')=a.country and (nationality='Omani' or nationality is null )) total_omani_in_oman
,round(((select count(*) from catalog_driver where ifnull(country,'')=a.country and (nationality='Omani' or nationality is null ))/count(driver_id))*100,2) omani_percentage
,(select count(*) from catalog_driver where ifnull(country,'')=a.country and (nationality!='Omani')) total_expat_in_oman
,round(((select count(*) from catalog_driver where ifnull(country,'')=a.country and (nationality!='Omani'))/count(driver_id))*100,2) expat_percentage
,(select count(*) from catalog_driver where ifnull(country,'')=a.country and (gender in ('Male','M')or gender is null) and (nationality='Omani' or nationality is null )) total_male_emp_in_oman
,(select count(*) from catalog_driver where ifnull(country,'')=a.country and (gender in ('FeMale','F')) and (nationality='Omani' or nationality is null ))total_female_emp_in_oman
,(select count(*) from catalog_driver where ifnull(country,'')=a.country and (gender in ('Male','M') or gender is null) and nationality!='Omani' ) total_male_expat_in_oman
,(select count(*) from catalog_driver where ifnull(country,'')=a.country and (gender in ('FeMale','F')) and nationality!='Omani' ) total_female_expat_in_oman
from
(select cd.driver_id,cd.nationality,cd.gender,ifnull(cd.country,'')country,ccr.country_logo
from catalog_driver cd
left join catalog_country ccr on ccr.country_name=cd.country) a
group by a.country)aa where 1= 1

此查询计算按国家/地区分组的员工、空缺职位等的总数。

但是,我在前端使用 Graphql。我在架构定义语言 (SDL) 中将其定义为 countryLevelHistory。我在 graphql UI 中获取countryLevelHistory。当我运行它时,它给出以下错误:

{
"errors": [
"Illegal value for GraphQLBigDecimal:7"
],
"stackTrace": "graphql.GraphQLException: Illegal value for GraphQLBigDecimal:7\r\n\tat com.fuseim.graphql.type.Scalars$2.serialize(Scalars.java:88)\r\n\tat graphql.execution.ExecutionStrategy.completeValueForScalar(ExecutionStrategy.java:154)\r\n\tat
...........
...........
...........
}

我用谷歌搜索了一下,但没有得到好的结果。任何人有任何想法,请告诉我。谢谢

最佳答案

您似乎正在使用 GraphQLBigDecimal,它是 java.math.bigdecimal。该类型应该具有精度(即 7.1)。

在处理作业计数时,您可能需要使用 Int 类型(不需要精度)。

关于mysql - GraphQL BigDecimal 的值非法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47450278/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com