### Cause: java.lang.reflect.UndeclaredThrowableException Caused by: org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.reflect.UndeclaredThrowableException### The error may exist in file [E:\codeBase\top713\superrescue-service\target\classes\mybatis\qc\TechserviceEffiserviceEntityMapper.xml]### The error may involve com.jn.ssr.superrescue.web.serviceEffi.dao.TechserviceEffiserviceEntityMapper.findTechEffi### The error occurred while executing a query Caused by: net.sf.jsqlparser.parser.ParseException: Encountered " "(" "( "" at line 2, column 8.Was expecting one of:"AS" ..."DO" ..."ANY" ..."KEY" ..."PERCENT" ..."END" ...
mybatis的错误,将sql放在Navicat中执行都可以
然后在<select></select>中写一个简单sql,发起情求,sql可以执行,说明mapper映射与resultMap还有parmaterType等没有错误
将sql的字段一个一个的字段进行删除然后执行,判断是哪个字段出错,最后找出是
SUM(o.service_type!='TC') AS repair_number,
这个字段,仿佛是mybatis不支持 SUM(列名)的格式
最后将这个字段修改为:
(select count(service_type) from or_rescue_order oro where service_type!="TC" and o.id = oro.id) AS repair_number,
就可以了