<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                [TOC] # 一、加入相關依賴 ``` <!--mybatis-plus--> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.5.0</version> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-extension</artifactId> <version>3.5.0</version><!-- 這個版本號一定要和mybatisplus的主版本號一致 --> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>dynamic-datasource-spring-boot-starter</artifactId> <version>3.5.0</version> </dependency> <!--必須使用0.9以上的版本--> <dependency> <groupId>com.github.jsqlparser</groupId> <artifactId>jsqlparser</artifactId> <version>4.2</version> </dependency> <dependency> <groupId>p6spy</groupId> <artifactId>p6spy</artifactId> <version>3.8.1</version> </dependency> <!-- MySQL 連接驅動依賴 --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.11</version> </dependency> <!-- pagehelper --> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>4.1.1</version> </dependency> <!--Commons--> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.4</version> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2.1</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.4</version> </dependency> <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> <version>1.9.3</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.1</version> </dependency> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.10</version> </dependency> ``` # 二、修改application.yml ``` spring: application: name: qingfeng datasource: dynamic: p6spy: true hikari: connection-timeout: 30000 max-lifetime: 1800000 max-pool-size: 15 min-idle: 5 connection-test-query: select 1 pool-name: QingfengHikariCP primary: base datasource: base: username: root password: Root@123 driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/qingfeng_admin?useUnicode=true&characterEncoding=UTF-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8&allowPublicKeyRetrieval=true mybatis-plus: type-aliases-package: com.qingfeng.*.entity.* mapper-locations: classpath:mapper/*/*.xml configuration: jdbc-type-for-null: null map-underscore-to-camel-case: false # 數據庫下劃線自動轉駝峰標示關閉 global-config: banner: false ``` # 三、修改Application啟動類 增加:@MapperScan(**"com.qingfeng.\*.mapper"**) ![](https://img.kancloud.cn/9f/6b/9f6bb64f4f05787b633c756accc5d341_1151x505.png) # 四、測試案例 ## demo案例模塊搭建 新建demo測試案例模塊,分別創建:DemoMapper.xml 、DemoMapper.java、IDemoService.java、DemoServiceImpl.java ![](https://img.kancloud.cn/61/29/6129327afd6da02cba4a25c43eec481c_1073x748.png) ## demo測試類 ``` package com.qingfeng; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.qingfeng.common.entity.Demo; import com.qingfeng.common.service.IDemoService; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.util.List; /** * @author Administrator * @version 1.0.0 * @ProjectName qingfeng * @Description TODO * @createTime 2022年01月11日 15:39:00 */ @SpringBootTest public class DemoTest { @Autowired private IDemoService demoService; @Test void save() { Demo demo = new Demo(); demo.setId("1"); demo.setName("張三"); demo.setRemark("備注"); demo.setCreate_time("20220111"); demoService.save(demo); } @Test void update() { Demo demo = new Demo(); demo.setId("1"); demo.setName("李四"); demo.setRemark("備注"); demo.setCreate_time("20220111"); demoService.updateById(demo); } @Test void info() { Demo demo = demoService.getById("1"); System.out.println(demo); } @Test void list() { QueryWrapper wrapper = new QueryWrapper(); wrapper.like("name","李"); List<Demo> list = demoService.list(wrapper); for (Demo demo:list) { System.out.println(demo); } } } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看