其他
我服了,相同SQL下Mybatis查询结果和数据库竟然不一样!
# 问题描述
# 解决办法
<select id="selectByUsernameAndPassword" resultMap="BaseResultMap" parameterType="string">
SELECT
<include refid="Base_Column_List" />
FROM user
where username = '${username}'
and password = '${password}'
</select>
<select id="selectByUsernameAndPassword" resultMap="BaseResultMap" parameterType="string">
SELECT
<include refid="Base_Column_List" />
FROM user
where username = '${username}' and password = '${password}'
</select>
# 异常分析
SELECT id, username, password FROM user where username = 'aaa' # ''
and password = 'xxx'
SELECT id, username, password FROM user where username = 'aaa' # '' and password= 'xxx'
# 总结
同时,分享一份Java面试资料给大家,覆盖了算法题目、常见面试题、JVM、锁、高并发、反射、Spring原理、微服务、Zookeeper、数据库、数据结构等等。
获取方式:点“在看”,关注公众号并回复 面试 领取。