package com.rf.psychological.dao.repository;

import com.rf.psychological.base.repository.BaseRepository;
import com.rf.psychological.dao.model.CategorySubjectEntity;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author zsy
 * @description:Category
 * @date 2021/6/17 15:55
 */
public interface CategorySubjectRepository extends BaseRepository<CategorySubjectEntity,String> {
    @Query(value = "select id,ename,flag from t_category_subject where flag=:flag  ", nativeQuery = true)
    List<CategorySubjectEntity> findByFlag(@Param("flag") String flag);

    @Transactional
    @Modifying
    @Query(value = "delete from t_category_subject where flag=:flag  ", nativeQuery = true)
    void deleteCategorySubjectByFlag(@Param("flag") String flag);

}
