|
|
|
@ -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);
|
|
|
|
|
@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, "系统异常,请联系管理员!");
|
|
|
|
|
}
|
|
|
|
|
List<SysKnowledgeAndCourse> sysKnowledgeAndCourses = knowledgeAndCourseMapper.selectByExample(example);
|
|
|
|
|
if (sysKnowledgeAndCourses == null || sysKnowledgeAndCourses.isEmpty()) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.INTERNAL_SERVER_ERROR, "该知识概要暂无绑定关系!");
|
|
|
|
|
} else {
|
|
|
|
|
//删除绑定关系
|
|
|
|
|
SysKnowledgeAndCourseExample example = new SysKnowledgeAndCourseExample();
|
|
|
|
|
example.createCriteria().andKnowledgeSummaryIdEqualTo(id).andOneIdEqualTo(oneId).andThreeIdEqualTo(threeId).andTwoIdEqualTo(twoId);
|
|
|
|
|
knowledgeAndCourseMapper.deleteByExample(example);
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "删除绑定关系成功!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "删除成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|