Package com.bytedesk.core.department
Class DepartmentRestService
java.lang.Object
com.bytedesk.core.base.BaseRestService<DepartmentEntity,DepartmentRequest,DepartmentResponse>
com.bytedesk.core.department.DepartmentRestService
@Service
public class DepartmentRestService
extends BaseRestService<DepartmentEntity,DepartmentRequest,DepartmentResponse>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DepartmentRepositoryprivate final MemberRepositoryprivate final org.modelmapper.ModelMapperprivate final UidUtilsFields inherited from class com.bytedesk.core.base.BaseRestService
authService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertToResponse(DepartmentEntity department) create(DepartmentRequest request) protected org.springframework.data.jpa.domain.Specification<DepartmentEntity>createSpecification(DepartmentRequest request) 创建Specification对象,子类必须实现 用于queryByOrg的通用实现voiddelete(DepartmentRequest request) voiddeleteByUid(String uid) protected DepartmentEntitydoSave(DepartmentEntity entity) 子类实现具体的保存逻辑protected org.springframework.data.domain.Page<DepartmentEntity>executePageQuery(org.springframework.data.jpa.domain.Specification<DepartmentEntity> spec, org.springframework.data.domain.Pageable pageable) 执行分页查询,子类必须实现 用于queryByOrg的通用实现existsByNameAndOrgUid(String name, String orgUid) existsByUid(String uid) findByNameAndOrgUid(String name, String orgUid) handleOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException e, DepartmentEntity entity) org.springframework.data.domain.Page<DepartmentResponse>queryByOrg(DepartmentRequest request) 通用的queryByOrg实现 子类如果有特殊逻辑可以重写此方法update(DepartmentRequest request) Methods inherited from class com.bytedesk.core.base.BaseRestService
deleteByOrgUid, findByOrgUid, getUidFromRequest, queryByUid, queryByUser, recover, save, setUserUidToRequest
-
Field Details
-
modelMapper
private final org.modelmapper.ModelMapper modelMapper -
departmentRepository
-
uidUtils
-
memberRepository
-
-
Constructor Details
-
DepartmentRestService
public DepartmentRestService()
-
-
Method Details
-
queryByOrg
public org.springframework.data.domain.Page<DepartmentResponse> queryByOrg(DepartmentRequest request) Description copied from class:BaseRestService通用的queryByOrg实现 子类如果有特殊逻辑可以重写此方法- Overrides:
queryByOrgin classBaseRestService<DepartmentEntity,DepartmentRequest, DepartmentResponse>
-
findByNameAndOrgUid
@Cacheable(value="department", key="#name + \'-\' + #orgUid", unless="#result == null") public Optional<DepartmentEntity> findByNameAndOrgUid(String name, String orgUid) -
findByUid
@Cacheable(value="department", key="#uid", unless="#result == null") public Optional<DepartmentEntity> findByUid(String uid) - Specified by:
findByUidin classBaseRestService<DepartmentEntity,DepartmentRequest, DepartmentResponse>
-
existsByNameAndOrgUid
-
existsByUid
-
create
- Specified by:
createin classBaseRestService<DepartmentEntity,DepartmentRequest, DepartmentResponse>
-
update
- Specified by:
updatein classBaseRestService<DepartmentEntity,DepartmentRequest, DepartmentResponse>
-
doSave
@CachePut(value="department", key="#entity.uid") protected DepartmentEntity doSave(DepartmentEntity entity) Description copied from class:BaseRestService子类实现具体的保存逻辑- Specified by:
doSavein classBaseRestService<DepartmentEntity,DepartmentRequest, DepartmentResponse>
-
deleteByUid
- Specified by:
deleteByUidin classBaseRestService<DepartmentEntity,DepartmentRequest, DepartmentResponse>
-
delete
- Specified by:
deletein classBaseRestService<DepartmentEntity,DepartmentRequest, DepartmentResponse>
-
handleOptimisticLockingFailureException
public DepartmentEntity handleOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException e, DepartmentEntity entity) - Specified by:
handleOptimisticLockingFailureExceptionin classBaseRestService<DepartmentEntity,DepartmentRequest, DepartmentResponse>
-
convertToResponse
- Specified by:
convertToResponsein classBaseRestService<DepartmentEntity,DepartmentRequest, DepartmentResponse>
-
createSpecification
protected org.springframework.data.jpa.domain.Specification<DepartmentEntity> createSpecification(DepartmentRequest request) Description copied from class:BaseRestService创建Specification对象,子类必须实现 用于queryByOrg的通用实现- Specified by:
createSpecificationin classBaseRestService<DepartmentEntity,DepartmentRequest, DepartmentResponse>
-
executePageQuery
protected org.springframework.data.domain.Page<DepartmentEntity> executePageQuery(org.springframework.data.jpa.domain.Specification<DepartmentEntity> spec, org.springframework.data.domain.Pageable pageable) Description copied from class:BaseRestService执行分页查询,子类必须实现 用于queryByOrg的通用实现- Specified by:
executePageQueryin classBaseRestService<DepartmentEntity,DepartmentRequest, DepartmentResponse>
-