我有一个域对象,其结构如下-
`
class TaxPlan {
String taxCode
String description
Double taxRate
Timestamp dateCreated
Timestamp lastUpdated
static belongsTo = [location: Location]
}
我想优化“位置”属性以使用bindUsing注释。我怎么做?我想要类似下面的代码-
class TaxPlan {
String taxCode
String description
Double taxRate
Timestamp dateCreated
Timestamp lastUpdated
@BindUsing({
obj, source ->
Location.findByStoreNumber(source['location'])?:RequestContextHolder.currentRequestAttributes()?.session.location
})
static belongsTo = [location: Location]
}