@Transactional(propagation = Propagation.REQUIRED) public boolean update(User user, File portrait) { if (portrait != null) { savePortrait(user.getPortraitPath(), portrait, 280); } return super.update(user, "id") != 0; }
@Transactional(propagation = Propagation.REQUIRED) public boolean register(User user, File portrait) { user.setStatus(UserStatus.NO_VALIDATE); if (portrait != null) { savePortrait(user.getPortraitPath(), portrait, 280); } else { user.setPortraitPath(replaceToDefaultPortrait(user.getPortraitPath())); } return super.save(md5Password(user)); }