GRAILS中Criteria的OR的写法 grailsjavasql
程序员文章站
2024-03-19 23:41:10
...
Person.withCriteria { or { and { eq 'lastName', 'Winter' eq 'firstName', 'Johnny' } and { eq 'lastName', 'Brown' eq 'firstName', 'Jeff' } } }
上面的语言将对应如下SQL语句
select this_.id as id0_0_, this_.version as version0_0_, this_.last_name as last3_0_0_, this_.first_name as first4_0_0_ from person this_ where ( ( this_.last_name='Winter' and this_.first_name='Johnny' ) or ( this_.last_name='Brown' and this_.first_name='Jeff' ) )