Department
The Department entity, mapped to the department table.
| Table | department |
| Tenant-scoped | Yes — extends TenantOwned |
| Columns | 4 |
| Relationships | 1 |
| Source | backend/src/main/java/com/motorph/payroll/model/Department.java |
Columns
| Field | Type | Column | Null | Notes |
|---|---|---|---|---|
departmentId | Integer | department_id | — | primary key, generated |
departmentName | String | department_name | — | unique |
description | String | description | Yes | — |
isArchived | Boolean | is_archived | — | — |
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 |
|---|---|---|---|---|
parentDepartment | @ManyToOne | Department | parent_department_id | — |
Referenced by
| Entity | Field | Kind |
|---|---|---|
| Department | parentDepartment | @ManyToOne |
| JobRequisition | department | @ManyToOne |
| Position | department | @ManyToOne |
| StaffingPlan | department | @ManyToOne |
Neighbourhood
Repository
DepartmentRepository
Declared over Department with id type Integer, with JpaSpecificationExecutor for dynamic filtering. Source: backend/src/main/java/com/motorph/payroll/repository/DepartmentRepository.java
| Method | Returns | Notes |
|---|---|---|
existsByDepartmentNameIgnoreCase(String departmentName) | boolean | derived |
existsByDepartmentNameIgnoreCaseAndDepartmentIdNot(String departmentName, Integer departmentId) | boolean | derived |
existsByParentDepartment_DepartmentId(Integer parentDepartmentId) | boolean | derived |
searchPaged(@Param("search") String search, Pageable pageable) | Page<Department> | explicit @Query |
Reached by
These controllers hold — directly or through a service they depend on — a repository over Department.
| Controller | Base path | Endpoints | Module |
|---|---|---|---|
| DepartmentController | /api/departments | 8 | HR |
| JobRequisitionController | /api/job-requisitions | 8 | Recruitment |
| PositionController | /api/positions | 8 | HR |
| PublicSignupController | /api/public/signup | 2 | Billing & Platform |
| StaffingPlanController | /api/staffing-plans | 7 | Recruitment |
| TenantAdminController | /api/admin/tenants | 7 | Billing & Platform |
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/.