package com.yihu.jw.base.dao.servicePackage;

import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

/**
 * Created by yeshijie on 2021/2/23.
 */
public interface ServicePackageItemDao extends PagingAndSortingRepository<ServicePackageItemDO, String>, JpaSpecificationExecutor<ServicePackageItemDO> {


    @Query("from ServicePackageItemDO w where w.servicePackageId =?1 and w.del='1'")
    List<ServicePackageItemDO> findByServicePackageId(String servicePackageId);

    @Modifying
    @Query("delete from ServicePackageItemDO p where p.servicePackageId=?1")
    void deleteByServicePackageId(String servicePackageId);
}
