1. 程式人生 > 遊戲攻略 >《原神攻略》旅行繪本網頁活動首日攻略

《原神攻略》旅行繪本網頁活動首日攻略

1.匯入依賴

        <!--mybatis-plus-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.2.0</version>
        </dependency>

2.配置

1、配置資料來源:

1).匯入驅動(驅動8.0相容MySQL5.7以及其他版本)

<!-- MySQL驅動-->
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.17</version>
</dependency>

2).在application.yml裡面配置資料來源相關資訊

spring:
  datasource:
    username: root
    password: 123456
    url: jdbc:mysql:
//localhost:3306/gulimall_pms driver-class-name: com.mysql.jdbc.Driver

2、配置mybatis-plus

1).在application.yml裡面使用@MapperScan("mapper介面的引用地址")

2).告訴mybatis-plus,sql對映檔案的位置(在application.yml裡面去配置)

mybatis-plus:
  mapper-locations: classpath:/mapper/**/*.xml

再給實體類有@TableId的主鍵的在配置檔案設定統一自增

mybatis-plus:
  mapper
-locations: classpath:/mapper/**/*.xml global-config: db-config: id-type: auto