| @@ -17,6 +17,7 @@ import org.springframework.security.core.authority.SimpleGrantedAuthority; | |||||
| import org.springframework.security.crypto.password.PasswordEncoder; | import org.springframework.security.crypto.password.PasswordEncoder; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| import org.springframework.util.Assert; | |||||
| import com.ffii.core.exception.NotFoundException; | import com.ffii.core.exception.NotFoundException; | ||||
| import com.ffii.core.exception.UnprocessableEntityException; | import com.ffii.core.exception.UnprocessableEntityException; | ||||
| @@ -275,4 +276,16 @@ public class UserService extends AbstractBaseEntityService<User, Long, UserRepos | |||||
| public List<UserCombo> getEscalationCombo() { | public List<UserCombo> getEscalationCombo() { | ||||
| return userRepository.findUserComboByTitleNotNullAndDepartmentNotNullAndNameNotNullAndDeletedFalse(); | 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()) | |||||
| ); | |||||
| } | |||||
| } | } | ||||