Skip to content

Commit

Permalink
🐛 Fixing a bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
newbee-mall committed May 28, 2020
1 parent 7a7cca6 commit 427f579
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,16 @@ public String login(String loginName, String passwordMD5, HttpSession httpSessio

@Override
public NewBeeMallUserVO updateUserInfo(MallUser mallUser, HttpSession httpSession) {
MallUser user = mallUserMapper.selectByPrimaryKey(mallUser.getUserId());
if (user != null) {
user.setNickName(mallUser.getNickName());
user.setAddress(mallUser.getAddress());
user.setIntroduceSign(mallUser.getIntroduceSign());
if (mallUserMapper.updateByPrimaryKeySelective(user) > 0) {
NewBeeMallUserVO userTemp = (NewBeeMallUserVO) httpSession.getAttribute(Constants.MALL_USER_SESSION_KEY);
MallUser userFromDB = mallUserMapper.selectByPrimaryKey(userTemp.getUserId());
if (userFromDB != null) {
userFromDB.setNickName(mallUser.getNickName());
userFromDB.setAddress(mallUser.getAddress());
userFromDB.setIntroduceSign(mallUser.getIntroduceSign());
if (mallUserMapper.updateByPrimaryKeySelective(userFromDB) > 0) {
NewBeeMallUserVO newBeeMallUserVO = new NewBeeMallUserVO();
user = mallUserMapper.selectByPrimaryKey(mallUser.getUserId());
BeanUtil.copyProperties(user, newBeeMallUserVO);
userFromDB = mallUserMapper.selectByPrimaryKey(mallUser.getUserId());
BeanUtil.copyProperties(userFromDB, newBeeMallUserVO);
httpSession.setAttribute(Constants.MALL_USER_SESSION_KEY, newBeeMallUserVO);
return newBeeMallUserVO;
}
Expand Down

0 comments on commit 427f579

Please sign in to comment.