关注JEECG发展历程 关注最新动态和版本, 记录JEECG成长点滴 更新日志 - 技术支持 - 招聘英才

JEECG最新版本下载 JEECG智能开发平台 - 显著提高开发效率 常见问题 - 入门视频 - 参与开源团队

商务QQ: 69893005、418799587 商务热线(5*8小时): 010-64808099 官方邮箱: jeecgos@163.com

查看: 6301|回复: 5

[Online报表] 动态报表可不可以一次查多表的数据?

[复制链接]
发表于 2018-3-13 18:50:15 | 显示全部楼层 |阅读模式
比如用户表外联部门表
select * from t_s_user u left join t_s_depart d on u.id=d.ID;



发表于 2018-3-13 20:11:26 | 显示全部楼层
可以
 楼主| 发表于 2018-3-13 21:14:50 | 显示全部楼层
我在mysql可以运行出数据,在动态报表上面提示 失败原因:SQL语法错误,您可以给个示范嘛?
发表于 2018-3-13 21:55:53 | 显示全部楼层
你把具体错误截图贴出来
 楼主| 发表于 2018-3-14 09:28:58 | 显示全部楼层
问题是因为两张表都有id,不能用
select * from要指定具体的字段。
不然会报下面错误:
[2018-03-14 09:13:36] [ERROR] [org.hibernate.engine.jdbc.spi.SqlExceptionHelper:144] Duplicate column name 'id'
org.hibernate.exception.SQLGrammarException: Duplicate column name 'id'
        at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:83)
        at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
        at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
        at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
        at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129)
        at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
        at com.sun.proxy.$Proxy132.executeQuery(Unknown Source)
        at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:452)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:402)
        at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:468)
        at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:478)
        at org.springframework.jdbc.core.JdbcTemplate.queryForList(JdbcTemplate.java:518)
        at org.jeecgframework.core.common.dao.jdbc.JdbcDao.findForJdbc(JdbcDao.java:136)
        at org.jeecgframework.web.cgreport.service.impl.core.CgReportServiceImpl.getSqlFields(CgReportServiceImpl.java:133)
        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:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
        at com.sun.proxy.$Proxy105.getSqlFields(Unknown Source)
        at org.jeecgframework.web.cgreport.controller.core.CgReportController.getFields(CgReportController.java:402)
        at org.jeecgframework.web.cgreport.controller.core.CgReportController.getSqlFields(CgReportController.java:366)
        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.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:747)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:676)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:270)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:191)
        at org.jeecgframework.core.aop.GZipFilter.doFilter(GZipFilter.java:119)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:220)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:191)
        at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:140)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:220)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:191)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:220)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:191)
        at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:220)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:191)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:227)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:211)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:817)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:623)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:444)
        at java.lang.Thread.run(Thread.java:748)
发表于 2018-3-14 10:37:08 | 显示全部楼层
?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表