|
@@ -5,6 +5,7 @@ import cn.cslg.pas.common.model.PersonnelVO;
|
|
|
import cn.cslg.pas.common.utils.CacheUtils;
|
|
|
import cn.cslg.pas.common.utils.RedisUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import org.apache.poi.ss.formula.functions.T;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -46,7 +47,7 @@ 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;
|
|
|
+ str1 = field+" "+jsonLeft.get("opr").toString()+" "+value;
|
|
|
}
|
|
|
if(jsonRight.containsKey("right")){
|
|
|
str2= recursionTree( jsonRight,dataSource,personnelVO);
|
|
@@ -54,7 +55,7 @@ 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;
|
|
|
+ str2 =field+" "+jsonRight.get("opr").toString()+" "+value;
|
|
|
}
|
|
|
String sql ="("+ str1+") "+ jsonObject.get("logicOpr")+" ("+str2+")";
|
|
|
return sql;
|
|
@@ -91,15 +92,44 @@ public class TreeUtils {
|
|
|
|
|
|
//对field部分进行计算 sql查询
|
|
|
public static String distinguishFields(String field, List<DataSource> dataSources,PersonnelVO personnelVO) throws NoSuchFieldException, IllegalAccessException {
|
|
|
+ List<PersonnelVO.DP> dps =personnelVO.getDpList();
|
|
|
+ List<PersonnelVO.PerRole> perRoles =personnelVO.getRList();
|
|
|
String tem ="";
|
|
|
String reField =field;
|
|
|
for(DataSource dataSource :dataSources){
|
|
|
if(field.equals(dataSource.getDataSourceField())){
|
|
|
+ if(field.contains("DP.")){
|
|
|
+ String Fields= field.split("\\.")[1];
|
|
|
+ for(PersonnelVO.DP dp : dps){
|
|
|
+ Class DPClass =dp.getClass();
|
|
|
+ Field dataField = DPClass.getDeclaredField(Fields);
|
|
|
+ dataField.setAccessible(true);
|
|
|
+ tem =dataField.get(dp).toString()+"," ;
|
|
|
+
|
|
|
+ }
|
|
|
+reField = "("+tem.substring(0,tem.length() - 1)+")";
|
|
|
+ }
|
|
|
+ else if(field.contains("PerRole.")){
|
|
|
+ String Fields= field.split("\\.")[1];
|
|
|
+ for(PersonnelVO.PerRole perRole : perRoles){
|
|
|
+ Class DPClass =perRole.getClass();
|
|
|
+ Field dataField = DPClass.getDeclaredField(Fields);
|
|
|
+ dataField.setAccessible(true);
|
|
|
+ tem =dataField.get(perRole).toString()+"," ;
|
|
|
+ }
|
|
|
+ reField = "("+tem.substring(0,tem.length() - 1)+")";
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else{
|
|
|
Class personClass =personnelVO.getClass();
|
|
|
Field dataField = personClass.getDeclaredField(field);
|
|
|
dataField.setAccessible(true);
|
|
|
reField =dataField.get(personnelVO).toString();
|
|
|
- break;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}}
|
|
|
|
|
|
return reField;
|