分享

Activiti待办任务查询中基于业务对象的条件查询

 KILLKISS 2013-11-06
Sql代码  收藏代码
  1.   select  
  2.     v.*,t.id_ as taskid     
  3. from  
  4.     provider v  
  5. inner join  
  6.     act_ru_execution e on v.id = e.business_key_             
  7. inner join  
  8.     act_re_procdef p  on e.proc_def_id_ = p.id_        
  9. inner join  
  10.      act_ru_task t on t.proc_inst_id_ = e.proc_inst_id_               
  11. where  
  12.     e.parent_id_ is null  
  13. and e.business_key_ is not null  
  14. and t.assignee_ ='admin'  

 

Sql代码  收藏代码
  1. select  
  2.    v.*, t.id_ as taskid     
  3. from  
  4.      act_ru_task t  
  5. inner join  
  6.     act_ru_execution e on  t.proc_inst_id_ = e.proc_inst_id_         
  7. inner join  
  8.     act_re_procdef p  on e.proc_def_id_ = p.id_        
  9. left join  
  10.       provider v on  v.id = e.business_key_             
  11. where  
  12.     e.parent_id_ is null  
  13. and e.business_key_ is not null  
  14. and t.assignee_ ='admin';  

 上面的代码可能有些问题

 

Sql代码  收藏代码
  1. Hibernate:   
  2.     select  
  3.         count(*) as col_0_0_   
  4.     from  
  5.         tpa_claims claims0_   
  6.     left outer join  
  7.         act_hi_procinst historicpr1_   
  8.             on claims0_.process_instance_id=historicpr1_.id_   
  9.     left outer join  
  10.         act_ru_task tasks2_   
  11.             on historicpr1_.id_=tasks2_.proc_inst_id_   
  12.     left outer join  
  13.         act_re_procdef processdef4_   
  14.             on historicpr1_.proc_def_id_=processdef4_.id_   
  15.     where  
  16.         (  
  17.             historicpr1_.end_time_ is null  
  18.         )   
  19.         and processdef4_.key_=?   
  20.         and tasks2_.assignee_=?  
  21. 2012-07-10 17:57:48,834 [http-9999-5] TRACE [org.hibernate.type.descriptor.sql.BasicBinder] - binding parameter [1] as [VARCHAR] - claims  
  22. 2012-07-10 17:57:48,834 [http-9999-5] TRACE [org.hibernate.type.descriptor.sql.BasicBinder] - binding parameter [2] as [VARCHAR] - 4  
  23. Hibernate:   
  24.     select  
  25.         *   
  26.     from  
  27.         ( select  
  28.             claims0_.id as id76_0_,  
  29.             tasks2_.id_ as id1_68_1_,  
  30.             processdef4_.id_ as id1_66_2_,  
  31.             claims0_.process_instance_id as process7_76_0_,  
  32.             claims0_.claims_date as claims2_76_0_,  
  33.             claims0_.create_date as create3_76_0_,  
  34.             claims0_.creator_id as creator4_76_0_,  
  35.             claims0_.first_check_id as first8_76_0_,  
  36.             claims0_.reality_claim_amount as reality5_76_0_,  
  37.             claims0_.remark as remark76_0_,  
  38.             tasks2_.assignee_ as assignee2_68_1_,  
  39.             tasks2_.create_time_ as create3_68_1_,  
  40.             tasks2_.delegation_ as delegation4_68_1_,  
  41.             tasks2_.description_ as descript5_68_1_,  
  42.             tasks2_.due_date_ as due6_68_1_,  
  43.             tasks2_.execution_id_ as execution7_68_1_,  
  44.             tasks2_.proc_inst_id_ as proc15_68_1_,  
  45.             tasks2_.name_ as name8_68_1_,  
  46.             tasks2_.owner_ as owner9_68_1_,  
  47.             tasks2_.parent_task_id_ as parent10_68_1_,  
  48.             tasks2_.priority_ as priority11_68_1_,  
  49.             tasks2_.proc_def_id_ as proc12_68_1_,  
  50.             tasks2_.rev_ as rev13_68_1_,  
  51.             tasks2_.task_def_key_ as task14_68_1_,  
  52.             processdef4_.category_ as category2_66_2_,  
  53.             processdef4_.deployment_id_ as deployment3_66_2_,  
  54.             processdef4_.dgrm_resource_name_ as dgrm4_66_2_,  
  55.             processdef4_.has_start_form_key_ as has5_66_2_,  
  56.             processdef4_.key_ as key6_66_2_,  
  57.             processdef4_.name_ as name7_66_2_,  
  58.             processdef4_.resource_name_ as resource8_66_2_,  
  59.             processdef4_.rev_ as rev9_66_2_,  
  60.             processdef4_.suspension_state_ as suspension10_66_2_,  
  61.             processdef4_.version_ as version11_66_2_   
  62.         from  
  63.             tpa_claims claims0_   
  64.         left outer join  
  65.             act_hi_procinst historicpr1_   
  66.                 on claims0_.process_instance_id=historicpr1_.id_   
  67.         left outer join  
  68.             act_ru_task tasks2_   
  69.                 on historicpr1_.id_=tasks2_.proc_inst_id_   
  70.         left outer join  
  71.             act_re_procdef processdef4_   
  72.                 on historicpr1_.proc_def_id_=processdef4_.id_   
  73.         where  
  74.             (  
  75.                 historicpr1_.end_time_ is null  
  76.             )   
  77.             and processdef4_.key_=?   
  78.             and tasks2_.assignee_=?   
  79.         order by  
  80.             claims0_.id asc )   
  81.     where  
  82.         rownum <= ?                             --感谢 @咖啡兔  

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约