大家好我有这个Grails代码:
free_search = ReportFree.createCriteria().list {
or {
report{
ilike("description", "%${params.search}%")
ilike("type", "%${params.search}%")
debitor {
and {
'in'('id', session.position?: 'VMD000000')
ilike("NAME", "%${params.search}%")
}
}
}
}
eq('open', true)
eq('copy', true)
}
我以为我从中获得了以下SQL:
select rf.* from report_free
inner join report r on rf.report_reportid = r.reportid and rf.report_type=b.type
inner join debitor deb on deb.CODE_ID=b.debitor
where (
b.description like '%something to search%'
or b.type like '%something to search%'
or (
deb.NAME like '%something to search%' and deb.CODE_ID in (List of Deb)
)
)
and rf.open=1 and rf.copy=1`
但它不起作用。我得到一个空列表。
我将SQL-Loggin打开为true。 Grails输出以下语句:
我替换了“this”和“?”
from
report_free
left outer join
report
on report_free.report_reportid=report.reportid
and report_free.report_type=report.type
left outer join
debitor
on debitor.CODE_ID=report.debitor
where
(
(
lower(report_free.description) like '%SOMETHING TO SEARCH%'
and lower(report.type) like '%SOMETHING TO SEARCH%'
and (
(
debitor.CODE_ID in (
'LIST OF ELEMENTS'
)
and lower(debitor.NAME) like '%SOMETHING TO SEARCH%'
)
)
)
)
and report_free.open=1
and report_free.copy=1
任何人都可以帮我解决这个问题
问候