CUBA在查询语句如何添加参数
生活随笔
收集整理的这篇文章主要介绍了
CUBA在查询语句如何添加参数
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
在browse.xml中的collectionDatasource 可以添加查询语句,使用 “= :custom$param” 的形式
<collectionDatasource id="procActorsDs"class="com.haulmont.bpm.entity.ProcActor"view="procActor-browse"><query><![CDATA[select pa from bpm$ProcActor pa where pa.procInstance.id = :custom$procInstanceorder by pa.procRole.order, pa.order]]></query> </collectionDatasource>
然后在后台Controller类中添加这个参数,datasoure.refresh(params)
public void refresh() {Map<String, Object> params = new HashMap<>();params.put("procInstance", procInstance);procActorsDs.refresh(params); }
如果是在后台中查询,那参数设置就跟JPQL很像了
public static ExcelTable findExcelTableById(DataManager dataManager, UUID entityId) {LoadContext ctx = LoadContext.create(ExcelTable.class).setView("_local");ctx.setQueryString("select et from cip$ExcelTable et where et.id = :entityId").setParameter("entityId", entityId);return (ExcelTable) dataManager.load(ctx); }
总结
以上是生活随笔为你收集整理的CUBA在查询语句如何添加参数的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: Spring——AOP
- 下一篇: AGG第二课 代码框架以及命名规则