My Employee 域具有关联的部门、部门和职位,它们本身都是域。这种关系编码为
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: [EmployeeController$_results_closure1_closure4@f559db0]
我尝试在eq
and 块内放入部门/部门/职位片段,但失败并出现错误
No signature of method: EmployeeController.and() is applicable for argument types: (EmployeeController$_results_closure1_closure4) values: [EmployeeController$_results_closure1_closure4@2f3302f3]
任何想法我做错了什么?