enhance crud jenis pengadaan
This commit is contained in:
@@ -1,10 +1,29 @@
|
||||
package com.iconplus.smartproc.repository;
|
||||
|
||||
import com.iconplus.smartproc.model.entity.JenisPengadaan;
|
||||
import com.iconplus.smartproc.model.projection.JenisPengadaanView;
|
||||
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 JenisPengadaanRepository extends JpaRepository<JenisPengadaan, Long> {
|
||||
|
||||
Optional<JenisPengadaan> findByIdAndIsDeleteFalse(Long id);
|
||||
Optional<JenisPengadaan> findByJenisPengadaanAndIsDeleteFalse(String jenisPengadaan);
|
||||
|
||||
@Query(value = "SELECT jp.id as id, " +
|
||||
"jp.jenisPengadaan as jenisPengadaan, " +
|
||||
"jp.keterangan as keterangan, " +
|
||||
"jp.isActive as isActive " +
|
||||
"FROM JenisPengadaan jp " +
|
||||
"WHERE jp.isDelete = false " +
|
||||
"AND (:search='' OR UPPER(jp.jenisPengadaan) like :search) " +
|
||||
"ORDER BY jp.id")
|
||||
Page<JenisPengadaanView> getListJenisPengadaan(String search, Pageable pageable);
|
||||
|
||||
}
|
Reference in New Issue
Block a user