- import groovy.sql.Sql
- class TestService{
- def dataSource//注入数据源
- def execute(){
- def db = new Sql(dataSource)
- db.rows('select * from user')
- db.eachRow('select * from user'){ println it }
- db.rows('call stp_select_user()')
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/19112012477.html
来源: http://www.codesnippet.cn/detail/19112012477.html