0
我的員工域具有相關的部門,部門和職位,這些部門本身都是域。這種關係被編碼爲嘗試創建條件的方法缺失
class Employee
{
...
String firstName
String lastName
Position position
Division division
Department department
...
}
(注意,沒有belongsTo
或hasOne
關係)我在每一個這些從下拉列表中選擇的ID發送帶有
<g:select name="department" from="${Department.list()}" optionKey="id" optionValue="${{it.name}}" />
(同樣,對於司和位置),但我得到一個錯誤的代碼查詢數據庫
def employeeList = Employee.createCriteria().list(sort: params.sort, order: params.order)
{
and
{
ilike "firstName", "%${params.firstName}%"
ilike "lastName", "%${params.lastName}%"
}
position
{
eq "position", ${params.position}
}
department
{
eq "department", ${params.department}
}
division
{
eq "division", ${params.division}
}
}
我得到的錯誤是
No signature of method: EmployeeController.department() is applicable for argument types: (EmployeeController$_results_closure1_closure4) values: [[email protected]]
我試圖把在該司/部門/位置eq
片段的和塊內,但失敗,出現錯誤
No signature of method: EmployeeController.and() is applicable for argument types: (EmployeeController$_results_closure1_closure4) values: [[email protected]]
任何想法我做錯了嗎?