解决用户无法注册的bug
This commit is contained in:
@@ -307,6 +307,23 @@ public class UserService {
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户名查询id
|
||||||
|
* @param loginName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Long getIdByLoginName(String loginName) {
|
||||||
|
Long userId = 0L;
|
||||||
|
UserExample example = new UserExample();
|
||||||
|
example.createCriteria().andLoginameEqualTo(loginName);
|
||||||
|
List<User> list = userMapper.selectByExample(example);
|
||||||
|
if(list!=null) {
|
||||||
|
userId = list.get(0).getId();
|
||||||
|
}
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public void addUserAndOrgUserRel(UserEx ue) throws Exception{
|
public void addUserAndOrgUserRel(UserEx ue) throws Exception{
|
||||||
if(BusinessConstants.DEFAULT_MANAGER.equals(ue.getLoginame())) {
|
if(BusinessConstants.DEFAULT_MANAGER.equals(ue.getLoginame())) {
|
||||||
@@ -335,13 +352,8 @@ public class UserService {
|
|||||||
//机构id
|
//机构id
|
||||||
oul.setOrgaId(ue.getOrgaId());
|
oul.setOrgaId(ue.getOrgaId());
|
||||||
//用户id,根据用户名查询id
|
//用户id,根据用户名查询id
|
||||||
UserExample example = new UserExample();
|
Long userId = getIdByLoginName(ue.getLoginame());
|
||||||
example.createCriteria().andLoginameEqualTo(ue.getLoginame());
|
|
||||||
List<User> list = userMapper.selectByExample(example);
|
|
||||||
if(list!=null) {
|
|
||||||
Long userId = list.get(0).getId();
|
|
||||||
oul.setUserId(userId);
|
oul.setUserId(userId);
|
||||||
}
|
|
||||||
//用户在机构中的排序
|
//用户在机构中的排序
|
||||||
oul.setUserBlngOrgaDsplSeq(ue.getUserBlngOrgaDsplSeq());
|
oul.setUserBlngOrgaDsplSeq(ue.getUserBlngOrgaDsplSeq());
|
||||||
|
|
||||||
@@ -403,6 +415,8 @@ public class UserService {
|
|||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
result= userMapper.insertSelective(ue);
|
result= userMapper.insertSelective(ue);
|
||||||
|
Long userId = getIdByLoginName(ue.getLoginame());
|
||||||
|
ue.setId(userId);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user