`

重写rest delete

阅读更多

第一种:

@Transactional

@Modifying

@Query(value = "UPDATE UserPO SET voided = 1 where id = ?1")

@Override

void deleteById(@NotNull Long userId);

 

第二种:(更底层)

@Entity

@Table(name="TABLE")

@ActionOverride(action="delete", with="activeFlag = false")

public class Table {

    @Column(name="ACTIVE_FLAG")

    boolean activeFlag;

    // ...

}

或者

@Entity

@Table(name="TABLE")

@SQLDelete(sql = "UPDATE TABLE SET ACTIVE_FLAG = false WHERE id = ?")

public class Table {

    @Column(name="ACTIVE_FLAG")

    boolean activeFlag;

    // ...

}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics