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

master
xiaoCJ 8 months ago
parent 805ce431aa
commit 986315e077

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

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

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

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

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

Loading…
Cancel
Save