| | |
| | | } |
| | | passwordMapper.insert(config); |
| | | } else { |
| | | // 更新 |
| | | config.setPasswordEnabled(req.getPasswordEnabled()); |
| | | // 更新 - 使用自定义SQL支持设置为null |
| | | String encodedPassword = null; |
| | | if (req.getPasswordEnabled() == 1 && StrUtil.isNotBlank(req.getPassword())) { |
| | | config.setPassword(passwordEncoder.encode(req.getPassword())); |
| | | } else { |
| | | // 不启用密码时,清空密码 |
| | | config.setPassword(null); |
| | | encodedPassword = passwordEncoder.encode(req.getPassword()); |
| | | } |
| | | passwordMapper.updateById(config); |
| | | passwordMapper.updatePasswordConfig(config.getId(), req.getPasswordEnabled(), encodedPassword); |
| | | } |
| | | } |
| | | |