MyBatis返回Map鍵值對數據


List<Map<String, String>> getMtypeList();
<select id="getMtypeList" resultType="java.util.HashMap">
    select code,`name` from jk_control_measure
</select>
[DEBUG] 2016-08-29 17:50:09 :==>  Executing: select code,`name` from jk_control_measure 
[DEBUG] 2016-08-29 17:50:09 :==> Parameters: 
[DEBUG] 2016-08-29 17:50:10 :<==    Columns: code, name
[DEBUG] 2016-08-29 17:50:10 :<==        Row: one, 地面沖洗
[DEBUG] 2016-08-29 17:50:10 :<==        Row: two, 邊界圍擋
[DEBUG] 2016-08-29 17:50:10 :<==        Row: three, 垃圾覆蓋
[DEBUG] 2016-08-29 17:50:10 :<==        Row: four, 裸地覆蓋
[DEBUG] 2016-08-29 17:50:10 :<==        Row: five, 灑水降塵
[DEBUG] 2016-08-29 17:50:10 :<==        Row: six, 車輛沖洗
[DEBUG] 2016-08-29 17:50:10 :<==        Row: seven, 建築渣土
[DEBUG] 2016-08-29 17:50:10 :<==        Row: eight, 車輛冒裝
[DEBUG] 2016-08-29 17:50:10 :<==        Row: nine, 揚塵覆蓋
[DEBUG] 2016-08-29 17:50:10 :<==        Row: ten, 車輛撒漏
[DEBUG] 2016-08-29 17:50:10 :<==        Row: eleven, 車輛黑煙
[DEBUG] 2016-08-29 17:50:10 :<==        Row: twelve, 道路積塵
[
{"NAME":"地面沖洗","name":"地面沖洗","code":"one","CODE":"one"},
{"NAME":"邊界圍擋","name":"邊界圍擋","code":"two","CODE":"two"},
{"NAME":"垃圾覆蓋","name":"垃圾覆蓋","code":"three","CODE":"three"},
{"NAME":"裸地覆蓋","name":"裸地覆蓋","code":"four","CODE":"four"},
{"NAME":"灑水降塵","name":"灑水降塵","code":"five","CODE":"five"},
{"NAME":"車輛沖洗","name":"車輛沖洗","code":"six","CODE":"six"},
{"NAME":"建築渣土","name":"建築渣土","code":"seven","CODE":"seven"},
{"NAME":"車輛冒裝","name":"車輛冒裝","code":"eight","CODE":"eight"},
{"NAME":"揚塵覆蓋","name":"揚塵覆蓋","code":"nine","CODE":"nine"},
{"NAME":"車輛撒漏","name":"車輛撒漏","code":"ten","CODE":"ten"},
{"NAME":"車輛黑煙","name":"車輛黑煙","code":"eleven","CODE":"eleven"},
{"NAME":"道路積塵","name":"道路積塵","code":"twelve","CODE":"twelve"}
]

返回的結果帶有大寫與小寫的key

 

如果在sql語句中的列名使用大寫會怎樣呢?自己測試一下吧!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM