Commit 560877d0 by fudahua

更新关联表

parent 6abf6248
......@@ -38,5 +38,7 @@ public interface StaffDepartmentRelatedService {
*/
public int cleanStaffDepartment(String wxEnterpriseId,List<String> staffIds);
public int update(TabHaobanStaffDepartmentRelated tab);
}
......@@ -97,4 +97,9 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
public int cleanStaffDepartment(String wxEnterpriseId, List<String> staffIds) {
return mapper.cleanStaffDepartment(wxEnterpriseId,staffIds);
}
@Override
public int update(TabHaobanStaffDepartmentRelated tab) {
return mapper.updateByPrimaryKeySelective(tab);
}
}
......@@ -452,6 +452,7 @@ public class StaffApiServiceImpl implements StaffApiService {
Set<String> newDepartIds = departmentDTOList.stream().map(DepartmentDTO::getDepartmentId).collect(Collectors.toSet());
Set<String> hasDepartIds = hasRelationMap.keySet();
Sets.SetView<String> delDepartIds = Sets.difference(hasDepartIds, newDepartIds);
Sets.SetView<String> updateDepartIds = Sets.difference(newDepartIds,hasDepartIds );
logger.info("删除部门:{}",JSONObject.toJSONString(delDepartIds));
if (!delDepartIds.isEmpty()) {
delDepartIds.forEach(delDepartId->{
......@@ -463,6 +464,20 @@ public class StaffApiServiceImpl implements StaffApiService {
}
});
}
if (!updateDepartIds.isEmpty()) {
updateDepartIds.forEach(updateDeId->{
TabHaobanStaffDepartmentRelated departmentRelated = finalHasRelationMap.get(updateDeId);
if (null != departmentRelated) {
departmentRelated.setPhoneNumber(staff.getPhoneNumber());
departmentRelated.setStaffName(staff.getStaffName());
departmentRelated.setWxUserId(staff.getWxUserId());
departmentRelated.setNationCode(staff.getNationCode());
departmentRelated.setUpdateTime(new Date());
staffDepartmentRelatedService.update(departmentRelated);
}
});
}
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment