修改案例题模板下载和打包压缩

master
xiaoCJ 8 months ago
parent 805ce431aa
commit 986315e077

@ -151,8 +151,9 @@ public class CaseController {
@ApiOperation("案例题编辑")
@PostMapping("updateCase")
public ResultEntity<HttpStatus> updateCase(@RequestBody SysCaseQuestion sysCaseQuestion,
@ApiParam("谁调的请求,传管理员/学校ID") @RequestParam String source) {
List<SysTopicAndCourse> sysTopicAndCourses = getSysTopicAndCourses(sysCaseQuestion.getCaseId(), sysCaseQuestion.getOneId());
@ApiParam("谁调的请求,传管理员/学校ID") @RequestParam String source,
@ApiParam("修改前旧的oneId") @RequestParam String oldOneId) {
List<SysTopicAndCourse> sysTopicAndCourses = getSysTopicAndCourses(sysCaseQuestion.getCaseId(), oldOneId);
// if (!sysTopicAndCourses.isEmpty()) {
// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "该案例题正在被使用!");
// } else {
@ -160,6 +161,8 @@ public class CaseController {
if ("管理员".equals(source) || source.equals(sysCaseQuestion.getSource())) {
if (!sysTopicAndCourses.isEmpty()) {
SysTopicAndCourse sysTopicAndCourse = sysTopicAndCourses.get(0);
sysTopicAndCourse.setOneId(sysCaseQuestion.getOneId());
sysTopicAndCourse.setOneName(sysCaseQuestion.getOneName());
sysTopicAndCourse.setTwoId(sysCaseQuestion.getTwoId());
sysTopicAndCourse.setThreeId(sysCaseQuestion.getThreeId());
sysTopicAndCourse.setTwoName(sysCaseQuestion.getTwoName());

@ -51,7 +51,6 @@ public class CourseTagManageController {
private SysObjectiveQuestionsMapper sysObjectiveQuestionsMapper;
@AnonymousAccess
@ApiOperation("添加二级目录")
@PostMapping("insertSysTwoCatalog")
@ -143,12 +142,18 @@ public class CourseTagManageController {
//删除资源关系表
SysResourceAndCourseExample example1 = new SysResourceAndCourseExample();
example1.createCriteria().andTwoIdEqualTo(id);
List<SysResourceAndCourse> sysResourceAndCourses = sysResourceAndCourseMapper.selectByExample(example1);
List<String> resourceIds = sysResourceAndCourses.stream().map(SysResourceAndCourse::getResourceId).collect(Collectors.toList());
sysResourceAndCourseMapper.deleteByExample(example1);
//删除资源
if (!resourceIds.isEmpty()) {
SysResourceExample sysResourceExample = new SysResourceExample();
sysResourceExample.createCriteria().andTwoTagEqualTo(id);
sysResourceExample.createCriteria().andResourceIdIn(resourceIds);
sysResourceMapper.deleteByExample(sysResourceExample);
}
//删除题目关系表
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
@ -159,27 +164,33 @@ public class CourseTagManageController {
//删除案例题
if (!topicIds.isEmpty()) {
SysCaseQuestionExample sysCaseQuestionExample = new SysCaseQuestionExample();
sysCaseQuestionExample.createCriteria().andCaseIdIn(topicIds);
sysCaseQuestionMapper.deleteByExample(sysCaseQuestionExample);
//删除客观题
SysObjectiveQuestionsExample sysObjectiveQuestionsExample =new SysObjectiveQuestionsExample();
SysObjectiveQuestionsExample sysObjectiveQuestionsExample = new SysObjectiveQuestionsExample();
sysObjectiveQuestionsExample.createCriteria().andObjectiveIdIn(topicIds);
sysObjectiveQuestionsMapper.deleteByExample(sysObjectiveQuestionsExample);
}
} else {
sysThreeCatalogMapper.deleteByPrimaryKey(id);
//删除资源关系表
SysResourceAndCourseExample sysResourceAndCourseExample = new SysResourceAndCourseExample();
sysResourceAndCourseExample.createCriteria().andThreeIdEqualTo(id);
sysResourceAndCourseMapper.deleteByExample(sysResourceAndCourseExample);
List<SysResourceAndCourse> sysResourceAndCourses = sysResourceAndCourseMapper.selectByExample(sysResourceAndCourseExample);
List<String> resourceIds = sysResourceAndCourses.stream().map(SysResourceAndCourse::getResourceId).collect(Collectors.toList());
sysResourceAndCourseMapper.deleteByExample(sysResourceAndCourseExample);
//删除资源
if (!resourceIds.isEmpty()) {
SysResourceExample sysResourceExample = new SysResourceExample();
sysResourceExample.createCriteria().andThreeTagEqualTo(id);
sysResourceExample.createCriteria().andResourceIdIn(resourceIds);
sysResourceMapper.deleteByExample(sysResourceExample);
}
//删除题目关系表
SysTopicAndCourseExample sysTopicAndCourseExample = new SysTopicAndCourseExample();
@ -191,15 +202,17 @@ public class CourseTagManageController {
sysTopicAndCourseMapper.deleteByExample(sysTopicAndCourseExample);
//删除案例题
if (!topicIds.isEmpty()) {
SysCaseQuestionExample sysCaseQuestionExample = new SysCaseQuestionExample();
sysCaseQuestionExample.createCriteria().andCaseIdIn(topicIds);
sysCaseQuestionMapper.deleteByExample(sysCaseQuestionExample);
//删除客观题
SysObjectiveQuestionsExample sysObjectiveQuestionsExample =new SysObjectiveQuestionsExample();
SysObjectiveQuestionsExample sysObjectiveQuestionsExample = new SysObjectiveQuestionsExample();
sysObjectiveQuestionsExample.createCriteria().andObjectiveIdIn(topicIds);
sysObjectiveQuestionsMapper.deleteByExample(sysObjectiveQuestionsExample);
}
}
} catch (Exception e) {
e.printStackTrace();
return new ResultEntity<>(HttpStatus.INTERNAL_SERVER_ERROR, "删除失败,请联系管理员");
@ -208,7 +221,6 @@ public class CourseTagManageController {
}
@AnonymousAccess
@ApiOperation("一级目录重新排序")
@PostMapping("setOneCatalogueRank")

@ -234,7 +234,7 @@ public class TopicResourceController {
SysObjectiveQuestions newData = new SysObjectiveQuestions();
BeanUtils.copyProperties(dto, newData);
sysObjectiveQuestionMapper.updateByPrimaryKey(newData);
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "编辑完成!");
return new ResultEntity<>(HttpStatus.OK, "编辑完成!");
}
@AnonymousAccess

@ -126,13 +126,18 @@ public class CourseApi {
//删除资源关系表
SysResourceAndCourseExample example1 = new SysResourceAndCourseExample();
example1.createCriteria().andTwoIdEqualTo(twoId);
List<SysResourceAndCourse> sysResourceAndCourses = sysResourceAndCourseMapper.selectByExample(example1);
List<String> resourceIds = sysResourceAndCourses.stream().map(SysResourceAndCourse::getResourceId).collect(Collectors.toList());
sysResourceAndCourseMapper.deleteByExample(example1);
//删除资源
if (!resourceIds.isEmpty()) {
SysResourceExample sysResourceExample = new SysResourceExample();
sysResourceExample.createCriteria().andTwoTagEqualTo(twoId);
sysResourceExample.createCriteria().andResourceIdIn(resourceIds);
sysResourceMapper.deleteByExample(sysResourceExample);
}
//删除题目关系表
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
example.createCriteria().andTwoIdEqualTo(twoId);
@ -142,14 +147,16 @@ public class CourseApi {
//删除案例题
if (!topicIds.isEmpty()) {
SysCaseQuestionExample sysCaseQuestionExample = new SysCaseQuestionExample();
sysCaseQuestionExample.createCriteria().andCaseIdIn(topicIds);
sysCaseQuestionMapper.deleteByExample(sysCaseQuestionExample);
//删除客观题
SysObjectiveQuestionsExample sysObjectiveQuestionsExample =new SysObjectiveQuestionsExample();
SysObjectiveQuestionsExample sysObjectiveQuestionsExample = new SysObjectiveQuestionsExample();
sysObjectiveQuestionsExample.createCriteria().andObjectiveIdIn(topicIds);
sysObjectiveQuestionsMapper.deleteByExample(sysObjectiveQuestionsExample);
}
return true;
} catch (Exception e) {
e.printStackTrace();

@ -121,7 +121,7 @@ public class ResourceDataApi {
@AnonymousAccess
@ApiOperation("数据集下载")
@GetMapping("downloadResourceData")
private void selectResourceDataList(@RequestParam String resourceId,
private void downloadResourceData(@RequestParam String resourceId,
HttpServletResponse response) {
try {
SysResourceData sysResourceData = sysResourceDataMapper.selectByPrimaryKey(resourceId);

Loading…
Cancel
Save