From 09c36ff4a74cd5cb9621cda5f48784c1d10b920b Mon Sep 17 00:00:00 2001 From: weizhiqiang <> Date: Fri, 1 Jul 2022 10:37:32 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=95=B0=E6=8D=AE=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E3=80=91=E6=95=B4=E5=90=88Mybatis-Plus=E6=95=B4=E6=94=B9?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/skyeye/eve/eitity/dict/SysDictTypeMation.java | 3 ++- .../com/skyeye/db/config/BaseDataSourceConfig.java | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/eitity/dict/SysDictTypeMation.java b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/eitity/dict/SysDictTypeMation.java index f9005259..72f696ce 100644 --- a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/eitity/dict/SysDictTypeMation.java +++ b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/eitity/dict/SysDictTypeMation.java @@ -5,6 +5,7 @@ package com.skyeye.eve.eitity.dict; import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.skyeye.annotation.api.ApiModel; import com.skyeye.annotation.api.ApiModelProperty; @@ -26,7 +27,7 @@ import java.io.Serializable; @ApiModel("数据字典类型实体类") public class SysDictTypeMation extends CommonOperatorUserInfo implements Serializable { - @TableField("id") + @TableId("id") private String id; @TableField("dict_name") diff --git a/skyeye-promote/skyeye-web/src/main/java/com/skyeye/db/config/BaseDataSourceConfig.java b/skyeye-promote/skyeye-web/src/main/java/com/skyeye/db/config/BaseDataSourceConfig.java index 3da181fa..9e6cdd4f 100644 --- a/skyeye-promote/skyeye-web/src/main/java/com/skyeye/db/config/BaseDataSourceConfig.java +++ b/skyeye-promote/skyeye-web/src/main/java/com/skyeye/db/config/BaseDataSourceConfig.java @@ -4,6 +4,7 @@ package com.skyeye.db.config; +import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; import com.skyeye.exception.CustomException; import org.apache.commons.collections.CollectionUtils; import org.apache.ibatis.session.SqlSessionFactory; @@ -109,18 +110,18 @@ public class BaseDataSourceConfig { @Primary @Bean(name = "baseSqlSessionFactory") public SqlSessionFactory baseSqlSessionFactory(@Qualifier("baseDataSource") DataSource dataSource) throws Exception { - SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean(); + MybatisSqlSessionFactoryBean mybatisSqlSessionFactoryBean = new MybatisSqlSessionFactoryBean(); - sqlSessionFactoryBean.setDataSource(dataSource); + mybatisSqlSessionFactoryBean.setDataSource(dataSource); String databaseType = this.initDatabaseType(dataSource); if (databaseType == null) { throw new CustomException("couldn't deduct database type"); } else { try { // 添加XML目录 - sqlSessionFactoryBean.setMapperLocations(resolveMapperLocations()); - sqlSessionFactoryBean.afterPropertiesSet(); - return sqlSessionFactoryBean.getObject(); + mybatisSqlSessionFactoryBean.setMapperLocations(resolveMapperLocations()); + mybatisSqlSessionFactoryBean.afterPropertiesSet(); + return mybatisSqlSessionFactoryBean.getObject(); } catch (Exception var5) { throw new CustomException("Could not create sqlSessionFactory", var5); }