以MD5格式存储的数据库密码。我必须在服务层中比较此字段的值。 代码:
String encodePass= changePasswordRequest.getCurrentPassword();
changePasswordRequest.setCurrentPassword(MD5.getMD5(encodePass));
employeeRepository.getAll().forEach(employee ->
if (employee.getUid().equals(changePasswordRequest.getUserName())
&& employee.getPassword() == changePasswordRequest.getCurrentPassword()) {
employee.setPassword(MD5.getMD5(employee.getPassword()));
this.updateEmployee(employee);
}
});