我有兩個域類。grails中的過濾列表
class BillingServiceGroup
{
Integer billingServiceGroupCode
String billingServiceGrpDesc
String status // ACTIVE or INACTIVE
}
class ServiceGroup
{
String serviceGroupName
String description
BillingServiceGroup billingServiceGroup
}
當我查看serviceGroup
頁面。它顯示了所有billingServiceGroup
的列表,但我的要求是隻有具有status == ACTIVE
的行才能顯示在列表中。
所以我必須根據狀態的值過濾列表。任何人都可以提供一些代碼來實現這個邏輯?
爲什麼你'status'場不是'boolean'或'enum'類型?它會讓你更容易。 – 2012-03-30 11:49:26
我已將狀態更改爲枚舉類型。枚舉狀態{ \t \t ACTIVE(真), \t \t無效(假) \t \t私人布爾布爾 \t \t公共狀態(布爾布爾){ \t \t \t this.bool =布爾 \t \t} \t} – 2012-03-30 13:23:35