
package cn.ysk.cashier.system.repository;

import cn.ysk.cashier.system.domain.DictDetail;
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 java.util.List;
import java.util.Set;

/**
* @author Zheng Jie
* @date 2019-04-10
*/
public interface DictDetailRepository extends JpaRepository<DictDetail, Long>, JpaSpecificationExecutor<DictDetail> {

    /**
     * 根据字典名称查询
     * @param name /
     * @return /
     */
    List<DictDetail> findByDictName(String name);


    @Modifying
    @Query(value = "delete from sys_dict_detail where rele_id in ?1", nativeQuery = true)
    void delAllByIdIn(Set<Long> idSet);

    @Modifying
    @Query(value = "delete from sys_dict_detail where detail_id = ?1 or rele_id=?1",nativeQuery = true)
    void delAllById(Long id);


}