package com.rf.psychological.scale.dao.repository;

import com.rf.psychological.base.repository.BaseRepository;
import com.rf.psychological.scale.dao.model.DimensionOrgEntity;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import javax.transaction.Transactional;
import java.util.List;

public interface DimensionOrgRepository extends BaseRepository<DimensionOrgEntity,String> {


    DimensionOrgEntity findByInstitutionNoAndDimensionId(String institutionNo, String id);

    @Transactional
    @Modifying
    @Query(value = "delete from t_dimension_org where dimension_id = :dimensionId and institution_no = :institutionNo",nativeQuery = true)
    void deleteByFlagAndInstitutionNo(@Param("dimensionId") String dimensionId, @Param("institutionNo") String institutionNo);
}
