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

master
xiaoCJ 8 months ago
parent 83aa953521
commit 805ce431aa

@ -43,6 +43,13 @@ public class CourseTagManageController {
private SysTopicAndCourseMapper sysTopicAndCourseMapper;
@Autowired
private SysResourceAndCourseMapper sysResourceAndCourseMapper;
@Autowired
private SysResourceMapper sysResourceMapper;
@Autowired
private SysCaseQuestionMapper sysCaseQuestionMapper;
@Autowired
private SysObjectiveQuestionsMapper sysObjectiveQuestionsMapper;
@AnonymousAccess
@ -98,11 +105,11 @@ public class CourseTagManageController {
List<String> ids = sysResourceAndCourses.stream().map(SysResourceAndCourse::getId).collect(Collectors.toList());
sysResourceAndCourseMapper.batchUpdateTwoName(ids, name);
SysTopicAndCourseExample example1 =new SysTopicAndCourseExample();
SysTopicAndCourseExample example1 = new SysTopicAndCourseExample();
example1.createCriteria().andTwoIdEqualTo(id);
List<SysTopicAndCourse> sysTopicAndCourses = sysTopicAndCourseMapper.selectByExample(example1);
List<String> collect = sysTopicAndCourses.stream().map(SysTopicAndCourse::getId).collect(Collectors.toList());
sysTopicAndCourseMapper.batchUpdateTwoName(collect,name);
sysTopicAndCourseMapper.batchUpdateTwoName(collect, name);
} else {
SysThreeCatalog sysThreeCatalog = sysThreeCatalogMapper.selectByPrimaryKey(id);
@ -115,11 +122,11 @@ public class CourseTagManageController {
List<String> ids = sysResourceAndCourses.stream().map(SysResourceAndCourse::getId).collect(Collectors.toList());
sysResourceAndCourseMapper.batchUpdateThreeName(ids, name);
SysTopicAndCourseExample example1 =new SysTopicAndCourseExample();
SysTopicAndCourseExample example1 = new SysTopicAndCourseExample();
example1.createCriteria().andThreeIdEqualTo(id);
List<SysTopicAndCourse> sysTopicAndCourses = sysTopicAndCourseMapper.selectByExample(example1);
List<String> collect = sysTopicAndCourses.stream().map(SysTopicAndCourse::getId).collect(Collectors.toList());
sysTopicAndCourseMapper.batchUpdateThreeName(collect,name);
sysTopicAndCourseMapper.batchUpdateThreeName(collect, name);
}
return new ResultEntity<>(HttpStatus.OK, "修改成功");
}
@ -133,58 +140,73 @@ public class CourseTagManageController {
try {
if (type == 2) {
sysTwoCatalogMapper.deleteByPrimaryKey(id);
//删除资源
//删除资源关系表
SysResourceAndCourseExample example1 = new SysResourceAndCourseExample();
example1.createCriteria().andTwoIdEqualTo(id);
sysResourceAndCourseMapper.deleteByExample(example1);
//删除题目
//删除资源
SysResourceExample sysResourceExample = new SysResourceExample();
sysResourceExample.createCriteria().andTwoTagEqualTo(id);
sysResourceMapper.deleteByExample(sysResourceExample);
//删除题目关系表
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
example.createCriteria().andTwoIdEqualTo(id);
List<SysTopicAndCourse> topicAndCourseList = sysTopicAndCourseMapper.selectByExample(example);
List<String> topicIds = topicAndCourseList.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
sysTopicAndCourseMapper.deleteByExample(example);
//删除案例题
SysCaseQuestionExample sysCaseQuestionExample = new SysCaseQuestionExample();
sysCaseQuestionExample.createCriteria().andCaseIdIn(topicIds);
sysCaseQuestionMapper.deleteByExample(sysCaseQuestionExample);
//删除客观题
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);
//删除资源
SysResourceAndCourseExample example1 = new SysResourceAndCourseExample();
example1.createCriteria().andThreeIdEqualTo(id);
sysResourceAndCourseMapper.deleteByExample(example1);
SysResourceExample sysResourceExample = new SysResourceExample();
sysResourceExample.createCriteria().andThreeTagEqualTo(id);
sysResourceMapper.deleteByExample(sysResourceExample);
//删除题目
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
example.createCriteria().andThreeIdEqualTo(id);
sysTopicAndCourseMapper.deleteByExample(example);
sysThreeCatalogMapper.deleteByPrimaryKey(id);
//删除题目关系表
SysTopicAndCourseExample sysTopicAndCourseExample = new SysTopicAndCourseExample();
sysTopicAndCourseExample.createCriteria().andThreeIdEqualTo(id);
List<SysTopicAndCourse> topicAndCourseList = sysTopicAndCourseMapper.selectByExample(sysTopicAndCourseExample);
List<String> topicIds = topicAndCourseList.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
sysTopicAndCourseMapper.deleteByExample(sysTopicAndCourseExample);
//删除案例题
SysCaseQuestionExample sysCaseQuestionExample = new SysCaseQuestionExample();
sysCaseQuestionExample.createCriteria().andCaseIdIn(topicIds);
sysCaseQuestionMapper.deleteByExample(sysCaseQuestionExample);
//删除客观题
SysObjectiveQuestionsExample sysObjectiveQuestionsExample =new SysObjectiveQuestionsExample();
sysObjectiveQuestionsExample.createCriteria().andObjectiveIdIn(topicIds);
sysObjectiveQuestionsMapper.deleteByExample(sysObjectiveQuestionsExample);
}
} catch (Exception e) {
e.printStackTrace();
return new ResultEntity<>(HttpStatus.INTERNAL_SERVER_ERROR,"删除失败,请联系管理员");
return new ResultEntity<>(HttpStatus.INTERNAL_SERVER_ERROR, "删除失败,请联系管理员");
}
return new ResultEntity<>(HttpStatus.OK, "删除成功");
}
// @AnonymousAccess
// @ApiOperation("排序")
// @PostMapping("setRank") //修改成LIST
// public ResultEntity<String> setRank(@ApiParam("一级传1/二级传2/三级传3") @RequestParam int type,
// @RequestParam String id,
// @RequestParam int rank) {
// if (type == 1) {
// SysOneCatalog sysOneCatalog = sysOneCatalogMapper.selectByPrimaryKey(id);
// sysOneCatalog.setSort(rank);
// sysOneCatalogMapper.updateByPrimaryKey(sysOneCatalog);
// return new ResultEntity<>(HttpStatus.OK, "排序成功");
// } else if (type == 2) {
// SysTwoCatalog sysTwoCatalog = sysTwoCatalogMapper.selectByPrimaryKey(id);
// sysTwoCatalog.setSort(rank);
// sysTwoCatalogMapper.updateByPrimaryKey(sysTwoCatalog);
// return new ResultEntity<>(HttpStatus.OK, "排序成功");
// } else {
// SysThreeCatalog sysThreeCatalog = sysThreeCatalogMapper.selectByPrimaryKey(id);
// sysThreeCatalog.setSort(rank);
// sysThreeCatalogMapper.updateByPrimaryKey(sysThreeCatalog);
// return new ResultEntity<>(HttpStatus.OK, "排序成功");
// }
// }
@AnonymousAccess

@ -123,15 +123,33 @@ public class CourseApi {
return false;
}
twoCatalogMapper.deleteByPrimaryKey(twoId);
//删除资源
//删除资源关系表
SysResourceAndCourseExample example1 = new SysResourceAndCourseExample();
example1.createCriteria().andTwoIdEqualTo(twoId);
sysResourceAndCourseMapper.deleteByExample(example1);
//删除题目
//删除资源
SysResourceExample sysResourceExample = new SysResourceExample();
sysResourceExample.createCriteria().andTwoTagEqualTo(twoId);
sysResourceMapper.deleteByExample(sysResourceExample);
//删除题目关系表
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
example.createCriteria().andTwoIdEqualTo(twoId);
List<SysTopicAndCourse> topicAndCourseList = sysTopicAndCourseMapper.selectByExample(example);
List<String> topicIds = topicAndCourseList.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
sysTopicAndCourseMapper.deleteByExample(example);
//删除案例题
SysCaseQuestionExample sysCaseQuestionExample = new SysCaseQuestionExample();
sysCaseQuestionExample.createCriteria().andCaseIdIn(topicIds);
sysCaseQuestionMapper.deleteByExample(sysCaseQuestionExample);
//删除客观题
SysObjectiveQuestionsExample sysObjectiveQuestionsExample =new SysObjectiveQuestionsExample();
sysObjectiveQuestionsExample.createCriteria().andObjectiveIdIn(topicIds);
sysObjectiveQuestionsMapper.deleteByExample(sysObjectiveQuestionsExample);
return true;
} catch (Exception e) {
e.printStackTrace();

Loading…
Cancel
Save