package com.dbnt.kcscbackend.admin.boards.repository;

import com.dbnt.kcscbackend.admin.boards.entity.TnBbsContents;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface TnBbsContentsRepository extends JpaRepository<TnBbsContents, Long> {

    @Query(value = "SELECT entity FROM TnBbsContents entity " +
            "WHERE entity.useYn = 'Y' " +
            "AND entity.bbsId = :bbsId " +
            "ORDER BY entity.bbsContSeq DESC")
    List<TnBbsContents> findByBbsId(@Param("bbsId") String bbsId);

}
