inisialisasi kembali
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package org.sadigit.repository.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Session;
|
||||
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.persistence.Tuple;
|
||||
|
||||
@ApplicationScoped
|
||||
public class PlnMobileServiceRepository {
|
||||
|
||||
@Inject
|
||||
Session session;
|
||||
|
||||
public List<Tuple> get10PengaduanTerbaruByIdPel(String idpel) {
|
||||
|
||||
// log.info("idpel: {}", idpel);
|
||||
String query = """
|
||||
(
|
||||
select
|
||||
g.id_pelanggan_no_meter as idpel,
|
||||
g.no_laporan as noLaporan,
|
||||
g.alamat_pelapor as alamatPelapor,
|
||||
g.created_date as createdDate,
|
||||
g.nama_pelapor as namaPelapor,
|
||||
r1.nama as namaRegu,
|
||||
g.keterangan as keterangan
|
||||
from
|
||||
Gangguan g
|
||||
left join MasterRegu r1 on g.regu.id = r1.id
|
||||
where
|
||||
g.id_pelanggan_no_meter = :idpel and
|
||||
g.created_date is not null
|
||||
union all
|
||||
select
|
||||
k.id_pelanggan_no_meter as idpel,
|
||||
k.no_laporan as noLaporan,
|
||||
k.alamat_pelapor as alamatPelapor,
|
||||
k.created_date as createdDate,
|
||||
k.nama_pelapor as namaPelapor,
|
||||
r2.nama as namaRegu,
|
||||
k.keterangan as keterangan
|
||||
from
|
||||
Keluhan k
|
||||
left join MasterRegu r2 on k.regu.id = r2.id
|
||||
where
|
||||
k.id_pelanggan_no_meter = :idpel and
|
||||
k.created_date is not null
|
||||
)
|
||||
order by createdDate asc
|
||||
""";
|
||||
|
||||
return session.createQuery(query, Tuple.class)
|
||||
.setParameter("idpel", idpel)
|
||||
.setMaxResults(10)
|
||||
.getResultList();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user