package com.yeejoin.amos.fas.business.dao.repository;

import com.yeejoin.amos.fas.dao.entity.PlanRule;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <h1><h1>
 *
 * @author tiantao
 * @date 2021/1/15 10:36
 */
@Repository
public interface IPlanRuleDao  extends BaseDao<PlanRule, Long>{

    void deleteByPlanId(long planId);

    List<PlanRule> getPlanDocsByPlanId(Long planId);

    List<PlanRule> findAllByIsDelete(Boolean isDelete);

    List<PlanRule> findAllByPlanIdIn(List<Long> planIds);

    @Query(value="SELECT * from c_plan_rule where plan_id in (?1) AND is_delete = 0 ", nativeQuery = true)
    List<PlanRule> findAllByPlanId(Long planId);
}
