diff --git a/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ExamQuestionCategoryController.java b/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ExamQuestionCategoryController.java
index 25e4ef553..49ecd1cfc 100644
--- a/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ExamQuestionCategoryController.java
+++ b/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ExamQuestionCategoryController.java
@@ -5,6 +5,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
+import com.ruoyi.exam.domain.ExamPaperCategory;
import com.ruoyi.framework.web.util.ShiroUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
@@ -178,4 +179,23 @@ public class ExamQuestionCategoryController extends BaseController
return res;
}
+ /**
+ * 删除
+ */
+ @Log(title = "试题分类管理", businessType = BusinessType.DELETE)
+ @RequiresPermissions("system:examQuestionCategory:remove")
+ @PostMapping("/remove/{id}")
+ @ResponseBody
+ public AjaxResult remove(@PathVariable("id") Long id)
+ {
+ ExamQuestionCategory exam = new ExamQuestionCategory();
+ exam.setParentId(id);
+ if (examQuestionCategoryService.selectList(exam).size() > 0)
+ {
+ return error(1, "存在下级分类,不允许删除");
+ }
+
+ return toAjax(examQuestionCategoryService.deleteById(id));
+ }
+
}
diff --git a/ruoyi-exam/src/main/resources/templates/exam/examQuestionCategory/examQuestionCategory.html b/ruoyi-exam/src/main/resources/templates/exam/examQuestionCategory/examQuestionCategory.html
index adc101149..2743abeeb 100644
--- a/ruoyi-exam/src/main/resources/templates/exam/examQuestionCategory/examQuestionCategory.html
+++ b/ruoyi-exam/src/main/resources/templates/exam/examQuestionCategory/examQuestionCategory.html
@@ -113,13 +113,30 @@
}
var actions = [];
actions.push('编辑 ');
- actions.push('删除');
+ actions.push('删除');
return actions.join('');
}
}]
};
$.treeTable.init(options);
});
+
+ function remove(id) {
+ $.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() {
+ $.ajax({
+ type : 'post',
+ url: prefix + "/remove/" + id,
+ success : function(result) {
+ if (result.code == web_status.SUCCESS) {
+ $.modal.msgSuccess(result.msg);
+ $.treeTable.refresh();
+ } else {
+ $.modal.msgError(result.msg);
+ }
+ }
+ });
+ });
+ }