起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1752|回复: 1

[处理中4] 查询待办任务

[复制链接]

77

主题

314

帖子

614

积分

高级会员

Rank: 4

积分
614
QQ
发表于 2016-9-9 09:24:02 | 显示全部楼层 |阅读模式
论坛的代码:
Map<String, Object> vars = new HashMap<String, Object>();
                 String condition = TaskUtils.getExecutorCondition("t", ContextHelper.getPerson().getPersonMembers(), true, vars);
                 System.out.println("sadsad");
         System.out.println(condition);
         String query = "select t, t.sName, t.sCURL, t.sProcess, t.sActivity, t.sCreateTime, t.sExecutorFName, t.sExecutorNames, t.sEURL, t.sCreatorFName, t.sShortcut, t.sHints, t.sCreatorFID, t.sExecutorFID, t.sKindID " +
                         " from SA_Task t " +
                         " where (t.sKindID='tkTask' or t.sKindID='tkExecutor' or t.sKindID='tkNotice' or t.sKindID IS NULL) " +
                         " and (t.sStatusID='tesReady' or t.sStatusID='tesExecuting') " +
                         " and (t.sTypeID IS NULL or t.sTypeID <> 'WORKREMIND')" +
                         " and " + condition +
                         " order by  t.sCreateTime desc " +
                         " limit 0,8 ";
         return KSQL.select(query, null, "/system/data", null);

为什么报错:
java.lang.reflect.InvocationTargetException
        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:497)
        at com.justep.system.action.Engine.invokeActions(Native Method)
        at com.justep.system.action.Engine.invokeActions(Unknown Source)
        at com.justep.business.server.BusinessServer.doAction(Unknown Source)
        at com.justep.business.server.BusinessServer.doExcute(Unknown Source)
        at com.justep.business.server.BusinessServer.excute(Unknown Source)
        at com.justep.business.server.BusinessServer.excute(Unknown Source)
        at com.justep.business.server.BusinessServerServlet.execService(Unknown Source)
        at com.justep.business.server.BusinessServerServlet.service(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
        at com.justep.x.bs.BusinessServerServlet.service(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:745)
Caused by: com.justep.exception.BusinessException: 编码: JUSTEP150210; 提示: 执行KSQL出错, KSQL: select t, t.sName, t.sCURL, t.sProcess, t.sActivity, t.sCreateTime, t.sExecutorFName, t.sExecutorNames, t.sEURL, t.sCreatorFName, t.sShortcut, t.sHints, t.sCreatorFID, t.sExecutorFID, t.sKindID  from SA_Task t  where (t.sKindID='tkTask' or t.sKindID='tkExecutor' or t.sKindID='tkNotice' or t.sKindID IS NULL)  and (t.sStatusID='tesReady' or t.sStatusID='tesExecuting')  and (t.sTypeID IS NULL or t.sTypeID <> 'WORKREMIND') and (:_efid0 like concat(t.sExecutorFID, '%')) and t.sExecutorFID like '/%'  order by  t.sCreateTime desc  limit 0,8
--> sql:
--> binds: []
        at com.justep.exception.BusinessException.create(Unknown Source)
        at com.justep.system.data.impl.TableUtilsImplement.ksqlSelect(Unknown Source)
        at com.justep.system.data.impl.TableUtilsImplement.ksqlSelect(Unknown Source)
        at com.justep.system.data.impl.TableUtilsImplement.ksqlSelect(Unknown Source)
        at com.justep.system.data.KSQL.select(Unknown Source)
        at Rss.testTask(Rss.java:654)
        ... 27 more
Caused by: com.justep.exception.BusinessException: 编码: JUSTEP154150; 提示: 找不到变量_efid0对应的值
        at com.justep.exception.BusinessException.create(Unknown Source)
        at com.justep.util.Utils.check(Unknown Source)
        at com.justep.system.ksql.visitor.SQLVisitor.visit(Unknown Source)
        at com.justep.system.ksql.node.VariableNode.accept(Unknown Source)
        at com.justep.system.ksql.visitor.SQLVisitor.visitChildren(Unknown Source)
        at com.justep.system.ksql.visitor.SQLVisitor.visit(Unknown Source)
        at com.justep.system.ksql.node.CompExpressionNode.accept(Unknown Source)
        at com.justep.system.ksql.visitor.SQLVisitor.visitChildren(Unknown Source)
        at com.justep.system.ksql.visitor.SQLVisitor.visit(Unknown Source)
        at com.justep.system.ksql.node.LogicalExpressionNode.accept(Unknown Source)
        at com.justep.system.ksql.visitor.SQLVisitor.visitChildren(Unknown Source)
        at com.justep.system.ksql.visitor.SQLVisitor.visit(Unknown Source)
        at com.justep.system.ksql.node.WhereNode.accept(Unknown Source)
        at com.justep.system.ksql.visitor.SQLVisitor.visitChildren(Unknown Source)
        at com.justep.system.ksql.visitor.SQLVisitor.visit(Unknown Source)
        at com.justep.system.ksql.node.SelectSentenceNode.accept(Unknown Source)
        at com.justep.system.ksql.visitor.SQLVisitor.visitChildren(Unknown Source)
        at com.justep.system.ksql.visitor.QueryVisitor.visit(Unknown Source)
        at com.justep.system.ksql.node.QuerySentence.accept(Unknown Source)
        ... 32 more

0

主题

1639

帖子

497

积分

中级会员

Rank: 3Rank: 3

积分
497
QQ
发表于 2016-9-9 11:46:30 | 显示全部楼层
Map<String, Object> vars = new HashMap<String, Object>();
                 String condition = TaskUtils.getExecutorCondition("t", ContextHelper.getPerson().getPersonMembers(), true, vars);
                 System.out.println("sadsad");
         System.out.println(condition);
         String query = "select t, t.sName, t.sCURL, t.sProcess, t.sActivity, t.sCreateTime, t.sExecutorFName, t.sExecutorNames, t.sEURL, t.sCreatorFName, t.sShortcut, t.sHints, t.sCreatorFID, t.sExecutorFID, t.sKindID " +
                         " from SA_Task t " +
                         " where (t.sKindID='tkTask' or t.sKindID='tkExecutor' or t.sKindID='tkNotice' or t.sKindID IS NULL) " +
                         " and (t.sStatusID='tesReady' or t.sStatusID='tesExecuting') " +
                         " and (t.sTypeID IS NULL or t.sTypeID <> 'WORKREMIND')" +
                         " and " + condition +
                         " order by  t.sCreateTime desc " +
                         " limit 0,8 ";
         return KSQL.select(query, null, "/system/data", null);
打断点,你看看这个query变量拼出来的sql直接放到数据库里能不能运行起来,检查sql是否正确
回复我的时候请点击我当前评论旁边的回复按钮,能保证第一时间看到您的回复,在问题解决后,希望大家可以吧解决方法也分享一下,这样可以让更多的X5开发者共同进步,谢谢大家的知识共享
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-11-24 19:02 , Processed in 0.068381 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

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