forked from wangziqi/ruoyi-vue-pro
fix(education): close collection release gate gaps
This commit is contained in:
@@ -66,6 +66,10 @@ public class PracticeSessionServiceImpl implements PracticeSessionService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PracticeSessionRespVO createPracticeSession(PracticeSessionCreateReqVO reqVO, Long userId, Long tenantId) {
|
||||
if (reqVO.getCollectionId() != null && !reqVO.getCollectionId().isBlank()
|
||||
&& reqVO.getNodeId() != null && !reqVO.getNodeId().isBlank()) {
|
||||
throw exception(INVALID_PRACTICE_CONFIG, "题集与目录节点不能同时指定");
|
||||
}
|
||||
// 1. Idempotent check: same tenant + clientSessionId exists → verify ownership before returning
|
||||
PracticeSessionDO existing = sessionMapper.selectByTenantAndClientSessionId(tenantId, reqVO.getClientSessionId());
|
||||
if (existing != null) {
|
||||
|
||||
@@ -35,6 +35,10 @@ public class QuestionCatalogServiceImpl implements QuestionCatalogService {
|
||||
@Override
|
||||
public PageResult<SafeQuestionRespVO> pageQuestions(QuestionPageReqVO reqVO) {
|
||||
assertEnabled();
|
||||
if (reqVO.getCollectionId() != null && !reqVO.getCollectionId().isBlank()
|
||||
&& reqVO.getNodeId() != null && !reqVO.getNodeId().isBlank()) {
|
||||
throw exception(INVALID_PRACTICE_CONFIG, "题集与目录节点不能同时指定");
|
||||
}
|
||||
|
||||
int pageNo = reqVO.getPageNo() != null ? reqVO.getPageNo() : 1;
|
||||
int pageSize = reqVO.getPageSize() != null ? reqVO.getPageSize() : 20;
|
||||
|
||||
@@ -16,14 +16,20 @@ BEGIN
|
||||
LEFT JOIN education_question_collection_question membership ON membership.collection_id=collection.id AND NOT membership.deleted
|
||||
LEFT JOIN education_question question ON question.id=membership.question_id
|
||||
WHERE collection.scope='TENANT_OWNED' AND collection.is_active AND NOT collection.is_hidden AND NOT collection.deleted
|
||||
AND (node.id IS NULL OR node.tenant_id IS DISTINCT FROM collection.tenant_id OR node.scope<>'TENANT_OWNED'
|
||||
AND (collection.collection_type<>'MANUAL'
|
||||
OR node.id IS NULL OR node.tenant_id IS DISTINCT FROM collection.tenant_id OR node.scope<>'TENANT_OWNED'
|
||||
OR node.deleted OR NOT node.is_active OR node.is_hidden
|
||||
OR collection.entry_id IS DISTINCT FROM node.entry_id
|
||||
OR entry.id IS NULL OR entry.scope NOT IN ('PUBLIC','TENANT_OWNED')
|
||||
OR (entry.scope='TENANT_OWNED' AND entry.tenant_id IS DISTINCT FROM collection.tenant_id)
|
||||
OR entry.deleted OR NOT entry.is_active OR entry.is_hidden
|
||||
OR (membership.id IS NOT NULL AND (question.id IS NULL OR question.tenant_id IS DISTINCT FROM collection.tenant_id
|
||||
OR question.scope<>'TENANT_OWNED' OR question.deleted OR question.status<>'PUBLISHED' OR NOT question.is_published)))
|
||||
OR (membership.id IS NOT NULL AND (membership.sort_order<0
|
||||
OR question.id IS NULL OR question.tenant_id IS DISTINCT FROM collection.tenant_id
|
||||
OR question.scope<>'TENANT_OWNED' OR question.deleted OR question.status<>'PUBLISHED' OR NOT question.is_published))
|
||||
OR EXISTS (SELECT 1 FROM education_question_collection_question ordered_membership
|
||||
WHERE ordered_membership.collection_id=collection.id AND NOT ordered_membership.deleted
|
||||
GROUP BY ordered_membership.collection_id
|
||||
HAVING count(*)<>count(DISTINCT ordered_membership.sort_order) OR min(ordered_membership.sort_order)<>0 OR max(ordered_membership.sort_order)<>count(*)-1))
|
||||
ORDER BY collection.id,membership.question_id NULLS FIRST LIMIT 1;
|
||||
IF bad_collection IS NOT NULL THEN
|
||||
RAISE EXCEPTION 'invalid historical active collection % member % blocks V4110',bad_collection,COALESCE(bad_question,0) USING ERRCODE='23514';
|
||||
|
||||
Reference in New Issue
Block a user