java项目 sql嵌套查询无法识别到占位符?,导致了前端服务器响应异常

java项目 sql嵌套查询无法识别到占位符?,导致了前端服务器响应异常

这里是我的两个占位符

   #sql ("queryReceivablesPlansByContractId")
        select a.plan_id,a.num,a.money,e.money2,a.return_type,date(a.return_date) as return_date
        from 72crm_crm_receivables_plan as a left join 72crm_crm_receivables as b on a.receivables_id = b.receivables_id
            left JOIN (select numnew,sum(money) as money2 from 72crm_crm_receivables where numnew is not null and plan_id
            is not null and contract_id = ? group by numnew) as e
            on a.num=e.numnew
        where a.contract_id = ? group by num
    #end

然后这里是进行参数的入参

img

    public R queryReceivablesPlansByContractId(Integer contractId, Integer receivablesId){
        List<Record> recordList = Db.find(Db.getSql("crm.receivablesplan.queryReceivablesPlansByContractId"),contractId,contractId);
        if (receivablesId != null){
            Record receivables = Db.findFirst("select plan_id,num,money,return_type,date(return_date) as return_date from " +
                    "72crm_crm_receivables_plan where receivables_id = ?", receivablesId);
            if (receivables != null){
                recordList.add(receivables);
            }
        }
        return R.ok().put("data",recordList);
    }

结果报错

img

img

注:我的mysql版本是5.7,sql文件中没有多余的注释这些

我猜是sql本身的问题吧,你这个sql在客户端上单独执行过吗?
另外,你可以把sql和代码用插入代码块的方式贴出来。方便大家修改。