Browse Source

添加默认库名称配置

miaolijing 2 years ago
parent
commit
102af9791f

+ 2 - 0
src/main/java/com/persagy/apm/diagnose/indicatorcompute/dao/ProjectIndicatorComputeMapper.java

@@ -2,6 +2,7 @@ package com.persagy.apm.diagnose.indicatorcompute.dao;
 
 import com.persagy.apm.diagnose.indicatorcompute.model.ProjectIndicatorCompute;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.framework.tenant.mybatis.datasource.db.annotation.Db;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
@@ -9,6 +10,7 @@ import org.apache.ibatis.annotations.Mapper;
  * @author lixing
  * @version V1.0 2021-09-21 13:32:54
  */
+@Db(value = "${datasource-db.name")
 @Mapper
 public interface ProjectIndicatorComputeMapper extends BaseMapper<ProjectIndicatorCompute>{
 

+ 2 - 0
src/main/java/com/persagy/apm/diagnose/timerecord/dao/CalculateTimeRecordMapper.java

@@ -2,6 +2,7 @@ package com.persagy.apm.diagnose.timerecord.dao;
 
 import com.persagy.apm.diagnose.timerecord.model.CalculateTimeRecord;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.framework.tenant.mybatis.datasource.db.annotation.Db;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
@@ -9,6 +10,7 @@ import org.apache.ibatis.annotations.Mapper;
  * @author lixing
  * @version V1.0 2021-09-10 00:13:10
  */
+@Db(value = "${datasource-db.name")
 @Mapper
 public interface CalculateTimeRecordMapper extends BaseMapper<CalculateTimeRecord>{
 

+ 4 - 2
src/main/resources/bootstrap.yml

@@ -53,7 +53,7 @@ tenant:
   switchover:
     datasource-db:
       #是否启动根据租户做数据源切换,如果是非SaaS版的独立部署此设置为false
-      enable: true
+      enable: false
       #是否从请求header中取集团编码
       interceptor-by-header: true
       #查询租户的sql,会从spring.datasource配置的数据源和数据库中读取
@@ -63,7 +63,6 @@ tenant:
       #默认只使用Db注解指定的数据库,不做其他处理,如果是非SaaS版的独立部署此处配置为true
       ignore-db-tenant: true
 
-
 # 日志管理方式使用集成框架的logback
 logging:
   config: classpath:logback-spring.xml
@@ -103,4 +102,7 @@ alarm:
   category:
     list: Eqwb,Eqdx   # 报警系统编码
 
+datasource-db:
+  name: ${persagy.datasource-db.name} # 默认库名称
+