|
|
@ -1,14 +1,15 @@ |
|
|
|
/** |
|
|
|
* Copyright (c) 2018 人人开源 All rights reserved. |
|
|
|
* |
|
|
|
* <p> |
|
|
|
* https://www.renren.io
|
|
|
|
* |
|
|
|
* <p> |
|
|
|
* 版权所有,侵权必究! |
|
|
|
*/ |
|
|
|
|
|
|
|
package com.elink.esua.epdc.commons.mybatis.interceptor; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.PluginUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
import com.baomidou.mybatisplus.extension.handlers.AbstractSqlParserHandler; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.entity.DataScope; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.entity.DataScope; |
|
|
@ -66,12 +67,17 @@ public class DataFilterInterceptor extends AbstractSqlParserHandler implements I |
|
|
|
} |
|
|
|
|
|
|
|
// 不用数据过滤
|
|
|
|
if(scope == null){ |
|
|
|
if (scope == null) { |
|
|
|
return invocation.proceed(); |
|
|
|
} |
|
|
|
|
|
|
|
// 拼接新SQL
|
|
|
|
originalSql = originalSql + scope.getSqlFilter(); |
|
|
|
String orderBy = "ORDER BY"; |
|
|
|
if (originalSql.indexOf(orderBy) > -1) { |
|
|
|
originalSql = originalSql.replace(orderBy, scope.getSqlFilter() + orderBy); |
|
|
|
} else { |
|
|
|
originalSql = originalSql + scope.getSqlFilter(); |
|
|
|
} |
|
|
|
|
|
|
|
// 重写SQL
|
|
|
|
metaObject.setValue("delegate.boundSql.sql", originalSql); |
|
|
|