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 DepartmentRepository
private final MemberRepository
private final org.modelmapper.ModelMapper
private final UidUtils
Fields 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的通用实现void
delete
(DepartmentRequest request) void
deleteByUid
(String uid) protected DepartmentEntity
doSave
(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:
queryByOrg
in 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:
findByUid
in classBaseRestService<DepartmentEntity,
DepartmentRequest, DepartmentResponse>
-
existsByNameAndOrgUid
-
existsByUid
-
create
- Specified by:
create
in classBaseRestService<DepartmentEntity,
DepartmentRequest, DepartmentResponse>
-
update
- Specified by:
update
in classBaseRestService<DepartmentEntity,
DepartmentRequest, DepartmentResponse>
-
doSave
@CachePut(value="department", key="#entity.uid") protected DepartmentEntity doSave(DepartmentEntity entity) Description copied from class:BaseRestService
子类实现具体的保存逻辑- Specified by:
doSave
in classBaseRestService<DepartmentEntity,
DepartmentRequest, DepartmentResponse>
-
deleteByUid
- Specified by:
deleteByUid
in classBaseRestService<DepartmentEntity,
DepartmentRequest, DepartmentResponse>
-
delete
- Specified by:
delete
in classBaseRestService<DepartmentEntity,
DepartmentRequest, DepartmentResponse>
-
handleOptimisticLockingFailureException
public DepartmentEntity handleOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException e, DepartmentEntity entity) - Specified by:
handleOptimisticLockingFailureException
in classBaseRestService<DepartmentEntity,
DepartmentRequest, DepartmentResponse>
-
convertToResponse
- Specified by:
convertToResponse
in 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:
createSpecification
in 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:
executePageQuery
in classBaseRestService<DepartmentEntity,
DepartmentRequest, DepartmentResponse>
-