从grails列表中获取特定行

时间:2013-06-11 08:49:00

标签: grails groovy grails-controller

我是grails的新手。我需要制作一份报告。这就是为什么我写了一个返回3行4列的查询。现在我需要将该列表中的每一行保存在不同的对象中。 我不知道。有人可以帮我这个吗?以下是我的尝试:

public List<GroovyRowResult> createDataResultForShoreBank(List<GroovyRowResult> listPrincipalOutstandingData){
        def val = listPrincipalOutstandingData.collect { it.values()}
        println("value  >>> "+val)

}

listPrincipalOutstandingData如下&gt;&gt;&gt;

/* listPrincipalOutstandingData */

       SELECT   lat.project_info_id, la.original_loan_duration, COUNT(la.id) AS loanCount, SUM(lat.principal_outstanding) AS pos
       FROM     loan_account_transaction AS lat
                INNER JOIN loan_account AS la ON (la.id = lat.`loan_account_id`)
                LEFT JOIN group_info AS gi ON (gi.id = lat.`group_info_id`)
                INNER JOIN
                (
                SELECT MAX(ilat.id) AS max_lat_id, ilat.loan_account_id
                FROM loan_account_transaction AS ilat
                WHERE ilat.`domain_status_id` = 1 AND  ilat.`office_info_id` = (SELECT id FROM office_info WHERE office_code =  'UG500013') 
                AND ilat.`project_info_id` IN ('BI0000000000000000000001','BI0000000000000000000003','BI0000000000000000000004') AND ilat.transaction_date <= '2013-04-26'
                GROUP BY ilat.loan_account_id
                ) AS tlat ON (tlat.loan_account_id = lat.`loan_account_id` AND tlat.max_lat_id = lat.id)
                WHERE  lat.`office_info_id` = (SELECT id FROM office_info WHERE office_code =   'UG500013') 
                AND lat.`project_info_id` IN ('BI0000000000000000000001','BI0000000000000000000003','BI0000000000000000000004')
                AND lat.`loan_status_id` != 2 AND lat.`loan_status_id` != 7 AND la.`domain_status_id` = 1 AND lat.`domain_status_id` = 1

                GROUP BY lat.project_info_id, la.original_loan_duration;

0 个答案:

没有答案