Commit 3843d5ce by huangjinxin

用户组织关联关系优化

1 parent fa3546d2
...@@ -86,7 +86,7 @@ public class UserInfo { ...@@ -86,7 +86,7 @@ public class UserInfo {
/** /**
* 组织ids * 组织ids
*/ */
private List<String> orgIds; private List<Integer> orgIds;
/** /**
* 组织级别 0:大区 1:分部 2:站点 * 组织级别 0:大区 1:分部 2:站点
*/ */
......
...@@ -19,8 +19,8 @@ public class UserOrgEntity { ...@@ -19,8 +19,8 @@ public class UserOrgEntity {
@Column(name = "user_id", nullable = false, unique = true) @Column(name = "user_id", nullable = false, unique = true)
private String userId; private String userId;
@Column(name = "org_ids", nullable = false) @Column(name = "org_id", nullable = false)
private String orgIds; private Integer orgId;
/** /**
* 组织级别 0:大区 1:分部 2:站点 * 组织级别 0:大区 1:分部 2:站点
......
...@@ -463,14 +463,14 @@ public class UserService { ...@@ -463,14 +463,14 @@ public class UserService {
} }
//处理用户机构关联信息 //处理用户机构关联信息
if (CollectionUtils.isNotEmpty(userInfo.getOrgIds()) && null != userInfo.getOrgIds()) { if (CollectionUtils.isNotEmpty(userInfo.getOrgIds()) && null != userInfo.getOrgIds()) {
UserOrgEntity userOrgEntity = userOrgDao.findByUserId(userInfo.getId()); for (Integer orgId : userInfo.getOrgIds()) {
if (null == userOrgEntity) { userOrgDao.deleteByUserId(userInfo.getId());
userOrgEntity = new UserOrgEntity(); UserOrgEntity userOrgEntity = new UserOrgEntity();
userOrgEntity.setUserId(userInfo.getId()); 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!