随笔分类 - mybatis
摘要:1.#{}和{} 将传入的数据直接进行sql拼接,不会加引号 可以用来表示表名select ${columns}
阅读全文
摘要:1. 纯注解 2. 顺序传参法 3. POJO传参法 4. Map传参法 5. DML操作 6. 通过注解实现结果集与对象的映射 7. 一对一的关联查询 8. 一对多的关联查询
阅读全文
摘要:1. 多表关联查询 1. resultMap的基础使用场景 解决实体与结果集的映射 <resultMap id="usersMapper" type="com.bjsxt.pojo.users"> <id property="userid" column="id"/> <result propert
阅读全文
摘要:1. 动态SQL if标签 <select id="selectUsersByProperty" resultType="users"> select * from users where 1=1 <if test="userid != 0"> and userid = #{userid} </if
阅读全文
摘要:1. Mapper动态代理规范 接口名称需要与映射配置文件名称相同 映射配置文件中 namespace 必须是接口的全名。 接口中的方法名和映射配置文件中的标签的 id 一致。 接口中的返回值类型和映射配置文件中的 resultType 的指定的类型一致 2. Mapper动态代理模式下的多参数处理
阅读全文
摘要:1. 使用构建者模式 public class UsersDaoImpl implements UsersDao { @Override public List<Users> selectUsersAll() throws IOException { InputStream inputStream
阅读全文