Explorar o código

fix: 派工企业管理-修改企业名称NPE异常

lixuesong hai 1 ano
pai
achega
1a3264b7a5

+ 9 - 7
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/WmDaAgentServiceImpl.java

@@ -549,14 +549,16 @@ public class WmDaAgentServiceImpl extends ServiceImpl<WmDaAgentMapper, WmDaAgent
 		List<SysDeptRelation> newList2 = new ArrayList<>();
 
 		WmDaAgent wmDaAgent1 = wmDaAgentMapper.selectOne(Wrappers.query(query));
-		for (String upId : ids) {
-			WmRelation wmRelation = new WmRelation();
-			wmRelation.setUpId(Integer.parseInt(upId));
-			wmRelation.setDownId(Integer.parseInt(wmDaAgent1.getId()));
-			newList.add(wmRelation);
-			wmRelationMapper.deleteByPrimaryKey(Long.valueOf(wmRelation.getDownId()));
+		if (wmDaAgent1 != null) {
+			for (String upId : ids) {
+				WmRelation wmRelation = new WmRelation();
+				wmRelation.setUpId(Integer.parseInt(upId));
+				wmRelation.setDownId(Integer.parseInt(wmDaAgent1.getId()));
+				newList.add(wmRelation);
+				wmRelationMapper.deleteByPrimaryKey(Long.valueOf(wmRelation.getDownId()));
+			}
+			wmRelationService.saveBatch(newList);
 		}
-		wmRelationService.saveBatch(newList);
 
 		for (String id : deptIds) {
 			SysDeptRelation sysDeptRelation = new SysDeptRelation();