Skip to main content

Department

The Department entity, mapped to the department table.

Tabledepartment
Tenant-scopedYes — extends TenantOwned
Columns4
Relationships1
Sourcebackend/src/main/java/com/motorph/payroll/model/Department.java

Columns​

FieldTypeColumnNullNotes
departmentIdIntegerdepartment_id—primary key, generated
departmentNameStringdepartment_name—unique
descriptionStringdescriptionYes—
isArchivedBooleanis_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​

FieldKindTargetJoin columnRequired
parentDepartment@ManyToOneDepartmentparent_department_id—

Referenced by​

EntityFieldKind
DepartmentparentDepartment@ManyToOne
JobRequisitiondepartment@ManyToOne
Positiondepartment@ManyToOne
StaffingPlandepartment@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

MethodReturnsNotes
existsByDepartmentNameIgnoreCase(String departmentName)booleanderived
existsByDepartmentNameIgnoreCaseAndDepartmentIdNot(String departmentName, Integer departmentId)booleanderived
existsByParentDepartment_DepartmentId(Integer parentDepartmentId)booleanderived
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.

ControllerBase pathEndpointsModule
DepartmentController/api/departments8HR
JobRequisitionController/api/job-requisitions8Recruitment
PositionController/api/positions8HR
PublicSignupController/api/public/signup2Billing & Platform
StaffingPlanController/api/staffing-plans7Recruitment
TenantAdminController/api/admin/tenants7Billing & 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/.