EmployeeDeduction
Assignment of a DeductionType + amount to a specific employee.
| Table | employee_deductions |
| Tenant-scoped | Yes — extends TenantOwned |
| Columns | 12 |
| Relationships | 2 |
| Source | backend/src/main/java/com/motorph/payroll/model/EmployeeDeduction.java |
Columns
| Field | Type | Column | Null | Notes |
|---|---|---|---|---|
employeeDeductionId | Integer | employee_deduction_id | — | primary key, generated |
amount | BigDecimal | amount | — | — |
amountBasis | DeductionAmountBasis | amount_basis | — | enum |
isRecurring | Boolean | is_recurring | — | — |
startDate | LocalDate | start_date | — | — |
endDate | LocalDate | end_date | Yes | — |
active | Boolean | active | — | — |
notes | String | notes | Yes | — |
createdBy | String | created_by | — | — |
createdDate | LocalDateTime | created_date | — | — |
lastModifiedBy | String | last_modified_by | Yes | — |
lastModifiedDate | LocalDateTime | last_modified_date | Yes | — |
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 |
|---|---|---|---|---|
employee | @ManyToOne | Employee | employee_number | Yes |
deductionType | @ManyToOne | DeductionType | deduction_type_id | Yes |
Referenced by
| Entity | Field | Kind |
|---|---|---|
| PayslipDeductionItem | employeeDeduction | @ManyToOne |
Neighbourhood
Repository
EmployeeDeductionRepository
Declared over EmployeeDeduction with id type Integer, with JpaSpecificationExecutor for dynamic filtering. Source: backend/src/main/java/com/motorph/payroll/repository/EmployeeDeductionRepository.java
| Method | Returns | Notes |
|---|---|---|
findWithDetailsByEmployeeDeductionId(Integer employeeDeductionId) | Optional<EmployeeDeduction> | derived |
existsByDeductionType_DeductionTypeId(Integer deductionTypeId) | boolean | derived |
findApplicable(@Param("employeeNumber") Integer employeeNumber, @Param("periodStart") LocalDate periodStart, @Param("periodEnd") LocalDate periodEnd) | List<EmployeeDeduction> | explicit @Query |
Reached by
These controllers hold — directly or through a service they depend on — a repository over EmployeeDeduction.
| Controller | Base path | Endpoints | Module |
|---|---|---|---|
| DeductionTypeController | /api/deduction-types | 4 | Payroll |
| DemoDataController | /api/system-admin/demo-data | 3 | Billing & Platform |
| EmployeeDeductionController | /api/employee-deductions | 5 | Payroll |
| PayrollController | /api/payroll | 8 | Payroll |
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/.