Просмотр исходного кода

Update for the user function

master
B.E.N.S.O.N 1 месяц назад
Родитель
Сommit
e49266d332
1 измененных файлов: 13 добавлений и 0 удалений
  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 Просмотреть файл

@@ -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())
);
}
} }

Загрузка…
Отмена
Сохранить