瀏覽代碼

集成lombok mybatisplus3.1.0

肖玮 5 年之前
父節點
當前提交
fdfe834d5b

+ 19 - 0
mec-education/pom.xml

@@ -50,6 +50,25 @@
 			<groupId>com.ym</groupId>
 			<artifactId>mec-biz</artifactId>
 		</dependency>
+
+		<dependency>
+			<groupId>com.baomidou</groupId>
+			<artifactId>mybatis-plus-boot-starter</artifactId>
+			<version>3.1.0</version>
+		</dependency>
+
+		<dependency>
+			<groupId>com.baomidou</groupId>
+			<artifactId>mybatis-plus-extension</artifactId>
+			<version>3.1.0</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.projectlombok</groupId>
+			<artifactId>lombok</artifactId>
+			<version>1.18.4</version>
+			<scope>provided</scope>
+		</dependency>
 	</dependencies>
 	<build>
 		<plugins>

+ 22 - 0
mec-education/src/main/java/com/ym/mec/education/config/MybatisPlusConfig.java

@@ -0,0 +1,22 @@
+package com.ym.mec.education.config;
+
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * program: mec
+ * description: mybatisplus分页插件
+ * @author xw
+ * create: 2019-09-25 13:26
+ */
+@Configuration
+public class MybatisPlusConfig {
+
+    @Bean
+    public PaginationInterceptor paginationInterceptor(){
+        PaginationInterceptor page = new PaginationInterceptor();
+        page.setDialectType("mysql");
+        return page;
+    }
+}

+ 14 - 10
mec-education/src/main/resources/application.yml

@@ -9,7 +9,7 @@ eureka:
 spring:
   application:
     name: education-server
-    
+
   datasource:
     name: test
     url: jdbc:mysql://47.99.212.176:3306/mec_dev?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai
@@ -31,11 +31,11 @@ spring:
     testOnReturn: false
     poolPreparedStatements: true
     maxOpenPreparedStatements: 20
-    
+
   redis:
     host: 47.99.212.176
     port: 6379
-    password: 
+    password:
     database: 0
     #连接超时时间(毫秒)
     timeout: 10000
@@ -50,12 +50,16 @@ spring:
       min-idle: 0
 
 mybatis:
-    mapperLocations: classpath:config/mybatis/*.xml
-    
+  mapperLocations: classpath:config/mybatis/*.xml
+mybatis-plus:
+  mapper-locations: classpath*:config/mybatis/*.xml
+  configuration:
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+
 swagger:
   base-package: com.ym.mec.education.controller
- 
-##认证 
+
+##认证
 security:
   oauth2:
     client:
@@ -63,7 +67,7 @@ security:
       client-secret: app
     resource:
       token-info-uri: http://localhost:8001/oauth/check_token
-  
+
 #spring boot admin 相关配置
 management:
   endpoints:
@@ -73,7 +77,7 @@ management:
   endpoint:
     health:
       show-details: ALWAYS
-  
+
 feign:
   hystrix:
-    enabled: true
+    enabled: true