|
@@ -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)" + //查询部门Ancestors左往右数,第3个分隔符的左边的全部内容
|
|
|
- " ,',',-1) company_id " +//查询完前三个数组后右往左数,第1个分隔符的右边的全部内容
|
|
|
- "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));
|
|
|
- }
|
|
|
+// 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)" + //查询部门Ancestors左往右数,第3个分隔符的左边的全部内容
|
|
|
+// " ,',',-1) company_id " +//查询完前三个数组后右往左数,第1个分隔符的右边的全部内容
|
|
|
+// "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()))
|