修改:用户在实训平台能看到公开的课程、考试及自己所属组织下的课程、考试数据
This commit is contained in:
parent
c6868d4e0a
commit
c4144e5f80
@ -64,8 +64,8 @@ public class ExamController {
|
|||||||
*查询试题列表信息
|
*查询试题列表信息
|
||||||
*/
|
*/
|
||||||
@GetMapping(path = "/list")
|
@GetMapping(path = "/list")
|
||||||
public PageVO<ExamDefinitionVO> queryExamInfoList(ExamDefinitionQueryVO queryVO) {
|
public PageVO<ExamDefinitionVO> queryExamInfoList(ExamDefinitionQueryVO queryVO, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||||
return iExamService.queryExamInfoList(queryVO);
|
return iExamService.queryExamInfoList(queryVO, loginInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,8 +56,8 @@ public class LessonController {
|
|||||||
* 根据条件获取课程列表
|
* 根据条件获取课程列表
|
||||||
*/
|
*/
|
||||||
@GetMapping(path = "")
|
@GetMapping(path = "")
|
||||||
public List<LessonVO> queryLessons(LessonQueryVO lessonQueryVO) {
|
public List<LessonVO> queryLessons(LessonQueryVO lessonQueryVO, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||||
return this.iLessonService.queryValidLessons(lessonQueryVO);
|
return this.iLessonService.queryValidLessons(lessonQueryVO, loginInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -234,14 +234,16 @@ public class ExamService implements IExamService {
|
|||||||
* 查询试题列表信息
|
* 查询试题列表信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageVO<ExamDefinitionVO> queryExamInfoList(ExamDefinitionQueryVO queryVO) {
|
public PageVO<ExamDefinitionVO> queryExamInfoList(ExamDefinitionQueryVO queryVO, LoginUserInfoVO loginInfo) {
|
||||||
//查询试题列表
|
//查询试题列表
|
||||||
ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample();
|
ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample();
|
||||||
ExamDefinitionExample.Criteria criteria = examDefinitionExample.createCriteria();
|
|
||||||
examDefinitionExample.setOrderByClause(" create_time DESC ");
|
examDefinitionExample.setOrderByClause(" create_time DESC ");
|
||||||
|
ExamDefinitionExample.Criteria criteria = examDefinitionExample.createCriteria();
|
||||||
|
ExamDefinitionExample.Criteria orCriteria = examDefinitionExample.createCriteria();
|
||||||
//根据课程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());
|
||||||
@ -250,6 +252,7 @@ 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<>();
|
||||||
@ -257,10 +260,12 @@ 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())) {
|
||||||
@ -273,7 +278,16 @@ 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);
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public interface IExamService {
|
|||||||
/**
|
/**
|
||||||
* 查询试题列表信息
|
* 查询试题列表信息
|
||||||
*/
|
*/
|
||||||
PageVO<ExamDefinitionVO> queryExamInfoList(ExamDefinitionQueryVO queryVO);
|
PageVO<ExamDefinitionVO> queryExamInfoList(ExamDefinitionQueryVO queryVO, LoginUserInfoVO loginInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除指定ID的考试信息
|
* 删除指定ID的考试信息
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
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;
|
||||||
@ -50,7 +49,7 @@ public interface ILessonService {
|
|||||||
/**
|
/**
|
||||||
* 查询有效的课程列表
|
* 查询有效的课程列表
|
||||||
*/
|
*/
|
||||||
List<LessonVO> queryValidLessons(LessonQueryVO lessonQueryVO);
|
List<LessonVO> queryValidLessons(LessonQueryVO lessonQueryVO, LoginUserInfoVO loginInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询课程列表(无视状态)
|
* 查询课程列表(无视状态)
|
||||||
|
@ -253,15 +253,27 @@ 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) {
|
public List<LessonVO> queryValidLessons(LessonQueryVO lessonQueryVO, LoginUserInfoVO loginInfo) {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user