package com.huimv.video.repo;

import com.huimv.video.domain.PastureArea;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @Project : huimv.shiwan
 * @Package : com.huimv.video.repo
 * @Description : TODO
 * @Author : yuxuexuan
 * @Create : 2021/1/7 0007 10:33
 **/
public interface PastureAreaRepo extends JpaRepository<PastureArea,Integer> , JpaSpecificationExecutor<PastureArea> {

    @Query(nativeQuery = true,value = "select * from pasture_area where parent=?1")
    List<PastureArea> findAllByParent(Integer id);

    @Query(nativeQuery = true,value = "select * from pasture_area where id=?1")
    PastureArea findAllById(Integer id);
}
