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 Dec 14, 2020
1 parent b158a1f commit a87b5a8
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import ltd.newbee.mall.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.thymeleaf.util.StringUtils;

import javax.servlet.http.HttpSession;
import java.util.List;
Expand Down Expand Up @@ -77,9 +78,15 @@ public NewBeeMallUserVO updateUserInfo(MallUser mallUser, HttpSession httpSessio
NewBeeMallUserVO userTemp = (NewBeeMallUserVO) httpSession.getAttribute(Constants.MALL_USER_SESSION_KEY);
MallUser userFromDB = mallUserMapper.selectByPrimaryKey(userTemp.getUserId());
if (userFromDB != null) {
userFromDB.setNickName(NewBeeMallUtils.cleanString(mallUser.getNickName()));
userFromDB.setAddress(NewBeeMallUtils.cleanString(mallUser.getAddress()));
userFromDB.setIntroduceSign(NewBeeMallUtils.cleanString(mallUser.getIntroduceSign()));
if (!StringUtils.isEmpty(mallUser.getNickName())) {
userFromDB.setNickName(NewBeeMallUtils.cleanString(mallUser.getNickName()));
}
if (!StringUtils.isEmpty(mallUser.getAddress())) {
userFromDB.setAddress(NewBeeMallUtils.cleanString(mallUser.getAddress()));
}
if (!StringUtils.isEmpty(mallUser.getIntroduceSign())) {
userFromDB.setIntroduceSign(NewBeeMallUtils.cleanString(mallUser.getIntroduceSign()));
}
if (mallUserMapper.updateByPrimaryKeySelective(userFromDB) > 0) {
NewBeeMallUserVO newBeeMallUserVO = new NewBeeMallUserVO();
userFromDB = mallUserMapper.selectByPrimaryKey(mallUser.getUserId());
Expand Down

0 comments on commit a87b5a8

Please sign in to comment.