27.flowable 自定义sql查询

网友投稿 1511 2022-09-17

27.flowable 自定义sql查询

27.flowable 自定义sql查询

业务场景:在实际开发中,由于我们需要一些flowable的个性化查询,而且他们提供的api无法满足我的需求的时候,这个时候我们应该考虑flowable有没有那种自定义的sql方式,其实flowable已经给我们预留了这样的接口方便我们随意扩展。 这里我就讲一种注解的方式扩展自定义sql查询 1、首先我们要定义一个mapper接口public interface CustomCommentMapper { @Select({ "select t.* from act_hi_comment t where t.PROC_INST_ID_ = #{procInstId}" }) List> selectCommentsByProcInstId(String procInstId);} 2、配置mapper到config里面//自定义sql Set> customMybatisMappers = new HashSet<>(); customMybatisMappers.add(CustomCommentMapper.class); configure.setCustomMybatisMappers(customMybatisMappers); 3、定义service@Servicepublic class CustomCommentService { @Autowired private ManagementService managementService; public List> getCommentsByProcInstId(String procInstId) { CustomSqlExecution>> customSqlExecution = new AbstractCustomSqlExecution>>(CustomCommentMapper.class) { @Override public List> execute(CustomCommentMapper customMapper) { return customMapper.selectCommentsByProcInstId(procInstId); } }; return managementService.executeCustomSql(customSqlExecution); }} 4、测试@Test public void testXml() { List> comments = customCommentService.getCommentsByProcInstId("aa798e711a9a11eaa07cdc8b287b3603"); System.out.println(comments); }

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:将十进制数据转换为二进制AND将二进制数据转换为十进制!(二进制数据转换成十进制数)
下一篇:#yyds干货盘点#windows server 2012 R2基本磁盘
相关文章

 发表评论

暂时没有评论,来抢沙发吧~