如何传递保存值的变量,而不是直接将值传递给常规搜索条件?
for (def payee in payees)
{
def results = resp.cases.find("eq 'hrid','7547') // hard code values work
def results = resp.cases.find("eq 'hrid',??????) // how can I pass payee
}
我是新手。请帮忙。谢谢
答案 0 :(得分:0)
基于examples,请检查:
usort($array, function($v1, $v2) {
$d1 = strlen($v1->ManuDate) === 4 ? '01-01-' . $v1->ManuDate : $v1->ManuDate;
$d2 = strlen($v2->ManuDate) === 4 ? '01-01-' . $v2->ManuDate : $v2->ManuDate;
return strtotime($d1) - strtotime($d2);
});
答案 1 :(得分:0)
GORM条件查询与您的示例完全不同。假设您有一个Payee
域类,其中包含名为 hrid 的属性:
<强>的grails-app /域/ COM /东西/ Payee.groovy 强>
class Payee {
String hrid
}
要获取Payee
7547 的所有hrid
个实例的列表,您需要运行这样的条件查询:
String hridValue = '7547'
List payees = Payee.withCriteria {
eq 'hrid', hridValue
}
我从右here开始的一系列文章中深入解释了Grails GORM查询。