소스 검색

编码规则 带国家编码没切换数据源问题处理

yzc 1 년 전
부모
커밋
f66a5f8941
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      hx-common/src/main/java/com/fjhx/common/service/coding/impl/CodingRuleServiceImpl.java

+ 2 - 0
hx-common/src/main/java/com/fjhx/common/service/coding/impl/CodingRuleServiceImpl.java

@@ -241,9 +241,11 @@ public class CodingRuleServiceImpl extends ServiceImpl<CodingRuleMapper, CodingR
     }
 
     private String getCountryCode(Long countryId) {
+        DynamicDataSourceContextHolder.push(SourceConstant.BASE);
         CustomizeArea customizeArea = customizeAreaService.getOne(q -> q
                 .eq(BaseIdPo::getId, countryId)
                 .eq(CustomizeArea::getLevelCode, 1));
+        DynamicDataSourceContextHolder.poll();
 
         if (customizeArea == null) {
             throw new ServiceException("国家为空");