Passing Enum List to Criteria

前端 未结 2 1103
一个人的身影
一个人的身影 2021-01-14 10:05

I have a domain Payment

class Payment {
  String name
  PaymentType paymentType
}

PaymentType is an ENUM

to search

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-14 10:49

    If paymentType is an array, you can do something like this:

    def results = Payment.createCriteria().list {
       'in' ('paymentType', params.paymentType.collect{PaymentType.valueOf(it)})
    }
    

提交回复
热议问题