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;
|
import cn.iocoder.yudao.module.education.dal.dataobject.catalog.PracticeBlueprintDO;
|
||||||
|
|
||||||
public interface PracticeBlueprintAuthoringService {
|
public interface PracticeBlueprintAuthoringService {
|
||||||
default PageResult<PracticeBlueprintDO> getPage(PageParam pageParam) { throw new UnsupportedOperationException(); }
|
PageResult<PracticeBlueprintDO> getPage(PageParam pageParam);
|
||||||
default PracticeBlueprintDO get(Long id) { throw new UnsupportedOperationException(); }
|
PracticeBlueprintDO get(Long id);
|
||||||
Long createDraft(PracticeBlueprintAuthoringCommand command);
|
Long createDraft(PracticeBlueprintAuthoringCommand command);
|
||||||
int reviseDraft(Long id, PracticeBlueprintAuthoringCommand command);
|
int reviseDraft(Long id, PracticeBlueprintAuthoringCommand command);
|
||||||
int activate(Long id, int expectedVersion, Long actorId);
|
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;
|
import cn.iocoder.yudao.module.education.dal.dataobject.catalog.CategoryDO;
|
||||||
|
|
||||||
public interface CategoryAuthoringService {
|
public interface CategoryAuthoringService {
|
||||||
default PageResult<CategoryDO> getPage(PageParam pageParam) { throw new UnsupportedOperationException(); }
|
PageResult<CategoryDO> getPage(PageParam pageParam);
|
||||||
default CategoryDO get(Long categoryId) { throw new UnsupportedOperationException(); }
|
CategoryDO get(Long categoryId);
|
||||||
Long createDraft(CategoryAuthoringCommand command);
|
Long createDraft(CategoryAuthoringCommand command);
|
||||||
int reviseDraft(Long categoryId, CategoryAuthoringCommand command);
|
int reviseDraft(Long categoryId, CategoryAuthoringCommand command);
|
||||||
int activate(Long categoryId, int expectedAuthoringVersion, Long actorId);
|
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;
|
import java.util.List;
|
||||||
|
|
||||||
public interface QuestionCollectionAuthoringService {
|
public interface QuestionCollectionAuthoringService {
|
||||||
default PageResult<QuestionCollectionDO> getPage(PageParam pageParam) { throw new UnsupportedOperationException(); }
|
PageResult<QuestionCollectionDO> getPage(PageParam pageParam);
|
||||||
default QuestionCollectionDO get(Long collectionId) { throw new UnsupportedOperationException(); }
|
QuestionCollectionDO get(Long collectionId);
|
||||||
Long createDraft(QuestionCollectionAuthoringCommand command);
|
Long createDraft(QuestionCollectionAuthoringCommand command);
|
||||||
int reviseDraft(Long collectionId, QuestionCollectionAuthoringCommand command);
|
int reviseDraft(Long collectionId, QuestionCollectionAuthoringCommand command);
|
||||||
int replaceMembership(Long collectionId, List<Long> questionIds, int expectedAuthoringVersion);
|
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;
|
import cn.iocoder.yudao.module.education.dal.dataobject.catalog.ContentNodeDO;
|
||||||
|
|
||||||
public interface ContentNodeAuthoringService {
|
public interface ContentNodeAuthoringService {
|
||||||
default PageResult<ContentNodeDO> getPage(PageParam pageParam) { throw new UnsupportedOperationException(); }
|
PageResult<ContentNodeDO> getPage(PageParam pageParam);
|
||||||
default ContentNodeDO get(Long nodeId) { throw new UnsupportedOperationException(); }
|
ContentNodeDO get(Long nodeId);
|
||||||
Long createDraft(ContentNodeAuthoringCommand command);
|
Long createDraft(ContentNodeAuthoringCommand command);
|
||||||
int reviseDraft(Long nodeId, ContentNodeAuthoringCommand command);
|
int reviseDraft(Long nodeId, ContentNodeAuthoringCommand command);
|
||||||
int activate(Long nodeId, int expectedAuthoringVersion, Long actorId);
|
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 {
|
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);
|
Long createDraft(QuestionDraftCommand command);
|
||||||
|
|
||||||
default int reviseDraft(Long questionId, QuestionDraftCommand command, int expectedContentVersion) {
|
int reviseDraft(Long questionId, QuestionDraftCommand command, int expectedContentVersion);
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
int place(Long questionId, QuestionPlacementCommand command);
|
int place(Long questionId, QuestionPlacementCommand command);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package cn.iocoder.yudao.module.education.service.question.authoring;
|
package cn.iocoder.yudao.module.education.service.question.authoring;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
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.common.util.json.JsonUtils;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
||||||
@@ -63,6 +65,23 @@ public class TenantQuestionLifecycleServiceImpl implements TenantQuestionLifecyc
|
|||||||
this.auditMapper = auditMapper;
|
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
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int place(Long questionId, QuestionPlacementCommand command) {
|
public int place(Long questionId, QuestionPlacementCommand command) {
|
||||||
|
|||||||
Reference in New Issue
Block a user