Align company tariff group query with legacy logic
This commit is contained in:
@@ -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) {
|
func (r MySQLLayananRepository) GetPerusahaanGroupTarif(ctx context.Context, id, groupTarifID string) (*PerusahaanGroupTarifDetail, error) {
|
||||||
var result PerusahaanGroupTarifDetail
|
var result PerusahaanGroupTarifDetail
|
||||||
err := r.db.QueryRowContext(ctx, `SELECT PerusahaanID, KodePerusahaan, Nama FROM perusahaan
|
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)
|
Scan(&result.PerusahaanID, &result.KodePerusahaan, &result.NamaPerusahaan)
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
@@ -171,7 +171,7 @@ func (r MySQLLayananRepository) GetPerusahaanGroupTarif(ctx context.Context, id,
|
|||||||
query += " AND pg.GroupTarifID = ?"
|
query += " AND pg.GroupTarifID = ?"
|
||||||
args = append(args, 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...)
|
rows, err := r.db.QueryContext(ctx, query, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user