TIL

[TIL] 2024/08/29

dev_ajrqkq 2024. 9. 2. 12:36

1. delete문 실행 시 @SQLDelete 어노테이션 사용하여 soft delete

@Where 어노테이션 사용하여 모든 조회 과정에서 deleted_at 이 null인 값만 가져오기

// Delete의 값이 null인 정보만 가져옴
@Where(clause = "deleted_at is NULL")
// Delete 쿼리문이 동작될때, 실제로는 Delete쿼리문이 가지않고 아래의 쿼리문이 동작함
@SQLDelete(sql = "UPDATE p_store SET deleted_at = current_timestamp WHERE id = ?")

 

2. patch 수정 시 필드를 보내지않을 경우 null값 들어가는 문제 발생하여  jsonnullable을 찾아보았다.

https://hyeri0903.tistory.com/274

 

[Spring] PUT 과 PATCH 사용시 주의할 점

목차   1. Spring 에서 PUT 과 PATCH 사용 시 발생하는 이슈일반적으로 PUT은 전체 수정, PATCH 는 일부 필드 수정으로 이해하고 사용하고있습니다.Spring 을 사용하면서 해당 Http Method 를 사용하다가 이

hyeri0903.tistory.com

근데 결국...아래처럼 수정함

public void modifyMenu(MenuModifyRequest requestDto) {
    this.name = requestDto.getName() == null ? this.name : requestDto.getName();
    this.quantity = requestDto.getQuantity() == null ? this.quantity : requestDto.getQuantity();
    this.price = requestDto.getPrice() == null ? this.price : requestDto.getPrice();
}

 

3. 깃 최근 커밋 message 수정 git commit --amend