Align company tariff group query with legacy logic

This commit is contained in:
2026-09-25 06:47:45 +07:00
parent 3b75b52ee4
commit d881872206

View File

@@ -151,7 +151,7 @@ func (r MySQLLayananRepository) GetPerusahaan(ctx context.Context, id string) (*
func (r MySQLLayananRepository) GetPerusahaanGroupTarif(ctx context.Context, id, groupTarifID string) (*PerusahaanGroupTarifDetail, error) {
var result PerusahaanGroupTarifDetail
err := r.db.QueryRowContext(ctx, `SELECT PerusahaanID, KodePerusahaan, Nama FROM perusahaan
WHERE NA = 'N' AND (PerusahaanID = ? OR KodePerusahaan = ?) LIMIT 1`, id, id).
WHERE PerusahaanID = ? OR KodePerusahaan = ? LIMIT 1`, id, id).
Scan(&result.PerusahaanID, &result.KodePerusahaan, &result.NamaPerusahaan)
if err == sql.ErrNoRows {
return nil, nil
@@ -171,7 +171,7 @@ func (r MySQLLayananRepository) GetPerusahaanGroupTarif(ctx context.Context, id,
query += " AND pg.GroupTarifID = ?"
args = append(args, groupTarifID)
}
query += " ORDER BY pg.TanggalBerlaku DESC, pg.GroupTarifID DESC"
query += " ORDER BY pg.Keterangan"
rows, err := r.db.QueryContext(ctx, query, args...)
if err != nil {
return nil, err