修改案例题删除和案例题步骤删除功能

master
xiaoCJ 3 months ago
parent df80528656
commit b64d3ed42b

@ -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) {

@ -77,10 +77,10 @@ public class CaseStepController {
@PostMapping("deleteCase") @PostMapping("deleteCase")
public ResultEntity<HttpStatus> deleteCase(@RequestBody SysCaseQuestionStepWithBLOBs sysCaseQuestionStep, public ResultEntity<HttpStatus> deleteCase(@RequestBody SysCaseQuestionStepWithBLOBs sysCaseQuestionStep,
@ApiParam("哪个用的掉的请求,传管理员/学校ID") @RequestParam String source) { @ApiParam("哪个用的掉的请求,传管理员/学校ID") @RequestParam String source) {
// List<SysTopicAndCourse> sysTopicAndCourses = getSysTopicAndCourses(sysCaseQuestionStep.getCaseId()); List<SysTopicAndCourse> sysTopicAndCourses = getSysTopicAndCourses(sysCaseQuestionStep.getCaseId());
// if (!sysTopicAndCourses.isEmpty()) { if (!sysTopicAndCourses.isEmpty()) {
// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "无法删除!该案例题正在被使用!"); todo 暂时把判断去掉 return new ResultEntity<>(HttpStatus.BAD_REQUEST, "无法删除!该案例题正在被使用!");
// } }
//todo 管理员任意删除 老师只能删除自己上传的 //todo 管理员任意删除 老师只能删除自己上传的
SysCaseQuestion sysCaseQuestion = sysCaseQuestionMapper.selectByPrimaryKey(sysCaseQuestionStep.getCaseId()); SysCaseQuestion sysCaseQuestion = sysCaseQuestionMapper.selectByPrimaryKey(sysCaseQuestionStep.getCaseId());
if ("管理员".equals(source) || source.equals(sysCaseQuestion.getSource())) { if ("管理员".equals(source) || source.equals(sysCaseQuestion.getSource())) {

Loading…
Cancel
Save