From 6acee0d1d79a05f7a3a3c386e9df02e9a741f544 Mon Sep 17 00:00:00 2001
From: ZQN <364596817@qq.com>
Date: 星期五, 21 六月 2024 17:21:16 +0800
Subject: [PATCH] 执法单节点添加,审批修改

---
 project-framework/src/main/java/com/project/framework/aspectj/DataScopeAspect.java |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/project-framework/src/main/java/com/project/framework/aspectj/DataScopeAspect.java b/project-framework/src/main/java/com/project/framework/aspectj/DataScopeAspect.java
index b533252..9c86359 100644
--- a/project-framework/src/main/java/com/project/framework/aspectj/DataScopeAspect.java
+++ b/project-framework/src/main/java/com/project/framework/aspectj/DataScopeAspect.java
@@ -2,6 +2,7 @@
 
 import com.project.common.annotation.DataScope;
 import com.project.common.core.domain.BaseEntity;
+import com.project.common.core.domain.BaseQuery;
 import com.project.common.core.domain.entity.SysRole;
 import com.project.common.core.domain.entity.SysUser;
 import com.project.common.core.domain.model.LoginUser;
@@ -124,19 +125,13 @@
             }
             else if (DATA_SCOPE_DEPT.equals(dataScope))
             {
-                sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId()));
+                sqlString.append(StringUtils.format(" OR {} = {} ", deptAlias, user.getDeptId()));
             }
             else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope))
             {
                 sqlString.append(StringUtils.format(
                         " OR {} IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )",
                         deptAlias, user.getDeptId(), user.getDeptId()));
-            }
-            else if (DATA_SCOPE_ORG.equals(dataScope))
-            {
-                sqlString.append(StringUtils.format(
-                        " OR {} IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )",
-                        deptAlias, user.getRecommendUser(), user.getRecommendUser()));
             }
             else if (DATA_SCOPE_SELF.equals(dataScope))
             {
@@ -159,7 +154,10 @@
             if (StringUtils.isNotNull(params) && params instanceof BaseEntity)
             {
                 BaseEntity baseEntity = (BaseEntity) params;
-                baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
+                baseEntity.getParams().put(DATA_SCOPE, "  (" + sqlString.substring(4) + ")");
+            } else if (StringUtils.isNotNull(params) && params instanceof BaseQuery) {
+                BaseQuery baseQuery = (BaseQuery) params;
+                baseQuery.getParams().put(DATA_SCOPE, "  (" + sqlString.substring(4) + ")");
             }
         }
     }

--
Gitblit v1.9.1