From ce5c7314ded7e5b190b1a3d04d11ed85bcec7e5c Mon Sep 17 00:00:00 2001 From: flower Date: Tue, 18 Dec 2018 07:43:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=95=E9=A2=98=E5=88=86=E7=B1=BB=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExamQuestionCategoryController.java | 20 +++++++++++++++++++ .../examQuestionCategory.html | 19 +++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) 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); + } + } + }); + }); + } \ No newline at end of file