fix(education): implement tenant question page/get and formalize authoring service contracts
This commit is contained in:
@@ -5,8 +5,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.education.dal.dataobject.catalog.PracticeBlueprintDO;
|
||||
|
||||
public interface PracticeBlueprintAuthoringService {
|
||||
default PageResult<PracticeBlueprintDO> getPage(PageParam pageParam) { throw new UnsupportedOperationException(); }
|
||||
default PracticeBlueprintDO get(Long id) { throw new UnsupportedOperationException(); }
|
||||
PageResult<PracticeBlueprintDO> getPage(PageParam pageParam);
|
||||
PracticeBlueprintDO get(Long id);
|
||||
Long createDraft(PracticeBlueprintAuthoringCommand command);
|
||||
int reviseDraft(Long id, PracticeBlueprintAuthoringCommand command);
|
||||
int activate(Long id, int expectedVersion, Long actorId);
|
||||
|
||||
@@ -5,8 +5,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.education.dal.dataobject.catalog.CategoryDO;
|
||||
|
||||
public interface CategoryAuthoringService {
|
||||
default PageResult<CategoryDO> getPage(PageParam pageParam) { throw new UnsupportedOperationException(); }
|
||||
default CategoryDO get(Long categoryId) { throw new UnsupportedOperationException(); }
|
||||
PageResult<CategoryDO> getPage(PageParam pageParam);
|
||||
CategoryDO get(Long categoryId);
|
||||
Long createDraft(CategoryAuthoringCommand command);
|
||||
int reviseDraft(Long categoryId, CategoryAuthoringCommand command);
|
||||
int activate(Long categoryId, int expectedAuthoringVersion, Long actorId);
|
||||
|
||||
@@ -7,8 +7,8 @@ import cn.iocoder.yudao.module.education.dal.dataobject.catalog.QuestionCollecti
|
||||
import java.util.List;
|
||||
|
||||
public interface QuestionCollectionAuthoringService {
|
||||
default PageResult<QuestionCollectionDO> getPage(PageParam pageParam) { throw new UnsupportedOperationException(); }
|
||||
default QuestionCollectionDO get(Long collectionId) { throw new UnsupportedOperationException(); }
|
||||
PageResult<QuestionCollectionDO> getPage(PageParam pageParam);
|
||||
QuestionCollectionDO get(Long collectionId);
|
||||
Long createDraft(QuestionCollectionAuthoringCommand command);
|
||||
int reviseDraft(Long collectionId, QuestionCollectionAuthoringCommand command);
|
||||
int replaceMembership(Long collectionId, List<Long> questionIds, int expectedAuthoringVersion);
|
||||
|
||||
@@ -5,8 +5,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.education.dal.dataobject.catalog.ContentNodeDO;
|
||||
|
||||
public interface ContentNodeAuthoringService {
|
||||
default PageResult<ContentNodeDO> getPage(PageParam pageParam) { throw new UnsupportedOperationException(); }
|
||||
default ContentNodeDO get(Long nodeId) { throw new UnsupportedOperationException(); }
|
||||
PageResult<ContentNodeDO> getPage(PageParam pageParam);
|
||||
ContentNodeDO get(Long nodeId);
|
||||
Long createDraft(ContentNodeAuthoringCommand command);
|
||||
int reviseDraft(Long nodeId, ContentNodeAuthoringCommand command);
|
||||
int activate(Long nodeId, int expectedAuthoringVersion, Long actorId);
|
||||
|
||||
@@ -7,15 +7,13 @@ import cn.iocoder.yudao.module.education.dal.dataobject.catalog.QuestionDO;
|
||||
/** 租户自有题目的显式发布生命周期。 */
|
||||
public interface TenantQuestionLifecycleService {
|
||||
|
||||
default PageResult<QuestionDO> getPage(PageParam pageParam) { throw new UnsupportedOperationException(); }
|
||||
PageResult<QuestionDO> getPage(PageParam pageParam);
|
||||
|
||||
default QuestionDO get(Long questionId) { throw new UnsupportedOperationException(); }
|
||||
QuestionDO get(Long questionId);
|
||||
|
||||
Long createDraft(QuestionDraftCommand command);
|
||||
|
||||
default int reviseDraft(Long questionId, QuestionDraftCommand command, int expectedContentVersion) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
int reviseDraft(Long questionId, QuestionDraftCommand command, int expectedContentVersion);
|
||||
|
||||
int place(Long questionId, QuestionPlacementCommand command);
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package cn.iocoder.yudao.module.education.service.question.authoring;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
||||
@@ -63,6 +65,23 @@ public class TenantQuestionLifecycleServiceImpl implements TenantQuestionLifecyc
|
||||
this.auditMapper = auditMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<QuestionDO> getPage(PageParam pageParam) {
|
||||
assertAuthoringMode();
|
||||
return questionMapper.selectTenantOwnedPage(pageParam, TenantContextHolder.getRequiredTenantId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuestionDO get(Long questionId) {
|
||||
assertAuthoringMode();
|
||||
Long tenantId = TenantContextHolder.getRequiredTenantId();
|
||||
QuestionDO question = questionMapper.selectTenantOwnedById(tenantId, questionId);
|
||||
if (question == null) {
|
||||
throw exception(QUESTION_AUTHORING_NOT_FOUND);
|
||||
}
|
||||
return question;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int place(Long questionId, QuestionPlacementCommand command) {
|
||||
|
||||
Reference in New Issue
Block a user