mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1.修改数据源标识的获取途径,由原先从前端传递,到从网关统一传递
This commit is contained in:
+4
-4
@@ -19,7 +19,7 @@ import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConsta
|
||||
*/
|
||||
public class DataSourceFilter extends OncePerRequestFilter {
|
||||
//数据源编码
|
||||
private static final String DATA_SOURCE_CODE = "dataCode";
|
||||
private static final String DATA_SOURCE_CODE = "data-code";
|
||||
|
||||
private WebProperties webProperties;
|
||||
|
||||
@@ -36,12 +36,12 @@ public class DataSourceFilter extends OncePerRequestFilter {
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||
String dataSourceCode = request.getHeader(DATA_SOURCE_CODE);
|
||||
if(StrUtil.isBlank(dataSourceCode)) {
|
||||
String dataCode = request.getHeader(DATA_SOURCE_CODE);
|
||||
if(StrUtil.isEmpty(dataCode)) {
|
||||
ServletUtils.writeJSON(response, CommonResult.error(DATA_SOURCE_CODE_NOT_FOUND));
|
||||
return;
|
||||
}
|
||||
DynamicDataSourceContextHolder.push(dataSourceCode);
|
||||
DynamicDataSourceContextHolder.push(dataCode);
|
||||
filterChain.doFilter(request, response);
|
||||
DynamicDataSourceContextHolder.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user