Ver código fonte

Update for the user function

master
B.E.N.S.O.N 1 mês atrás
pai
commit
e49266d332
1 arquivos alterados com 13 adições e 0 exclusões
  1. +13
    -0
      src/main/java/com/ffii/fpsms/modules/user/service/UserService.java

+ 13
- 0
src/main/java/com/ffii/fpsms/modules/user/service/UserService.java Ver arquivo

@@ -17,6 +17,7 @@ import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;

import com.ffii.core.exception.NotFoundException;
import com.ffii.core.exception.UnprocessableEntityException;
@@ -275,4 +276,16 @@ public class UserService extends AbstractBaseEntityService<User, Long, UserRepos
public List<UserCombo> getEscalationCombo() {
return userRepository.findUserComboByTitleNotNullAndDepartmentNotNullAndNameNotNullAndDeletedFalse();
}

@Transactional(rollbackFor = Exception.class)
@Override
public void markDelete(User entity) {
Assert.notNull(entity, "entity must not be null");
// Use direct SQL update to bypass JPA validation during soft delete
// This prevents ConstraintViolationException when password field has @NotBlank constraint
jdbcDao.executeUpdate(
"UPDATE `user` SET deleted = 1 WHERE id = :id",
Map.of("id", entity.getId())
);
}
}

Carregando…
Cancelar
Salvar