@Repository public interface AssignmentRepository extends org.springframework.data.jpa.repository.JpaRepository<Assignment,Long>
deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAll, flush, getOne, save, saveAndFlushfindAll@Query(value=" from Assignment A where A.employee.id =:empId order by A.fromDate") List<Assignment> getAllAssignmentsByEmpId(@Param(value="empId") Long empId)
@Query(value=" from Assignment A where A.fromDate<=current_date and A.toDate>=current_date and A.employee.id =:empId order by A.fromDate") List<Assignment> getAllActiveAssignmentsByEmpId(@Param(value="empId") Long empId)
@Query(value=" from Assignment A where A.fromDate<=:givenDate and A.toDate>=:givenDate and A.position.id=:posId order by A.fromDate") List<Assignment> getAssignmentsForPosition(@Param(value="posId") Long posId, @Param(value="givenDate") Date givenDate)
@Query(value=" from Assignment A where A.fromDate<=current_date and A.toDate>=current_date and A.primary=true and A.position.id=:posId") Assignment getPrimaryAssignmentForPosition(@Param(value="posId") Long posId)
@Query(value=" from Assignment A where A.fromDate<=current_date and A.toDate>=current_date and A.primary=true and A.employee.id=:userId ") Assignment getPrimaryAssignmentForUser(@Param(value="userId") Long userId)
@Query(value=" from Assignment A where A.fromDate<=:givenDate and A.toDate>=:givenDate and A.primary=true and A.employee.id=:empId ") Assignment getAssignmentByEmpAndDate(@Param(value="empId") Long empId, @Param(value="givenDate") Date givenDate)
@Query(value=" from Assignment A where A.fromDate<=current_date and A.toDate>=current_date and A.primary=true and A.employee.id=:empId") Assignment getPrimaryAssignmentForEmployee(@Param(value="empId") Long empId)
@Query(value=" from Assignment A where A.position.id=:posId and A.fromDate<=current_date and A.toDate>=current_date order by A.fromDate") List<Assignment> getAssignmentsForPosition(@Param(value="posId") Long posId)
@Query(value=" from Assignment A where A.position.id=:posId and A.fromDate<=:givenDate and A.toDate>=:givenDate and A.primary=true and A.employee.active=true") Assignment getPrimaryAssignmentForPositionAndDate(@Param(value="posId") Long posId, @Param(value="givenDate") Date givenDate)
@Query(value=" from Assignment A where A.employee.id=:empId and A.primary=true and A.fromDate<=:fromDate and A.toDate>=:toDate") Assignment getPrimaryAssignmentForGivenRange(@Param(value="empId") Long empId, @Param(value="fromDate") Date fromDate, @Param(value="toDate") Date toDate)
@Query(value=" from Assignment A where A.designation.id=:designationId and A.department.id=:departmentId and A.primary=true and A.fromDate<=:givenDate and A.toDate>=:givenDate ") List<Assignment> getPrimaryAssignmentForDepartmentAndDesignation(@Param(value="departmentId") Long departmentId, @Param(value="designationId") Long designationId, @Param(value="givenDate") Date givenDate)
@Query(value=" from Assignment A where A.designation.id=:designationId and A.department.id=:departmentId and A.fromDate<=:givenDate and A.toDate>=:givenDate order by A.primary desc") List<Assignment> getAllAssignmentForDepartmentAndDesignation(@Param(value="departmentId") Long departmentId, @Param(value="designationId") Long designationId, @Param(value="givenDate") Date givenDate)
@Query(value=" from Assignment A where A.department.id=:departmentId and A.primary=true and A.fromDate<=:givenDate and A.toDate>=:givenDate ") List<Assignment> getPrimaryAssignmentForDepartment(@Param(value="departmentId") Long departmentId, @Param(value="givenDate") Date givenDate)
@Query(value=" from Assignment A where A.department.id=:departmentId and A.fromDate<=:givenDate and A.toDate>=:givenDate order by A.primary desc") List<Assignment> getAllAssignmentForDepartment(@Param(value="departmentId") Long departmentId, @Param(value="givenDate") Date givenDate)
@Query(value=" from Assignment A where A.department.id=:departmentId and A.fromDate<=:givenDate and A.toDate>=:givenDate and A.position.name like \'%\'||:posName||\'%\' order by A.primary desc") List<Assignment> getAllAssignmentForDepartmentAndPositionNameLike(@Param(value="departmentId") Long departmentId, @Param(value="givenDate") Date givenDate, @Param(value="posName") String posName)
@Query(value=" from Assignment A where A.fromDate<=:givenDate and A.toDate>=:givenDate and A.position.name like \'%\'||:posName||\'%\' order by A.primary desc") List<Assignment> getAllAssignmentForPositionNameLike(@Param(value="givenDate") Date givenDate, @Param(value="posName") String posName)
@Query(value=" from Assignment A where A.designation.id=:designationId and A.primary=true and A.fromDate<=:givenDate and A.toDate>=:givenDate ") List<Assignment> getPrimaryAssignmentForDesignation(@Param(value="designationId") Long designationId, @Param(value="givenDate") Date givenDate)
@Query(value=" from Assignment A where A.designation.id=:designationId and A.fromDate<=:givenDate and A.toDate>=:givenDate order by A.primary desc") List<Assignment> getAllAssignmentForDesignation(@Param(value="designationId") Long designationId, @Param(value="givenDate") Date givenDate)
@Query(value=" from Assignment A where A.department.id=:deptId and A.designation.id=:desigId and ((:fromDate between A.fromDate and A.toDate) or (:toDate between A.fromDate and A.toDate) or (A.fromDate<=:fromDate and A.toDate>=:toDate)) and A.primary=true") List<Assignment> findByDeptDesigAndDates(@Param(value="deptId") Long deptId, @Param(value="desigId") Long desigId, @Param(value="fromDate") Date fromDate, @Param(value="toDate") Date toDate)
@Query(value=" from Assignment A where A.department.id=:deptId and A.designation.id=:desigId and A.fromDate<=:givenDate and A.toDate>=:givenDate ") List<Assignment> findAllAssignmentsByDeptDesigAndGivenDate(@Param(value="deptId") Long deptId, @Param(value="desigId") Long desigId, @Param(value="givenDate") Date givenDate)
@Query(value=" from Assignment A where A.department.id=:deptId and A.fromDate<=:givenDate and A.toDate>=:givenDate order by A.fromDate ") List<Assignment> findAllByDepartmentAndDate(@Param(value="deptId") Long deptId, @Param(value="givenDate") Date givenDate)
@Query(value=" from Assignment A where A.employee.id=:empId and A.fromDate<=:givenDate and A.toDate>=:givenDate order by A.fromDate desc") List<Assignment> findByEmployeeAndGivenDate(@Param(value="empId") Long empId, @Param(value="givenDate") Date givenDate)
@Query(value=" from Assignment A where A.fromDate<=current_date and A.toDate>=current_date and A.designation.name=:name and A.primary=true") List<Assignment> findPrimaryAssignmentForDesignationName(@Param(value="name") String name)
@Query(value=" select ASSIGN from Assignment ASSIGN inner join ASSIGN.employee as EMP inner join EMP.jurisdictions as JRDN where ASSIGN.designation.id=:desigId and ASSIGN.fromDate<=current_date and ASSIGN.toDate>=current_date and JRDN.boundary.id in :boundaryIds order by ASSIGN.primary desc") List<Assignment> findByDesignationAndBoundary(@Param(value="desigId") Long desigId, @Param(value="boundaryIds") Set<Long> boundaryIds)
@Query(value=" select ASSIGN from Assignment ASSIGN inner join ASSIGN.employee as EMP inner join EMP.jurisdictions as JRDN where ASSIGN.department.id=:deptId and ASSIGN.designation.id=:desigId and ASSIGN.fromDate<=current_date and ASSIGN.toDate>=current_date and JRDN.boundary.id in :boundaryIds order by ASSIGN.primary desc") List<Assignment> findByDepartmentDesignationAndBoundary(@Param(value="deptId") Long deptId, @Param(value="desigId") Long desigId, @Param(value="boundaryIds") Set<Long> boundaryIds)
@Query(value=" select ASSIGN from Assignment ASSIGN inner join ASSIGN.employee as EMP inner join EMP.jurisdictions as JRDN where ASSIGN.department.id=:deptId and ASSIGN.fromDate<=current_date and ASSIGN.toDate>=current_date and JRDN.boundary.id in :boundaryIds order by ASSIGN.primary desc") List<Assignment> findByDepartmentAndBoundary(@Param(value="deptId") Long deptId, @Param(value="boundaryIds") Set<Long> boundaryIds)
@Query(value=" select ASSIGN from Assignment ASSIGN where ASSIGN.designation.id=:designationId and ASSIGN.employee.active=true and ASSIGN.fromDate<=current_date and ASSIGN.toDate>=current_date order by ASSIGN.primary desc") List<Assignment> getAllActiveAssignments(@Param(value="designationId") Long designationId)
@Query(value="select assignment.employee from Assignment assignment where assignment.employee.active=true and assignment.designation.name in (:designation)") Set<org.egov.infra.admin.master.entity.User> getUsersByDesignations(@Param(value="designation") String[] designation)
@Query(value=" select distinct A.designation.roles from Assignment A where A.fromDate<=current_date and A.toDate<current_date and A.employee.id =:empId") Set<org.egov.infra.admin.master.entity.Role> getRolesForExpiredAssignmentsByEmpId(@Param(value="empId") Long empId)
@Query(value=" select distinct A.designation.roles from Assignment A where A.fromDate<=current_date and A.toDate>=current_date and A.employee.id =:empId") Set<org.egov.infra.admin.master.entity.Role> getRolesForActiveAssignmentsByEmpId(@Param(value="empId") Long empId)
@Query(value=" select A from Assignment A where A.department.id=:deptId and A.designation.id in :desigIds and A.fromDate<=:givenDate and A.toDate>=:givenDate") List<Assignment> findByDepartmentDesignationsAndGivenDate(@Param(value="deptId") Long deptId, @Param(value="desigIds") List<Long> desigIds, @Param(value="givenDate") Date givenDate)
@Query(value=" select distinct A.position from Assignment A where upper(A.position.name) like upper(:positionName) ") List<org.egov.pims.commons.Position> findEmployeePositions(@Param(value="positionName") String positionName)
@Query(value=" select A from Assignment A, HeadOfDepartments hod where hod.hod.id=:deptId and A.id = hod.assignment.id and A.fromDate<=:givenDate and A.toDate>=:givenDate order by A.primary, A.toDate desc") List<Assignment> findAllAssignmentsByHODDeptAndGivenDate(@Param(value="deptId") Long deptId, @Param(value="givenDate") Date givenDate)
@Query(value=" from Assignment A where A.primary=true and A.fromDate<=:givenDate and A.toDate>=:givenDate and A.employee.name like \'%\'||:empName||\'%\' order by A.employee.name desc") List<Assignment> getAllAssignmentForEmployeeNameLike(@Param(value="givenDate") Date givenDate, @Param(value="empName") String empName)
List<Assignment> findByDesignationId(Long desigId)
List<Assignment> findByDepartmentId(Long deptId)
List<Assignment> findByDepartmentIdAndDesignationId(Long deptId, Long desigId)
@Query(value=" from Assignment A where A.position.id=:posId and ((:fromDate between A.fromDate and A.toDate) or (:toDate between A.fromDate and A.toDate) or (A.fromDate>=:fromDate and A.toDate<=:toDate)) and A.primary=true") List<Assignment> getPrimaryAssignmentForPositionAndDateRange(@Param(value="posId") Long posId, @Param(value="fromDate") Date fromDate, @Param(value="toDate") Date toDate)
@Query(value=" from Assignment A where A.position.id=:posId and A.employee.id = :userId and A.fromDate<=:givenDate and A.toDate>=:givenDate ") List<Assignment> findByPositionAndEmployee(@Param(value="posId") Long posId, @Param(value="userId") Long userId, @Param(value="givenDate") Date givenDate)
Copyright © 2015–2017 eGovernments Foundation. All rights reserved.