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

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

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

查看: 5314|回复: 3

[代码生成器] 数据加载问题bug?

[复制链接]
发表于 2018-5-18 22:53:29 | 显示全部楼层 |阅读模式
本帖最后由 zkw1813133460 于 2018-5-18 22:56 编辑

情景:minidao自定义sql查询数据,页面动态列,查询数据生成。调用TagUtil.datagrid方法。加载多次。初次加载3此。录入条件查询加载2次。
下列代码为初次加载报错代码。确认sql语句无误。
版本:3.7.3,3.7.5都有此错误。3.7.2使用TagUtil.datagrid2方法初次加载2此,录入条件查询加载1次。不报错。正常显示。
  1. 打印几次------1===10
  2. 打印几次------1===10
  3. 打印几次------0===10
  4. org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [select techown_report.ID as ID, techown_api.apiname as apiname, t_s_base_user.realname as sale, techown_api.accountname as accountname, techown_customer.customershort as customershort, techown_api.price as price, industry.typename as industryclassification, account.typename as accounttype, billingway.typename as billingway, paymentway.typename as paymentway from techown_report LEFT JOIN techown_api on techown_report.name=techown_api.apiname LEFT JOIN techown_customer on techown_api.customerid=techown_customer.id LEFT JOIN t_s_base_user on t_s_base_user.id=techown_customer.sale LEFT JOIN (select t_s_type.typecode,t_s_type.typename from t_s_type LEFT JOIN t_s_typegroup on t_s_typegroup.ID=t_s_type.typegroupid where t_s_typegroup.typegroupcode='industry') as industry on techown_api.industryclassification=industry.typecode LEFT JOIN (select t_s_type.typecode,t_s_type.typename from t_s_type LEFT JOIN t_s_typegroup on t_s_typegroup.ID=t_s_type.typegroupid where t_s_typegroup.typegroupcode='account') as account on techown_api.accounttype=account.typecode LEFT JOIN (select t_s_type.typecode,t_s_type.typename from t_s_type LEFT JOIN t_s_typegroup on t_s_typegroup.ID=t_s_type.typegroupid where t_s_typegroup.typegroupcode='billingway') as billingway on techown_api.billingway=billingway.typecode LEFT JOIN (select t_s_type.typecode,t_s_type.typename from t_s_type LEFT JOIN t_s_typegroup on t_s_typegroup.ID=t_s_type.typegroupid where t_s_typegroup.typegroupcode='paymentway') as paymentway on techown_api.paymentway=paymentway.typecode where 1=1 and accountname like ? and customershort like ? GROUP BY techown_report.name ORDER BY techown_report.name LIMIT ?,?]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-10,10' at line 1
  5.         at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231)
  6.         at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
  7.         at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:660)
  8.         at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:695)
  9.         at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:722)
  10.         at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:772)
  11.         at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:192)
  12.         at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:199)
  13.         at org.jeecgframework.minidao.aop.MiniDaoHandler.getReturnMinidaoResult(MiniDaoHandler.java:337)
  14.         at org.jeecgframework.minidao.aop.MiniDaoHandler.invoke(MiniDaoHandler.java:106)
  15.         at com.sun.proxy.$Proxy163.getAccountDetails(Unknown Source)
  16.         at com.jeecg.details.controller.TechownAccountDetailsController.datagrid(TechownAccountDetailsController.java:74)
  17.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  18.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  19.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  20.         at java.lang.reflect.Method.invoke(Method.java:498)
  21.         at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
  22.         at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
  23.         at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
  24.         at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:747)
  25.         at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:676)
  26.         at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
  27.         at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
  28.         at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
  29.         at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
  30.         at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
  31.         at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
  32.         at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
  33.         at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
  34.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
  35.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  36.         at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
  37.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  38.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  39.         at org.jeecgframework.core.aop.GZipFilter.doFilter(GZipFilter.java:119)
  40.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  41.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  42.         at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:140)
  43.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  44.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  45.         at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
  46.         at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  47.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  48. [2018-05-18 22:40:26] [ERROR] [org.jeecgframework.core.common.exception.GlobalExceptionResolver:86] 全局处理异常捕获:
  49.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  50. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-10,10' at line 1
  51.         at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)
  52.         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  53.         at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  54.         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  55.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  56.         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  57.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  58.         at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  59.         at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
  60.         at com.mysql.jdbc.Util.getInstance(Util.java:386)
  61.         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
  62.         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)
  63.         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
  64.         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)
  65.         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
  66.         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617)
  67.         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
  68.         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)
  69.         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
  70.         at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2825)
  71.         at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2156)
  72.         at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2323)
  73.         at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeQuery(FilterChainImpl.java:2708)
  74.         at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_executeQuery(FilterEventAdapter.java:465)
  75.         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
  76.         at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeQuery(FilterChainImpl.java:2705)
  77.         at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:625)
  78.         at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.executeQuery(PreparedStatementProxyImpl.java:99)
  79.         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
  80.         at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeQuery(DruidPooledPreparedStatement.java:211)
  81.         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
  82.         at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:703)
  83.         at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:498)
  84.         at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644)
  85.         at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
  86.         at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:695)
  87.         at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:796)
  88.         at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:722)
  89.         at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:772)
  90.         at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:192)
  91.         at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1372)
  92.         at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:199)
  93.         at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
  94.         at org.jeecgframework.minidao.aop.MiniDaoHandler.getReturnMinidaoResult(MiniDaoHandler.java:337)
  95.         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  96.         at org.jeecgframework.minidao.aop.MiniDaoHandler.invoke(MiniDaoHandler.java:106)
  97.         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  98.         at com.sun.proxy.$Proxy163.getAccountDetails(Unknown Source)
  99.         at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  100.         at java.lang.Thread.run(Thread.java:748)
  101. Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-10,10' at line 1
  102.         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  103.         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  104.         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  105.         at com.jeecg.details.controller.TechownAccountDetailsController.datagrid(TechownAccountDetailsController.java:74)
  106.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  107.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  108.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  109.         at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  110.         at java.lang.reflect.Method.invoke(Method.java:498)
  111.         at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
  112.         at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
  113.         at com.mysql.jdbc.Util.getInstance(Util.java:386)
  114.         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
  115.         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)
  116.         at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
  117.         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)
  118.         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617)
  119.         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)
  120.         at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2825)
  121.         at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2156)
  122.         at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2323)
  123.         at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeQuery(FilterChainImpl.java:2708)
  124.         at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_executeQuery(FilterEventAdapter.java:465)
  125.         at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeQuery(FilterChainImpl.java:2705)
  126.         at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.executeQuery(PreparedStatementProxyImpl.java:99)
  127.         at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeQuery(DruidPooledPreparedStatement.java:211)
  128.         at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
  129.         at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:747)
  130.         at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:676)
  131.         at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
  132.         at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
  133.         at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
  134.         at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
  135.         at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
  136.         at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
  137.         at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
  138.         at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:703)
  139.         at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
  140.         at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644)
  141.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
  142.         ... 62 more
  143.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  144.         at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
  145.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  146.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  147.         at org.jeecgframework.core.aop.GZipFilter.doFilter(GZipFilter.java:119)
  148.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  149.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  150.         at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:140)
  151.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  152.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  153.         at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
  154.         at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  155.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  156.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  157.         at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)
  158.         at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  159.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  160.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  161.         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
  162.         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
  163.         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
  164.         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
  165.         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
  166.         at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:625)
  167.         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
  168.         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
  169.         at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:498)
  170.         at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
  171.         at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:796)
  172.         at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1372)
  173.         at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
  174.         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  175.         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  176.         at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  177.         at java.lang.Thread.run(Thread.java:748)
复制代码
下列代码为录入条件查询报错
  1. 打印几次------0===10
  2. org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [select techown_report.ID as ID, techown_api.apiname as apiname, t_s_base_user.realname as sale, techown_api.accountname as accountname, techown_customer.customershort as customershort, techown_api.price as price, industry.typename as industryclassification, account.typename as accounttype, billingway.typename as billingway, paymentway.typename as paymentway from techown_report LEFT JOIN techown_api on techown_report.name=techown_api.apiname LEFT JOIN techown_customer on techown_api.customerid=techown_customer.id LEFT JOIN t_s_base_user on t_s_base_user.id=techown_customer.sale LEFT JOIN (select t_s_type.typecode,t_s_type.typename from t_s_type LEFT JOIN t_s_typegroup on t_s_typegroup.ID=t_s_type.typegroupid where t_s_typegroup.typegroupcode='industry') as industry on techown_api.industryclassification=industry.typecode LEFT JOIN (select t_s_type.typecode,t_s_type.typename from t_s_type LEFT JOIN t_s_typegroup on t_s_typegroup.ID=t_s_type.typegroupid where t_s_typegroup.typegroupcode='account') as account on techown_api.accounttype=account.typecode LEFT JOIN (select t_s_type.typecode,t_s_type.typename from t_s_type LEFT JOIN t_s_typegroup on t_s_typegroup.ID=t_s_type.typegroupid where t_s_typegroup.typegroupcode='billingway') as billingway on techown_api.billingway=billingway.typecode LEFT JOIN (select t_s_type.typecode,t_s_type.typename from t_s_type LEFT JOIN t_s_typegroup on t_s_typegroup.ID=t_s_type.typegroupid where t_s_typegroup.typegroupcode='paymentway') as paymentway on techown_api.paymentway=paymentway.typecode where 1=1 and accountname like ? and customershort like ? GROUP BY techown_report.name ORDER BY techown_report.name LIMIT ?,?]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-10,10' at line 1
  3.         at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231)
  4.         at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
  5.         at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:660)
  6.         at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:695)
  7.         at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:722)
  8.         at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:772)
  9.         at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:192)
  10.         at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:199)
  11.         at org.jeecgframework.minidao.aop.MiniDaoHandler.getReturnMinidaoResult(MiniDaoHandler.java:337)
  12.         at org.jeecgframework.minidao.aop.MiniDaoHandler.invoke(MiniDaoHandler.java:106)
  13.         at com.sun.proxy.$Proxy163.getAccountDetails(Unknown Source)
  14.         at com.jeecg.details.controller.TechownAccountDetailsController.datagrid(TechownAccountDetailsController.java:74)
  15.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  16.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  17.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  18.         at java.lang.reflect.Method.invoke(Method.java:498)
  19.         at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
  20.         at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
  21.         at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
  22.         at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:747)
  23.         at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:676)
  24.         at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
  25.         at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
  26.         at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
  27.         at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
  28.         at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
  29.         at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
  30.         at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
  31.         at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
  32.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
  33.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  34.         at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
  35. [2018-05-18 22:46:04] [ERROR] [org.jeecgframework.core.common.exception.GlobalExceptionResolver:86] 全局处理异常捕获:
  36. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-10,10' at line 1
  37.         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  38.         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  39.         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  40.         at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  41.         at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
  42.         at com.mysql.jdbc.Util.getInstance(Util.java:386)
  43.         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
  44.         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)
  45.         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)
  46.         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617)
  47.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  48.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  49.         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)
  50.         at org.jeecgframework.core.aop.GZipFilter.doFilter(GZipFilter.java:119)
  51.         at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2825)
  52.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  53.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  54.         at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:140)
  55.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  56.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  57.         at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2156)
  58.         at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
  59.         at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  60.         at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2323)
  61.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  62.         at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeQuery(FilterChainImpl.java:2708)
  63.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  64.         at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_executeQuery(FilterEventAdapter.java:465)
  65.         at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeQuery(FilterChainImpl.java:2705)
  66.         at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)
  67.         at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.executeQuery(PreparedStatementProxyImpl.java:99)
  68.         at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  69.         at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeQuery(DruidPooledPreparedStatement.java:211)
  70.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  71.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  72.         at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:703)
  73.         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
  74.         at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644)
  75.         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
  76.         at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:695)
  77.         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
  78.         at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:722)
  79.         at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:772)
  80.         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
  81.         at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:192)
  82.         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
  83.         at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:199)
  84.         at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:625)
  85.         at org.jeecgframework.minidao.aop.MiniDaoHandler.getReturnMinidaoResult(MiniDaoHandler.java:337)
  86.         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
  87.         at org.jeecgframework.minidao.aop.MiniDaoHandler.invoke(MiniDaoHandler.java:106)
  88.         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
  89.         at com.sun.proxy.$Proxy163.getAccountDetails(Unknown Source)
  90.         at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:498)
  91.         at com.jeecg.details.controller.TechownAccountDetailsController.datagrid(TechownAccountDetailsController.java:74)
  92.         at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
  93.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  94.         at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:796)
  95.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  96.         at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1372)
  97.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  98.         at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
  99.         at java.lang.reflect.Method.invoke(Method.java:498)
  100.         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  101.         at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
  102.         at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
  103.         at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
  104.         at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:747)
  105.         at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:676)
  106.         at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
  107.         at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
  108.         at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
  109.         at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
  110.         at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
  111.         at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
  112.         at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
  113.         at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
  114.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
  115.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  116.         at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
  117.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  118.         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  119.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  120.         at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  121.         at org.jeecgframework.core.aop.GZipFilter.doFilter(GZipFilter.java:119)
  122.         at java.lang.Thread.run(Thread.java:748)
  123.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  124. Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-10,10' at line 1
  125.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  126.         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)        at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:140)

  127.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  128.         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  129.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  130.         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  131.         at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
  132.         at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  133.         at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  134.         at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
  135.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  136.         at com.mysql.jdbc.Util.getInstance(Util.java:386)
  137.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  138.         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
  139.         at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)
  140.         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)
  141.         at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  142.         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)
  143.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  144.         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617)
  145.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  146.         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)
  147.         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
  148.         at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2825)
  149.         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
  150.         at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2156)
  151.         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
  152.         at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2323)
  153.         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
  154.         at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeQuery(FilterChainImpl.java:2708)
  155.         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
  156.         at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_executeQuery(FilterEventAdapter.java:465)
  157.         at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:625)
  158.         at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeQuery(FilterChainImpl.java:2705)
  159.         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
  160.         at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.executeQuery(PreparedStatementProxyImpl.java:99)
  161.         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
  162.         at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeQuery(DruidPooledPreparedStatement.java:211)
  163.         at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:498)
  164.         at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:703)
  165.         at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
  166.         at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644)
  167.         at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:796)
  168.         ... 62 more
  169.         at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1372)
  170.         at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
  171.         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  172.         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  173.         at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  174.         at java.lang.Thread.run(Thread.java:748)
复制代码
下列代码为使用TagUtil.datagrid2方法日志
  1. [2018-05-18 22:48:29] [INFO] [org.jeecgframework.web.graphreport.service.impl.core.GraphReportServiceImpl:72] -------------动态报表功能--------querySql--SELECT t.* FROM ( select a.userid, count(*) ct, sum(case when right(logcontent, 4) in ('登录成功', 'cess') then 1 else 0 end) login_count from t_s_log a where 1=1 group by a.userid ) t  order by ct desc
  2. 打印几次------1===10
  3. 打印几次------1===10
复制代码
下列代码为录入条件查询日志,使用TagUtil.datagrid2方法
  1. 打印几次------1===10
复制代码
下列代码为controller   datagrid方法
  1. /**
  2.      * easyui AJAX请求数据
  3.      *
  4.      * @param request
  5.      * @param response
  6.      * @param dataGrid
  7.      * @param
  8.      */

  9.     @RequestMapping(params = "datagrid")
  10.     public void datagrid(TechownAccountDetailsEntity techownAccountDetailsEntity, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
  11.         //查询所有账号信息
  12.         Integer pageNumber = dataGrid.getPage();
  13.         Integer pageSize = dataGrid.getRows();
  14.         Integer beginLimit = (pageNumber - 1) * pageSize;
  15.         Integer endLimit = pageSize;
  16.         System.out.println("打印几次------" + pageNumber + "===" + pageSize);
  17.         List<Map<String, Object>> list = techownAccountDetailsDao.getAccountDetails("%" + techownAccountDetailsEntity.getAccountname() + "%", "%" + techownAccountDetailsEntity.getCustomershort() + "%", beginLimit, endLimit);
  18.         List<String> dates = getMonthBetweenDate(techownAccountDetailsEntity.getDate_begin(), techownAccountDetailsEntity.getDate_end());
  19.         Map<String, Map<String, Object>> extMap = new HashMap<String, Map<String, Object>>();
  20.         for (int i = 0; i < list.size(); i++) {
  21.             Map<String, Object> map = list.get(i);
  22.             if (dates != null) {
  23.                 for (int j = 0; j < dates.size(); j++) {
  24.                     Integer each = techownAccountDetailsDao.getEachApiSendByDate(list.get(i).get("apiname").toString(), dates.get(j));
  25.                     map.put(dates.get(j), each == null ? 0 : each);
  26.                 }
  27.                 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  28.                 String begin = sdf.format(techownAccountDetailsEntity.getDate_begin() == null ? new Date() : techownAccountDetailsEntity.getDate_begin());
  29.                 String end = sdf.format(techownAccountDetailsEntity.getDate_end() == null ? new Date(): techownAccountDetailsEntity.getDate_end());
  30.                 Integer summonth = techownAccountDetailsDao.getSumApiSendByDate(list.get(i).get("apiname").toString(), begin, end);
  31.                 map.put("summonth", summonth == null ? 0 : summonth);
  32.             }
  33.             extMap.put(list.get(i).get("ID").toString(), map);
  34.         }
  35.         dataGrid.setTotal(techownAccountDetailsDao.getAccountDetailsCount("%" + techownAccountDetailsEntity.getAccountname() + "%", "%" + techownAccountDetailsEntity.getCustomershort() + "%"));
  36.         TagUtil.datagrid2(response, dataGrid, extMap);
  37.     }
复制代码
此图片为使用TagUtil.datagrid2方法加载数据
2.png
此图片为使用TagUtil.datagrid方法加载数据
1.png


附上TagUtil.datagrid2和TagUtil.datagrid方法
  1. /**
  2.          * 控件类型:easyui 3.7.2版本方法
  3.          * 返回datagrid JSON数据
  4.          *
  5.          * @param response
  6.          * @param dataGrid
  7.          * @param extMap   数据列表的扩展
  8.          */
  9.         public static void datagrid2(HttpServletResponse response, DataGrid dg, Map<String, Map<String, Object>> extMap) {
  10.                 response.setContentType("application/json");
  11.                 response.setHeader("Cache-Control", "no-store");
  12.                 JSONObject object = TagUtil.getJson(dg);
  13.                 JSONArray r = object.getJSONArray("rows");
  14.                 r.clear();
  15.                 for (Map.Entry<String, Map<String, Object>> map : extMap.entrySet()) {
  16.                         JSONObject o = new JSONObject();
  17.                         o.putAll(extMap.get(map.getKey()));
  18.                         r.add(o);
  19.                 }
  20.                 PrintWriter pw = null;
  21.                 try {
  22.                         pw = response.getWriter();
  23.                         pw.write(object.toString());
  24.                         pw.flush();
  25.                 } catch (IOException e) {
  26.                         e.printStackTrace();
  27.                 } finally {
  28.                         try {
  29.                                 pw.close();

  30.                                 object.clear();

  31.                                 dg.clear();
  32.                                 dg = null;
  33.                                 System.gc();
  34.                                 extMap = null;

  35.                         } catch (Exception e2) {
  36.                                 // TODO: handle exception
  37.                         }
  38.                 }
  39.         }
复制代码
  1. /**
  2.          * 控件类型:easyui
  3.          * 返回datagrid JSON数据
  4.          * @param response
  5.          * @param dataGrid
  6.          * @param extMap 数据列表的扩展
  7.          */
  8.         public static void datagrid(HttpServletResponse response,DataGrid dg,Map<String,Map<String,Object>>  extMap) {
  9.                 response.setContentType("application/json");
  10.                 response.setHeader("Cache-Control", "no-store");
  11.                 JSONObject object = TagUtil.getJson(dg);
  12.                 JSONArray r =  object.getJSONArray("rows");
  13.                 for (Object object2 : r) {
  14.                         JSONObject o =(JSONObject) object2;
  15.                         o.putAll(extMap.get(o.get("id")));
  16.                 }
  17.                 PrintWriter pw = null;
  18.                 try {
  19.                         pw=response.getWriter();
  20.                         pw.write(object.toString());
  21.                         pw.flush();
  22.                 } catch (IOException e) {
  23.                         e.printStackTrace();
  24.                 }finally{
  25.                         try {
  26.                                 pw.close();

  27.                                 object.clear();

  28.                                 dg.clear();
  29.                                 dg = null;
  30.                                 System.gc();
  31.                                 extMap = null;

  32.                         } catch (Exception e2) {
  33.                                 // TODO: handle exception
  34.                         }
  35.                 }
  36.         }
复制代码
 楼主| 发表于 2018-5-18 23:01:01 | 显示全部楼层
附上我的数据格式
3.png
发表于 2018-5-19 16:07:10 | 显示全部楼层
我们没测出这个问题
 楼主| 发表于 2018-5-19 17:59:30 | 显示全部楼层
admin 发表于 2018-5-19 16:07
我们没测出这个问题

问题原因找到了。原因是datagrid设置了默认查询  查了一次  然后在初始化又加载了一次  这就是2次 。
但另外的问题是TagUtil.datagrid的方法又问题。它一直在使用datagrid数据  相当于需要把数据录入datagrid的结果集results中?然后再去用map?感觉这个逻辑有点繁琐了吧 ?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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