mybatis
exception_index
If you can't explain it simply, you don't understand it well enough!
展开
-
mybatis遍历集合List、Array、Map
一、遍历集合1.不用注解public void insertList(List<User> users);<insert id="insertList" parameterType="java.util.List" >insert into user (id,name,password,sex,age)values <foreach collec...原创 2018-07-16 14:36:50 · 9549 阅读 · 0 评论 -
mybatis模糊查询
1、直接使用%,比较简便,可能会导致SQL注入。LIKE "%"#{address,jdbcType=VARCHAR}"%"2、可以有效防止SQL注入问题。LIKE concat('%', #{address,jdbcType=VARCHAR}, '%')原创 2018-07-16 14:47:36 · 288 阅读 · 0 评论 -
Mybatis中批量插入并返回主键笔记
1.mapper中的代码int insertBatchUserReturnId(List<User> users);也可以在形参前面加上@Param("xxxx")xml中的代码,collection必须填list类型<insert id="insertBatchUserReturnId" keyProperty="userId" useGeneratedKe...原创 2018-10-18 08:52:21 · 482 阅读 · 0 评论