Skip to main content

CustomerOrder

The CustomerOrder entity, mapped to the customer_order table.

Tablecustomer_order
Tenant-scopedYes — extends TenantOwned
Columns7
Relationships3
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——

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—

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/admin3Inventory & Portal
PortalOrderController/api/portal/orders4Inventory & 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/.