MyBatis筆記

一、MyBatis 入門

1匈勋、架構(gòu):

  1. sqlMapConfig.xml文件(這個(gè)文件名可以自己定義)
  2. mapper.xml文件時(shí)sql的映射文件(這個(gè)文件需要在上邊的sqlMapConfig.xml進(jìn)行配置)
  3. 通過mybatis環(huán)境配置構(gòu)造sqlSessionFactory會(huì)話工廠
  4. 會(huì)話工廠創(chuàng)建sqlSession會(huì)話
  5. mybatis底層自定義了Executor執(zhí)行器接口操作數(shù)據(jù)庫(kù)若皱,兩個(gè)接口實(shí)現(xiàn)兔毙,一個(gè)是基本實(shí)現(xiàn),一個(gè)是緩存實(shí)現(xiàn)
  6. Mapped Statement 是mybatis的一個(gè)底層封裝對(duì)象,包裝了mybatis的配置信息疯趟,sql映射信息拘哨,mapper.xml中的一個(gè)sql對(duì)應(yīng)一個(gè)mapped statement對(duì)象。so sql的id就是Mapped statement 的id
  7. Mapped Statement對(duì)sql執(zhí)行輸入?yún)?shù)進(jìn)行定義信峻,包括HashMap基本類型 pojo 倦青。類似于jdbc的preparedStatement的參數(shù)設(shè)置。
  8. Mapped Statement對(duì)輸出結(jié)果進(jìn)行定義站欺,包括hashMap 基本類型 pojo

2姨夹、下載

下載文件

  • mybatis-x.x.x.jar核心包
  • lib依賴包

3、入門程序

  1. 創(chuàng)建java工程

  2. 加入mybatis的核心包矾策,依賴包磷账,數(shù)據(jù)驅(qū)動(dòng)包

    • lib\asm-3.3.1.jar
      lib\cglib-2.2.2.jar
      lib\commons-logging-1.1.1.jar
      lib\ehcache-core-2.6.5.jar
      lib\javassist-3.17.1-GA.jar
      lib\junit-4.9.jar
      lib\log4j-1.2.17.jar
      lib\log4j-api-2.0-rc1.jar
      lib\log4j-core-2.0-rc1.jar
      lib\mybatis-3.2.7.jar
      lib\mybatis-ehcache-1.0.2.jar
      lib\mysql-connector-java-5.1.7-bin.jar
      lib\slf4j-api-1.7.5.jar
      lib\slf4j-log4j12-1.7.5.jar
  3. config目錄下創(chuàng)建log4j.properties 創(chuàng)建輸出日志

        # Global logging configuration
        log4j.rootLogger=DEBUG, stdout
        # Console output...
        log4j.appender.stdout=org.apache.log4j.ConsoleAppender
        log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
        log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
    
  4. 創(chuàng)建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>
            <!--jdbc的配置方式,spring中的配置方式-->
            <environments default="development">
                <environment id="development">
                <!-- 使用jdbc事務(wù)管理-->
                    <transactionManager type="JDBC" />
                <!-- 數(shù)據(jù)庫(kù)連接池-->
                    <dataSource type="POOLED">
                        <property name="driver" value="com.mysql.jdbc.Driver" />
                        <property name="url" value="jdbc:mysql://localhost:3306/mybatis?characterEncoding=utf-8" />
                        <property name="username" value="root" />
                        <property name="password" value="mysql" />
                    </dataSource>
                </environment>
            </environments>
    
        </configuration>
    
  5. 創(chuàng)建PO類

    Public class User {
    private int id;
    private String username;// 用戶姓名
    private String sex;// 性別
    private Date birthday;// 生日
    private String address;// 地址
    get/set……
    
  6. 程序編寫-基本的操作*查詢

    1. Users.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="test">
        </mapper>
    
    1. Users.xml
        <select id="findUserById" parameterType="int" resultType="com.baip.po.User">
       select * from user where id = #{id}
        </select>
        <!-- 自定義條件查詢用戶列表 -->
        <select id="findUserByUsername" parameterType="java.lang.String" 
                resultType="com.baip.po.User">
        select * from user where username like '%${value}%' 
        </select>
    

    paramterType定義輸入到sql中映射類型贾虽,#{id}表示使用preparedstatement設(shè)置占位符號(hào)逃糟,并將輸入變量id傳到sql
    resultType:定義結(jié)果映射類型
    #{id}是進(jìn)行映射的表示一個(gè)占位符號(hào),可以實(shí)現(xiàn)preparedStatement向占位符中設(shè)置值蓬豁,防止sql注入绰咽。如果傳入的參數(shù)是簡(jiǎn)單類型,括號(hào)中可以是value或者是其他的名稱地粪。
    ${}是進(jìn)行拼接的 取募,不進(jìn)行jdbc的類型轉(zhuǎn)換,括號(hào)中只能是value

    1. 加載映射文件蟆技,在SqlMapConfig.xml中
    <mappers>
       <mapper resource="sqlmap/User.xml"/>
    </mappers>
    
    1. 測(cè)試程序
        private SqlSessionFactory sqlSessionFactory;
    
           @Before
       public void createSqlSessionFactory() throws IOException {
       // 配置文件
                String resource = "SqlMapConfig.xml";
                InputStream inputStream = Resources.getResourceAsStream(resource);
    
                // 使用SqlSessionFactoryBuilder從xml配置文件中創(chuàng)建SqlSessionFactory
                sqlSessionFactory = new SqlSessionFactoryBuilder()
                        .build(inputStream);
    
        }
    
    @Test
    public void testFindUserById() {
        // 數(shù)據(jù)庫(kù)會(huì)話實(shí)例
        SqlSession sqlSession = null;
        try {
            // 創(chuàng)建數(shù)據(jù)庫(kù)會(huì)話實(shí)例sqlSession
            sqlSession = sqlSessionFactory.openSession();
            // 查詢單個(gè)記錄玩敏,根據(jù)用戶id查詢用戶信息
            User user = sqlSession.selectOne("test.findUserById", 10);
            // 輸出用戶信息
            System.out.println(user);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (sqlSession != null) {
                sqlSession.close();
            }
        }

    }
```
  1. 新增* 自增鍵返回
    User.xml中

    <insert id="insertUser" parameterType="com.baip.po.User">
            <!-- selectKey將主鍵返回,需要再返回 -->
            <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
                select LAST_INSERT_ID()
            </selectKey>
        insert into user(username,birthday,sex,address)
            values(#{username},#{birthday},#{sex},#{address});
    </insert>
    
    • keyProperty 返回的主鍵放到pojo的哪個(gè)屬性上
    • order 執(zhí)行順序
    • resultType查看返回的追殲類型
    • LAST_INSERT_ID mysql的函數(shù)

    關(guān)于主鍵的賦值方式可以是:

    select uuid()
    SELECT 自定義序列.NEXTVAL FROM DUAL
    
    

二质礼、Dao開發(fā)方法

上邊的測(cè)試方法類似于傳統(tǒng)的Dao方法旺聚,通過SqlSessionFactory創(chuàng)建sqlSession調(diào)用SqlSession的數(shù)據(jù)庫(kù)方法
調(diào)用sqlSession的數(shù)據(jù)庫(kù)方法執(zhí)行statement的id存在硬編碼,不利于開發(fā)維護(hù)眶蕉。sqlSession.selectOne這個(gè)selectOne就是Dao寫的方法砰粹,這個(gè)就是硬編碼

1、Mapper動(dòng)態(tài)代理的方式

  1. 實(shí)現(xiàn)原理
    Mapper接口開發(fā)方法中需要遵循如下的規(guī)范
    1. Mapper.xml文件中的nameSpace和maper接口的類路徑相同
    2. Mapper接口方法名和Mapper.xml中定義的id相同
    3. Maper接口中輸入的參數(shù)類型和Mapper.xml中定義的每個(gè)sql的parameterType的類型相同
    4. Mapper接口中輸出的參數(shù)類型和mapper.xml中定義的每個(gè)sql的result的類型相同
  2. Mapper.xml映射文件
    <mapper namespace="com.baip.mapper.UserMapper">
    
    <select id="findUserById" parameterType="int" resultType="com.baip.po.User">
        select * from user where id = #{id}
    </select>
    
  3. Mapper.java接口文件:
    Public interface UserMapper {
        //根據(jù)用戶id查詢用戶信息
        public User findUserById(int id) throws Exception;
        //查詢用戶列表
        public List<User> findUserByUsername(String username) throws Exception;
        //添加用戶信息
        public void insertUser(User user)throws Exception; 
    }
    
    注意相等的地方:
    • UserMapper namespace 和interface的接口名一致
    • findUserById id和方法名一致
    • UserMapper的 findUserById方法參數(shù) int類型和parameterType參數(shù)保持一致
    • UserMapper的 findUserById方法返回參數(shù) 和 resultType保持一致
  4. 加載UserMapper.xml
    在SqlMapConfig.xml中造挽,加載映射文件
     <!-- 加載映射文件 -->
      <mappers>
        <mapper resource="mapper/UserMapper.xml"/>
    </mappers>
    

三碱璃、SqlMapConfig.xml配置文件

1、配置內(nèi)容

從上到下依次:

  1. properties
  2. settings
  3. typeAliases(類型別名)
  4. typeHandlers(類型處理器)
  5. objectFactory對(duì)象工廠
  6. plugin(插件)
  7. environments(環(huán)境集合屬性對(duì)象)
    environment(環(huán)境子屬性對(duì)象)
    transactionManager(事務(wù)管理)
    dataSource(數(shù)據(jù)源)
  8. mappers映射器

2刽宪、properties

  1. 定義db.properties文件

    jdbc.driver=com.mysql.jdbc.Driver
    jdbc.url=jdbc:mysql://localhost:3306/mybatis
    jdbc.username=root
    jdbc.password=mysql
    
  2. SqlMapConfig.xml中引用:

    <properties resource="db.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>
    

    mybatis對(duì)對(duì)應(yīng)屬性的加載順序

    1. proerties元素內(nèi)定義的屬性首先被讀取
    2. properties元素中的resource或者是url加載屬性厘贼,會(huì)覆蓋讀取的同名屬性
    3. 最后讀取parameterType傳遞的屬性,覆蓋已經(jīng)讀取的同名屬性

3圣拄、settings配置

    <settings>
        <!-- 打開延遲加載 的開關(guān) -->
        <setting name="lazyLoadingEnabled" value="true"/>
        <!-- 將積極加載改為消極加載即按需要加載 -->
        <setting name="aggressiveLazyLoading" value="false"/>
        <!-- 開啟二級(jí)緩存 -->
        <setting name="cacheEnabled" value="true"/>
    </settings>

4嘴秸、typeAliases(類型別名)

別名 映射類型
_byte byte
_long long
_short short
_int int
_integer int
_double double
_float float
_boolean boolean
string String
byte Byte
long Long
short Short
int Integer
integer Integer
double Double
float Float
boolean Boolean
date Date
decimal BigDecimal
bigdecimal BigDecimal

自定義別名

<typeAliases>
    <!-- 單個(gè)別名定義 -->
    <typeAlias alias="user" type="com.baip.po.User"/>
    <!-- 批量別名定義,掃描整個(gè)包下的類,別名為類名(首字母大寫或小寫都可以) -->
    <package name="com.baip.po"/>
    <package name="其它包"/>
</typeAliases>

5岳掐、mappers映射器

1.類型處理器用于java類型和jdbc類型映射凭疮,如下: <mapper resource="sqlmap/User.xml" />

  1. <mapper url="file:///D:\workspace\mybatis_01\config\sqlmap\User.xml" />
  2. <mapper class="com.baip.mapper.UserMapper"/>此種方法要求mapper接口名稱和mapper映射文件名稱相同,且放在同一個(gè)目錄中串述。
  3. <package name="com.baip.mapper"/>注冊(cè)指定包下的所有mapper接口 此種方法要求mapper接口名稱和mapper映射文件名稱相同执解,且放在同一個(gè)目錄中。

6纲酗、Mapper.xml映射文件

6.1 parameterType

傳遞pojo對(duì)象

<select id='findUserByUser' paramterType="User" resultType="user">
select * from wehre id=#{id} and usernamelike '%${usernaem}%'
</select>

上邊標(biāo)注的是user對(duì)象中的字段名

傳遞hashmap
Sql映射文件定義如下:

<!-- 傳遞hashmap綜合查詢用戶信息 -->
    <select id="findUserByHashmap" parameterType="hashmap" resultType="user">
       select * from user where id=#{id} and username like '%${username}%'
    </select>

這里的id和username都是指hashMap的key

resultType總結(jié)

  1. 輸出pojo對(duì)象和輸出pojo列表在sql中定義resultType是一樣的
  2. 返回單個(gè)pojo對(duì)象要保證sql查詢出來的結(jié)果集為單條衰腌,內(nèi)部使用session.selectOne方法調(diào)用
  3. 返回pojo列表表示查詢出來的結(jié)果集可能多條,內(nèi)部使用session.selectList方法觅赊,mapper接口使用List<pojo>對(duì)象作為方法返回值

7右蕊、動(dòng)態(tài)sql

1、if


<!-- 傳遞pojo綜合查詢用戶信息 -->
    <select id="findUserList" parameterType="user" resultType="user">
        select * from user 
        where 1=1 
        <if test="id!=null and id!=''">
        and id=#{id}
        </if>
        <if test="username!=null and username!=''">
        and username like '%${username}%'
        </if>
    </select>

2吮螺、where

自動(dòng)處理第一個(gè)and

<select id="findUserList" parameterType="user" resultType="user">
        select * from user 
        <where>
        <if test="id!=null and id!=''">
        and id=#{id}
        </if>
        <if test="username!=null and username!=''">
        and username like '%${username}%'
        </if>
        </where>
</select>

3饶囚、foreach

向sql傳遞數(shù)組或List mybatis使用foreach解析

<if test="ids!=null and ids.size>0">
    <foreach collection="ids" open=" and id in(" close=")" item="id" separator="," >
        #{id}
    </foreach>
</if>

8、sql片段

<sql id="query_user">
    <if test="id!=null and id!=''">
        and id=#{id}
    </if>
    <if test="username!=null and username!=''">
        and username like '%${username}%'
    </if>
</sql>

使用的時(shí)候鸠补,include

<select id="findUsers" parameterType="user" resultType="user">
        select * from user 
        <where>
        <include refid="namespace.query_user"/>
        </where>
    </select>

如果是其他的workspace里的代碼片段萝风,那就需要前邊追加一個(gè)namespace

四、整合spring

通過spring管理sqlSessionFactory mapper接口
mybatis提供的spring整合jar包
mybatis-spring-x.x.x.jar

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>

    <!—使用自動(dòng)掃描器時(shí)紫岩,mapper.xml文件如果和mapper.java接口在一個(gè)目錄則此處不用定義mappers -->
    <mappers>
       <package name="cn.baip.mapper" />
    </mappers>
</configuration>

applicationContext.xml 定義數(shù)據(jù)庫(kù)連接池和sqlSessionFactory

<!-- 加載配置文件 -->
<context:property-placeholder location="classpath:db.properties"/>
    <!-- 數(shù)據(jù)庫(kù)連接池 -->
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${jdbc.driver}"/>
            <property name="url" value="${jdbc.url}"/>
            <property name="username" value="${jdbc.username}"/>
            <property name="password" value="${jdbc.password}"/>
            <property name="maxActive" value="10"/>
            <property name="maxIdle" value="5"/>
    </bean> 
<!-- mapper配置 -->
    <!-- 讓spring管理sqlsessionfactory 使用mybatis和spring整合包中的 -->
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <!-- 數(shù)據(jù)庫(kù)連接池 -->
        <property name="dataSource" ref="dataSource" />
        <!-- 加載mybatis的全局配置文件 -->
        <property name="configLocation" value="classpath:mybatis/SqlMapConfig.xml" />
    </bean>

</beans>

1规惰、Mapper Dao接口實(shí)現(xiàn)繼承sqlSessionDaoSupport

  1. 在sqlMapConfig.xml中配置映射文件
    <mappers>
    <mapper resource="mapper.xml文件的地址" />
        <mapper resource="mapper.xml文件的地址" />
    </mappers>
    
```
  1. 定義dao接口
  2. dao接口實(shí)現(xiàn)類集成SqlSessionDaoSupport
    
        SqlSession sqlSession = this.getSqlSession();
        User user = sqlSession.selectOne("test.findUserById", id);
        return user;
        
    
  3. spring配置
    <bean id="" class="mapper接口實(shí)現(xiàn)">
        <property name="sqlSessionFactory" ref="sqlSessionFactory" ></property>
    </bean>
    

2、使用org.mybatis.spring.mapper.MapperFactoryBean

  1. 在sqlMapConfig.xmlz中配置mapper.xml位置
  2. d定義接口
  3. spring中定義
    <bean id="" class="org.mybatis.spring.mapper.MapperFactoryBean">
        <property name="mapperInterface" value="mapper接口地址"/>
    <property name="sqlSessionFactory" ref="sqlSessionFactory"/>
    </bean>
    
<bean id="userMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
    <!--mapperInterface指定mapper接口-->
    <property name="mapperInterface" value="com.baip.ssm.mapper.UserMapper"/>
    <property name="sqlSessionFactory" ref="sqlSessionFactory"/>
</bean>
```

3泉蝌、mapper掃描卿拴,感覺這個(gè)比較常用

  1. mapper編寫

  2. 定義mapper接口

    注意mapper.xml的文件名和mapper的接口名保持一致,而且放在同一個(gè)目錄下

  3. 配置mapper掃描在application中

    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="mapper接口包地址"></property>
        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
    </bean>
    

    多個(gè)包的時(shí)候梨与,中間可以用逗號(hào)或者是分號(hào)分割

  4. spring容器中獲取mapper的實(shí)現(xiàn)對(duì)象。
    如果將mapper.xml 和mapper接口的名稱保持一致文狱,放在同一個(gè)目錄下粥鞋,不用在sqlMapConfig.xml中進(jìn)行配置

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市瞄崇,隨后出現(xiàn)的幾起案子呻粹,更是在濱河造成了極大的恐慌,老刑警劉巖苏研,帶你破解...
    沈念sama閱讀 216,402評(píng)論 6 499
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件等浊,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡摹蘑,警方通過查閱死者的電腦和手機(jī)筹燕,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,377評(píng)論 3 392
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人撒踪,你說我怎么就攤上這事过咬。” “怎么了制妄?”我有些...
    開封第一講書人閱讀 162,483評(píng)論 0 353
  • 文/不壞的土叔 我叫張陵掸绞,是天一觀的道長(zhǎng)。 經(jīng)常有香客問我耕捞,道長(zhǎng)衔掸,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,165評(píng)論 1 292
  • 正文 為了忘掉前任俺抽,我火速辦了婚禮敞映,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘凌埂。我一直安慰自己驱显,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,176評(píng)論 6 388
  • 文/花漫 我一把揭開白布瞳抓。 她就那樣靜靜地躺著埃疫,像睡著了一般。 火紅的嫁衣襯著肌膚如雪孩哑。 梳的紋絲不亂的頭發(fā)上栓霜,一...
    開封第一講書人閱讀 51,146評(píng)論 1 297
  • 那天,我揣著相機(jī)與錄音横蜒,去河邊找鬼胳蛮。 笑死,一個(gè)胖子當(dāng)著我的面吹牛丛晌,可吹牛的內(nèi)容都是我干的仅炊。 我是一名探鬼主播,決...
    沈念sama閱讀 40,032評(píng)論 3 417
  • 文/蒼蘭香墨 我猛地睜開眼澎蛛,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼抚垄!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起谋逻,我...
    開封第一講書人閱讀 38,896評(píng)論 0 274
  • 序言:老撾萬榮一對(duì)情侶失蹤呆馁,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后毁兆,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體浙滤,經(jīng)...
    沈念sama閱讀 45,311評(píng)論 1 310
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,536評(píng)論 2 332
  • 正文 我和宋清朗相戀三年气堕,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了纺腊。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片畔咧。...
    茶點(diǎn)故事閱讀 39,696評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖摹菠,靈堂內(nèi)的尸體忽然破棺而出盒卸,到底是詐尸還是另有隱情,我是刑警寧澤次氨,帶...
    沈念sama閱讀 35,413評(píng)論 5 343
  • 正文 年R本政府宣布蔽介,位于F島的核電站,受9級(jí)特大地震影響煮寡,放射性物質(zhì)發(fā)生泄漏虹蓄。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,008評(píng)論 3 325
  • 文/蒙蒙 一幸撕、第九天 我趴在偏房一處隱蔽的房頂上張望薇组。 院中可真熱鬧,春花似錦坐儿、人聲如沸律胀。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,659評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽炭菌。三九已至颈渊,卻和暖如春宫屠,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背挽拔。 一陣腳步聲響...
    開封第一講書人閱讀 32,815評(píng)論 1 269
  • 我被黑心中介騙來泰國(guó)打工酌毡, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留克握,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 47,698評(píng)論 2 368
  • 正文 我出身青樓枷踏,卻偏偏與公主長(zhǎng)得像菩暗,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子旭蠕,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,592評(píng)論 2 353