修改知识概要删除接口,和新增接口

master
xiaoCJ 7 months ago
parent 97a589a1f1
commit c24b2e73bd

@ -50,11 +50,14 @@ public class KnowledgeSummaryController {
return new ResultEntity<>(HttpStatus.OK, "修改成功!"); return new ResultEntity<>(HttpStatus.OK, "修改成功!");
} }
sysKnowledgeSummary.setKnowledgeSummaryId(IdUtil.randomUUID()); //新增
String uuid = IdUtil.randomUUID();
sysKnowledgeSummary.setKnowledgeSummaryId(uuid);
knowledgeSummaryMapper.insert(sysKnowledgeSummary); knowledgeSummaryMapper.insert(sysKnowledgeSummary);
SysKnowledgeAndCourse sysKnowledgeAndCourse = new SysKnowledgeAndCourse(); SysKnowledgeAndCourse sysKnowledgeAndCourse = new SysKnowledgeAndCourse();
sysKnowledgeAndCourse.setId(IdUtil.randomUUID()); sysKnowledgeAndCourse.setId(IdUtil.randomUUID());
sysKnowledgeAndCourse.setKnowledgeSummaryId(uuid);
if (StringUtils.isNotBlank(sysKnowledgeSummary.getOneTagId())) { if (StringUtils.isNotBlank(sysKnowledgeSummary.getOneTagId())) {
sysKnowledgeAndCourse.setOneId(sysKnowledgeSummary.getOneTagId()); sysKnowledgeAndCourse.setOneId(sysKnowledgeSummary.getOneTagId());
sysKnowledgeAndCourse.setOneName(sysKnowledgeSummary.getOneTagName()); sysKnowledgeAndCourse.setOneName(sysKnowledgeSummary.getOneTagName());
@ -71,48 +74,41 @@ public class KnowledgeSummaryController {
return new ResultEntity<>(HttpStatus.OK, "保存成功!"); return new ResultEntity<>(HttpStatus.OK, "保存成功!");
} }
@AnonymousAccess // @AnonymousAccess
@ApiOperation("知识概要删除数据") // @ApiOperation("知识概要删除数据")
@PostMapping("deleteKnowledgeSummary") // @PostMapping("deleteKnowledgeSummary")
public ResultEntity<String> deleteKnowledgeSummary(@RequestParam String id) { // public ResultEntity<String> deleteKnowledgeSummary(@RequestParam String id) {
SysKnowledgeAndCourseExample example = new SysKnowledgeAndCourseExample(); // SysKnowledgeAndCourseExample example = new SysKnowledgeAndCourseExample();
example.createCriteria().andKnowledgeSummaryIdEqualTo(id); // example.createCriteria().andKnowledgeSummaryIdEqualTo(id);
List<SysKnowledgeAndCourse> sysKnowledgeAndCourses = knowledgeAndCourseMapper.selectByExample(example); // List<SysKnowledgeAndCourse> sysKnowledgeAndCourses = knowledgeAndCourseMapper.selectByExample(example);
if (sysKnowledgeAndCourses != null && !sysKnowledgeAndCourses.isEmpty()) { // if (sysKnowledgeAndCourses != null && !sysKnowledgeAndCourses.isEmpty()) {
return new ResultEntity<>(HttpStatus.INTERNAL_SERVER_ERROR, "该知识概要正在被使用,请先删除绑定关系!"); // return new ResultEntity<>(HttpStatus.INTERNAL_SERVER_ERROR, "该知识概要正在被使用,请先删除绑定关系!");
} else { // } else {
knowledgeSummaryMapper.deleteByPrimaryKey(id); // knowledgeSummaryMapper.deleteByPrimaryKey(id);
return new ResultEntity<>(HttpStatus.OK, "删除成功!"); // return new ResultEntity<>(HttpStatus.OK, "删除成功!");
} // }
} // }
@AnonymousAccess @AnonymousAccess
@ApiOperation("知识概要删除绑定关系") @ApiOperation("知识概要删除")
@PostMapping("deleteKnowledgeSummaryBind") @PostMapping("deleteKnowledgeSummaryBind")
public ResultEntity<String> deleteKnowledgeSummaryBind(@RequestParam String id, public ResultEntity<String> deleteKnowledgeSummaryBind(@RequestParam String id,
@RequestParam(required = false) String oneId, @RequestParam String oneId,
@RequestParam(required = false) String twoId, @RequestParam String twoId,
@RequestParam(required = false) String threeId) { @RequestParam String threeId) {
SysKnowledgeAndCourseExample example = new SysKnowledgeAndCourseExample(); //删除知识概要
SysKnowledgeAndCourseExample.Criteria criteria = example.createCriteria(); try {
criteria.andKnowledgeSummaryIdEqualTo(id); knowledgeSummaryMapper.deleteByPrimaryKey(id);
if (StringUtils.isNotBlank(oneId)) { } catch (Exception e) {
criteria.andOneIdEqualTo(oneId); e.printStackTrace();
} return new ResultEntity<>(HttpStatus.INTERNAL_SERVER_ERROR, "系统异常,请联系管理员!");
if (StringUtils.isNotBlank(twoId)) {
criteria.andTwoIdEqualTo(twoId);
}
if (StringUtils.isNotBlank(threeId)) {
criteria.andThreeIdEqualTo(threeId);
}
List<SysKnowledgeAndCourse> sysKnowledgeAndCourses = knowledgeAndCourseMapper.selectByExample(example);
if (sysKnowledgeAndCourses == null || sysKnowledgeAndCourses.isEmpty()) {
return new ResultEntity<>(HttpStatus.INTERNAL_SERVER_ERROR, "该知识概要暂无绑定关系!");
} else {
knowledgeAndCourseMapper.deleteByExample(example);
return new ResultEntity<>(HttpStatus.OK, "删除绑定关系成功!");
} }
} //删除绑定关系
SysKnowledgeAndCourseExample example = new SysKnowledgeAndCourseExample();
example.createCriteria().andKnowledgeSummaryIdEqualTo(id).andOneIdEqualTo(oneId).andThreeIdEqualTo(threeId).andTwoIdEqualTo(twoId);
knowledgeAndCourseMapper.deleteByExample(example);
return new ResultEntity<>(HttpStatus.OK, "删除成功!");
}
@AnonymousAccess @AnonymousAccess

@ -325,8 +325,8 @@ public class TopicResourceController {
Cell cell11 = row.getCell(11); Cell cell11 = row.getCell(11);
Cell cell12 = row.getCell(12); Cell cell12 = row.getCell(12);
//判断题的BCDE选项和解析可能为空 //判断题的CDE选项和解析可能为空
if (cell0 == null || cell2 == null || cell3 == null || cell7 == null || cell8 == null || cell10 == null || cell11 == null || cell12 == null) { if (cell0 == null || cell1 == null ||cell2 == null || cell3 == null || cell7 == null || cell8 == null || cell10 == null || cell11 == null || cell12 == null) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "必填项不能为空"); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "必填项不能为空");
} }

@ -428,10 +428,10 @@ public class ObjectiveApi {
@ApiOperation("根据客观题IDList批量查询客观题") @ApiOperation("根据客观题IDList批量查询客观题")
@PostMapping("selectBatchByIdList") @PostMapping("selectBatchByIdList")
private List<SysObjectiveQuestions> selectBatchByIdList(@RequestBody List<String> objectIdList) { private List<SysObjectiveQuestions> selectBatchByIdList(@RequestBody List<String> objectIdList) {
SysObjectiveQuestionsExample example = new SysObjectiveQuestionsExample(); SysObjectiveQuestionsExample example = new SysObjectiveQuestionsExample();
example.createCriteria().andObjectiveIdIn(objectIdList); example.createCriteria().andObjectiveIdIn(objectIdList);
List<SysObjectiveQuestions> sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByExample(example); List<SysObjectiveQuestions> sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByExample(example);
return sysObjectiveQuestions; return sysObjectiveQuestions;
} }
/** /**

Loading…
Cancel
Save