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

master
xiaoCJ 7 months ago
parent 97a589a1f1
commit c24b2e73bd

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

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

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

Loading…
Cancel
Save