CustomerOrder
The CustomerOrder entity, mapped to the customer_order table.
| Table | customer_order |
| Tenant-scoped | Yes — extends TenantOwned |
| Columns | 7 |
| Relationships | 3 |
| Source | backend/src/main/java/com/motorph/payroll/model/CustomerOrder.java |
Columns
| Field | Type | Column | Null | Notes |
|---|---|---|---|---|
orderId | Integer | order_id | — | primary key, generated |
orderNo | String | order_no | — | unique |
status | String | status | — | — |
notes | String | notes | Yes | — |
totalAmount | BigDecimal | total_amount | — | — |
createdAt | LocalDateTime | created_at | — | — |
updatedAt | LocalDateTime | updated_at | — | — |
Plus tenant_id, inherited from TenantOwned. Hibernate stamps it on insert and adds where tenant_id = ? to every query, so it is never written or read by application code.
Relationships
| Field | Kind | Target | Join column | Required |
|---|---|---|---|---|
portalUser | @ManyToOne | PortalUser | portal_user_id | Yes |
items | @OneToMany | CustomerOrderItem | mapped by order | — |
trackingHistory | @OneToMany | ShipmentTracking | mapped by order | — |
Referenced by
| Entity | Field | Kind |
|---|---|---|
| CustomerOrderItem | order | @ManyToOne |
| ShipmentTracking | order | @ManyToOne |
Neighbourhood
Repository
CustomerOrderRepository
Declared over CustomerOrder with id type Integer, with JpaSpecificationExecutor for dynamic filtering. Source: backend/src/main/java/com/motorph/payroll/repository/CustomerOrderRepository.java
| Method | Returns | Notes |
|---|---|---|
findByPortalUser_PortalUserId(Integer portalUserId, Pageable pageable) | Page<CustomerOrder> | derived |
findByStatus(String status, Pageable pageable) | Page<CustomerOrder> | derived |
countByCreatedAtBetween(LocalDateTime from, LocalDateTime to) | long | derived |
countByOrderNoStartingWith(String prefix) | long | derived |
searchAll(@Param("status") String status, @Param("search") String search, Pageable pageable) | Page<CustomerOrder> | explicit @Query |
Reached by
These controllers hold — directly or through a service they depend on — a repository over CustomerOrder.
| Controller | Base path | Endpoints | Module |
|---|---|---|---|
| PortalAdminController | /api/portal/admin | 3 | Inventory & Portal |
| PortalOrderController | /api/portal/orders | 4 | Inventory & Portal |
Generated page
This page is rebuilt from the source on every docs build by docs-site/scripts/gen-code-wiki.mjs. Editing it has no effect — change the code, or, if what you want to say is prose, write it in docs/.