InventoryItem
The InventoryItem entity, mapped to the inventory_item table.
| Table | inventory_item |
| Tenant-scoped | Yes — extends TenantOwned |
| Columns | 16 |
| Relationships | 3 |
| Source | backend/src/main/java/com/motorph/payroll/model/InventoryItem.java |
Columns
| Field | Type | Column | Null | Notes |
|---|---|---|---|---|
itemId | Integer | item_id | — | primary key, generated |
sku | String | sku | — | unique |
name | String | name | — | — |
description | String | description | Yes | — |
unitOfMeasure | String | unit_of_measure | — | — |
reorderPoint | Integer | reorder_point | — | — |
unitCost | BigDecimal | unit_cost | Yes | — |
classification | String | classification | — | Inventory classification for valuation and the BIR inventory list (V152). |
reorderQty | Integer | reorder_qty | Yes | How many to order when stock falls below the reorder point. |
safetyStock | Integer | safety_stock | — | The floor kept for emergencies, in every warehouse without its own level (V160). |
averageCost | BigDecimal | average_cost | — | Moving weighted average cost and the item's total carrying value across all locations. |
carryingValue | BigDecimal | carrying_value | — | — |
status | String | status | — | — |
trackingType | String | tracking_type | — | — |
isSellable | Boolean | is_sellable | — | Which document line pickers may offer this item. |
isPurchasable | Boolean | is_purchasable | — | — |
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 |
|---|---|---|---|---|
category | @ManyToOne | ItemCategory | category_id | — |
defaultTaxCode | @ManyToOne | TaxCode | default_tax_code_id | — |
preferredSupplier | @ManyToOne | Supplier | preferred_supplier_id | — |
Referenced by
| Entity | Field | Kind |
|---|---|---|
| CustomerOrderItem | item | @ManyToOne |
| InventoryLot | item | @ManyToOne |
| InventoryStock | item | @ManyToOne |
| ItemPrice | item | @ManyToOne |
| ItemPriceHistory | item | @ManyToOne |
| ItemSerial | item | @ManyToOne |
| PurchaseReceivingItem | item | @ManyToOne |
| StockTransaction | item | @ManyToOne |
| StoreInventory | item | @ManyToOne |
| WarehouseTransfer | item | @ManyToOne |
Neighbourhood
12 of 13 associations shown; the tables above are complete.
Repository
InventoryItemRepository
Declared over InventoryItem with id type Integer, with JpaSpecificationExecutor for dynamic filtering. Source: backend/src/main/java/com/motorph/payroll/repository/InventoryItemRepository.java
| Method | Returns | Notes |
|---|---|---|
existsBySkuIgnoreCase(String sku) | boolean | derived |
existsBySkuIgnoreCaseAndItemIdNot(String sku, Integer itemId) | boolean | derived |
findBySkuIgnoreCase(String sku) | Optional<InventoryItem> | derived |
findAllByCategory_CategoryId(Integer categoryId) | List<InventoryItem> | derived |
lockById(@org.springframework.data.repository.query.Param("id") Integer id) | Optional<InventoryItem> | explicit @Query |
searchByKeyword(String keyword) | List<InventoryItem> | explicit @Query |
Reached by
These controllers hold — directly or through a service they depend on — a repository over InventoryItem.
| Controller | Base path | Endpoints | Module |
|---|---|---|---|
| BarcodeController | /api/inventory | 1 | Inventory & Portal |
| InventoryController | /api/inventory | 38 | Inventory & Portal |
| InventoryReportController | /api/inventory/reports | 3 | Inventory & Portal |
| ItemPriceController | — | 6 | Inventory & Portal |
| PortalOrderController | /api/portal/orders | 7 | Inventory & Portal |
| SerialLotController | /api/inventory | 5 | Inventory & Portal |
| StoreController | /api/inventory/stores | 7 | Inventory & Portal |
| WarehouseTransferController | /api/inventory/transfers | 2 | Inventory & Portal |
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/.