操作失败,nested exception is org.apache.ibatis.exceptions.PersistenceException:
\n### Error querying database.
Cause: java.lang.NullPointerException\n###
The error may exist in cn/com/icbf/operationanalysis/mapper/AccountCustomerDataAnalysisMapper.xml\n### The error may involve
cn.com.icbf.operationanalysis.mapper.AccountCustomerDataAnalysisMapper.cbcAppointCaseAmount\n###
The error occurred while handling results
\n### SQL: select sum(cbc_commission_amount) from account_customer_data_analysis WHERE customer= ?\n### Cause: java.lang.NullPointerException
这个时候查看一下sql查询出的数据是不是NULL,而实体的类型是不是不能为空
我这里的报错是我的字段类型是Bigdecimal而查出来的是null所以需要在sql加上判断:
IFNULL(sum(cbc_commission_amount),0)
select IFNULL(sum(cbc_commission_amount),0) fromaccount_customer_data_analysis
判断不为空就可以正常