给出代码片段(请不要问我为什么用这种方式构建它...)
...some more Logic...
def blaParam = ['checkinable':checkinable]
def blaQuery = " AND c.product = :checkinable"
...some more Logic...
和
def paramBox = [] + blaParam
def queryBox = "" + blaQuery
def c = Bla.executeQuery("FROM Bla b WHERE 1 = 1 "+queryBox+" ", paramBox, [max:params.max])
我最后收到了一条消息
errors.GrailsExceptionResolver Remember that ordinal parameters are 1-based!
如何防止这种情况?
答案 0 :(得分:1)
合并最后两个参数贴图对我有用:
Bla.executeQuery("FROM Bla b WHERE 1 = 1 "+queryBox+" ", paramBox + [max:params.max])
答案 1 :(得分:1)
如果我改变
def paramBox = [] + blaParam
到
def paramBox = [:] + blaParam
它正在运作