Merge remote-tracking branch 'origin/guoshengxiong' into guoshengxiong
This commit is contained in:
commit
9a51dad438
@ -1,5 +1,6 @@
|
|||||||
package com.zhgd.mybatis;
|
package com.zhgd.mybatis;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.parser.SqlParserHelper;
|
import com.baomidou.mybatisplus.core.parser.SqlParserHelper;
|
||||||
@ -30,10 +31,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class DataScopeInterceptor extends JsqlParserSupport implements InnerInterceptor {
|
public class DataScopeInterceptor extends JsqlParserSupport implements InnerInterceptor {
|
||||||
@ -150,6 +148,14 @@ public class DataScopeInterceptor extends JsqlParserSupport implements InnerInte
|
|||||||
} else {
|
} else {
|
||||||
processFromItem(fromItem, obj);
|
processFromItem(fromItem, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果还存在关联查询
|
||||||
|
List<Join> joins = plainSelect.getJoins();
|
||||||
|
if (CollUtil.isNotEmpty(joins)) {
|
||||||
|
for (Join join : joins) {
|
||||||
|
processJoin(join,obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void processFromItem(FromItem fromItem, Object obj) {
|
protected void processFromItem(FromItem fromItem, Object obj) {
|
||||||
@ -160,4 +166,17 @@ public class DataScopeInterceptor extends JsqlParserSupport implements InnerInte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理关联查询
|
||||||
|
*
|
||||||
|
* @param join 关联查询
|
||||||
|
* @param obj
|
||||||
|
*/
|
||||||
|
protected void processJoin(Join join, Object obj) {
|
||||||
|
FromItem joinTable = join.getRightItem();
|
||||||
|
if (joinTable instanceof SubSelect) {
|
||||||
|
processSelectBody(((SubSelect) joinTable).getSelectBody(),obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,6 @@
|
|||||||
from xz_checking_route as t
|
from xz_checking_route as t
|
||||||
join enterprise_info ei on find_in_set(ei.id, t.enterprise_id)
|
join enterprise_info ei on find_in_set(ei.id, t.enterprise_id)
|
||||||
group by t.id) as t
|
group by t.id) as t
|
||||||
join xz_checking_route t1 on t1.id = t.id
|
|
||||||
</sql>
|
</sql>
|
||||||
<select id="queryList" resultType="com.zhgd.xmgl.modules.checking.entity.XzCheckingRoute">
|
<select id="queryList" resultType="com.zhgd.xmgl.modules.checking.entity.XzCheckingRoute">
|
||||||
<include refid="selectTable">
|
<include refid="selectTable">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user