0

我有以下 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 返回奖学金。

4

1 回答 1

1

您应该使用相应or{}的 andand{}子句:

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)
  }
}
于 2015-04-02T22:06:52.790 回答