Prechádzať zdrojové kódy

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

yzc 1 rok pred
rodič
commit
f66a5f8941

+ 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("国家为空");