Closed wusyJava closed 4 years ago
用原生 SQL 这样写,JPA 会默认转成大写的。虽然是大写的,不过你也可以用小写去 get
里面的元素也是可以得到数据的。
如果非要转成小写的话,你得用 JPQL 语句去写,以 new map
返回就是小写的了,示例如:
SELECT new map(userId as id, userName as name, account as account, companyName as companyName,groupPath as groupPath) FROM User
好的,谢谢!
wushanying@foxmail.com
发件人: 闪烁之狐 (blinkfox) 发送时间: 2019-12-10 00:08 收件人: blinkfox/fenix 抄送: wusyJava; Author 主题: Re: [blinkfox/fenix] 查询结果问题 。 (#6) 用原生 SQL 这样写,JPA 会默认转成大写的。虽然是大写的,不过你也可以用小写去 get 里面的元素也是可以得到数据的。 如果非要转成小写的话,你得用 JPQL 语句去写,以 new map 返回就是小写的了,示例如: SELECT new map(userId as id, userName as name, account as account, companyName as companyName,groupPath as groupPath) FROM User — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
sql为: SELECT user_id as id, user_name as name, account as account,companyname as companyName,grouppath as groupPath FROM user java为: @QueryFenix(value = "SysUserDao.queryForRoleSelList", nativeQuery = true) List<Map<String, Object>> queryForRoleSelList(SysUserParams params, Set orders);
如何让Map 中的key 为id 而不是ID