ソースを参照

sz 人员绑定设备 为空则跳过

xiao547607 5 年 前
コミット
be9da3dcb8

+ 1 - 0
common/src/main/resources/mapper/base/PersonDeviceRelation.xml

@@ -129,6 +129,7 @@ id_,device_id,person_id,del_flag,create_by,create_time,update_by,update_time		fr
 		where a.person_id=#{personId}
 		and a.device_id = b.id_
 		and a.del_flag=false
+		and b.del_flag=false
 	</select>
 
     <select id="findByIsBoundAndUpdateTime" resultMap="PersonDeviceRelationMap">

+ 25 - 0
web/src/main/java/com/jpsoft/smart/modules/base/controller/PersonInfoController.java

@@ -229,6 +229,9 @@ public class PersonInfoController {
             PersonCompany classPersonCompany = null;
             for(String pc : pcs){
                 //添加
+                if(StringUtils.isEmpty(pc)){
+                    continue;
+                }
                 classPersonCompany = new PersonCompany();
                 classPersonCompany.setId(UUID.randomUUID().toString());
                 classPersonCompany.setCompanyId(pc);
@@ -431,6 +434,7 @@ public class PersonInfoController {
             @ApiImplicitParam(name = "idCard",value = "身份证", required = false, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "phone",value = "手机号", required = false, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "companyCode",value = "企业编码", required = false, paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "parentId",value = "上级企业ID", required = false, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "subordinate",value = "会否保护下级单位", required = false, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "derviceName",value = "设备名称", required = false, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "position1",value = "一级位置", required = false, paramType = "form",dataType = "String"),
@@ -446,6 +450,7 @@ public class PersonInfoController {
             @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="derviceName",defaultValue="") String derviceName,
             @RequestParam(value="position1",defaultValue="") String position1,
@@ -502,6 +507,26 @@ public class PersonInfoController {
             }
         }
 
+        if(StringUtils.isNotEmpty(parentId)){
+            CompanyInfo parentCompanyInfo = companyInfoService.get(parentId);
+
+            String parentCode = parentCompanyInfo.getCode();
+
+            if (StringUtils.isEmpty(parentCode)){
+                if (!userService.hasRole(subject,"SYSADMIN")) {
+                    searchParams.put("companyCode", parentCode + "%");
+                }
+            }
+            else{
+                if(subordinate){
+                    searchParams.put("companyCode", parentCode + "%");
+                }
+                else {
+                    searchParams.put("companyCode", parentCode);
+                }
+            }
+        }
+
         if (StringUtils.isNotEmpty(position1)) {
             searchParams.put("position1","%" + position1 + "%");
         }