刚刚使用mybatis,项目中遇见这样一个问题
select后面的字段我都起了一个别名,但是查询出来的字段确是一个大写一个小写
比如查询结果中msgId 会有两个 msgId=20 MSGId=20 很是奇怪!
于是我将别名全部修改成大写问题解决,不知道是不是mybatis的bug
<select id="listRevertScrip" resultType="hashmap">
SELECT m.msg_id msgId,
m.dt_create_time revertTime,
m.record_id recordId,
m.room_id roomId,
a.ask_id askId,
a.content askContent,
a.dt_create_time askTime,
a.reward reward,
a.username askUsername,
s.answer_id answerId,
s.content revertContent,
s.comment comment,
s.grade grade,
s.username answerUsername
FROM t_liv_message m,
t_liv_scrip_answer s,
t_liv_scrip_ask a
WHERE m.record_id = a.record_id and
m.room_id = a.room_id and
m.msg_id = s.answer_id and
s.ask_id = a.ask_id
<if test="roomId != null and roomId != 0">
AND a.room_id = #{roomId} AND m.room_id = #{roomId}
</if>
<if test="recordId != null and recordId != 0">
AND a.record_id = #{recordId} AND m.record_id = #{recordId}
</if>
<if test="username != null and username != ''">
AND a.username = #{username}
</if>
ORDER BY m.dt_create_time desc
<if test="start != -1 and size != -1">
LIMIT #{start}, #{size}
</if>
</select>
select后面的字段我都起了一个别名,但是查询出来的字段确是一个大写一个小写
比如查询结果中msgId 会有两个 msgId=20 MSGId=20 很是奇怪!
于是我将别名全部修改成大写问题解决,不知道是不是mybatis的bug