
Mybatis
lwf006164
嗯,想了解请联系我。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Mybatis篇.如何获取自增的id
添加useGeneratedKeys=“true” keyProperty=“id” //示例 <insert id="addErrorLogAsync" useGeneratedKeys="true" keyProperty="id"> insert into error_log ( id, server_name, class_na...原创 2019-07-18 18:06:12 · 555 阅读 · 0 评论 -
Mybatis篇.在xml文件中迭代数组与集合
数组 //判断数组是否为空且长度是否为0 <if test="id != null and id.length > 0"> <foreach collection="id" open="(" close=")" item="item" separator=","> ${item} </foreach> </if> 集合 //判断集合是...原创 2019-07-18 18:12:10 · 397 阅读 · 0 评论 -
Mybatis篇.$与#的区别
$ select * from a where id = ${recId} 最后生成的SQL为: 1select * from a where id = 1 即:直接将参数值替换到了原来${recId}的位置,相当于硬拼SQL # select * from a where id = #{recid} 最后生成的SQL为: select * from a where id = ? 即:#{......原创 2019-07-18 18:29:24 · 142 阅读 · 0 评论