智慧屏安装APP的最佳实践与跨平台小程序开发的结合
1137
2023-01-03
mybatis返回类型map时如何将key大写转为小写
亲测:
SELECT DEPTNO as "deptno",DEPTNAME,DEPTGRADE,PARENTDEPT
FROM VMGR_DEPT
ORDER BY DEPTGRADE,DEPTNO
别人案例:
SELECT id AS "id", title AS "title", content AS "content" FROM Blog WHERE id = #{id}
public class Snippet {
public static Map
Map
if (orgMap == null || orgMap.isEmpty()) {
return resultMap;
}
Set
for (String key : keySet) {
String newKey = key.toLowerCase();
newKey = newKey.replace("_", "");
resultMap.put(newKey, orgMap.get(key));
}
return resultMap;
}
}
mybatis映射map返回的全是大写
解决方法
在查询的字段后加别名
user_id as “userId”
注意:别名必须加双引号
SELECT A.SELL_PRICE as "price", B.USEHnVuOVjqDR_ID as "userId"
FROM QLYY_SELL_AUCTION_RECORD A, QLYY_SELL_APPLY B
WHERE A.SELL_PRICE = (SELECT MAX(SELL_PRICE)
FROM QLYY_SELL_AUCTION_RECORD
WHERE SELL_PROGRAM_ID = #{programId})
AND A.SELL_PROGRAM_ID = #{programId}
AND B.APPLY_CODE = A.SELL_USER
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~