日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Mybatis学习总结二

發布時間:2025/3/15 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Mybatis学习总结二 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Mybatis學習總結二

  • 0、不需要修改的文件(在src下面)
      • jdbc.properties文件
      • log4j.properties文件
      • SqlMapConfig.xml文件
  • 1、高級結果映射
    • 1.1、一對一
      • 數據表內容
      • 開發環境
      • Address類
      • User類
      • UserMapper(Dao)接口
      • UserMapper.xml文件
      • 測試
      • 測試結果
    • 1.2、一對多
      • 數據庫內容
      • 開發環境
      • Address類
      • Phone類
      • User類
      • UserMapper接口
      • UserMapper.xml文件(第一種寫法)
      • UserMapper.xml文件(第二種寫法)
      • 測試
      • 測試結果
    • 1.3、多對多
      • 1.3.0、不變的東西
        • 數據庫信息
        • 開發環境
        • Course類
        • Student類
        • SqlMapConfig.xml的一些小改變
      • 1.3.1、查詢學生所選課程的情況
        • StudentMapper.xml配置
        • StudentMapper接口
        • 測試
        • 測試結果
      • 1.3.2、查詢本門課程的所有學生
        • CourseMapper.xml配置
        • CourseMapper接口
        • 測試
        • 測試結果
      • 1.3.3、增加一條選修記錄
        • StudentCourseMapper.xml配置
        • StudentCourse接口
        • 測試(記得提交事務)
        • 測試結果
  • 2、延遲加載
    • 2.1、什么是延遲加載
    • 2.2、在SqlMapConfig.xml中設置延遲加載
    • 2.3、一對多的延遲加載案例
      • 數據庫信息
      • 開發環境
      • 兩個實體類
        • Student
        • Course
      • 兩個接口
        • StudentMapper
        • CourseMapper
      • 兩個xml配置(重點)
        • StudentMapper.xml(注意sql語句和resultMap)
        • CourseMapper.xml(注意sql語句)
      • 測試
        • 不加載課程信息
        • 加載課程信息
      • 測試結果
        • 不加載課程信息結果
        • 加載課程信息結果(當屬性被訪問時,再去數據庫查找,于是mapper需要這樣的sql語句)
  • 3、查詢緩存
    • 3.0、什么是緩存
    • 3.1、一級緩存
      • 開發環境
      • 實體類
      • 接口
      • 配置文件
      • 測試
      • 測試結果(可以看出,只做了一次查詢)
    • 3.2、二級緩存
      • 二級緩存原理
      • 開發環境
      • 開啟緩存
        • SqlMapConfig.xml配置
        • StudentMapper.xml配置
      • 實體類
      • 接口
      • 測試
      • 測試結果
      • 禁用緩存與刷新緩存
    • 3.3、整合ehcache
      • 應用場景
      • 導包
      • 添加ehcache.xml文件(下面的diskStore是我們自己的緩存路徑)
      • 修改StudentMapper.xml
  • 4、逆向工程(發送一波黑馬筆記)
    • 4.1、下載逆向工程
    • 4.2、創建逆向工程
    • 4.3、創建Generator.java
    • 4.4、添加generatorConfig.xml
    • 4.5、注意事項
  • 參考

0、不需要修改的文件(在src下面)

jdbc.properties文件

jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql:///mybatis jdbc.username=root jdbc.password=3306

log4j.properties文件

log4j.rootLogger=DEBUG, Console log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n log4j.logger.org.apache=INFO

SqlMapConfig.xml文件

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration><!-- 引入外部文件 --><properties resource="jdbc.properties"></properties><!-- 環境 --><environments default="development"><environment id="development"><transactionManager type="JDBC" /><dataSource type="POOLED"><property name="driver" value="${jdbc.driver}" /><property name="url" value="${jdbc.url}" /><property name="username" value="${jdbc.username}" /><property name="password" value="${jdbc.password}" /></dataSource></environment></environments><!-- 加載UserMapper.xml文件 --><mappers><package name="UserMapper.xml" /></mappers> </configuration>

1、高級結果映射

1.1、一對一

數據表內容


開發環境

Address類

package com.csa.po; public class Address {private Integer addressId;private String province;private String city;// get/set...方法// toString方法 }

User類

package com.csa.po; public class User {private Integer userId;private String name;private Integer age;private Address address;// get/set...方法// toString方法 }

UserMapper(Dao)接口

package com.csa.dao; import com.csa.po.User; public interface UserDao {/*** 通過用戶id,查找User* @param id* @return*/public User selectUserById(Integer id); }

UserMapper.xml文件

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.csa.dao.UserDao"><resultMap type="com.csa.po.User" id="User"><!-- user信息 --><id column="user_id" property="userId"/><result column="name" property="name"/><result column="age" property="age"/><!-- 一對一 --><association property="address" javaType="com.csa.po.Address"><id column="address_id" property="addressId"/><result column="province" property="province"/><result column="city" property="city"/></association></resultMap><!-- 查詢用戶,通過用戶id --><select id="selectUserById" parameterType="int" resultMap="User">select * from user,addresswhere user_id = #{userId} and address = address_id</select></mapper>

測試

package com.csa.app; import java.io.InputStream; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import com.csa.dao.UserDao; import com.csa.po.User;public class App {public static void main(String[] args) throws Exception {// 讀取全局配置文件String resource = "SqlMapConfig.xml";InputStream input = Resources.getResourceAsStream(resource);// 創建SqlSessionFactorySqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(input);// 創建sqlSessionSqlSession sqlSession = sqlSessionFactory.openSession();// 創建daoUserDao userDao = sqlSession.getMapper(UserDao.class);User user = userDao.selectUserById(3);System.out.println(user);// 關閉sqlSessionsqlSession.close();}}

測試結果

1.2、一對多

數據庫內容



開發環境

Address類

package com.csa.po; public class Address {private Integer addressId;private String province;private String city;// get/set...方法// toString方法 }

Phone類

package com.csa.po; public class Phone {private Integer phoneId;private String model;private String memory;// get/set...方法// toString方法 }

User類

package com.csa.po; import java.util.List; public class User {private Integer userId;private String name;private Integer age;private Address address;private List<Phone> phoneList;// get/set...方法// toString方法 }

UserMapper接口

package com.csa.dao; import com.csa.po.User; public interface UserMapper {/*** 通過用戶id,查找User* @param id* @return*/public User selectUserById(Integer id); }

UserMapper.xml文件(第一種寫法)

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.csa.dao.UserMapper"><resultMap type="com.csa.po.User" id="User"><!-- user信息 --><id column="user_id" property="userId"/><result column="name" property="name"/><result column="age" property="age"/><!-- 一對一 --><association property="address" javaType="com.csa.po.Address"><id column="address_id" property="addressId"/><result column="province" property="province"/><result column="city" property="city"/></association><!-- 一對多 --><collection property="phoneList" ofType="com.csa.po.Phone"><id column="phone_id" property="phoneId"/><result column="model" property="model"/><result column="memory" property="memory"/></collection></resultMap><!-- 查詢用戶,通過用戶id --><select id="selectUserById" parameterType="int" resultMap="User">select * from user,address,phonewhere user_id = #{id} and address = address_id and user = user_id</select></mapper>

UserMapper.xml文件(第二種寫法)

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.csa.dao.UserMapper"><resultMap type="com.csa.po.User" id="UserMap"><!-- user信息 --><id column="user_id" property="userId"/><result column="name" property="name"/><result column="age" property="age"/><!-- 一對一 --><association property="address" javaType="com.csa.po.Address"><id column="address_id" property="addressId"/><result column="province" property="province"/><result column="city" property="city"/></association></resultMap><!-- 使用到繼承 --><resultMap type="com.csa.po.User" id="User" extends="UserMap"><!-- 一對多 --><collection property="phoneList" ofType="com.csa.po.Phone"><id column="phone_id" property="phoneId"/><result column="model" property="model"/><result column="memory" property="memory"/></collection></resultMap><!-- 查詢用戶,通過用戶id --><select id="selectUserById" parameterType="int" resultMap="User">select * from user,address,phonewhere user_id = #{id} and address = address_id and user = user_id</select></mapper>

測試

package com.csa.app;import java.io.InputStream; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import com.csa.dao.UserMapper; import com.csa.po.User;public class App {public static void main(String[] args) throws Exception {// 讀取全局配置文件String resource = "SqlMapConfig.xml";InputStream input = Resources.getResourceAsStream(resource);// 創建SqlSessionFactorySqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(input);// 創建sqlSessionSqlSession sqlSession = sqlSessionFactory.openSession();// 創建daoUserMapper userMapper = sqlSession.getMapper(UserMapper.class);User user = userMapper.selectUserById(3);System.out.println(user);// 關閉sqlSessionsqlSession.close();}}

測試結果

1.3、多對多

1.3.0、不變的東西

數據庫信息



開發環境

Course類

package com.csa.po; import java.util.List; public class Course {private Integer courseId;private String courseName;private Integer credit;private List<Student> studentList;// get/set...方法// toString方法 }

Student類

package com.csa.po; import java.util.List; public class Student {private Integer studentId;private String studentName;private Integer age;private List<Course> courseList;// get/set...方法// toString方法 }

SqlMapConfig.xml的一些小改變

<!-- 加載UserMapper.xml文件 --> <mappers><mapper resource="StudentMapper.xml"/><mapper resource="CourseMapper.xml"/><mapper resource="StudentCourseMapper.xml"/> </mappers>

1.3.1、查詢學生所選課程的情況

StudentMapper.xml配置

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.csa.dao.StudentMapper"><!-- CURD操作 --><resultMap type="com.csa.po.Student" id="Student"><id column="student_id" property="studentId"/><result column="student_name" property="studentName"/><result column="age" property="age"/><collection property="courseList" ofType="com.csa.po.Course"><id column="course_id" property="courseId"/><result column="course_name" property="courseName"/><result column="credit" property="credit"/></collection></resultMap><!-- 通過id查找該學生選修的課程 --><select id="selectStudentCoursesById" parameterType="int" resultMap="Student">select * from student natural join course natural join student_course where student_id = #{studentId}</select> </mapper>

StudentMapper接口

package com.csa.dao; import com.csa.po.Student; public interface StudentMapper {/*** 通過學生id查找學生選修情況* @param id* @return*/public Student selectStudentCoursesById(Integer id); }

測試

package com.csa.app;import java.io.InputStream; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import com.csa.dao.StudentMapper; import com.csa.po.Student;public class App {public static void main(String[] args) throws Exception {// 讀取全局配置文件String resource = "SqlMapConfig.xml";InputStream input = Resources.getResourceAsStream(resource);// 創建SqlSessionFactorySqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(input);// 創建sqlSessionSqlSession sqlSession = sqlSessionFactory.openSession();// 創建daoStudentMapper studentMapper = (StudentMapper) sqlSession.getMapper(StudentMapper.class);Student student = studentMapper.selectStudentCoursesById(2);System.out.println(student);// 關閉sqlSessionsqlSession.close();}}

測試結果

1.3.2、查詢本門課程的所有學生

CourseMapper.xml配置

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.csa.dao.CourseMapper"><!-- CRUD操作 --><resultMap type="com.csa.po.Course" id="Course"><id column="course_id" property="courseId"/><result column="course_name" property="courseName"/><result column="credit" property="credit"/><collection property="studentList" ofType="com.csa.po.Student"><id column="student_id" property="studentId"/><result column="student_name" property="studentName"/><result column="age" property="age"/></collection></resultMap><!-- 通過課程id查詢本課程的所有學生 --><select id="selectCourseStudentsById" parameterType="int" resultMap="Course">select * from student natural join course natural join student_coursewhere course_id = #{courseId}</select></mapper>

CourseMapper接口

package com.csa.dao; import com.csa.po.Course; public interface CourseMapper {/*** 通過課程id查詢本門課程的所有學生* @param id* @return*/public Course selectCourseStudentsById(Integer id); }

測試

package com.csa.app;import java.io.InputStream; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder;import com.csa.dao.CourseMapper; import com.csa.dao.StudentMapper; import com.csa.po.Course; import com.csa.po.Student;public class App {public static void main(String[] args) throws Exception {// 讀取全局配置文件String resource = "SqlMapConfig.xml";InputStream input = Resources.getResourceAsStream(resource);// 創建SqlSessionFactorySqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(input);// 創建sqlSessionSqlSession sqlSession = sqlSessionFactory.openSession();// 創建daoCourseMapper courseMapper = sqlSession.getMapper(CourseMapper.class);Course course = courseMapper.selectCourseStudentsById(3);System.out.println(course);// 關閉sqlSessionsqlSession.close();}}

測試結果

1.3.3、增加一條選修記錄

StudentCourseMapper.xml配置

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.csa.dao.StudentCourseMapper"><!-- CURD操作 --><insert id="addElective"><!-- 沒有給定參數則是為param1、param2...paramn -->insert into student_course values(#{param1.studentId},#{param2.courseId},#{param3})</insert> </mapper>

StudentCourse接口

package com.csa.dao; import com.csa.po.Course; import com.csa.po.Student; public interface StudentCourseMapper {public void addElective(Student student,Course course,Integer score); }

測試(記得提交事務)

package com.csa.app;import java.io.InputStream;import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder;import com.csa.dao.StudentCourseMapper; import com.csa.po.Course; import com.csa.po.Student;public class App {public static void main(String[] args) throws Exception {// 讀取全局配置文件String resource = "SqlMapConfig.xml";InputStream input = Resources.getResourceAsStream(resource);// 創建SqlSessionFactorySqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(input);// 創建sqlSessionSqlSession sqlSession = sqlSessionFactory.openSession();// 創建daoStudentCourseMapper studentCourseMapper = sqlSession.getMapper(StudentCourseMapper.class);Student student = new Student();student.setStudentId(2);Course course = new Course();course.setCourseId(2);studentCourseMapper.addElective(student, course, 99);// 提交事務sqlSession.commit();// 關閉sqlSessionsqlSession.close();}}

測試結果



2、延遲加載

2.1、什么是延遲加載

延遲加載又叫懶加載,也叫按需加載。也就是說先加載主信息,在需要的時候,再去加載從信息。

在mybatis中,resultMap標簽 的association標簽和collection標簽具有延遲加載的功能。

2.2、在SqlMapConfig.xml中設置延遲加載

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration><!-- 引入外部文件 --><properties resource="jdbc.properties"></properties><settings><!-- 開啟延遲加載,默認為true --><setting name="lazyLoadingEnabled" value="true"/><!-- 將積極加載改為消極加載即按需要加載,默認為true --><setting name="aggressiveLazyLoading" value="false"/></settings><!-- 環境 --><environments default="development"><environment id="development"><transactionManager type="JDBC" /><dataSource type="POOLED"><property name="driver" value="${jdbc.driver}" /><property name="url" value="${jdbc.url}" /><property name="username" value="${jdbc.username}" /><property name="password" value="${jdbc.password}" /></dataSource></environment></environments><!-- 加載UserMapper.xml文件 --><mappers><mapper resource="StudentMapper.xml"/><mapper resource="CourseMapper.xml"/></mappers> </configuration>

2.3、一對多的延遲加載案例

數據庫信息



開發環境

兩個實體類

Student

package com.csa.po;import java.util.List;public class Student {private Integer studentId;private String studentName;private Integer age;private List<Course> courseList;// get/set...方法// toString方法 }

Course

package com.csa.po;import java.util.List;public class Course {private Integer courseId;private String courseName;private Integer credit;private List<Student> studentList;// get/set...方法// toString方法 }

兩個接口

StudentMapper

package com.csa.dao; import com.csa.po.Student; public interface StudentMapper {/*** 通過學生id查找學生選修情況* @param id* @return*/public Student selectStudentCoursesById(Integer id); }

CourseMapper

package com.csa.dao; import com.csa.po.Course; public interface CourseMapper {/*** 通過課程id查詢本門課程的所有學生* @param id* @return*/public Course selectCourseStudentsById(Integer id); }

兩個xml配置(重點)

StudentMapper.xml(注意sql語句和resultMap)

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.csa.dao.StudentMapper"><!-- CURD操作 --><resultMap type="com.csa.po.Student" id="Student"><id column="student_id" property="studentId"/><result column="student_name" property="studentName"/><result column="age" property="age"/><collection property="courseList" ofType="com.csa.po.Course"select="com.csa.dao.CourseMapper.selectCourseStudentsById" column="student_id"></collection></resultMap><!-- 通過id查找該學生選修的課程 --><select id="selectStudentCoursesById" parameterType="int" resultMap="Student">select * from student where student_id = #{studentId}</select> </mapper>

CourseMapper.xml(注意sql語句)

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.csa.dao.CourseMapper"><!-- CRUD操作 --><resultMap type="com.csa.po.Course" id="Course"><id column="course_id" property="courseId"/><result column="course_name" property="courseName"/><result column="credit" property="credit"/><collection property="studentList" ofType="com.csa.po.Student"><id column="student_id" property="studentId"/><result column="student_name" property="studentName"/><result column="age" property="age"/></collection></resultMap><!-- 通過課程id查詢本課程的所有學生 --><select id="selectCourseStudentsById" parameterType="int" resultMap="Course">select * from course natural join student_coursewhere student_id = #{student_id}</select></mapper>

測試

不加載課程信息

package com.csa.app; import java.io.InputStream; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import com.csa.dao.StudentMapper; import com.csa.po.Course; import com.csa.po.Student;public class App {public static void main(String[] args) throws Exception {// 讀取全局配置文件String resource = "SqlMapConfig.xml";InputStream input = Resources.getResourceAsStream(resource);// 創建SqlSessionFactorySqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(input);// 創建sqlSessionSqlSession sqlSession = sqlSessionFactory.openSession();// 創建daoStudentMapper studentMapper = sqlSession.getMapper(StudentMapper.class);Student student = studentMapper.selectStudentCoursesById(2);// 將下面這段放開,則是延遲加載了course!/*for (Course course : student.getCourseList()) {System.out.println(course);}*/// 關閉sqlSessionsqlSession.close();}}

加載課程信息

package com.csa.app; import java.io.InputStream; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import com.csa.dao.StudentMapper; import com.csa.po.Course; import com.csa.po.Student;public class App {public static void main(String[] args) throws Exception {// 讀取全局配置文件String resource = "SqlMapConfig.xml";InputStream input = Resources.getResourceAsStream(resource);// 創建SqlSessionFactorySqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(input);// 創建sqlSessionSqlSession sqlSession = sqlSessionFactory.openSession();// 創建daoStudentMapper studentMapper = sqlSession.getMapper(StudentMapper.class);Student student = studentMapper.selectStudentCoursesById(2);for (Course course : student.getCourseList()) {System.out.println(course);}// 關閉sqlSessionsqlSession.close();}}

測試結果

不加載課程信息結果

加載課程信息結果(當屬性被訪問時,再去數據庫查找,于是mapper需要這樣的sql語句)

# 這里的查詢條件是學號! select * from course natural join student_coursewhere student_id = #{student_id}


3、查詢緩存

3.0、什么是緩存

Mybatis的緩存,包括一級緩存和二級緩存。

一級緩存指的就是sqlsession,在sqlsession中有一個數據區域,是map結構,這個區域就是一級緩存區域。一級緩存中的key是由sql語句、條件、statement等信息組成一個唯一值。一級緩存中的value,就是查詢出的結果對象。

二級緩存指的就是同一個namespace下的mapper,二級緩存中,也有一個map結構,這個區域就是一級緩存區域。一級緩存中的key是由sql語句、條件、statement等信息組成一個唯一值。一級緩存中的value,就是查詢出的結果對象。

3.1、一級緩存

一級緩存是默認使用的。同一個sqlsession中的緩存。

開發環境

實體類

package com.csa.po; public class Student {private Integer studentId;private String studentName;private Integer age;// get/set...方法// toString方法 }

接口

package com.csa.dao; import com.csa.po.Student; public interface StudentMapper {/*** 通過學生id查找學生* @param id* @return*/public Student selectStudentById(Integer id); }

配置文件

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.csa.dao.StudentMapper"><!-- CURD操作 --><resultMap type="com.csa.po.Student" id="Student"><id column="student_id" property="studentId"/><result column="student_name" property="studentName"/><result column="age" property="age"/></resultMap><!-- 通過id查找該學生選修的課程 --><select id="selectStudentById" parameterType="int" resultMap="Student">select * from student where student_id = #{studentId}</select> </mapper>

測試

package com.csa.app;import java.io.InputStream; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import com.csa.dao.StudentMapper; import com.csa.po.Student;public class App {public static void main(String[] args) throws Exception {// 讀取全局配置文件String resource = "SqlMapConfig.xml";InputStream input = Resources.getResourceAsStream(resource);// 創建SqlSessionFactorySqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(input);// 創建sqlSessionSqlSession sqlSession = sqlSessionFactory.openSession();// 創建daoStudentMapper studentMapper = sqlSession.getMapper(StudentMapper.class);Student student1 = studentMapper.selectStudentById(2);Student student2 = studentMapper.selectStudentById(2);System.out.println(student1);System.out.println(student2);// 關閉sqlSessionsqlSession.close();}}

測試結果(可以看出,只做了一次查詢)

3.2、二級緩存

二級緩存需要手動開啟。

二級緩存原理

開發環境

開啟緩存

SqlMapConfig.xml配置

<!-- 開啟二級緩存 --> <setting name="cacheEnabled" value="true"/>

StudentMapper.xml配置

<!-- 開啟二級緩存,默認使用了PerpettualCache --> <cache/>

實體類

需要序列化!

package com.csa.po; import java.io.Serializable; public class Student implements Serializable{private Integer studentId;private String studentName;private Integer age;// get/set...方法// toString方法 }

接口

與上面一樣!

測試

package com.csa.app;import java.io.InputStream; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import com.csa.dao.StudentMapper; import com.csa.po.Student;public class App {public static void main(String[] args) throws Exception {// 讀取全局配置文件String resource = "SqlMapConfig.xml";InputStream input = Resources.getResourceAsStream(resource);// 創建SqlSessionFactorySqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(input);// 創建sqlSessionSqlSession sqlSession1 = sqlSessionFactory.openSession();SqlSession sqlSession2 = sqlSessionFactory.openSession();SqlSession sqlSession3 = sqlSessionFactory.openSession();// 創建daoStudentMapper studentMapper1 = sqlSession1.getMapper(StudentMapper.class);StudentMapper studentMapper2 = sqlSession2.getMapper(StudentMapper.class);StudentMapper studentMapper3 = sqlSession3.getMapper(StudentMapper.class);Student student1 = studentMapper1.selectStudentById(2);// 關閉sqlSessionsqlSession1.close();Student student2 = studentMapper2.selectStudentById(2);sqlSession2.close();Student student3 = studentMapper3.selectStudentById(2);Student student11 = studentMapper3.selectStudentById(4);sqlSession3.close();System.out.println(student1);System.out.println(student2);System.out.println(student3);System.out.println(student11);}}

測試結果

禁用緩存與刷新緩存

<!-- useCache:是否使用緩存flushCache:是否刷新緩存--> <!-- 通過id查找該學生選修的課程 --> <select id="selectStudentById" parameterType="int" resultMap="Student"useCache="false" flushCache="true">select * from student where student_id = #{studentId} </select>

3.3、整合ehcache

應用場景

使用場景:對于訪問響應速度要求高,但是實時性不高的查詢,可以采用二級緩存技術。

注意:在使用二級緩存的時候,要設置一下刷新間隔(cache標簽中有一個flashInterval屬性)來定時刷新二級緩存,這個刷新間隔根據具體需求來設置,比如設置30分鐘、60分鐘等,單位為毫秒。

導包

添加ehcache.xml文件(下面的diskStore是我們自己的緩存路徑)

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../config/ehcache.xsd"><!--The ehcache-failsafe.xml is a default configuration for ehcache, if an ehcache.xml is not configured.The diskStore element is optional. It must be configured if you have overflowToDisk or diskPersistent enabledfor any cache. If it is not configured, a warning will be issues and java.io.tmpdir will be used.diskStore has only one attribute - "path". It is the path to the directory where .data and .index files will be created.If the path is a Java System Property it is replaced by its value in therunning VM.The following properties are translated:* user.home - User's home directory* user.dir - User's current working directory* java.io.tmpdir - Default temp file path* ehcache.disk.store.dir - A system property you would normally specify on the command linee.g. java -Dehcache.disk.store.dir=/u01/myapp/diskdir ...Subdirectories can be specified below the property e.g. java.io.tmpdir/one--><diskStore path="java.io.tmpdir"/><!--Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider,which is notified when Caches are added or removed from the CacheManager.The attributes of CacheManagerEventListenerFactory are:* class - a fully qualified factory class name* properties - comma separated properties having meaning only to the factory.Sets the fully qualified class name to be registered as the CacheManager event listener.The events include:* adding a Cache* removing a CacheCallbacks to listener methods are synchronous and unsynchronized. It is the responsibilityof the implementer to safely handle the potential performance and thread safety issuesdepending on what their listener is doing.If no class is specified, no listener is created. There is no default.<cacheManagerEventListenerFactory class="" properties=""/>--><!--(Enable for distributed operation)Specifies a CacheManagerPeerProviderFactory which will be used to create aCacheManagerPeerProvider, which discovers other CacheManagers in the cluster.The attributes of cacheManagerPeerProviderFactory are:* class - a fully qualified factory class name* properties - comma separated properties having meaning only to the factory.Ehcache comes with a built-in RMI-based distribution system with two means of discovery ofCacheManager peers participating in the cluster:* automatic, using a multicast group. This one automatically discovers peers and detectschanges such as peers entering and leaving the group* manual, using manual rmiURL configuration. A hardcoded list of peers is provided atconfiguration time.Configuring Automatic Discovery:Automatic discovery is configured as per the following example:<cacheManagerPeerProviderFactoryclass="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,multicastGroupPort=4446, timeToLive=32"/>Valid properties are:* peerDiscovery (mandatory) - specify "automatic"* multicastGroupAddress (mandatory) - specify a valid multicast group address* multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeattraffic* timeToLive - specify a value between 0 and 255 which determines how far the packets will propagate.By convention, the restrictions are:0 - the same host1 - the same subnet32 - the same site64 - the same region128 - the same continent255 - unrestrictedConfiguring Manual Discovery:Manual discovery is configured as per the following example:<cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"properties="peerDiscovery=manual,rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1| //server1:40000/sampleCache2|//server2:40000/sampleCache2"/>Valid properties are:* peerDiscovery (mandatory) - specify "manual"* rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form//hostname:portThe hostname is the hostname of the remote CacheManager peer. The port is the listeningport of the RMICacheManagerPeerListener of the remote CacheManager peer.<cacheManagerPeerProviderFactoryclass="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"properties="peerDiscovery=automatic,multicastGroupAddress=230.0.0.1,multicastGroupPort=4446, timeToLive=1"/>--><!--(Enable for distributed operation)Specifies a CacheManagerPeerListenerFactory which will be used to create aCacheManagerPeerListener, whichlistens for messages from cache replicators participating in the cluster.The attributes of cacheManagerPeerListenerFactory are:class - a fully qualified factory class nameproperties - comma separated properties having meaning only to the factory.Ehcache comes with a built-in RMI-based distribution system. The listener component isRMICacheManagerPeerListener which is configured usingRMICacheManagerPeerListenerFactory. It is configured as per the following example:<cacheManagerPeerListenerFactoryclass="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"properties="hostName=fully_qualified_hostname_or_ip,port=40001,socketTimeoutMillis=120000"/>All properties are optional. They are:* hostName - the hostName of the host the listener is running on. Specifywhere the host is multihomed and you want to control the interface over which clustermessages are received. Defaults to the host name of the default interface if notspecified.* port - the port the listener listens on. This defaults to a free port if not specified.* socketTimeoutMillis - the number of ms client sockets will stay open when sendingmessages to the listener. This should be long enough for the slowest message.If not specified it defaults 120000ms.<cacheManagerPeerListenerFactoryclass="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"/>--><!-- Cache configuration.The following attributes are required.name:Sets the name of the cache. This is used to identify the cache. It must be unique.maxElementsInMemory:Sets the maximum number of objects that will be created in memory (0 == no limit)maxElementsOnDisk:Sets the maximum number of objects that will be maintained in the DiskStoreThe default value is zero, meaning unlimited.eternal:Sets whether elements are eternal. If eternal, timeouts are ignored and theelement is never expired.overflowToDisk:Sets whether elements can overflow to disk when the in-memory cachehas reached the maxInMemory limit.The following attributes are optional.timeToIdleSeconds:Sets the time to idle for an element before it expires.i.e. The maximum amount of time between accesses before an element expiresIs only used if the element is not eternal.Optional attribute. A value of 0 means that an Element can idle for infinity.The default value is 0.timeToLiveSeconds:Sets the time to live for an element before it expires.i.e. The maximum time between creation time and when an element expires.Is only used if the element is not eternal.Optional attribute. A value of 0 means that and Element can live for infinity.The default value is 0.diskPersistent:Whether the disk store persists between restarts of the Virtual Machine.The default value is false.diskExpiryThreadIntervalSeconds:The number of seconds between runs of the disk expiry thread. The default valueis 120 seconds.diskSpoolBufferSizeMB:This is the size to allocate the DiskStore for a spool buffer. Writes are madeto this area and then asynchronously written to disk. The default size is 30MB.Each spool buffer is used only by its cache. If you get OutOfMemory errors considerlowering this value. To improve DiskStore performance consider increasing it. Trace levellogging in the DiskStore will show if put back ups are occurring.memoryStoreEvictionPolicy:Policy would be enforced upon reaching the maxElementsInMemory limit. Defaultpolicy is Least Recently Used (specified as LRU). Other policies available -First In First Out (specified as FIFO) and Less Frequently Used(specified as LFU)Cache elements can also contain sub elements which take the same format of a factory classand properties. Defined sub-elements are:* cacheEventListenerFactory - Enables registration of listeners for cache events, such asput, remove, update, and expire.* bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, which is called by acache on initialisation to prepopulate itself.Each cache that will be distributed needs to set a cache event listener which replicatesmessages to the other CacheManager peers. For the built-in RMI implementation this is doneby adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to eachdistributed cache's configuration as per the following example:<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"properties="replicateAsynchronously=true,replicatePuts=true,replicateUpdates=true,replicateUpdatesViaCopy=true,replicateRemovals=true "/>The RMICacheReplicatorFactory recognises the following properties:* replicatePuts=true|false - whether new elements placed in a cache arereplicated to others. Defaults to true.* replicateUpdates=true|false - whether new elements which override anelement already existing with the same key are replicated. Defaults to true.* replicateRemovals=true - whether element removals are replicated. Defaults to true.* replicateAsynchronously=true | false - whether replications areasynchronous (true) or synchronous (false). Defaults to true.* replicateUpdatesViaCopy=true | false - whether the new elements arecopied to other caches (true), or whether a remove message is sent. Defaults to true.* asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronousreplicator runs at a set interval of milliseconds. The default is 1000. The minimumis 10. This property is only applicable if replicateAsynchronously=true* asynchronousReplicationMaximumBatchSize=<number of operations> - The maximumnumber of operations that will be batch within a single RMI message. The defaultis 1000. This property is only applicable if replicateAsynchronously=trueThe RMIBootstrapCacheLoader bootstraps caches in clusters where RMICacheReplicators areused. It is configured as per the following example:<bootstrapCacheLoaderFactoryclass="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"/>The RMIBootstrapCacheLoaderFactory recognises the following optional properties:* bootstrapAsynchronously=true|false - whether the bootstrap happens in the backgroundafter the cache has started. If false, bootstrapping must complete before the cache ismade available. The default value is true.* maximumChunkSizeBytes=<integer> - Caches can potentially be very large, larger than thememory limits of the VM. This property allows the bootstraper to fetched elements inchunks. The default chunk size is 5000000 (5MB).--><!--Mandatory Default Cache configuration. These settings will be applied to cachescreated programmtically using CacheManager.add(String cacheName)--><defaultCachemaxElementsInMemory="10000"eternal="false"timeToIdleSeconds="120"timeToLiveSeconds="120"maxElementsOnDisk="10000000"diskExpiryThreadIntervalSeconds="120"memoryStoreEvictionPolicy="LRU"><persistence strategy="localTempSwap"/></defaultCache> </ehcache>

修改StudentMapper.xml

<!-- 開啟二級緩存,默認使用了org.mybatis.caches.ehcache.EncacheCache --> <cache type="org.mybatis.caches.ehcache.EncacheCache"/>

4、逆向工程(發送一波黑馬筆記)

4.1、下載逆向工程

逆向工程jar的下載地址

4.2、創建逆向工程

4.3、創建Generator.java

4.4、添加generatorConfig.xml

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfigurationPUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN""http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"><generatorConfiguration><context id="testTables" targetRuntime="MyBatis3"><commentGenerator><!-- 是否去除自動生成的注釋 true:是 : false:否 --><property name="suppressAllComments" value="true" /></commentGenerator><!--數據庫連接的信息:驅動類、連接地址、用戶名、密碼 --><jdbcConnection driverClass="com.mysql.jdbc.Driver"connectionURL="jdbc:mysql://localhost:3306/mybatis" userId="root"password="root"></jdbcConnection><!-- <jdbcConnection driverClass="oracle.jdbc.OracleDriver" connectionURL="jdbc:oracle:thin:@127.0.0.1:1521:yycg" userId="yycg" password="yycg"> </jdbcConnection> --><!-- 默認false,把JDBC DECIMAL 和 NUMERIC 類型解析為 Integer,為 true時把JDBC DECIMAL 和 NUMERIC 類型解析為java.math.BigDecimal --><javaTypeResolver><property name="forceBigDecimals" value="false" /></javaTypeResolver><!-- targetProject:生成PO類的位置 --><javaModelGenerator targetPackage="com.itheima.ms.po"targetProject=".\src"><!-- enableSubPackages:是否讓schema作為包的后綴 --><property name="enableSubPackages" value="false" /><!-- 從數據庫返回的值被清理前后的空格 --><property name="trimStrings" value="true" /></javaModelGenerator><!-- targetProject:mapper映射文件生成的位置 --><sqlMapGenerator targetPackage="com.itheima.ms.mapper"targetProject=".\src"><!-- enableSubPackages:是否讓schema作為包的后綴 --><property name="enableSubPackages" value="false" /></sqlMapGenerator><!-- targetPackage:mapper接口生成的位置 --><javaClientGenerator type="XMLMAPPER"targetPackage="com.itheima.ms.mapper" targetProject=".\src"><!-- enableSubPackages:是否讓schema作為包的后綴 --><property name="enableSubPackages" value="false" /></javaClientGenerator><!-- 指定數據庫表 --><table tableName="items"></table><table tableName="orders"></table><table tableName="orderdetail"></table><table tableName="user"></table></context> </generatorConfiguration>

4.5、注意事項

Mapper.xml文件已經存在時,如果進行重新生成則mapper.xml文件時,內容不被覆蓋而是進行內容追加,結果導致mybatis解析失敗。

解決方法:刪除原來已經生成的mapper xml文件再進行生成。

Mybatis自動生成的po及mapper.java文件不是內容而是直接覆蓋沒有此問題。

參考

黑馬筆記、黑馬、黑馬!!!

總結

以上是生活随笔為你收集整理的Mybatis学习总结二的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

色视频在线看 | 精品在线观看一区二区 | 国产午夜精品av一区二区 | 国产精品视频你懂的 | 91视频免费看网站 | 国产精品h在线观看 | 色吧久久 | 亚洲三级在线免费观看 | 在线中文字幕电影 | 狠狠色丁香久久婷婷综合丁香 | 久草在线高清 | 精品久久久久亚洲 | 九九免费在线观看 | 一区二区三区电影在线播 | 国产精品久久久久影视 | 色天天综合久久久久综合片 | 999在线视频 | 日韩三级视频在线观看 | 免费网站v | 久久国产精品99久久久久久丝袜 | 伊人狠狠 | 日韩有码第一页 | 天天射天天干 | 国产99中文字幕 | 91精品1区2区 | 日韩欧美视频一区 | 丁香色天天 | 日韩成人欧美 | 91系列在线| 丰满少妇一级片 | 综合久久婷婷 | 免费日韩一区二区三区 | 三级黄色在线 | 成人黄色小说视频 | 在线小视频 | www.狠狠 | 日本精品va在线观看 | 欧美另类网站 | 国产一级黄色片免费看 | www激情com | 69国产盗摄一区二区三区五区 | 五月天综合色 | 在线成人一区 | 日韩色爱 | 麻豆视频免费在线播放 | 国产精品久久久久久久久久东京 | av电影免费在线看 | 婷婷四房综合激情五月 | 国产黄在线观看 | 久久婷婷国产 | 麻豆传媒一区二区 | 99人成在线观看视频 | 久久香蕉电影网 | 91在线www | 一级黄色片毛片 | 久久免费福利 | 久久福利影视 | 国内小视频在线观看 | 91av在线播放视频 | 91精品在线观看视频 | 婷婷狠狠操 | 一级c片| 激情久久五月天 | 国产在线观看你懂得 | 99精品免费久久久久久久久 | 婷婷在线看 | 日韩高清不卡一区二区三区 | 美女免费视频黄 | 免费久久视频 | 国产在线观看免费观看 | 狠狠狠色丁香婷婷综合久久五月 | 国产黄色免费在线观看 | 国产三级视频在线 | 日韩一区二区三区免费视频 | 欧美在线一 | 国产精品久久久久久久久久99 | 丁香六月天婷婷 | 激情影音| 在线免费黄色毛片 | 人人舔人人射 | 国产系列在线观看 | 全黄网站 | 欧美日韩高清不卡 | 久久成| 天堂中文在线播放 | 麻豆久久久 | 久久精品韩国 | 九九九视频在线 | a级黄色片视频 | 成人黄色av免费在线观看 | 18网站在线观看 | 婷婷视频导航 | 在线观看免费一级片 | 精品久久视频 | 久草免费在线视频 | 国内精品久久久久影院一蜜桃 | 在线看欧美 | 国产精品自在线 | 日韩精品久久久久久 | 久久久资源 | 一级欧美日韩 | 久久综合五月婷婷 | 日韩中文字幕国产 | 欧洲精品亚洲精品 | 亚洲高清网站 | 国产高清免费在线观看 | 日本精品一区二区三区在线观看 | 亚洲免费高清视频 | 欧美成人黄色片 | 国产精品亚洲人在线观看 | 三级黄色在线观看 | 色综合久久久久综合99 | 一区二区三区中文字幕在线观看 | 国产成人一区二区三区在线观看 | 五月婷激情 | 日韩有码网站 | 国产精品久久久777 成人手机在线视频 | 一区二区三区 亚洲 | 97人人模人人爽人人喊网 | 国产高清视频在线播放 | 在线观看中文字幕一区 | 丁香婷婷激情国产高清秒播 | 在线观看亚洲精品 | 久久久亚洲成人 | 特级西西444www大胆高清无视频 | 欧美精品在线视频观看 | 国产精品网在线观看 | 日韩一区二区久久 | 首页av在线 | 亚洲一级片在线观看 | 91视频在线免费看 | 看污网站| 99久久99久久免费精品蜜臀 | 精品久久久久久久久中文字幕 | 中文字幕一区二区三区乱码不卡 | 日韩av有码在线 | 国产亚洲精品久久久久久大师 | 91九色最新 | 综合久久一本 | 中文字幕乱码电影 | 国产 日韩 在线 亚洲 字幕 中文 | 狠狠操狠狠 | 精品免费99久久 | 黄视频色网站 | 亚洲精品国产精品久久99 | 亚洲美女免费精品视频在线观看 | 久草视频中文在线 | 国产免费午夜 | 亚洲精品高清在线观看 | 日韩电影在线一区 | 天天爽夜夜爽人人爽一区二区 | 亚洲永久在线 | 91久久精品一区二区二区 | av片子在线观看 | 粉嫩av一区二区三区四区在线观看 | 国产理伦在线 | www.天天操.com | 在线黄色av | 99久久www | 99久久精品国产一区二区三区 | 婷婷五综合| 国产精品午夜久久 | 久久久久久久国产精品视频 | 国产精品久久久久久模特 | 国产精品久久一区二区三区不卡 | www在线观看国产 | 丁香5月婷婷久久 | 69国产盗摄一区二区三区五区 | 精品国产一区二区三区日日嗨 | www夜夜操com | 在线 视频 一区二区 | 国内小视频在线观看 | 九九爱免费视频在线观看 | 草久草久| av电影中文字幕在线观看 | 6080yy午夜一二三区久久 | 久久久久久高潮国产精品视 | 亚洲四虎 | 亚洲欧美成aⅴ人在线观看 四虎在线观看 | 日本韩国精品一区二区在线观看 | 国产在线va| 97天堂| 欧美亚洲另类在线视频 | 国产精品女人久久久 | 日韩高清 一区 | 日韩毛片一区 | 91在线免费视频观看 | 国产欧美在线一区二区三区 | 五月天婷婷免费视频 | 久久久电影 | 中文字幕av一区二区三区四区 | japanesexxxxfreehd乱熟 | 亚洲电影第一页av | 欧美一级免费黄色片 | 国产精品一区在线观看 | 国产麻豆剧果冻传媒视频播放量 | 国产成人av在线影院 | 99热这里精品 | 97视频在线观看网址 | 国产精品久久久免费 | 久久精品伊人 | 国产精品一区二区久久 | 成人国产精品av | 在线免费观看的av网站 | 国际精品久久久久 | 精产嫩模国品一二三区 | 久久久久久免费视频 | 97网| 欧美日韩二区三区 | 久久影院中文字幕 | 午夜久久影院 | 亚洲综合丁香 | 久久久久亚洲精品中文字幕 | 中文字幕亚洲不卡 | 日韩高清毛片 | 看片网站黄| 欧美va电影 | 99久久精品免费看国产麻豆 | 狠狠的操 | 毛片视频网址 | www.久草.com | 在线日本看片免费人成视久网 | 91视频在线网址 | 日韩a在线播放 | www.五月天婷婷.com | 亚洲视频一| 成人羞羞免费 | 99久久激情视频 | 91九色蝌蚪视频网站 | 久久久www成人免费毛片麻豆 | 国产精品3| 中日韩在线视频 | 国产又粗又猛又黄又爽 | 午夜在线免费观看 | 丝袜制服天堂 | 黄色三级免费 | 青青视频一区 | 99精品乱码国产在线观看 | 成人在线一区二区三区 | 丁香视频五月 | 九九九九九九精品 | 在线观看日韩视频 | 啪啪小视频网站 | 欧美一区二区三区在线看 | 亚洲特级片 | 五月激情姐姐 | 久久久性 | 国产电影黄色av | 久久精品视频播放 | 国产精品久久久久高潮 | 99精品视频在线观看播放 | 人人爽爽人人 | 亚洲桃花综合 | 欧美日韩一级久久久久久免费看 | 国产精品1区2区 | 国产亚洲精品精品精品 | 超碰免费公开 | 欧美精品久久久久久久久久 | 日韩两性视频 | 国产不卡一区二区视频 | 色在线最新 | 亚洲污视频 | 精品国产精品久久 | 色婷婷狠狠干 | 亚洲精品视频在线看 | 婷婷福利影院 | 伊人导航 | 日本久热| 婷婷综合久久 | 精品国产乱码 | 色婷婷狠| 天天操天 | 久久久久久久99 | 久久久国产精品视频 | 中文字幕在线专区 | 97夜夜澡人人爽人人免费 | 色91在线视频 | 天天爱天天色 | 97精品视频在线播放 | 天天要夜夜操 | 日本黄色特级片 | 777久久久 | 亚洲夜夜综合 | 91精品在线观看入口 | 中文字幕中文字幕在线一区 | 99在线精品视频观看 | 四虎成人精品永久免费av | 亚洲一二三在线 | 美女视频久久黄 | 日本久久久亚洲精品 | 麻豆精品在线视频 | 国产精品99蜜臀久久不卡二区 | 久草在线一免费新视频 | 婷婷视频在线观看 | 亚洲一区二区三区在线看 | 少妇自拍av| 日本黄色大片免费看 | 天天操天天射天天插 | 亚洲影视九九影院在线观看 | 国产人成看黄久久久久久久久 | 国产精品久久久久久久久婷婷 | 免费色av | 欧美日韩视频一区二区 | 天天操综 | 天堂网一区 | 在线免费观看国产黄色 | 一区二区理论片 | 欧美午夜久久 | 国产一区高清在线观看 | 国产永久免费高清在线观看视频 | 日韩精品一区二区三区电影 | 亚洲国产大片 | 久草在线观 | 久久永久免费 | 色就是色综合 | 亚洲女同videos | 久久成人国产精品入口 | 最新av观看 | 天天操天天干天天爱 | 国产一区二区三区 在线 | 国产精品女同一区二区三区久久夜 | 国产在线精品视频 | 99精品99 | 亚洲免费av网站 | 中文字幕亚洲精品日韩 | 精品美女久久久久 | 日韩在线观看视频免费 | 91视频在线播放视频 | 国内免费的中文字幕 | 国产视频一区二区三区在线 | 国产精品麻豆果冻传媒在线播放 | www.伊人色.com | 亚洲成a人片77777kkkk1在线观看 | 日本女人b | 激情黄色一级片 | 精品国产乱子伦一区二区 | 国产精品久久久久久久av电影 | 在线观看一级视频 | 精品久久1 | 久久a级片 | 亚洲精品白浆高清久久久久久 | 麻豆精品视频在线观看免费 | 2019免费中文字幕 | 成人av影视 | 中文字幕av免费在线观看 | 亚洲精品乱码久久久久久9色 | www免费| 国产在线不卡 | 热久久最新地址 | 亚洲区另类春色综合小说 | 久久久蜜桃 | 久久高清 | 天天天插 | 亚洲第一区精品 | 激情综合网色播五月 | 久久久黄视频 | 在线视频观看亚洲 | 天天射狠狠干 | 欧美日韩免费观看一区二区三区 | 亚洲免费在线看 | 成人看片 | 免费av片在线 | 亚洲精品人人 | 久久99久久99精品免视看婷婷 | 亚洲自拍av在线 | 久久99精品久久久久久三级 | 丁香网婷婷 | 91久久国产综合精品女同国语 | 色婷婷狠狠五月综合天色拍 | 国产老妇av | 免费久久久 | 国产亚洲精品女人久久久久久 | 亚洲精品一区二区三区在线观看 | 射久久久 | 亚洲动漫在线观看 | 日韩欧美极品 | 制服丝袜亚洲 | 人人揉人人揉人人揉人人揉97 | 久精品在线 | av成人资源| 精品福利国产 | 91在线公开视频 | 国产在线日韩 | 色999视频| 99久高清在线观看视频99精品热在线观看视频 | 超碰日韩在线 | 亚洲成人精品av | 最近日本字幕mv免费观看在线 | 成人精品国产免费网站 | 夜夜躁天天躁很躁波 | 黄色国产大片 | 免费观看成人 | 毛片的网址 | 久久性生活片 | 久久一区91 | 国产亚洲精品久久久久久无几年桃 | 日韩a级黄色片 | 亚洲精品乱码白浆高清久久久久久 | 国产精品久久中文字幕 | 久久99爱视频 | 最近中文字幕大全 | 天天操天天干天天插 | 亚洲三区在线 | 99在线高清视频在线播放 | 久久久精品高清 | 久久国内精品 | 欧美午夜视频在线 | 又色又爽又黄 | 国产小视频在线播放 | 婷婷色在线播放 | a色网站| 美女在线国产 | 福利久久 | 99久久精品国产系列 | 亚洲国产一区在线观看 | 国产精品精品久久久 | 99在线精品视频在线观看 | 九9热这里真品2 | 亚洲 成人 一区 | 久久国产系列 | 国产午夜精品一区二区三区嫩草 | 亚洲一级黄色大片 | 中文在线资源 | 精品久久久久久久久久久久久久久久久久 | 97在线观看免费高清完整版在线观看 | 欧美久久影院 | www.香蕉视频在线观看 | 在线观看一级 | 青青久草在线视频 | 欧美性久久久久久 | 久久精品屋 | 超碰在线98 | 又粗又长又大又爽又黄少妇毛片 | 日韩成人在线一区二区 | 99这里只有久久精品视频 | 欧美性猛片, | 婷婷丁香视频 | 亚洲高清视频在线 | 狠狠成人| 91精品啪在线观看国产 | 区一区二区三区中文字幕 | 天天操天天玩 | 日韩欧美电影 | 六月丁香在线观看 | 久草手机视频 | 午夜精品久久久久 | 2024av| 亚洲精品国产高清 | 日韩黄色在线电影 | 最近免费中文字幕 | 麻豆视频国产在线观看 | 狠狠色丁香婷综合久久 | 日韩免费观看高清 | 成人丁香花 | 91精品国产99久久久久久久 | 麻豆免费视频观看 | 亚洲视频中文 | 毛片网站免费 | 国产亚洲精品bv在线观看 | 成人欧美日韩国产 | 久久国产精品电影 | 麻豆视频在线免费 | www在线观看国产 | 国产精品综合av一区二区国产馆 | 日批视频在线 | 亚洲精品乱码久久久久久蜜桃91 | 免费日韩 精品中文字幕视频在线 | 欧美精品国产综合久久 | 色老板在线 | 韩国av不卡 | 色婷婷激情电影 | 免费看一及片 | 国产精品第二页 | 欧美精品一区二区性色 | 亚洲三级网 | 久久五月天综合 | 久久a视频| 精品一区二区久久久久久久网站 | 国产看片免费 | 91亚洲精品在线 | 黄色aa久久 | 久久艹艹 | 麻豆视频免费播放 | 丁香花中文字幕 | 成人一级电影在线观看 | 久草免费新视频 | 国产不卡在线观看视频 | 808电影 | 天天在线免费视频 | 国产色婷婷精品综合在线手机播放 | 久久久久久高清 | 天天操天天舔天天爽 | 婷婷亚洲激情 | 91在线精品一区二区 | 久久新视频 | 日韩欧美国产精品 | 伊人天天色 | 久久在线电影 | 午夜精品福利一区二区三区蜜桃 | av成人免费观看 | 日韩欧美国产精品 | 99色| 久久精品—区二区三区 | 亚洲婷婷网| 欧美精品xx | 欧美va日韩va | 99se视频在线观看 | 亚洲狠狠丁香婷婷综合久久久 | 怡春院av | 亚洲不卡在线 | 91视频 - x99av| 在线免费观看国产 | 97狠狠操 | 日本99精品 | 天天插天天操天天干 | 18国产精品白浆在线观看免费 | 成人av免费在线观看 | www在线免费观看 | 国产伦精品一区二区三区高清 | 亚洲另类久久 | 三级av中文字幕 | 九九热免费观看 | 国产精品99久久免费黑人 | 中文字字幕在线 | 少妇bbw揉bbb欧美 | 日韩h在线观看 | 日本精品中文字幕 | 中日韩在线视频 | 婷婷婷国产在线视频 | 久久国产精品久久精品国产演员表 | 综合铜03| 欧美久久久久久久 | 9草在线 | 国产精品久久久亚洲 | 亚洲欧美日韩一二三区 | 久久久蜜桃一区二区 | 狠狠干电影 | 超碰在线9 | 国产精品9999久久久久仙踪林 | 欧美成年黄网站色视频 | av电影中文字幕 | 人人看人人 | 操操操人人| 日韩在线观看小视频 | 日本中文字幕电影在线免费观看 | 国产美女精品视频 | 国产99中文字幕 | 国产这里只有精品 | av无限看 | 日韩精品亚洲专区在线观看 | 久久久精品久久日韩一区综合 | 97久久精品午夜一区二区 | 91香蕉国产 | 国产精品一区二区三区四区在线观看 | 色综合久久网 | 日韩视频三区 | 五月婷婷黄色 | 国产精品九九久久99视频 | 91天天操 | 亚洲精品一区中文字幕乱码 | 亚洲精品在线电影 | 又湿又紧又大又爽a视频国产 | 国产精品久久久久久麻豆一区 | 国产黑丝一区二区 | 午夜三级福利 | 开心激情网五月天 | 国产精品igao视频网入口 | 午夜 在线| 久久99热精品这里久久精品 | 亚洲美女视频在线观看 | 精品国产一二区 | 久久婷婷一区 | 欧美激情第一区 | 久久精品一区八戒影视 | 婷婷色中文 | 二区三区毛片 | 日韩| 狠狠操狠狠干天天操 | 亚洲视频网站在线观看 | 久久er99热精品一区二区三区 | 99久久婷婷国产综合亚洲 | 国产免费久久av | 91精品国产综合久久婷婷香蕉 | 最新中文字幕在线资源 | 亚洲视频久久久 | 欧美精品一区二区性色 | 青青看片 | 中文字幕网站 | 美女视频黄频大全免费 | 久久草草热国产精品直播 | 天天干夜夜夜 | 久久精品一区二区三 | 国产又粗又长的视频 | av在线免费在线观看 | 手机看片福利 | 国产夫妻av在线 | 精品国偷自产在线 | 日韩精品在线免费播放 | 久草视频资源 | 国产综合在线视频 | 国内精品久久天天躁人人爽 | 亚洲电影免费 | 亚色视频在线观看 | a极黄色片 | 国产a高清 | 69夜色精品国产69乱 | 日韩精品高清视频 | 欧美巨大荫蒂茸毛毛人妖 | 久久视频免费看 | 日韩大陆欧美高清视频区 | 中文欧美字幕免费 | 伊人av综合| 日韩av免费大片 | 五月综合网| 国产伦精品一区二区三区在线 | 天天干天天看 | 五月婷婷视频在线 | 最近最新mv字幕免费观看 | 一区精品在线 | 久久最新视频 | 国产精品精品久久久久久 | av电影免费在线播放 | 91精品1区2区 | 日韩在线小视频 | 精品99在线观看 | 国产成人久久久久 | 欧美激情精品 | 99色免费视频 | 免费视频网 | 一区二区三区在线视频观看58 | 最近的中文字幕大全免费版 | 一区二区中文字幕在线观看 | 91丨九色丨蝌蚪丨老版 | 亚一亚二国产专区 | 亚洲va欧美va国产va黑人 | 色婷婷 亚洲 | 看国产黄色大片 | 丁香资源影视免费观看 | 中文字幕人成人 | 美女网站在线播放 | 精品国产精品久久一区免费式 | 久久人人看 | 日韩黄色中文字幕 | 国产精品成久久久久三级 | 午夜精品久久久久久久久久 | 激情婷婷综合网 | 亚洲区另类春色综合小说 | 高清一区二区 | 探花视频免费观看高清视频 | 国产免费亚洲 | 在线91精品 | 色橹橹欧美在线观看视频高清 | 日韩欧美精品在线观看视频 | 黄网站免费大全入口 | 国产剧情久久 | 2018精品视频| 成年美女黄网站色大片免费看 | 精品国产欧美一区二区三区不卡 | 日韩高清国产精品 | 99热高清| 天天操月月操 | 色先锋av资源中文字幕 | 日日夜夜天天 | 日韩精品免费一区二区 | 高清不卡一区二区三区 | 婷婷电影在线观看 | 一区二区精品久久 | 午夜久久影视 | 麻豆久久久| 综合中文字幕 | 国产精品自在线拍国产 | 免费看国产一级片 | 久久艹在线观看 | 91传媒在线 | 成人国产一区二区 | 免费看污污视频的网站 | 国产99久久久久久免费看 | 99re国产视频 | 亚洲一级在线观看 | av电影在线免费观看 | 亚洲第一伊人 | 91观看视频| 91手机视频 | 99久久er热在这里只有精品15 | 亚洲经典中文字幕 | 欧美91视频 | 激情综合网五月婷婷 | 亚洲精品国产精品久久99 | 五月婷婷六月综合 | 国产精品手机在线 | 亚洲一区 av| 亚洲黄色网络 | 久草综合在线观看 | 久久久资源 | 欧美日韩国产二区三区 | 在线看国产日韩 | 欧美最猛性xxxxx(亚洲精品) | 成人免费一区二区三区在线观看 | 91精品视频免费看 | av久久在线 | 色婷婷www | 毛片无卡免费无播放器 | 91看片在线免费观看 | 狠狠干综合| 久久理伦片 | 一区二区视频播放 | 手机看片国产日韩 | 91自拍视频在线 | 99久久精品国产一区 | 亚洲精品自在在线观看 | 亚洲网站在线看 | 日韩亚洲国产精品 | 欧美精品网站 | 久久影院中文字幕 | 国产一级免费视频 | 欧美日韩在线免费观看视频 | 91精品国产欧美一区二区成人 | 在线影院中文字幕 | 亚洲欧美综合精品久久成人 | 日韩欧美在线观看一区二区三区 | av免费在线免费观看 | 日韩有码在线播放 | 色综合天天 | 国产高清无线码2021 | 91精品久久久久久久91蜜桃 | 中文字幕在线视频精品 | 91麻豆精品国产91久久久久久久久 | 91粉色视频| 成人av一区二区在线观看 | 午夜免费在线观看 | 欧美色图视频一区 | 国产在线欧美日韩 | 丁香婷婷激情五月 | 国产r级在线观看 | 国产美女精品人人做人人爽 | 亚洲国产久 | 亚洲日本一区二区在线 | 国产精品ⅴa有声小说 | 国产精品成人av在线 | 久久久高清免费视频 | 九九免费在线观看 | 久久久久久久久久久电影 | 国产视频精品免费播放 | 91视频麻豆视频 | 91精品国产麻豆国产自产影视 | 亚洲免费在线观看视频 | 亚洲国产精品小视频 | 天天色天天草天天射 | 国产精品嫩草55av | 午夜免费福利视频 | 日韩精品三区四区 | 国产精品一区二区免费视频 | 国产视频97 | 999成人国产| 久一久久 | 91精品在线免费观看视频 | av中文字幕av| 国产精品久久久久久久7电影 | 精品不卡视频 | 国产精品黑丝在线观看 | 久久久国产精华液 | 精品国产一区二区三区免费 | 国产精品女主播一区二区三区 | 国产精品18久久久久久久久久久久 | 国产精品1区2区 | 黄色亚洲免费 | 久久久久免费精品视频 | 日韩免费在线视频观看 | 午夜黄网 | 久久69精品久久久久久久电影好 | avsex| 日日摸日日 | 五月婷婷国产 | 福利视频网址 | 色综合婷婷久久 | 久久久首页 | 久久精品欧美一区二区三区麻豆 | 欧美精品你懂的 | 久久久久国产视频 | 日日夜夜天天操 | 久久国产视频网站 | 中文字幕在线中文 | 操夜夜操| 美女网站视频免费都是黄 | 久久久久久久免费 | 久久久久久久久久久福利 | 91完整视频 | 日韩性片 | 97超碰精品 | 美女视频黄免费的 | 日本黄色一级电影 | 国产伦精品一区二区三区照片91 | 欧美国产91| 国产美女久久 | 亚洲午夜精品久久久久久久久久久久 | av在线免费播放网站 | 久久人人爽人人爽人人片av软件 | 日韩精品视频免费专区在线播放 | 丝袜美腿一区 | 波多野结衣视频在线 | 丁香色婷婷 | 黄色毛片网站在线观看 | 成片免费观看视频999 | 亚洲人成人在线 | 射射射综合网 | 久久综合中文字幕 | 欧美夫妻生活视频 | 午夜性色 | 国产精品亚洲精品 | 久久激情综合网 | 色黄久久久久久 | 久久精品精品电影网 | 天天玩天天操天天射 | 天海翼一区二区三区免费 | 午夜91在线 | 天海翼一区二区三区免费 | 国产黄色精品在线观看 | 日日夜夜天天人人 | 日韩av黄 | 久久精品高清 | 亚洲免费永久精品国产 | 日韩狠狠操 | 国产精品a久久 | 四虎永久免费在线观看 | 18女毛片| 青青啪| 婷婷深爱网 | 久草在线观看视频免费 | 久久九九影视 | 欧美日韩在线视频一区 | 九九影视理伦片 | 久久一区二区三区超碰国产精品 | 久久视频二区 | 精品亚洲午夜久久久久91 | 日日干夜夜爱 | 日韩成人免费电影 | 三级av小说 | 精品在线视频一区二区三区 | 天天天色综合 | 在线观看www.| 日韩欧美视频免费观看 | 亚洲传媒在线 | 综合色播| 少妇bbb | 69精品| 欧美在线观看视频免费 | 婷婷成人亚洲综合国产xv88 | av综合av| 网站在线观看你们懂的 | 人人澡人 | a午夜在线 | 狠狠色丁香久久婷婷综合五月 | 综合网在线视频 | 激情深爱.com | 色99导航| 五月天高清欧美mv | 中文字幕123区 | 日韩欧美一区二区在线播放 | 91污视频在线 | 热精品 | 国产精品女人久久久 | 在线免费视频你懂的 | 久久久久久激情 | 五月婷婷中文字幕 | 日本韩国中文字幕 | 在线观看亚洲电影 | 亚洲视频 中文字幕 | 亚洲高清视频在线观看免费 | 亚洲成人资源网 | 国产成人精品久久久久 | 在线观看久久久久久 | 欧美激情视频在线免费观看 | 亚洲 中文 欧美 日韩vr 在线 | 九月婷婷人人澡人人添人人爽 | 亚洲日本欧美在线 | 四虎影视成人永久免费观看视频 | 国产黄色成人av | 成人aaa毛片 | 亚洲国产中文字幕在线视频综合 | 日日干美女 | 在线观看亚洲电影 | 中文字幕在线观看免费高清电影 | 久久久久北条麻妃免费看 | 精品一区三区 | 久久精品资源 | 正在播放五月婷婷狠狠干 | 国产精品乱码久久久久久1区2区 | 91福利小视频 | 久久久一本精品99久久精品 | 国产精品久久在线 | 91在线资源 | 91精品久久久久久 | 成人免费观看电影 | 久草视频视频在线播放 | 国产中文字幕在线看 | 亚洲精品麻豆视频 | 欧美一级片免费 | 欧美一区二区三区在线观看 | 最新久久免费视频 | adc在线观看 | 国产一及片 | 亚洲视频免费在线看 | 丁香花在线观看视频在线 | 免费在线国产 | 久久精品视频在线观看 | 毛片网站免费 | 亚洲国产三级在线观看 | 亚洲黄污| 91丨九色丨蝌蚪丰满 | 日韩免费b| 在线免费观看黄色小说 | 精品国产一区二 | 久久久av电影 | 日狠狠| 日韩在线中文字幕 | 亚洲黄色免费网站 | 成人黄大片视频在线观看 | 精品国产一区二区三区av性色 | 欧美国产一区在线 | 亚洲欧美激情插 | 一区二区欧美日韩 | 国产999精品久久久影片官网 | 麻豆首页| 国产精品入口麻豆 | 免费又黄又爽的视频 | 午夜精品久久久久久久99 | 日本韩国欧美在线观看 | 99视频在线看 | 国产尤物一区二区三区 | 麻豆国产在线播放 | 精品色综合 | 久久国产美女 | 精品免费视频 | 欧美精品久久久久久久久久久 | 99久久国产免费,99久久国产免费大片 | 久久久av电影 | 超碰av在线免费观看 | 日韩中文字幕第一页 | 日韩免费视频在线观看 | 亚洲国产丝袜在线观看 | 亚洲黄色在线免费观看 | 一区二区三区手机在线观看 | 国产精品久久久久久久久久久不卡 | 久久久久免费精品国产小说色大师 | 九九九九热精品免费视频点播观看 | 欧美日韩中文国产一区发布 | 深夜免费福利视频 | 国产精品99视频 | 国产精品久久久久毛片大屁完整版 | 国产美腿白丝袜足在线av | 国产剧情一区二区在线观看 | 国内精品久久久久影院优 | 色婷丁香 | 日日操网 | 黄色成年片 | 国产精品欧美日韩 | 国产激情久久久 | 在线观看理论 | 久艹在线观看视频 | 免费美女久久99 | 最近中文字幕高清字幕免费mv | 久久免费在线视频 | 日本aaa在线观看 | 97超碰人人在线 | 久久免费高清 | 婷婷 综合 色 | 国产黄色免费在线观看 | 黄色软件网站在线观看 | 欧美日韩精品网站 | 亚洲国产成人在线播放 | 国产精品免费久久久久久久久久中文 | 久久久久免费看 | 久久99国产精品自在自在app | 国产精品av免费观看 | 干干夜夜 | 啪啪av在线| 久久一区二区免费视频 | 中文字幕在线观看免费高清电影 | 日韩欧美aaa| 中文 一区二区 | 91香蕉视频在线 | 人人添人人澡人人澡人人人爽 | 免费69视频 | 午夜久久久久久久久久影院 | 在线观看av片 | 在线三级av | 日本黄色免费在线观看 | 国产一区二区视频在线播放 | 国产精品手机在线观看 | 久草资源在线观看 | 久草在线在线 | 国产日产欧美在线观看 | 精品久久久久久亚洲综合网站 | 色婷婷激情四射 | 91在线看视频免费 | 日韩精品一区二区三区水蜜桃 | 在线观看视频99 | 久久精品一二三 |