【数据字典】整合Mybatis-Plus整改完成

This commit is contained in:
weizhiqiang 2022-07-01 10:37:32 +08:00
parent 01f5b4dee5
commit 09c36ff4a7
2 changed files with 8 additions and 6 deletions

View file

@ -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")

View file

@ -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);
}