Commit 3843d5ce by huangjinxin

用户组织关联关系优化

1 parent fa3546d2
......@@ -86,7 +86,7 @@ public class UserInfo {
/**
* 组织ids
*/
private List<String> orgIds;
private List<Integer> orgIds;
/**
* 组织级别 0:大区 1:分部 2:站点
*/
......
......@@ -19,8 +19,8 @@ public class UserOrgEntity {
@Column(name = "user_id", nullable = false, unique = true)
private String userId;
@Column(name = "org_ids", nullable = false)
private String orgIds;
@Column(name = "org_id", nullable = false)
private Integer orgId;
/**
* 组织级别 0:大区 1:分部 2:站点
......
......@@ -463,14 +463,14 @@ public class UserService {
}
//处理用户机构关联信息
if (CollectionUtils.isNotEmpty(userInfo.getOrgIds()) && null != userInfo.getOrgIds()) {
UserOrgEntity userOrgEntity = userOrgDao.findByUserId(userInfo.getId());
if (null == userOrgEntity) {
userOrgEntity = new UserOrgEntity();
for (Integer orgId : userInfo.getOrgIds()) {
userOrgDao.deleteByUserId(userInfo.getId());
UserOrgEntity userOrgEntity = new UserOrgEntity();
userOrgEntity.setUserId(userInfo.getId());
userOrgEntity.setOrgId(orgId);
userOrgEntity.setOrgLevel(userInfo.getOrgLevel());
userOrgDao.save(userOrgEntity);
}
userOrgEntity.setOrgIds(String.join(",", userInfo.getOrgIds()));
userOrgEntity.setOrgLevel(userInfo.getOrgLevel());
userOrgDao.save(userOrgEntity);
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!