浏览代码

Merge remote-tracking branch 'origin/saas' into saas

yanite 3 年之前
父节点
当前提交
b0e8ea1f85

+ 7 - 5
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/interceptor/TenantInterceptor.java

@@ -45,11 +45,13 @@ public class TenantInterceptor extends HandlerInterceptorAdapter {
 		}
 		if(StringUtils.isNotEmpty(tenantId)){
 			TenantContextHolder.setTenantId(Integer.parseInt(tenantId));
-			TenantInfo tenantInfo = tenantInfoService.getOpenTenant(Integer.parseInt(tenantId));
-			if(tenantInfo != null){
-				request.setAttribute(DATA_SOURCE_ID, tenantInfo.getDataSource());
-			}else {
-				throw new BizException("机构信息异常,请联系管理员");
+			if(Integer.parseInt(tenantId) != -1){
+				TenantInfo tenantInfo = tenantInfoService.getOpenTenant(Integer.parseInt(tenantId));
+				if(tenantInfo != null){
+					request.setAttribute(DATA_SOURCE_ID, tenantInfo.getDataSource());
+				}else {
+					throw new BizException("机构信息异常,请联系管理员");
+				}
 			}
 		}
 		return true;

+ 8 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java

@@ -686,12 +686,14 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
             }
         }
         if(StringUtils.isNotEmpty(tenantId)){
-            TenantInfo tenantInfo = this.baseMapper.getOpenTenant(Integer.parseInt(tenantId));
-            if(tenantInfo != null){
-                TenantContextHolder.setTenantId(Integer.parseInt(tenantId));
-                request.setAttribute("datasourceId", tenantInfo.getDataSource());
-            }else {
-                throw new BizException("机构信息异常,请联系管理员");
+            TenantContextHolder.setTenantId(Integer.parseInt(tenantId));
+            if(Integer.parseInt(tenantId) != -1){
+                TenantInfo tenantInfo = this.baseMapper.getOpenTenant(Integer.parseInt(tenantId));
+                if(tenantInfo != null){
+                    request.setAttribute("datasourceId", tenantInfo.getDataSource());
+                }else {
+                    throw new BizException("机构信息异常,请联系管理员");
+                }
             }
         }
     }

+ 1 - 4
mec-biz/src/main/resources/config/mybatis/StudentVisitMapper.xml

@@ -76,14 +76,11 @@
             <if test="visitTime != null">
                 visit_time_ = #{visitTime},
             </if>
-            <if test="createTime != null">
-                create_time_ = #{createTime},
-            </if>
             <if test="objectId != null">
                 object_id_ = #{objectId},
             </if>
         </set>
-        where id_ = #{id,jdbcType=INTEGER} and tenant_id_ = #{tenantId}
+        WHERE id_ = #{id,jdbcType=INTEGER} AND tenant_id_ = #{tenantId}
     </update>
 
     <select id="queryPage" resultMap="StudentVisit">