Fix display order in various locations. closes #120 #121
|
@ -21,7 +21,7 @@ public class WarehouseController {
|
|||
Model model,
|
||||
HttpServletRequest request
|
||||
) {
|
||||
model.addAttribute("bookings", warehouseBookingRepository.findAll());
|
||||
model.addAttribute("bookings", warehouseBookingRepository.findAllDesc());
|
||||
return "intern/warehouse/index";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class SupplierOrderController {
|
|||
|
||||
List<UImodelSupplierOrder> totals = new ArrayList<UImodelSupplierOrder>();
|
||||
|
||||
for (SupplierOrder order : supplierOrderRepository.findAll()) {
|
||||
for (SupplierOrder order : supplierOrderRepository.findAllDesc()) {
|
||||
final Article article = articleRepository.findArticleByArticleOffer(order.ordered).orElse(null);
|
||||
totals.add(new UImodelSupplierOrder(order, article));
|
||||
}
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
package org.hso.ecommerce.repos.supplier;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hso.ecommerce.entities.supplier.SupplierOrder;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface SupplierOrderRepository extends JpaRepository<SupplierOrder, Long> {
|
||||
|
||||
@Query("SELECT SUM(so.numberOfUnits) FROM SupplierOrder so JOIN so.ordered ao WHERE ao.articleNumber = :articleNumber AND so.delivered IS NULL")
|
||||
Integer countUndeliveredReorders(String articleNumber);
|
||||
@Query("SELECT SUM(so.numberOfUnits) FROM SupplierOrder so JOIN so.ordered ao WHERE ao.articleNumber = :articleNumber AND so.delivered IS NULL")
|
||||
Integer countUndeliveredReorders(String articleNumber);
|
||||
|
||||
@Query(value = "SELECT * FROM supplier_orders as a WHERE a.supplier_id = :supplierId", nativeQuery = true)
|
||||
@Query(value = "SELECT * FROM supplier_orders as a WHERE a.supplier_id = :supplierId ORDER BY a.id DESC", nativeQuery = true)
|
||||
List<SupplierOrder> findOrderBySupplierID(@Param("supplierId") long supplierId);
|
||||
|
||||
|
||||
@Query("SELECT a FROM SupplierOrder a")
|
||||
List<SupplierOrder> findAll();
|
||||
|
||||
@Query("SELECT a FROM SupplierOrder a ORDER BY a.id DESC")
|
||||
List<SupplierOrder> findAllDesc();
|
||||
}
|
||||
|
|
|
@ -13,5 +13,8 @@ public interface WarehouseBookingRepository extends JpaRepository<WarehouseBooki
|
|||
@Query("Select b FROM WarehouseBooking b WHERE b.isDone = 0")
|
||||
List<WarehouseBooking> findNotDone();
|
||||
|
||||
@Query("Select b FROM WarehouseBooking b ORDER BY b.id DESC")
|
||||
List<WarehouseBooking> findAllDesc();
|
||||
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue