• 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$procInstance
            order 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);
    }
  • 相关阅读:
    Oracle数据库
    Python-aiohttp百万并发
    Sentry的安装搭建与使用
    traceroute命令初探
    Python中断言与异常的区别
    二十三种设计模式及其python实现
    Celery
    SQLAlchemy
    python里使用reduce()函数
    python实现栈
  • 原文地址:https://www.cnblogs.com/acm-bingzi/p/cubaQueryParam.html
Copyright © 2020-2023  润新知