/** * 修改密码 * * @param userId * @param newPassword */ @Transactional(readOnly = false) public void changePassword(Integer userId, String newPassword) { User user = findOne(userId); user.setPassword(newPassword); passwordHelper.encryptPassword(user); update(user); }
/** * 修改密码 * * @param userId * @param newPassword */ public void changePassword(Long userId, String newPassword) { User user = userDao.findOne(userId); user.setPassword(newPassword); passwordHelper.encryptPassword(user); userDao.updateUser(user); }
@Transactional(readOnly = false) public User create(User user) { passwordHelper.encryptPassword(user); return systemDaos.userDao.save(user); }
/** * 创建用户 * * @param user */ public User createUser(User user) { // 加密密码 passwordHelper.encryptPassword(user); return userDao.createUser(user); }