随笔分类 -  Mybatis

摘要:如果example传入的值可能为Null,可能会出现删除所有数据的情况。 例子如下: 如果 userId 为空,那么实际执行的sql是不会有 where 条件的全表删除语句。 真的,好傻逼的tkmybatis,简直可以说是弱智 阅读全文
posted @ 2023-03-23 19:33 rongbu2 阅读(27) 评论(0) 推荐(0)
摘要:1.返回值Map mapper.xml <select id="selectUserMapLimitOne" resultType="java.util.HashMap"> select id,name from user order by id desc limit 1 </select> 接口定 阅读全文
posted @ 2021-12-29 15:50 rongbu2 阅读(312) 评论(0) 推荐(0)
摘要:BUG 的情况如下: <if test="a !=null and a='1'.toString()"> and a = #{a} </if> 这样写导致的就是不管a传什么值,最后都会拼接上 and a = 1 这一段SQL。 原因就是 a = '1'.toString() 而不是 a == '1' 阅读全文
posted @ 2021-11-17 22:43 rongbu2 阅读(66) 评论(0) 推荐(0)