0

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

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

}

listPrincipalOutstandingData 如下 >>>

/* 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;
4

0 回答 0