| @@ -23,9 +23,7 @@ open class DashboardService( | |||||
| fun CustomerSubsidiary(args: Map<String, Any>): List<Map<String, Any>> { | fun CustomerSubsidiary(args: Map<String, Any>): List<Map<String, Any>> { | ||||
| val sql = StringBuilder("select" | val sql = StringBuilder("select" | ||||
| + " row_number()OVER (" | |||||
| + " ORDER BY c.id" | |||||
| + " ) as id," | |||||
| + " ROW_NUMBER() OVER (ORDER BY c.id, c.name, c.code, c.address, c.district, c.brNo, c.typeId, s.id, s.name, s.code, s.address, s.district, s.brNo, s.typeId) AS RowNum," | |||||
| + " c.id as customerId," | + " c.id as customerId," | ||||
| + " c.name as customerName," | + " c.name as customerName," | ||||
| + " c.code as customerCode," | + " c.code as customerCode," | ||||
| @@ -45,6 +43,7 @@ open class DashboardService( | |||||
| + " left join project p on c.id = p.customerId" | + " left join project p on c.id = p.customerId" | ||||
| + " left join subsidiary s on p.customerSubsidiaryId = s.id" | + " left join subsidiary s on p.customerSubsidiaryId = s.id" | ||||
| + " where c.deleted = 0" | + " where c.deleted = 0" | ||||
| + " and p.status not in (\"Pending to Start\",\"Completed\",\"Deleted\")" | |||||
| ) | ) | ||||
| if (args != null) { | if (args != null) { | ||||
| if (args.containsKey("customerName")) | if (args.containsKey("customerName")) | ||||
| @@ -58,6 +57,7 @@ open class DashboardService( | |||||
| fun searchCustomerSubsidiaryProject(args: Map<String, Any>): List<Map<String, Any>> { | fun searchCustomerSubsidiaryProject(args: Map<String, Any>): List<Map<String, Any>> { | ||||
| val sql = StringBuilder("select" | val sql = StringBuilder("select" | ||||
| + " ROW_NUMBER() OVER (ORDER BY p.id, p.code, p.name, te.code, s.name, tg.name, p.totalManhour, milestonePayment.comingPaymentMilestone) AS id," | |||||
| + " p.id as id," | + " p.id as id," | ||||
| + " p.id as projectId," | + " p.id as projectId," | ||||
| + " p.code as projectCode," | + " p.code as projectCode," | ||||
| @@ -91,6 +91,7 @@ open class DashboardService( | |||||
| + " ) milestonePayment on 1=1" | + " ) milestonePayment on 1=1" | ||||
| + " where p.customerId = :customerId" | + " where p.customerId = :customerId" | ||||
| + " and p.customerSubsidiaryId = :subsidiaryId" | + " and p.customerSubsidiaryId = :subsidiaryId" | ||||
| + " and p.status not in (\"Pending to Start\",\"Completed\",\"Deleted\")" | |||||
| + " group by p.id, p.code, p.name, te.code, s.name, tg.name, p.totalManhour, milestonePayment.comingPaymentMilestone" | + " group by p.id, p.code, p.name, te.code, s.name, tg.name, p.totalManhour, milestonePayment.comingPaymentMilestone" | ||||
| ) | ) | ||||
| @@ -99,6 +100,7 @@ open class DashboardService( | |||||
| fun searchCustomerNonSubsidiaryProject(args: Map<String, Any>): List<Map<String, Any>> { | fun searchCustomerNonSubsidiaryProject(args: Map<String, Any>): List<Map<String, Any>> { | ||||
| val sql = StringBuilder("select" | val sql = StringBuilder("select" | ||||
| + " ROW_NUMBER() OVER (ORDER BY p.id, p.code, p.name, te.code, s.name, tg.name, p.totalManhour, milestonePayment.comingPaymentMilestone) AS id," | |||||
| + " p.id as id," | + " p.id as id," | ||||
| + " p.id as projectId," | + " p.id as projectId," | ||||
| + " p.code as projectCode," | + " p.code as projectCode," | ||||
| @@ -132,6 +134,7 @@ open class DashboardService( | |||||
| + " ) milestonePayment on 1=1" | + " ) milestonePayment on 1=1" | ||||
| + " where p.customerId = :customerId" | + " where p.customerId = :customerId" | ||||
| + " and isNull(p.customerSubsidiaryId)" | + " and isNull(p.customerSubsidiaryId)" | ||||
| + " and p.status not in (\"Pending to Start\",\"Completed\",\"Deleted\")" | |||||
| + " group by p.id, p.code, p.name, te.code, s.name, tg.name, p.totalManhour, milestonePayment.comingPaymentMilestone" | + " group by p.id, p.code, p.name, te.code, s.name, tg.name, p.totalManhour, milestonePayment.comingPaymentMilestone" | ||||
| ) | ) | ||||