|
|
@ -202,18 +202,17 @@ public class CaseController {
|
|
|
|
public ResultEntity<HttpStatus> deleteCase(@RequestBody SysCaseQuestion sysCaseQuestion,
|
|
|
|
public ResultEntity<HttpStatus> deleteCase(@RequestBody SysCaseQuestion sysCaseQuestion,
|
|
|
|
@ApiParam("哪个用的掉的请求,传管理员/学校ID") @RequestParam String source) {
|
|
|
|
@ApiParam("哪个用的掉的请求,传管理员/学校ID") @RequestParam String source) {
|
|
|
|
List<SysTopicAndCourse> sysTopicAndCourses = getSysTopicAndCourses(sysCaseQuestion.getCaseId(), sysCaseQuestion.getOneId());
|
|
|
|
List<SysTopicAndCourse> sysTopicAndCourses = getSysTopicAndCourses(sysCaseQuestion.getCaseId(), sysCaseQuestion.getOneId());
|
|
|
|
// if (!sysTopicAndCourses.isEmpty()) {
|
|
|
|
if (!sysTopicAndCourses.isEmpty()) {
|
|
|
|
// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "无法删除!该案例题正在被使用!");
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "无法删除!该案例题正在被使用!");
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
//todo 管理员任意删除 老师只能删除自己上传的
|
|
|
|
|
|
|
|
if ("管理员".equals(source) || source.equals(sysCaseQuestion.getSource())) {
|
|
|
|
|
|
|
|
topicAndCourseMapper.deleteByPrimaryKey(sysTopicAndCourses.get(0).getId());
|
|
|
|
|
|
|
|
caseQuestionMapper.deleteByPrimaryKey(sysCaseQuestion.getCaseId());
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "删除成功!");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "权限不足!");
|
|
|
|
if ("管理员".equals(source) || source.equals(sysCaseQuestion.getSource())) {
|
|
|
|
|
|
|
|
topicAndCourseMapper.deleteByPrimaryKey(sysTopicAndCourses.get(0).getId());
|
|
|
|
|
|
|
|
caseQuestionMapper.deleteByPrimaryKey(sysCaseQuestion.getCaseId());
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "删除成功!");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "权限不足!");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<SysTopicAndCourse> getSysTopicAndCourses(String caseId, String oneId) {
|
|
|
|
private List<SysTopicAndCourse> getSysTopicAndCourses(String caseId, String oneId) {
|
|
|
|