SQL から返されたいくつかの行を grails 選択に入力しようとしていますが、何らかの理由で機能していません。次のコードがあります。
コントローラ:
import groovy.sql.Sql
class ClinicalRequirementsController {
static allowedMethods = [save: "POST", update: "POST", delete: "POST"]
def dataSource //injection of dataSource
def create() {
def db = new Sql(dataSource)
def terms = db.rows("""SELECT stvterm_code
FROM stvterm
WHERE stvterm_fa_proc_yr = (SELECT stvterm_fa_proc_yr
FROM stvterm, current_term
WHERE stvterm_code = current_term.cur_term)
ORDER BY stvterm_code ASC""")
[terms: terms]
db.close()
[clinicalRequirementsInstance: new ClinicalRequirements(params)]
}
}
GSP セレクト:
<g:select name="insuranceSemesterVerified" from="${terms}" required="" value="${clinicalRequirementsInstance?.insuranceSemesterVerified}" valueMessagePrefix="clinicalRequirements.insuranceSemesterVerified"/>
私はかなり困惑しています。うまくいけば、誰かが私を間違っているところに向けることができます。他の場所のデータベースに対してクエリを既に確認しました。