|
@@ -138,34 +138,34 @@ public class DataScopeAspect
|
|
|
sqlString.append(" OR 1=0 ");
|
|
|
}
|
|
|
}
|
|
|
- else if (DATA_SCOPE_COMPANY.equals(dataScope))
|
|
|
- {
|
|
|
-
|
|
|
- * 1.查询出数据所属部门的ancestors
|
|
|
- * 2.查询出查询人的公司id也就是部门的第三级
|
|
|
- * 3。公司id包含在数据所属部门的ancestors后认为是公司所属数据
|
|
|
- * */
|
|
|
- StringBuilder companysqlString = new StringBuilder();
|
|
|
- companysqlString.append(StringUtils.format(
|
|
|
- "select SUBSTRING_INDEX(" +
|
|
|
- " SUBSTRING_INDEX(companyAncestors.ancestors,',',3)" +
|
|
|
- " ,',',-1) company_id " +
|
|
|
- "from(" +
|
|
|
- " select" +
|
|
|
- " companyDept.ancestors " +
|
|
|
- " from" +
|
|
|
- " sys_dept companyDept " +
|
|
|
- " where" +
|
|
|
- " companyDept.dept_id ={} " +
|
|
|
- " and " +
|
|
|
- " LENGTH(companyDept.ancestors )>6 " +
|
|
|
- ") companyAncestors",user.getDeptId()));
|
|
|
-
|
|
|
- sqlString.append(StringUtils.format(
|
|
|
- " OR FIND_IN_SET( ( "+companysqlString.toString()+" ),{}.ancestors) " +
|
|
|
- " OR {}.dept_id =("+companysqlString.toString()+")",
|
|
|
- deptAlias,deptAlias));
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(sqlString.toString()))
|