【发布时间】:2012-03-30 09:46:50
【问题描述】:
我有两个域类。
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类型?它会让你的事情变得更容易。 -
我已将状态更改为枚举类型。枚举状态{ ACTIVE(true), INACTIVE(false) private boolean bool public Status(boolean bool){ this.bool = bool } }