package com.webchat.repository.dao;

import com.webchat.repository.entity.ArticleEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;


@Repository
public interface IArticleDAO extends JpaSpecificationExecutor<ArticleEntity>,
        JpaRepository<ArticleEntity, Long> {


    @Transactional
    @Modifying
    @Query(value = "update ArticleEntity a set a.status = 2 where a.id = :id")
    int updatePushedStatus(Long id);

}