Browse Source

导出单位查询条件修改。

zhengqiang 5 years ago
parent
commit
8975d38c3b

+ 13 - 9
web/src/main/java/com/jpsoft/smart/modules/base/controller/PersonInfoController.java

@@ -990,7 +990,7 @@ public class PersonInfoController {
             @RequestParam(value="name",defaultValue="") String name,
             @RequestParam(value="idCard",defaultValue="") String idCard,
             @RequestParam(value="phone",defaultValue="") String phone,
-            @RequestParam(value="companyCode",defaultValue="")  String companyCode,
+            @RequestParam(value="parentId",defaultValue="")  String parentId,
             @RequestParam(value="subordinate",defaultValue="false")  Boolean subordinate,
             @RequestParam(value="position1",defaultValue="") String position1,
             @RequestParam(value="position2",defaultValue="") String position2,
@@ -1079,17 +1079,21 @@ public class PersonInfoController {
                 searchParams.put("phone","%" + phone + "%");
             }
 
-            if (StringUtils.isEmpty(companyCode)){
-                if (!userService.hasRole(subject,"SYSADMIN")) {
-                    searchParams.put("companyCode", companyInfo.getCode() + "%");
+            if (StringUtils.isNotEmpty(parentId)) {
+                CompanyInfo parent = companyInfoService.get(parentId);
+                String companyCode = parent!=null ? parent.getCode() : "";
+
+                if (StringUtils.isEmpty(companyCode)) {
+                    if (subordinate) {
+                        searchParams.put("companyCode", companyCode + "%");
+                    } else {
+                        searchParams.put("companyCode", companyCode);
+                    }
                 }
             }
             else{
-                if(subordinate){
-                    searchParams.put("companyCode", companyCode + "%");
-                }
-                else {
-                    searchParams.put("companyCode", companyCode);
+                if (!userService.hasRole(subject, "SYSADMIN")) {
+                    searchParams.put("companyCode", companyInfo.getCode() + "%");
                 }
             }
 //            if (userService.hasRole(subject,"SYSADMIN")) {