Explorar el Código

templeDesice 2022/8/30

lwhhszx hace 3 años
padre
commit
ca550daea6

+ 7 - 0
PAS/src/main/java/cn/cslg/pas/common/config/InnerInterceptor/LizzMybatisIntercepts.java

@@ -2,6 +2,7 @@ package cn.cslg.pas.common.config.InnerInterceptor;
 
 import cn.cslg.pas.common.model.PersonnelVO;
 import cn.cslg.pas.common.utils.CacheUtils;
+import cn.cslg.pas.common.utils.RedisUtil;
 import cn.cslg.pas.common.utils.SecurityUtils.SecurityUtils;
 import cn.cslg.pas.common.utils.auth.TreeUtils;
 import cn.cslg.pas.common.model.DataSource;
@@ -39,6 +40,10 @@ public class LizzMybatisIntercepts implements InnerInterceptor {
     @Autowired
     private  CacheUtils cacheUtils ;
 
+    @Lazy//懒加载,当调用时注入
+    @Autowired
+    private RedisUtil redisUtil ;
+
     @Value("${authorUrl}")
     private String url;
     @SneakyThrows
@@ -50,6 +55,8 @@ public class LizzMybatisIntercepts implements InnerInterceptor {
         String Localsql = boundSql.getSql();
         Map<String,Object> maps= SecurityUtils.getDataScope(); //获得线程里保存的functionId
         if (maps != null) {
+            String q= "token:login:"+maps.get("token").toString().replace("=",":");
+       String a=   redisUtil.get(q);
             SecurityUtils.cleanDataScope(); //当第一次进来后删除线程保存的functionId,避免后续使用的查询sql进来
             Integer functionId =Integer.parseInt(maps.get("functionId").toString());
             String token =maps.get("token").toString();

+ 11 - 2
PAS/src/main/java/cn/cslg/pas/common/utils/auth/TreeUtils.java

@@ -47,7 +47,11 @@ public class TreeUtils {
         else{
             String field =jsonLeft.get("field").toString();
             String value=distinguishFields(jsonLeft.get("value").toString(),dataSource,personnelVO);
-            str1 = field+" "+jsonLeft.get("opr").toString()+" "+value;
+            if(jsonLeft.get("opr").toString().equals("FIND_IN_SET")){
+                str1 ="FIND_IN_SET("+value+","+field+")";
+            }
+            else{
+            str1 = field+" "+jsonLeft.get("opr").toString()+" "+value;}
         }
         if(jsonRight.containsKey("right")){
             str2= recursionTree( jsonRight,dataSource,personnelVO);
@@ -55,7 +59,12 @@ public class TreeUtils {
         else{
             String field =jsonRight.get("field").toString();
             String value=distinguishFields(jsonRight.get("value").toString(),dataSource,personnelVO);
-            str2 =field+" "+jsonRight.get("opr").toString()+" "+value;
+            if(jsonRight.get("opr").toString().equals("FIND_IN_SET")){
+                str2 ="FIND_IN_SET("+value+","+field+")";
+            }
+            else{
+                str2 = field+" "+jsonRight.get("opr").toString()+" "+value;}
+
         }
         String sql ="("+ str1+") "+ jsonObject.get("logicOpr")+" ("+str2+")";
         return sql;

+ 10 - 10
PAS/src/main/java/cn/cslg/pas/service/ProjectService.java

@@ -134,16 +134,16 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         List<Project> dataList = pageList.getRecords();
         Map<String, Object> map = new HashMap<>();
         map.put("departmentId", dataList.stream().map(Project::getDepartmentId).collect(Collectors.toList()));
-        try {
-            JSONArray jsonObject = apiUtils.invokeApi(new JSONObject(map), "/permission/api/system/getDepartmentById", "post", "data");
-            for (int i = 0; i < dataList.size(); i++) {
-                dataList.get(i).setDepartmentName((String) jsonObject.get(i));
-            }
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        this.setDataList(dataList);
-        pageList.setRecords(dataList);
+//        try {
+//            JSONArray jsonObject = apiUtils.invokeApi(new JSONObject(map), "/permission/api/system/getDepartmentById", "post", "data");
+//            for (int i = 0; i < dataList.size(); i++) {
+//                dataList.get(i).setDepartmentName((String) jsonObject.get(i));
+//            }
+//        } catch (IOException e) {
+//            e.printStackTrace();
+//        }
+//        this.setDataList(dataList);
+//        pageList.setRecords(dataList);
         return pageList;
     }
 

+ 1 - 0
PAS/src/main/resources/mapper/ProjectMapper.xml

@@ -41,6 +41,7 @@
                     FIND_IN_SET(#{item}, a.scenarioid)
                 </foreach>
             </if>
+        1=1
         </where>
         order by a.`${params.sort.prop}` ${params.sort.order}
     </select>