grails查询指定列,且以map的形式返回结果集,有两种方式:
1、select new map(id as id,name as name) from User
2、User.createCriteria().list{
projections{
property("id","aliasId")
property("name","aliasName")
}
setResultTransformer(CriteriaSpecification.ALIAS_TO_ENTITY_MAP)
}
原文地址:http://blog.51cto.com/gz521/2054840
时间: 2024-10-29 08:25:55