Skip to main content

CustomerOrder

The CustomerOrder entity, mapped to the customer_order table.

Tablecustomer_order
Tenant-scopedYes — extends TenantOwned
Columns10
Relationships6
Sourcebackend/src/main/java/com/motorph/payroll/model/CustomerOrder.java

Columns​

FieldTypeColumnNullNotes
orderIdIntegerorder_id—primary key, generated
orderNoStringorder_no—unique
statusStringstatus——
notesStringnotesYes—
totalAmountBigDecimaltotal_amount——
createdAtLocalDateTimecreated_at——
updatedAtLocalDateTimeupdated_at——
shipToOrderShipToship_toYesDelivery address and contact from checkout; null for orders placed before V175.
customerReferenceStringcustomer_referenceYesThe customer's own reference for the order, such as their purchase order number.
stockShortbooleanstock_short—Accepted although it took the warehouse below safety stock.

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​

FieldKindTargetJoin columnRequired
portalUser@ManyToOnePortalUserportal_user_idYes
items@OneToManyCustomerOrderItemmapped by order—
trackingHistory@OneToManyShipmentTrackingmapped by order—
salesOrder@ManyToOnecom.motorph.payroll.sales.model.SalesOrdersales_order_id—
delivery@ManyToOnecom.motorph.payroll.sales.model.Deliverydelivery_id—
warehouse@ManyToOneWarehousewarehouse_id—

Referenced by​

EntityFieldKind
CustomerOrderItemorder@ManyToOne
ShipmentTrackingorder@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

MethodReturnsNotes
findByPortalUser_PortalUserId(Integer portalUserId, Pageable pageable)Page<CustomerOrder>derived
findByStatus(String status, Pageable pageable)Page<CustomerOrder>derived
countByCreatedAtBetween(LocalDateTime from, LocalDateTime to)longderived
countByOrderNoStartingWith(String prefix)longderived
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.

ControllerBase pathEndpointsModule
PortalAdminController/api/portal/admin4Inventory & Portal
PortalOrderController/api/portal/orders7Inventory & 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/.