I have a domain Payment
class Payment {
String name
PaymentType paymentType
}
PaymentType is an ENUM
to search all payments of a particular payment type is simple
def results = Payment.createCriteria.list = {
'in' ('paymentType', PaymentType.valueOf(params.paymentType))
}
how can i handle the situation when I want to search all Payments against more then one payment type i.e. if params.paymentType is an array?
If paymentType is an array, you can do something like this:
def results = Payment.createCriteria().list {
'in' ('paymentType', params.paymentType.collect{PaymentType.valueOf(it)})
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With