32 lines
1.2 KiB
Java
32 lines
1.2 KiB
Java
package com.iconplus.smartproc.repository;
|
|
|
|
import com.iconplus.smartproc.model.entity.JenisAnggaran;
|
|
import com.iconplus.smartproc.model.projection.JenisAnggaranView;
|
|
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 JenisAnggaranRepository extends JpaRepository<JenisAnggaran, Long> {
|
|
|
|
@Query(value = "SELECT ja.id as id, " +
|
|
"ja.jenisAnggaran as jenisAnggaran, " +
|
|
"ja.keterangan as keterangan, " +
|
|
"ja.deleted as deleted " +
|
|
"FROM JenisAnggaran ja " +
|
|
"WHERE ja.deleted = false " +
|
|
"AND (:search is null " +
|
|
"or (UPPER(ja.jenisAnggaran) like :search OR UPPER(ja.keterangan) like :search)) " +
|
|
"ORDER BY ja.id")
|
|
Page<JenisAnggaranView> getAllJenisAnggaran(String search, Pageable pageable);
|
|
|
|
Optional<JenisAnggaran> findByIdAndDeletedFalse(Long id);
|
|
|
|
Optional<JenisAnggaran> findByJenisAnggaranAndDeletedFalse(String jenisAnggaran);
|
|
|
|
}
|