MetaTaskBindRepo.java 1.3 KB

1234567891011121314151617181920212223242526
  1. package com.izouma.nineth.repo;
  2. import com.izouma.nineth.domain.MetaTaskBind;
  3. import com.izouma.nineth.enums.MetaTaskType;
  4. import org.springframework.data.jpa.repository.JpaRepository;
  5. import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
  6. import org.springframework.data.jpa.repository.Query;
  7. import java.util.List;
  8. public interface MetaTaskBindRepo extends JpaRepository<MetaTaskBind, Long>, JpaSpecificationExecutor<MetaTaskBind> {
  9. List<MetaTaskBind> findByTaskIdAndTypeAndDel(Long taskId, MetaTaskType type, boolean del);
  10. @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)
  11. Long findAtomTaskId(Long taskId, String type);
  12. @Query("select m.atomTaskId from MetaTaskBind m where m.taskId = ?1 and m.del = false")
  13. List<Long> findAtomTaskIds(Long taskId);
  14. MetaTaskBind findByTaskIdAndAtomTaskIdAndDel(Long taskId, Long atomTaskId, boolean del);
  15. @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)
  16. Long findNextAtomTaskId(Long taskId, int atomTaskIndex);
  17. }