記一次大坑:mybatis查詢結果和接收的不同,折騰我好幾個小時.sql
先上代碼:代碼是要查詢排名,sql執行的結果mybatis
SELECT b.operator_id, b.class_count, b.class_study, b.student_count, b.rownum AS rank, b.rownum AS praiseSum FROM ( SELECT concat((@rownum :=@rownum + 1) + 0, '') AS rownum, operator_id, class_count, class_study, student_count FROM (SELECT @rownum := 0) AS foo, appraise_list WHERE base_id = 120 ORDER BY class_count DESC ) b WHERE b.operator_id = 233
結果,用對象接收的時候,這個字段怎麼都是rank=4.app
這就讓我以爲很奇怪了,最後找到https://blog.csdn.net/bwddd/article/details/80264697 這個博客.spa
粗看感受沒啥聯繫啊,不過仍是抱着嘗試的態度,試了下,盡然好了.net
原mybatis.xml文件code
修改後的文件:xml
修改後,盡然特麼好了!!!!不清楚緣由,等有機會再去了解吧,記錄一下.對象