Revert "修改:用户在实训平台能看到公开的课程、考试及自己所属组织下的课程、考试数据"

This reverts commit c4144e5f80.
This commit is contained in:
joylink_zhangsai 2022-07-14 18:11:40 +08:00
parent abdf784bd9
commit d4f0b78154
6 changed files with 11 additions and 36 deletions

View File

@ -64,8 +64,8 @@ public class ExamController {
*查询试题列表信息 *查询试题列表信息
*/ */
@GetMapping(path = "/list") @GetMapping(path = "/list")
public PageVO<ExamDefinitionVO> queryExamInfoList(ExamDefinitionQueryVO queryVO, @RequestAttribute LoginUserInfoVO loginInfo) { public PageVO<ExamDefinitionVO> queryExamInfoList(ExamDefinitionQueryVO queryVO) {
return iExamService.queryExamInfoList(queryVO, loginInfo); return iExamService.queryExamInfoList(queryVO);
} }
/** /**

View File

@ -56,8 +56,8 @@ public class LessonController {
* 根据条件获取课程列表 * 根据条件获取课程列表
*/ */
@GetMapping(path = "") @GetMapping(path = "")
public List<LessonVO> queryLessons(LessonQueryVO lessonQueryVO, @RequestAttribute LoginUserInfoVO loginInfo) { public List<LessonVO> queryLessons(LessonQueryVO lessonQueryVO) {
return this.iLessonService.queryValidLessons(lessonQueryVO, loginInfo); return this.iLessonService.queryValidLessons(lessonQueryVO);
} }
/** /**

View File

@ -238,16 +238,14 @@ public class ExamService implements IExamService {
* 查询试题列表信息 * 查询试题列表信息
*/ */
@Override @Override
public PageVO<ExamDefinitionVO> queryExamInfoList(ExamDefinitionQueryVO queryVO, LoginUserInfoVO loginInfo) { public PageVO<ExamDefinitionVO> queryExamInfoList(ExamDefinitionQueryVO queryVO) {
//查询试题列表 //查询试题列表
ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample(); ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample();
examDefinitionExample.setOrderByClause(" create_time DESC ");
ExamDefinitionExample.Criteria criteria = examDefinitionExample.createCriteria(); ExamDefinitionExample.Criteria criteria = examDefinitionExample.createCriteria();
ExamDefinitionExample.Criteria orCriteria = examDefinitionExample.createCriteria(); examDefinitionExample.setOrderByClause(" create_time DESC ");
//根据课程ID查询考试 //根据课程ID查询考试
if (Objects.nonNull(queryVO.getLessonId())) { if (Objects.nonNull(queryVO.getLessonId())) {
criteria.andLessonIdEqualTo(queryVO.getLessonId()); criteria.andLessonIdEqualTo(queryVO.getLessonId());
orCriteria.andLessonIdEqualTo(queryVO.getLessonId());
} else if (Objects.nonNull(queryVO.getMapId())) { } else if (Objects.nonNull(queryVO.getMapId())) {
// 地图id查询 // 地图id查询
List<LessonVO> lessonList = this.iLessonService.queryValidLessonsOfMap(queryVO.getMapId()); List<LessonVO> lessonList = this.iLessonService.queryValidLessonsOfMap(queryVO.getMapId());
@ -256,7 +254,6 @@ public class ExamService implements IExamService {
.map(LessonVO::getId) .map(LessonVO::getId)
.collect(Collectors.toList()); .collect(Collectors.toList());
criteria.andLessonIdIn(lessonIdList); criteria.andLessonIdIn(lessonIdList);
orCriteria.andLessonIdIn(lessonIdList);
} else { } else {
// 返回null // 返回null
return new PageVO<>(); return new PageVO<>();
@ -264,12 +261,10 @@ public class ExamService implements IExamService {
} }
if (StringUtils.hasText(queryVO.getStatus())) { if (StringUtils.hasText(queryVO.getStatus())) {
criteria.andStatusEqualTo(queryVO.getStatus()); criteria.andStatusEqualTo(queryVO.getStatus());
orCriteria.andStatusEqualTo(queryVO.getStatus());
} }
//根据考试名称模糊匹配 //根据考试名称模糊匹配
if (StringUtils.hasText(queryVO.getName())) { if (StringUtils.hasText(queryVO.getName())) {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName())); criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
orCriteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
} }
//根据创建人名称模糊匹配 //根据创建人名称模糊匹配
if (StringUtils.hasText(queryVO.getCreatorName())) { if (StringUtils.hasText(queryVO.getCreatorName())) {
@ -282,16 +277,7 @@ public class ExamService implements IExamService {
creatorIdList.add(null); creatorIdList.add(null);
} }
criteria.andCreatorIdIn(creatorIdList); criteria.andCreatorIdIn(creatorIdList);
orCriteria.andCreatorIdIn(creatorIdList);
} }
//公开数据和组织内数据
criteria.andOrgIdIsNull();
Org topOrg = iOrgService.findTopOrgOfUser(loginInfo.getAccountVO().getId());
if (topOrg != null) {
orCriteria.andOrgIdEqualTo(topOrg.getId());
examDefinitionExample.or(orCriteria);
}
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize()); PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
Page<ExamDefinition> examDefinitionList = (Page<ExamDefinition>) examDefinitionDAO.selectByExample(examDefinitionExample); Page<ExamDefinition> examDefinitionList = (Page<ExamDefinition>) examDefinitionDAO.selectByExample(examDefinitionExample);

View File

@ -41,7 +41,7 @@ public interface IExamService {
/** /**
* 查询试题列表信息 * 查询试题列表信息
*/ */
PageVO<ExamDefinitionVO> queryExamInfoList(ExamDefinitionQueryVO queryVO, LoginUserInfoVO loginInfo); PageVO<ExamDefinitionVO> queryExamInfoList(ExamDefinitionQueryVO queryVO);
/** /**
* 删除指定ID的考试信息 * 删除指定ID的考试信息

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.services; package club.joylink.rtss.services;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.entity.LsLesson; import club.joylink.rtss.entity.LsLesson;
import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
@ -49,7 +50,7 @@ public interface ILessonService {
/** /**
* 查询有效的课程列表 * 查询有效的课程列表
*/ */
List<LessonVO> queryValidLessons(LessonQueryVO lessonQueryVO, LoginUserInfoVO loginInfo); List<LessonVO> queryValidLessons(LessonQueryVO lessonQueryVO);
/** /**
* 分页查询已发布的课程 * 分页查询已发布的课程

View File

@ -253,27 +253,15 @@ public class LessonService implements ILessonService {
return new LessonVO(lessonList.get(0)); return new LessonVO(lessonList.get(0));
} }
/**
* 查询有效的公开的属于自己组织的数据
*/
@Override @Override
public List<LessonVO> queryValidLessons(LessonQueryVO lessonQueryVO, LoginUserInfoVO loginInfo) { public List<LessonVO> queryValidLessons(LessonQueryVO lessonQueryVO) {
LsLessonExample example = new LsLessonExample(); LsLessonExample example = new LsLessonExample();
example.setOrderByClause("id desc"); example.setOrderByClause("id desc");
Criteria criteria = example.createCriteria() Criteria criteria = example.createCriteria()
.andStatusEqualTo(MapStatus.Online.getCode()) .andStatusEqualTo(MapStatus.Online.getCode());
.andOrgIdIsNull();
if (Objects.nonNull(lessonQueryVO.getMapId())) { if (Objects.nonNull(lessonQueryVO.getMapId())) {
criteria.andMapIdEqualTo(lessonQueryVO.getMapId()); criteria.andMapIdEqualTo(lessonQueryVO.getMapId());
} }
Org topOrg = iOrgService.findTopOrgOfUser(loginInfo.getAccountVO().getId());
if (topOrg != null) {
Criteria orCriteria = example.or().andStatusEqualTo(MapStatus.Online.getCode())
.andOrgIdEqualTo(topOrg.getId());
if (Objects.nonNull(lessonQueryVO.getMapId())) {
orCriteria.andMapIdEqualTo(lessonQueryVO.getMapId());
}
}
List<LsLesson> list = this.lessonDAO.selectByExample(example); List<LsLesson> list = this.lessonDAO.selectByExample(example);
return LessonVO.convert(list); return LessonVO.convert(list);
} }