package com.izouma.nineth.repo; import com.izouma.nineth.domain.MetaTaskBind; import com.izouma.nineth.enums.MetaTaskType; 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; public interface MetaTaskBindRepo extends JpaRepository, JpaSpecificationExecutor { List findByTaskIdAndTypeAndDel(Long taskId, MetaTaskType type, boolean del); @Query(value = "select m.atom_task_id from meta_task_bind m where m.task_id = ?1 and m.type = ?2 and m.del = false order by m.atom_task_index asc limit 1", nativeQuery = true) Long findAtomTaskId(Long taskId, String type); @Query("select m.atomTaskId from MetaTaskBind m where m.taskId = ?1 and m.del = false") List findAtomTaskIds(Long taskId); MetaTaskBind findByTaskIdAndAtomTaskIdAndDel(Long taskId, Long atomTaskId, boolean del); @Query(value = "select m.atom_task_id from meta_task_bind m where m.task_id = ?1 and m.type = 'NODE' and m.del = false and m.atom_task_index > ?2 order by m.atom_task_index asc limit 1", nativeQuery = true) Long findNextAtomTaskId(Long taskId, int atomTaskIndex); }