add master data api
This commit is contained in:
@@ -1,10 +1,32 @@
|
||||
package com.iconplus.smartproc.repository;
|
||||
|
||||
import com.iconplus.smartproc.model.entity.JenisKontrak;
|
||||
import com.iconplus.smartproc.model.projection.JenisKontrakView;
|
||||
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.Optional;
|
||||
|
||||
@Repository
|
||||
public interface JenisKontrakRepository extends JpaRepository<JenisKontrak, Long> {
|
||||
|
||||
}
|
||||
|
||||
@Query(value = "SELECT jk.id as id, " +
|
||||
"jk.jenisKontrak as jenisKontrak, " +
|
||||
"jk.keterangan as keterangan, " +
|
||||
"jk.isActive as isActive, " +
|
||||
"jk.isDelete as isDelete " +
|
||||
"FROM JenisKontrak jk " +
|
||||
"WHERE jk.isDelete = false " +
|
||||
"AND (:search is '' " +
|
||||
"or UPPER(jk.jenisKontrak) like :search) " +
|
||||
"ORDER BY jk.id")
|
||||
Page<JenisKontrakView> getAllJenisKontrak(String search, Pageable pageable);
|
||||
|
||||
Optional<JenisKontrak> findByIdAndIsDeleteFalse(Long id);
|
||||
|
||||
Optional<JenisKontrak> findByJenisKontrakAndIsDeleteFalse(String jenisKontrak);
|
||||
|
||||
}
|
Reference in New Issue
Block a user