Package com.bytedesk.core.topic
Class TopicRestService
java.lang.Object
com.bytedesk.core.base.BaseRestService<TopicEntity,TopicRequest,TopicResponse>
com.bytedesk.core.topic.TopicRestService
@Service
public class TopicRestService
extends BaseRestService<TopicEntity,TopicRequest,TopicResponse>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AuthService
private final org.modelmapper.ModelMapper
private final TopicRepository
private final UidUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addClientId
(String clientId) convertToResponse
(TopicEntity entity) create
(TopicRequest request) void
protected org.springframework.data.jpa.domain.Specification<TopicEntity>
createSpecification
(TopicRequest request) 创建Specification对象,子类必须实现 用于queryByOrg的通用实现void
delete
(TopicRequest request) void
deleteByUid
(String uid) protected TopicEntity
doSave
(TopicEntity entity) 子类实现具体的保存逻辑protected org.springframework.data.domain.Page<TopicEntity>
executePageQuery
(org.springframework.data.jpa.domain.Specification<TopicEntity> spec, org.springframework.data.domain.Pageable pageable) 执行分页查询,子类必须实现 用于queryByOrg的通用实现existsByUid
(String uid) findAll()
查询所有的 TopicEntityfindByClientId
(String clientId) findByTopic
(String topic) findByUserUid
(String userUid) handleOptimisticLockingFailureException
(org.springframework.orm.ObjectOptimisticLockingFailureException e, TopicEntity entity) isSubscribed
(TopicRequest request) void
remove
(TopicRequest topicRequest) void
void
removeClientId
(String clientId) subscribe
(TopicRequest request) void
unsubscribe
(TopicRequest request) void
unsubscribe
(String topic, String clientId) update
(TopicRequest request) Methods inherited from class com.bytedesk.core.base.BaseRestService
deleteByOrgUid, findByOrgUid, getUidFromRequest, queryByOrg, queryByUid, queryByUser, recover, save, setUserUidToRequest
-
Field Details
-
topicRepository
-
modelMapper
private final org.modelmapper.ModelMapper modelMapper -
uidUtils
-
authService
-
-
Constructor Details
-
TopicRestService
public TopicRestService()
-
-
Method Details
-
createSpecification
protected org.springframework.data.jpa.domain.Specification<TopicEntity> createSpecification(TopicRequest request) Description copied from class:BaseRestService
创建Specification对象,子类必须实现 用于queryByOrg的通用实现- Specified by:
createSpecification
in classBaseRestService<TopicEntity,
TopicRequest, TopicResponse>
-
executePageQuery
protected org.springframework.data.domain.Page<TopicEntity> executePageQuery(org.springframework.data.jpa.domain.Specification<TopicEntity> spec, org.springframework.data.domain.Pageable pageable) Description copied from class:BaseRestService
执行分页查询,子类必须实现 用于queryByOrg的通用实现- Specified by:
executePageQuery
in classBaseRestService<TopicEntity,
TopicRequest, TopicResponse>
-
findByClientId
@Cacheable(value="topic", key="#clientId", unless="#result == null") public Optional<TopicEntity> findByClientId(String clientId) -
findByUid
@Cacheable(value="topic", key="#uid", unless="#result==null") public Optional<TopicEntity> findByUid(String uid) - Specified by:
findByUid
in classBaseRestService<TopicEntity,
TopicRequest, TopicResponse>
-
findByUserUid
@Cacheable(value="topic", key="#userUid", unless="#result==null") public Optional<TopicEntity> findByUserUid(String userUid) -
findByTopic
@Cacheable(value="topic", key="#topic", unless="#result==null") public Set<TopicEntity> findByTopic(String topic) -
existsByUid
-
create
-
create
- Specified by:
create
in classBaseRestService<TopicEntity,
TopicRequest, TopicResponse>
-
update
- Specified by:
update
in classBaseRestService<TopicEntity,
TopicRequest, TopicResponse>
-
doSave
Description copied from class:BaseRestService
子类实现具体的保存逻辑- Specified by:
doSave
in classBaseRestService<TopicEntity,
TopicRequest, TopicResponse>
-
handleOptimisticLockingFailureException
public TopicEntity handleOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException e, TopicEntity entity) - Specified by:
handleOptimisticLockingFailureException
in classBaseRestService<TopicEntity,
TopicRequest, TopicResponse>
-
deleteByUid
- Specified by:
deleteByUid
in classBaseRestService<TopicEntity,
TopicRequest, TopicResponse>
-
delete
- Specified by:
delete
in classBaseRestService<TopicEntity,
TopicRequest, TopicResponse>
-
convertToResponse
- Specified by:
convertToResponse
in classBaseRestService<TopicEntity,
TopicRequest, TopicResponse>
-
isSubscribed
-
remove
-
remove
-
subscribe
-
subscribe
-
unsubscribe
-
unsubscribe
-
addClientId
-
removeClientId
-
findAll
查询所有的 TopicEntity- Returns:
- 所有的 TopicEntity 列表
-