我有以下Grails withCriteria结构:
allInfo = Scholarship.withCriteria {
between('gpa', '0', gpa)
grades {
idEq year
}
scholarshipCounties {
eq('county.id', county)
}
majors {
idEq major
}
activities {
idEq activity
}
eq('specialTypeInd', special)
}
我希望通过(gpa和成绩和专业)或奖学金计划或活动或specialTypeInd返回奖学金。
答案 0 :(得分:1)
您应该使用相应的or{}
和and{}
条款:
allInfo = Scholarship.withCriteria {
and{
between('gpa', '0', gpa)
grades {
idEq year
}
majors {
idEq major
}
}
or{
scholarshipCounties {
eq('county.id', county)
}
activities {
idEq activity
}
eq('specialTypeInd', special)
}
}