当前使用版本(必填,否则不予处理)
3.4.2
该问题是如何引起的?(确定最新版也有问题再提!!!)
group by之后统计条数,
select count(*)
from (
SELECT
entity_relation_id,
entity1_id as entity_id
FROM fb_entity_relation_detail ferd
WHERE ferd.entity_relation_id = #{entityRelationId,jdbcType=VARCHAR}
and ferd.entity1_id
in
<foreach open="(" close=")" separator="," collection="entityIds" item="item" index="index">
#{item}
</foreach>
group BY entity1_id
) as temp
where temp.entity_relation_id = #{entityRelationId,jdbcType=VARCHAR}
重现步骤(如果有就写完整)
报错信息
throwable : org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
Error querying database. Cause: java.lang.ClassCastException: net.sf.jsqlparser.statement.select.SubSelect cannot be cast to net.sf.jsqlparser.schema.Table
The error may exist in file [/Users/edy/Desktop/code/fenbei-form/fenbei-entity-relation/fenbei-entity-relation-dao/target/classes/sqlMapper/EntityRelationDetailMapper.xml]
The error may involve com.fenbei.entityrelation.dao.entityrelationdetail.EntityRelationDetailDAO.selectCountEntity1RelationDetailInfo
The error occurred while executing a query
Cause: java.lang.ClassCastException: net.sf.jsqlparser.statement.select.SubSelect cannot be cast to net.sf.jsqlparser.schema.Table
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:92)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:440)
at com.sun.proxy.$Proxy169.selectOne(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:159)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:90)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:148)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)
at com.sun.proxy.$Proxy224.selectCountEntity1RelationDetailInfo(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
at com.finhub.framework.core.aspect.AbstractAspect.proceedWithLog(AbstractAspect.java:58)
at com.finhub.framework.mybatis.aspect.DaoCostLogAspect.aroundAdvice(DaoCostLogAspect.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
at org.springframework.aop.aspectj.Asp
Comment From: miemieYaho
?
Comment From: yeohx
已解决