package com.realnet.stepperworkflow.Repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import org.springframework.stereotype.Repository;
import java.util.*;

import com.realnet.stepperworkflow.Entity.Stepper_table_config;

@Repository
public interface Stepper_table_configRepository extends JpaRepository<Stepper_table_config, Integer> {

	@Query(value = "select * from stepper_table_config where  created_by=?1", nativeQuery = true)
	List<Stepper_table_config> findAll(Long creayedBy);

	@Query(value = "select * from stepper_table_config where  created_by=?1", nativeQuery = true)
	Page<Stepper_table_config> findAll(Pageable page, Long creayedBy);

	@Query(value = "select * from stepper_table_config where stepper_id=?1 &&   table_id=?2", nativeQuery = true)
	List<Stepper_table_config> getAllBysteAndTbId(Integer stepper_id, Integer table_id);

	@Query(value = "select * from stepper_table_config where stepper_id=?1", nativeQuery = true)
	List<Stepper_table_config> getAllBystepId(Integer stepper_id);

	@Query(value = "select * from stepper_table_config where stepper_id=?1 &&   table_name=?2 order by id desc", nativeQuery = true)
	Stepper_table_config getBystepIdAndtabname(Integer stepper_id, String table_name);
}