From 25ecc25139e780128c537f22e6cca340c5827ef8 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 11 May 2019 01:20:01 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E5=90=8E=E7=AB=AF=EF=BC=9A=E5=BC=95?= =?UTF-8?q?=E5=85=A5=20MyBatis=20Plus=20=E7=BE=8E=E6=BB=8B=E6=BB=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/common-framework/pom.xml | 2 +- .../boot/web/AdminMVCAutoConfiguration.java | 2 +- pom.xml | 6 ++++++ system/system-service-impl/pom.xml | 8 ++------ .../iocoder/mall/admin/dao/AccessLogMapper.java | 5 ++--- .../src/main/resources/config/application.yaml | 16 +++++++++++++--- .../src/main/resources/config/application.yaml | 15 ++++++++++++--- 7 files changed, 37 insertions(+), 17 deletions(-) diff --git a/common/common-framework/pom.xml b/common/common-framework/pom.xml index d7ec41bd7..82ed1d073 100644 --- a/common/common-framework/pom.xml +++ b/common/common-framework/pom.xml @@ -69,7 +69,7 @@ org.mybatis mybatis - 3.5.0 + 3.5.1 com.fasterxml.jackson.core diff --git a/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/web/AdminMVCAutoConfiguration.java b/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/web/AdminMVCAutoConfiguration.java index 66811dc6e..f2c947b57 100644 --- a/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/web/AdminMVCAutoConfiguration.java +++ b/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/web/AdminMVCAutoConfiguration.java @@ -41,7 +41,7 @@ public class AdminMVCAutoConfiguration implements WebMvcConfigurer { } @Bean - @ConditionalOnMissingBean(GlobalResponseBodyHandler.class) + @ConditionalOnMissingBean(GlobalExceptionHandler.class) public GlobalExceptionHandler globalExceptionHandler() { return new GlobalExceptionHandler(); } diff --git a/pom.xml b/pom.xml index 815a20695..46eb2efa3 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,7 @@ 2.9.2 1.9.3 2.0.0 + 3.1.1 2.0.1 27.0.1-jre 2.0.1 @@ -141,6 +142,11 @@ mybatis-spring-boot-starter ${mybatis-spring-boot-starter.version} + + com.baomidou + mybatis-plus-boot-starter + ${mybatis-plus.version} + com.google.guava diff --git a/system/system-service-impl/pom.xml b/system/system-service-impl/pom.xml index ab75ffb7e..4a85eda25 100644 --- a/system/system-service-impl/pom.xml +++ b/system/system-service-impl/pom.xml @@ -21,10 +21,6 @@ mysql mysql-connector-java - - org.springframework.boot - spring-boot-starter-jdbc - org.apache.dubbo @@ -44,8 +40,8 @@ - org.mybatis.spring.boot - mybatis-spring-boot-starter + com.baomidou + mybatis-plus-boot-starter diff --git a/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dao/AccessLogMapper.java b/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dao/AccessLogMapper.java index 947e79c9c..f7c19272f 100644 --- a/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dao/AccessLogMapper.java +++ b/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dao/AccessLogMapper.java @@ -1,11 +1,10 @@ package cn.iocoder.mall.admin.dao; import cn.iocoder.mall.admin.dataobject.AccessLogDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.springframework.stereotype.Repository; @Repository -public interface AccessLogMapper { - - void insert(AccessLogDO entity); +public interface AccessLogMapper extends BaseMapper { } diff --git a/system/system-service-impl/src/main/resources/config/application.yaml b/system/system-service-impl/src/main/resources/config/application.yaml index aaf7532f0..2cf22d7ee 100644 --- a/system/system-service-impl/src/main/resources/config/application.yaml +++ b/system/system-service-impl/src/main/resources/config/application.yaml @@ -7,9 +7,19 @@ spring: password: ${MALL_MYSQL_PASSWORD} # mybatis -mybatis: - config-location: classpath:mybatis-config.xml - mapper-locations: classpath:mapper/*.xml +#mybatis: +# config-location: classpath:mybatis-config.xml +# mapper-locations: classpath:mapper/*.xml +# type-aliases-package: cn.iocoder.mall.admin.dataobject + +# mybatis-plus +mybatis-plus: + configuration: + map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 + global-config: + db-config: + id-type: auto + mapper-locations: classpath*:mapper/*.xml type-aliases-package: cn.iocoder.mall.admin.dataobject # dubbo diff --git a/user/user-service-impl/src/main/resources/config/application.yaml b/user/user-service-impl/src/main/resources/config/application.yaml index e469d9354..4d4edb0fb 100644 --- a/user/user-service-impl/src/main/resources/config/application.yaml +++ b/user/user-service-impl/src/main/resources/config/application.yaml @@ -7,9 +7,18 @@ spring: password: ${MALL_MYSQL_PASSWORD} # mybatis -mybatis: - config-location: classpath:mybatis-config.xml - mapper-locations: classpath:mapper/*.xml +#mybatis: +# config-location: classpath:mybatis-config.xml +# mapper-locations: classpath:mapper/*.xml +# type-aliases-package: cn.iocoder.mall.user.biz.dataobject + +# mybatis-plus +mybatis-plus: + configuration: + mapUnderscoreToCamelCase: true # 虽然默认为 true ,但是还是显示去指定下。 + mapperLocations: classpath*:mapper/*.xml + typeAliasesPackage: cn.iocoder.mall.user.biz.dataobject + mapper-locations: classpath*:mapper/*.xml type-aliases-package: cn.iocoder.mall.user.biz.dataobject # dubbo