Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
926efeb64e
|
|
@ -499,7 +499,7 @@
|
|||
},
|
||||
// 工具栏表格树修改
|
||||
editTree: function() {
|
||||
var row = $('#bootstrap-table').bootstrapTreeTable('getSelections')[0];
|
||||
var row = $('#bootstrap-tree-table').bootstrapTreeTable('getSelections')[0];
|
||||
if ($.common.isEmpty(row)) {
|
||||
$.modal.alertWarning("请至少选择一条记录");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
手机号码:<input type="text" name="phonenumber"/>
|
||||
</li>
|
||||
<li>
|
||||
用户状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
|
||||
用户状态: <select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ import java.util.ArrayList;
|
|||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import com.ruoyi.common.json.JSONObject;
|
||||
import com.ruoyi.exam.domain.ExamQuestionCategory;
|
||||
import com.ruoyi.exam.domain.ExamQuestionItem;
|
||||
import com.ruoyi.exam.service.IExamQuestionCategoryService;
|
||||
import com.ruoyi.exam.service.IExamQuestionItemService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
|
@ -38,6 +42,9 @@ public class ExamQuestionController extends BaseController
|
|||
|
||||
@Autowired
|
||||
private IExamQuestionCategoryService examQuestionCategoryService;
|
||||
|
||||
@Autowired
|
||||
private IExamQuestionItemService examQuestionItemService;
|
||||
|
||||
@RequiresPermissions("exam:examQuestion:view")
|
||||
@GetMapping()
|
||||
|
|
@ -139,6 +146,18 @@ public class ExamQuestionController extends BaseController
|
|||
return toAjax(examQuestionService.insertQuestion(examQuestion,number,content));
|
||||
}
|
||||
|
||||
|
||||
@RequiresPermissions("exam:examQuestion:edit")
|
||||
@Log(title = "问题", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/update")
|
||||
@ResponseBody
|
||||
public AjaxResult update(ExamQuestion examQuestion,@RequestParam(value = "number", required = true) String[] number,
|
||||
@RequestParam(value = "content", required = true) String[] content)
|
||||
{
|
||||
|
||||
return toAjax(examQuestionService.updateQuestion(examQuestion,number,content));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改问题
|
||||
*/
|
||||
|
|
@ -147,7 +166,21 @@ public class ExamQuestionController extends BaseController
|
|||
{
|
||||
ExamQuestion examQuestion = examQuestionService.selectExamQuestionById(id);
|
||||
mmap.put("examQuestion", examQuestion);
|
||||
return prefix + "/edit";
|
||||
ExamQuestionItem examQuestionItem = new ExamQuestionItem();
|
||||
examQuestionItem.setExamQuestionId(id);
|
||||
List<ExamQuestionItem> examQuestionItems = examQuestionItemService.selectList(examQuestionItem);
|
||||
JSONArray arr = new JSONArray();
|
||||
arr.addAll(examQuestionItems);
|
||||
mmap.put("examQuestionItem", arr.toString());
|
||||
String s = "";
|
||||
if(examQuestion.getType().equals("1")){
|
||||
s= "/choiceUpdate";
|
||||
}else if(examQuestion.getType().equals("2")){
|
||||
s = "/morechoiceUpdate";
|
||||
}else{
|
||||
s = "/judgeUpdate";
|
||||
}
|
||||
return prefix + s;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -170,7 +203,8 @@ public class ExamQuestionController extends BaseController
|
|||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
{
|
||||
examQuestionItemService.deleteByQuestionIds(ids);
|
||||
return toAjax(examQuestionService.deleteExamQuestionByIds(ids));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,4 +60,5 @@ public interface ExamQuestionItemMapper extends MyMapper<ExamQuestionItem>
|
|||
*/
|
||||
public int deleteExamQuestionItemByIds(String[] ids);
|
||||
|
||||
void deleteByQuestionIds(String[] ids);
|
||||
}
|
||||
|
|
@ -26,5 +26,6 @@ public interface IExamQuestionItemService extends AbstractBaseService<ExamQuesti
|
|||
*/
|
||||
public List<ExamQuestionItem> selectExamQuestionItemList(ExamQuestionItem examQuestionItem);
|
||||
|
||||
|
||||
|
||||
void deleteByQuestionIds(String ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,4 +52,6 @@ public interface IExamQuestionService extends AbstractBaseService<ExamQuestion>
|
|||
public int deleteExamQuestionByIds(String ids);
|
||||
|
||||
int insertQuestion(ExamQuestion examQuestion, String[] number, String[] content);
|
||||
|
||||
int updateQuestion(ExamQuestion examQuestion, String[] number, String[] content);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,13 @@ public class ExamQuestionItemServiceImpl extends AbstractBaseServiceImpl<ExamQue
|
|||
{
|
||||
return examQuestionItemMapper.selectExamQuestionItemList(examQuestionItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByQuestionIds(String ids) {
|
||||
String[] split = ids.split(",");
|
||||
examQuestionItemMapper.deleteByQuestionIds(split);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询问题选项分页列表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -113,4 +113,31 @@ public class ExamQuestionServiceImpl extends AbstractBaseServiceImpl<ExamQuestio
|
|||
return i ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateQuestion(ExamQuestion examQuestion, String[] number, String[] content) {
|
||||
Date date = new Date();
|
||||
examQuestion.setUpdateDate(date);
|
||||
examQuestion.setUpdateBy(ShiroUtils.getLoginName());
|
||||
int i = examQuestionMapper.updateExamQuestion(examQuestion);
|
||||
examQuestion.setCreateDate(null);
|
||||
examQuestion.setUpdateDate(null);
|
||||
List<ExamQuestion> select = examQuestionMapper.selectExamQuestionList(examQuestion);
|
||||
String id = select.get(0).getId();
|
||||
examQuestionItemMapper.deleteByQuestionIds(new String[]{id});
|
||||
ExamQuestionItem examQuestionItem = new ExamQuestionItem();
|
||||
for (int i1 = 0; i1 < number.length; i1++) {examQuestionItem.setContent(content[i1]);
|
||||
examQuestionItem.setNumber(number[i1]);
|
||||
examQuestionItem.setExamQuestionId(select.get(0).getId()+"");
|
||||
examQuestionItem.setCreateDate(date);
|
||||
examQuestionItem.setCreateBy(ShiroUtils.getLoginName());
|
||||
examQuestionItemMapper.insertExamQuestionItem(examQuestionItem);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return i ;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,5 +96,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
<delete id="deleteByQuestionIds">
|
||||
delete from exam_question_item where exam_question_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-examQuestion-add">
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="id" name="id" th:value="${examQuestion.id}">
|
||||
<input type="hidden" id="categoryId" name="categoryId" th:value="${examQuestion.categoryId}">
|
||||
<input type="hidden" id="type" name="type" th:value="${examQuestion.type}">
|
||||
<input type="hidden" id="answer" name="questionAnswer" th:value="${examQuestion.answer}">
|
||||
<input type="hidden" id="item" name="item" th:value="${examQuestionItem}">
|
||||
<label class="col-sm-3 control-label">问题标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="title" name="title" class="form-control" type="text" th:value="${examQuestion.title}">
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="form-group">-->
|
||||
<!--<label class="col-sm-3 control-label">问题答案:</label>-->
|
||||
<!--<div class="col-sm-8">-->
|
||||
<!--<input id="answer" name="answer" class="form-control" type="text">-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="form-group" >
|
||||
<label class="col-sm-3 control-label">问题选项:</label>
|
||||
<div class="col-sm-1" style="padding-right: 0px;">
|
||||
<input class="form-control" name="answer" value="A" type="radio" style="margin: 0 0 0;">
|
||||
</div>
|
||||
<div class="col-sm-1" style="padding-right: 0px;padding-left: 0px">
|
||||
<input style="padding: 6px 10px;text-align: center" id="number1" name="number" class="form-control" type="text" value="A" readonly>
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-left: 0px">
|
||||
<input id="content1" name="content" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" >
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-1" style="padding-right: 0px;">
|
||||
<input class="form-control" name="answer" value="B" type="radio" style="margin: 0 0 0;">
|
||||
</div>
|
||||
<div class="col-sm-1" style="padding-right: 0px;padding-left: 0px">
|
||||
<input style="padding: 6px 10px;text-align: center" id="number2" name="number" class="form-control" type="text" value="B" readonly>
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-left: 0px">
|
||||
<input id="content2" name="content" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="addOption">
|
||||
<label class="col-sm-4 control-label"></label>
|
||||
<div class="col-sm-7" style="padding-left: 0px">
|
||||
<a style="text-align: center;color: #999;border: 1px #ccc dashed;display:block;height: 34px
|
||||
;line-height: 34px" href="javascript:addOption();">添加选项</a>
|
||||
</div>
|
||||
</div>
|
||||
<!--</div>-->
|
||||
|
||||
<!--<div class="form-group">-->
|
||||
<!--<label class="col-sm-3 control-label">标签:</label>-->
|
||||
<!--<div class="col-sm-8">-->
|
||||
<!--<input id="label" name="label" class="form-control" type="text">-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注信息:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="remarks" name="remarks" class="form-control" type="text" th:value="${examQuestion.remarks}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
|
||||
|
||||
if ($.validator) {
|
||||
$.validator.prototype.elements = function () {
|
||||
var validator = this,
|
||||
rulesCache = {};
|
||||
return $([]).add(this.currentForm.elements)
|
||||
.filter(":input")
|
||||
.not(":submit, :reset, :image, [disabled]")
|
||||
.not(this.settings.ignore)
|
||||
.filter(function () {
|
||||
var elementIdentification = this.id || this.name;
|
||||
!elementIdentification && validator.settings.debug && window.console && console.error("%o has no id nor name assigned", this);
|
||||
if (elementIdentification in rulesCache || !validator.objectLength($(this).rules()))
|
||||
return false;
|
||||
rulesCache[elementIdentification] = true;
|
||||
return true;
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
var questionItem = $("#item").val();
|
||||
var questionAnswer = $("#answer").val();
|
||||
questionItem =$.parseJSON(questionItem)
|
||||
|
||||
for(var i in questionItem){
|
||||
var number = questionItem[i].number;
|
||||
if(number == "A"){
|
||||
$("#content1").val(questionItem[i].content);
|
||||
continue;
|
||||
}
|
||||
if(number == "B"){
|
||||
$("#content2").val(questionItem[i].content);
|
||||
continue;
|
||||
}
|
||||
$("#addOption").before(' <div class="form-group update1" id="div'+item[index]+'"> <label class="col-sm-3 control-label"></label><div class="col-sm-1" style="padding-right: 0px;"> <input class="form-control update4" name="answer" value="'+item[index]+'" type="radio" style="margin: 0 0 0;">' +
|
||||
'</div><div class="col-sm-1" style="padding-right: 0px;padding-left: 0px"> ' +
|
||||
'<input style="padding: 6px 10px;text-align: center" id="number'+item[index]+'" name="number" class="form-control update2" type="text" value="'+item[index]+'" readonly> ' +
|
||||
'</div> <div class="col-sm-6" style="padding-left: 0px"> <input name="content" id = "con'+item[index]+'" class="form-control" type="text" value="'+questionItem[i].content+'"> </div> <div class="col-sm-1"> <a class="update3" style="text-align: center;color: #999;border: 1px #ccc dashed;display:block;height: 34px;line-height: 34px" href="javascript:deleteOption(\''+item[index++]+'\');">X</a> </div></div>')
|
||||
}
|
||||
|
||||
var radios = document.getElementsByName("answer");
|
||||
|
||||
for ( var i = 0; i < radios.length; i++) {
|
||||
|
||||
if (radios[i].value==questionAnswer) {
|
||||
radios[i].checked=true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
var item = ["C","D","E","F","G","H","I","G","K","L","M","N"];
|
||||
var index = 0;
|
||||
var prefix = ctx + "exam/examQuestion"
|
||||
|
||||
$("#form-examQuestion-add").validate({
|
||||
rules:{
|
||||
title:{
|
||||
required:true,
|
||||
},
|
||||
content:{
|
||||
required:true,
|
||||
},
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
debugger
|
||||
if (!$.validate.form()) {
|
||||
return
|
||||
}
|
||||
|
||||
var radios = document.getElementsByName("answer");
|
||||
var i = 0
|
||||
for ( ; i < radios.length; i++) {
|
||||
|
||||
if (radios[i].checked == true) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i==radios.length){
|
||||
$.modal.alertError("请至少选择一个答案");
|
||||
return;
|
||||
}
|
||||
|
||||
$.operate.save(prefix + "/update", $('#form-examQuestion-add').serialize());
|
||||
}
|
||||
|
||||
|
||||
|
||||
function addOption(){
|
||||
$("#addOption").before(' <div class="form-group update1" id="div'+item[index]+'"> <label class="col-sm-3 control-label"></label><div class="col-sm-1" style="padding-right: 0px;"> <input class="form-control update4" name="answer" value="'+item[index]+'" type="radio" style="margin: 0 0 0;">' +
|
||||
'</div><div class="col-sm-1" style="padding-right: 0px;padding-left: 0px"> ' +
|
||||
'<input style="padding: 6px 10px;text-align: center" id="number'+item[index]+'" name="number" class="form-control update2" type="text" value="'+item[index]+'" readonly> ' +
|
||||
'</div> <div class="col-sm-6" style="padding-left: 0px"> <input name="content" id = "con'+item[index]+'" class="form-control" type="text"> </div> <div class="col-sm-1"> <a class="update3" style="text-align: center;color: #999;border: 1px #ccc dashed;display:block;height: 34px;line-height: 34px" href="javascript:deleteOption(\''+item[index++]+'\');">X</a> </div></div>')
|
||||
}
|
||||
|
||||
function deleteOption(id){
|
||||
debugger
|
||||
$("#div"+id).remove();
|
||||
index--;
|
||||
var index1 = 0;
|
||||
var index2 = 0;
|
||||
var index3 = 0;
|
||||
var index4 = 0
|
||||
$(".update1").each(function(){
|
||||
$(this).attr("id","div"+item[index1++])
|
||||
})
|
||||
$(".update2").each(function(){
|
||||
$(this).attr("value",item[index2++])
|
||||
})
|
||||
$(".update3").each(function(){
|
||||
$(this).attr("href",'javascript:deleteOption(\''+item[index3++]+'\');');
|
||||
})
|
||||
$(".update4").each(function(){
|
||||
$(this).attr("value",'javascript:deleteOption(\''+item[index4++]+'\');');
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -78,9 +78,7 @@
|
|||
shiro:hasPermission="exam:examQuestion:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="exam:examQuestion:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table" data-mobile-responsive="true"></table>
|
||||
|
|
@ -93,6 +91,7 @@
|
|||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('exam:examQuestion:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('exam:examQuestion:remove')}]];
|
||||
var type = [[${@dict.getType('exam_question_type')}]];
|
||||
var prefix = ctx + "exam/examQuestion";
|
||||
|
||||
$(function () {
|
||||
|
|
@ -115,6 +114,10 @@
|
|||
showExport: true,
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},{
|
||||
field:"id",
|
||||
title: '#',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
|
|
@ -124,12 +127,12 @@
|
|||
{
|
||||
field: 'type',
|
||||
title: '问题类型',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'label',
|
||||
title: '标签',
|
||||
sortable: true
|
||||
sortable: true,
|
||||
formatter: function(value, item, index) {
|
||||
debugger
|
||||
return $.table.selectDictLabel(type, item.type);
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
field: 'createBy',
|
||||
|
|
@ -141,11 +144,6 @@
|
|||
title: '创建时间',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'remarks',
|
||||
title: '答案解析',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,192 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-examQuestion-add">
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="id" name="id" th:value="${examQuestion.id}">
|
||||
<input type="hidden" id="categoryId" name="categoryId" th:value="${examQuestion.categoryId}">
|
||||
<input type="hidden" id="type" name="type" th:value="${examQuestion.type}">
|
||||
<input type="hidden" id="answer" name="questionAnswer" th:value="${examQuestion.answer}">
|
||||
<input type="hidden" id="item" name="item" th:value="${examQuestionItem}">
|
||||
<label class="col-sm-3 control-label">问题标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="title" name="title" class="form-control" type="text" th:value="${examQuestion.title}">
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="form-group">-->
|
||||
<!--<label class="col-sm-3 control-label">问题答案:</label>-->
|
||||
<!--<div class="col-sm-8">-->
|
||||
<!--<input id="answer" name="answer" class="form-control" type="text">-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="form-group" >
|
||||
<label class="col-sm-3 control-label">问题选项:</label>
|
||||
<div class="col-sm-1" style="padding-right: 0px;">
|
||||
<input class="form-control" name="answer" value="A" type="radio" style="margin: 0 0 0;">
|
||||
</div>
|
||||
<div class="col-sm-1" style="padding-right: 0px;padding-left: 0px">
|
||||
<input style="padding: 6px 10px;text-align: center" id="number1" name="number" class="form-control" type="text" value="A" readonly>
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-left: 0px">
|
||||
<input id="content1" name="content" class="form-control" type="text" value="正确" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group" >
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-1" style="padding-right: 0px;">
|
||||
<input class="form-control" name="answer" value="B" type="radio" style="margin: 0 0 0;" >
|
||||
</div>
|
||||
<div class="col-sm-1" style="padding-right: 0px;padding-left: 0px">
|
||||
<input style="padding: 6px 10px;text-align: center" id="number2" name="number" class="form-control" type="text" value="B" readonly>
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-left: 0px">
|
||||
<input id="content2" name="content" class="form-control" type="text" value="错误" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--</div>-->
|
||||
|
||||
<!--<div class="form-group">-->
|
||||
<!--<label class="col-sm-3 control-label">标签:</label>-->
|
||||
<!--<div class="col-sm-8">-->
|
||||
<!--<input id="label" name="label" class="form-control" type="text">-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注信息:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="remarks" name="remarks" class="form-control" type="text" th:value="${examQuestion.remarks}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
if ($.validator) {
|
||||
$.validator.prototype.elements = function () {
|
||||
var validator = this,
|
||||
rulesCache = {};
|
||||
return $([]).add(this.currentForm.elements)
|
||||
.filter(":input")
|
||||
.not(":submit, :reset, :image, [disabled]")
|
||||
.not(this.settings.ignore)
|
||||
.filter(function () {
|
||||
var elementIdentification = this.id || this.name;
|
||||
!elementIdentification && validator.settings.debug && window.console && console.error("%o has no id nor name assigned", this);
|
||||
if (elementIdentification in rulesCache || !validator.objectLength($(this).rules()))
|
||||
return false;
|
||||
rulesCache[elementIdentification] = true;
|
||||
return true;
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
var questionItem = $("#item").val();
|
||||
var questionAnswer = $("#answer").val();
|
||||
questionItem =$.parseJSON(questionItem)
|
||||
|
||||
for(var i in questionItem){
|
||||
var number = questionItem[i].number;
|
||||
if(number == "A"){
|
||||
$("#content1").val(questionItem[i].content);
|
||||
continue;
|
||||
}
|
||||
if(number == "B"){
|
||||
$("#content2").val(questionItem[i].content);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
var radios = document.getElementsByName("answer");
|
||||
|
||||
for ( var i = 0; i < radios.length; i++) {
|
||||
|
||||
if (radios[i].value==questionAnswer) {
|
||||
radios[i].checked=true
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var item = ["C","D","E","F","G","H","I","G","K","L","M","N"];
|
||||
var index = 0;
|
||||
var prefix = ctx + "exam/examQuestion"
|
||||
$("#form-examQuestion-add").validate({
|
||||
rules:{
|
||||
title:{
|
||||
required:true,
|
||||
},
|
||||
content:{
|
||||
required:true,
|
||||
},
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
debugger
|
||||
if (!$.validate.form()) {
|
||||
return
|
||||
}
|
||||
|
||||
var radios = document.getElementsByName("answer");
|
||||
var i = 0
|
||||
for ( ; i < radios.length; i++) {
|
||||
|
||||
if (radios[i].checked == true) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i==radios.length){
|
||||
$.modal.alertError("请至少选择一个答案");
|
||||
return;
|
||||
}
|
||||
|
||||
$.operate.save(prefix + "/update", $('#form-examQuestion-add').serialize());
|
||||
}
|
||||
|
||||
|
||||
|
||||
function addOption(){
|
||||
$("#addOption").before(' <div class="form-group update1" id="div'+item[index]+'"> <label class="col-sm-3 control-label"></label><div class="col-sm-1" style="padding-right: 0px;"> <input class="form-control update4" name="answer" value="'+item[index]+'" type="checkbox" style="margin: 0 0 0;">' +
|
||||
'</div><div class="col-sm-1" style="padding-right: 0px;padding-left: 0px"> ' +
|
||||
'<input style="padding: 6px 10px;text-align: center" id="number'+item[index]+'" name="number" class="form-control update2" type="text" value="'+item[index]+'" readonly> ' +
|
||||
'</div> <div class="col-sm-6" style="padding-left: 0px"> <input name="content" class="form-control" type="text"> </div> <div class="col-sm-1"> <a class="update3" style="text-align: center;color: #999;border: 1px #ccc dashed;display:block;height: 34px;line-height: 34px" href="javascript:deleteOption(\''+item[index++]+'\');">X</a> </div></div>')
|
||||
}
|
||||
|
||||
function deleteOption(id){
|
||||
debugger
|
||||
$("#div"+id).remove();
|
||||
index--;
|
||||
var index1 = 0;
|
||||
var index2 = 0;
|
||||
var index3 = 0;
|
||||
var index4 = 0
|
||||
$(".update1").each(function(){
|
||||
$(this).attr("id","div"+item[index1++])
|
||||
})
|
||||
$(".update2").each(function(){
|
||||
$(this).attr("value",item[index2++])
|
||||
})
|
||||
$(".update3").each(function(){
|
||||
$(this).attr("href",'javascript:deleteOption(\''+item[index3++]+'\');');
|
||||
})
|
||||
$(".update4").each(function(){
|
||||
$(this).attr("value",'javascript:deleteOption(\''+item[index4++]+'\');');
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-examQuestion-add">
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="id" name="id" th:value="${examQuestion.id}">
|
||||
<input type="hidden" id="categoryId" name="categoryId" th:value="${examQuestion.categoryId}">
|
||||
<input type="hidden" id="type" name="type" th:value="${examQuestion.type}">
|
||||
<input type="hidden" id="answer" name="questionAnswer" th:value="${examQuestion.answer}">
|
||||
<input type="hidden" id="item" name="item" th:value="${examQuestionItem}">
|
||||
<label class="col-sm-3 control-label">问题标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="title" name="title" class="form-control" type="text" th:value="${examQuestion.title}">
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="form-group">-->
|
||||
<!--<label class="col-sm-3 control-label">问题答案:</label>-->
|
||||
<!--<div class="col-sm-8">-->
|
||||
<!--<input id="answer" name="answer" class="form-control" type="text">-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="form-group" >
|
||||
<label class="col-sm-3 control-label">问题选项:</label>
|
||||
<div class="col-sm-1" style="padding-right: 0px;">
|
||||
<input class="form-control" name="answer" value="A" type="checkbox" style="margin: 0 0 0;">
|
||||
</div>
|
||||
<div class="col-sm-1" style="padding-right: 0px;padding-left: 0px">
|
||||
<input style="padding: 6px 10px;text-align: center" id="number1" name="number" class="form-control" type="text" value="A" readonly>
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-left: 0px">
|
||||
<input id="content1" name="content" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" >
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-1" style="padding-right: 0px;">
|
||||
<input class="form-control" name="answer" value="B" type="checkbox" style="margin: 0 0 0;">
|
||||
</div>
|
||||
<div class="col-sm-1" style="padding-right: 0px;padding-left: 0px">
|
||||
<input style="padding: 6px 10px;text-align: center" id="number2" name="number" class="form-control" type="text" value="B" readonly>
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-left: 0px">
|
||||
<input id="content2" name="content" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="addOption">
|
||||
<label class="col-sm-4 control-label"></label>
|
||||
<div class="col-sm-7" style="padding-left: 0px">
|
||||
<a style="text-align: center;color: #999;border: 1px #ccc dashed;display:block;height: 34px
|
||||
;line-height: 34px" href="javascript:addOption();">添加选项</a>
|
||||
</div>
|
||||
</div>
|
||||
<!--</div>-->
|
||||
|
||||
<!--<div class="form-group">-->
|
||||
<!--<label class="col-sm-3 control-label">标签:</label>-->
|
||||
<!--<div class="col-sm-8">-->
|
||||
<!--<input id="label" name="label" class="form-control" type="text">-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注信息:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="remarks" name="remarks" class="form-control" type="text" th:value="${examQuestion.remarks}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
if ($.validator) {
|
||||
$.validator.prototype.elements = function () {
|
||||
var validator = this,
|
||||
rulesCache = {};
|
||||
return $([]).add(this.currentForm.elements)
|
||||
.filter(":input")
|
||||
.not(":submit, :reset, :image, [disabled]")
|
||||
.not(this.settings.ignore)
|
||||
.filter(function () {
|
||||
debugger
|
||||
var elementIdentification = this.id || this.name;
|
||||
!elementIdentification && validator.settings.debug && window.console && console.error("%o has no id nor name assigned", this);
|
||||
if (elementIdentification in rulesCache || !validator.objectLength($(this).rules()))
|
||||
return false;
|
||||
rulesCache[elementIdentification] = true;
|
||||
return true;
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
var questionItem = $("#item").val();
|
||||
var questionAnswer = $("#answer").val();
|
||||
questionItem =$.parseJSON(questionItem)
|
||||
|
||||
for(var i in questionItem){
|
||||
var number = questionItem[i].number;
|
||||
if(number == "A"){
|
||||
$("#content1").val(questionItem[i].content);
|
||||
continue;
|
||||
}
|
||||
if(number == "B"){
|
||||
$("#content2").val(questionItem[i].content);
|
||||
continue;
|
||||
}
|
||||
|
||||
$("#addOption").before(' <div class="form-group update1" id="div'+item[index]+'"> <label class="col-sm-3 control-label"></label><div class="col-sm-1" style="padding-right: 0px;"> <input class="form-control update4" name="answer" value="'+item[index]+'" type="checkbox" style="margin: 0 0 0;">' +
|
||||
'</div><div class="col-sm-1" style="padding-right: 0px;padding-left: 0px"> ' +
|
||||
'<input style="padding: 6px 10px;text-align: center" id="number'+item[index]+'" name="number" class="form-control update2" type="text" value="'+item[index]+'" readonly> ' +
|
||||
'</div> <div class="col-sm-6" style="padding-left: 0px"> <input name="content" id = "con'+item[index]+'" class="form-control" type="text" value="'+questionItem[i].content+'"> </div> <div class="col-sm-1"> <a class="update3" style="text-align: center;color: #999;border: 1px #ccc dashed;display:block;height: 34px;line-height: 34px" href="javascript:deleteOption(\''+item[index++]+'\');">X</a> </div></div>')
|
||||
}
|
||||
|
||||
var radios = document.getElementsByName("answer");
|
||||
debugger
|
||||
for ( var i = 0; i < radios.length; i++) {
|
||||
|
||||
if (questionAnswer.indexOf(radios[i].value)!=-1) {
|
||||
radios[i].checked=true
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var item = ["C","D","E","F","G","H","I","G","K","L","M","N"];
|
||||
var index = 0;
|
||||
var prefix = ctx + "exam/examQuestion"
|
||||
$("#form-examQuestion-add").validate({
|
||||
rules:{
|
||||
title:{
|
||||
required:true,
|
||||
},
|
||||
content:{
|
||||
required:true,
|
||||
},
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
debugger
|
||||
if (!$.validate.form()) {
|
||||
return
|
||||
}
|
||||
|
||||
var radios = document.getElementsByName("answer");
|
||||
var i = 0
|
||||
for ( ; i < radios.length; i++) {
|
||||
|
||||
if (radios[i].checked == true) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i==radios.length){
|
||||
$.modal.alertError("请至少选择一个答案");
|
||||
return;
|
||||
}
|
||||
|
||||
$.operate.save(prefix + "/update", $('#form-examQuestion-add').serialize());
|
||||
}
|
||||
|
||||
|
||||
|
||||
function addOption(){
|
||||
$("#addOption").before(' <div class="form-group update1" id="div'+item[index]+'"> <label class="col-sm-3 control-label"></label><div class="col-sm-1" style="padding-right: 0px;"> <input class="form-control update4" name="answer" value="'+item[index]+'" type="checkbox" style="margin: 0 0 0;">' +
|
||||
'</div><div class="col-sm-1" style="padding-right: 0px;padding-left: 0px"> ' +
|
||||
'<input style="padding: 6px 10px;text-align: center" id="number'+item[index]+'" name="number" class="form-control update2" type="text" value="'+item[index]+'" readonly> ' +
|
||||
'</div> <div class="col-sm-6" style="padding-left: 0px"> <input name="content" id = "con'+item[index]+'" class="form-control" type="text"> </div> <div class="col-sm-1"> <a class="update3" style="text-align: center;color: #999;border: 1px #ccc dashed;display:block;height: 34px;line-height: 34px" href="javascript:deleteOption(\''+item[index++]+'\');">X</a> </div></div>')
|
||||
}
|
||||
|
||||
function deleteOption(id){
|
||||
debugger
|
||||
$("#div"+id).remove();
|
||||
index--;
|
||||
var index1 = 0;
|
||||
var index2 = 0;
|
||||
var index3 = 0;
|
||||
var index4 = 0
|
||||
$(".update1").each(function(){
|
||||
$(this).attr("id","div"+item[index1++])
|
||||
})
|
||||
$(".update2").each(function(){
|
||||
$(this).attr("value",item[index2++])
|
||||
})
|
||||
$(".update3").each(function(){
|
||||
$(this).attr("href",'javascript:deleteOption(\''+item[index3++]+'\');');
|
||||
})
|
||||
$(".update4").each(function(){
|
||||
$(this).attr("value",'javascript:deleteOption(\''+item[index4++]+'\');');
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -19,13 +19,12 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* 课程分类管理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/train/course/category")
|
||||
public class TrainCourseCategoryController extends BaseController
|
||||
{
|
||||
public class TrainCourseCategoryController extends BaseController {
|
||||
private String prefix = "course/category";
|
||||
|
||||
@Autowired
|
||||
|
|
@ -33,17 +32,15 @@ public class TrainCourseCategoryController extends BaseController
|
|||
|
||||
@RequiresPermissions("train:course:category:view")
|
||||
@GetMapping()
|
||||
public String dept()
|
||||
{
|
||||
return prefix + "/dept";
|
||||
public String dept() {
|
||||
return prefix + "/category";
|
||||
}
|
||||
|
||||
@RequiresPermissions("train:course:category:list")
|
||||
@GetMapping("/list")
|
||||
@ResponseBody
|
||||
public List<TrainCourseCategory> list(TrainCourseCategory dept)
|
||||
{
|
||||
List<TrainCourseCategory> deptList = trainCourseCategoryService.selectDeptList(dept);
|
||||
public List<TrainCourseCategory> list(TrainCourseCategory dept) {
|
||||
List<TrainCourseCategory> deptList = trainCourseCategoryService.selectDeptList( dept );
|
||||
return deptList;
|
||||
}
|
||||
|
||||
|
|
@ -51,9 +48,8 @@ public class TrainCourseCategoryController extends BaseController
|
|||
* 新增课程分类
|
||||
*/
|
||||
@GetMapping("/add/{parentId}")
|
||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dept", trainCourseCategoryService.selectDeptById(parentId));
|
||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) {
|
||||
mmap.put( "dept", trainCourseCategoryService.selectDeptById( parentId ) );
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
|
|
@ -64,24 +60,21 @@ public class TrainCourseCategoryController extends BaseController
|
|||
@RequiresPermissions("train:course:category:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(TrainCourseCategory dept)
|
||||
{
|
||||
dept.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(trainCourseCategoryService.insertDept(dept));
|
||||
public AjaxResult addSave(TrainCourseCategory dept) {
|
||||
dept.setCreateBy( ShiroUtils.getLoginName() );
|
||||
return toAjax( trainCourseCategoryService.insertDept( dept ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@GetMapping("/edit/{deptId}")
|
||||
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
||||
{
|
||||
TrainCourseCategory dept = trainCourseCategoryService.selectDeptById(deptId);
|
||||
if (StringUtils.isNotNull(dept) && 100L == deptId)
|
||||
{
|
||||
dept.setParentName("无");
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") Long id, ModelMap mmap) {
|
||||
TrainCourseCategory dept = trainCourseCategoryService.selectDeptById( id );
|
||||
if (StringUtils.isNotNull( dept ) && 100L == id) {
|
||||
dept.setParentName( "无" );
|
||||
}
|
||||
mmap.put("dept", dept);
|
||||
mmap.put( "dept", dept );
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
|
|
@ -92,10 +85,9 @@ public class TrainCourseCategoryController extends BaseController
|
|||
@RequiresPermissions("train:course:category:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(TrainCourseCategory dept)
|
||||
{
|
||||
dept.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(trainCourseCategoryService.updateDept(dept));
|
||||
public AjaxResult editSave(TrainCourseCategory dept) {
|
||||
dept.setUpdateBy( ShiroUtils.getLoginName() );
|
||||
return toAjax( trainCourseCategoryService.updateDept( dept ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -103,19 +95,16 @@ public class TrainCourseCategoryController extends BaseController
|
|||
*/
|
||||
@Log(title = "课程分类管理", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("train:course:category:remove")
|
||||
@PostMapping("/remove/{deptId}")
|
||||
@PostMapping("/remove/{id}")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(@PathVariable("deptId") Long deptId)
|
||||
{
|
||||
if (trainCourseCategoryService.selectDeptCount(deptId) > 0)
|
||||
{
|
||||
return error(1, "存在下级课程分类,不允许删除");
|
||||
public AjaxResult remove(@PathVariable("id") Long id) {
|
||||
if (trainCourseCategoryService.selectDeptCount( id ) > 0) {
|
||||
return error( 1, "存在下级课程分类,不允许删除" );
|
||||
}
|
||||
if (trainCourseCategoryService.checkDeptExistUser(deptId))
|
||||
{
|
||||
return error(1, "课程分类存在用户,不允许删除");
|
||||
if (trainCourseCategoryService.checkDeptExistUser( id )) {
|
||||
return error( 1, "课程分类存在用户,不允许删除" );
|
||||
}
|
||||
return toAjax(trainCourseCategoryService.deleteDeptById(deptId));
|
||||
return toAjax( trainCourseCategoryService.deleteDeptById( id ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -123,18 +112,16 @@ public class TrainCourseCategoryController extends BaseController
|
|||
*/
|
||||
@PostMapping("/checkDeptNameUnique")
|
||||
@ResponseBody
|
||||
public String checkDeptNameUnique(TrainCourseCategory dept)
|
||||
{
|
||||
return trainCourseCategoryService.checkDeptNameUnique(dept);
|
||||
public String checkDeptNameUnique(TrainCourseCategory dept) {
|
||||
return trainCourseCategoryService.checkDeptNameUnique( dept );
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择课程分类树
|
||||
*/
|
||||
@GetMapping("/selectDeptTree/{deptId}")
|
||||
public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dept", trainCourseCategoryService.selectDeptById(deptId));
|
||||
@GetMapping("/selectDeptTree/{id}")
|
||||
public String selectDeptTree(@PathVariable("id") Long id, ModelMap mmap) {
|
||||
mmap.put( "dept", trainCourseCategoryService.selectDeptById( id ) );
|
||||
return prefix + "/tree";
|
||||
}
|
||||
|
||||
|
|
@ -143,8 +130,7 @@ public class TrainCourseCategoryController extends BaseController
|
|||
*/
|
||||
@GetMapping("/treeData")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> treeData()
|
||||
{
|
||||
public List<Map<String, Object>> treeData() {
|
||||
List<Map<String, Object>> tree = trainCourseCategoryService.selectDeptTree();
|
||||
return tree;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,13 +19,12 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* 课件分类信息
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/train/courseware/category")
|
||||
public class TrainCoursewareCategoryController extends BaseController
|
||||
{
|
||||
public class TrainCoursewareCategoryController extends BaseController {
|
||||
private String prefix = "courseware/category";
|
||||
|
||||
@Autowired
|
||||
|
|
@ -33,27 +32,24 @@ public class TrainCoursewareCategoryController extends BaseController
|
|||
|
||||
@RequiresPermissions("train:courseware:category:view")
|
||||
@GetMapping()
|
||||
public String dept()
|
||||
{
|
||||
return prefix + "/dept";
|
||||
public String category() {
|
||||
return prefix + "/category";
|
||||
}
|
||||
|
||||
@RequiresPermissions("train:courseware:category:list")
|
||||
@GetMapping("/list")
|
||||
@ResponseBody
|
||||
public List<TrainCoursewareCategory> list(TrainCoursewareCategory dept)
|
||||
{
|
||||
List<TrainCoursewareCategory> deptList = trainCoursewareCategoryService.selectDeptList(dept);
|
||||
return deptList;
|
||||
public List<TrainCoursewareCategory> list(TrainCoursewareCategory category) {
|
||||
List<TrainCoursewareCategory> categoryList = trainCoursewareCategoryService.selectCategoryList( category );
|
||||
return categoryList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增课件分类
|
||||
*/
|
||||
@GetMapping("/add/{parentId}")
|
||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dept", trainCoursewareCategoryService.selectDeptById(parentId));
|
||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) {
|
||||
mmap.put( "category", trainCoursewareCategoryService.selectCategoryById( parentId ) );
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
|
|
@ -64,24 +60,21 @@ public class TrainCoursewareCategoryController extends BaseController
|
|||
@RequiresPermissions("train:courseware:category:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(TrainCoursewareCategory dept)
|
||||
{
|
||||
dept.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(trainCoursewareCategoryService.insertDept(dept));
|
||||
public AjaxResult addSave(TrainCoursewareCategory category) {
|
||||
category.setCreateBy( ShiroUtils.getLoginName() );
|
||||
return toAjax( trainCoursewareCategoryService.insertCategory( category ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@GetMapping("/edit/{deptId}")
|
||||
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
||||
{
|
||||
TrainCoursewareCategory dept = trainCoursewareCategoryService.selectDeptById(deptId);
|
||||
if (StringUtils.isNotNull(dept) && 100L == deptId)
|
||||
{
|
||||
dept.setParentName("无");
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") Long id, ModelMap mmap) {
|
||||
TrainCoursewareCategory category = trainCoursewareCategoryService.selectCategoryById( id );
|
||||
if (StringUtils.isNotNull( category ) && 100L == id) {
|
||||
category.setParentName( "无" );
|
||||
}
|
||||
mmap.put("dept", dept);
|
||||
mmap.put( "category", category );
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
|
|
@ -92,10 +85,9 @@ public class TrainCoursewareCategoryController extends BaseController
|
|||
@RequiresPermissions("train:courseware:category:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(TrainCoursewareCategory dept)
|
||||
{
|
||||
dept.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(trainCoursewareCategoryService.updateDept(dept));
|
||||
public AjaxResult editSave(TrainCoursewareCategory category) {
|
||||
category.setUpdateBy( ShiroUtils.getLoginName() );
|
||||
return toAjax( trainCoursewareCategoryService.updateCategory( category ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -103,38 +95,33 @@ public class TrainCoursewareCategoryController extends BaseController
|
|||
*/
|
||||
@Log(title = "课件分类管理", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("train:courseware:category:remove")
|
||||
@PostMapping("/remove/{deptId}")
|
||||
@PostMapping("/remove/{id}")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(@PathVariable("deptId") Long deptId)
|
||||
{
|
||||
if (trainCoursewareCategoryService.selectDeptCount(deptId) > 0)
|
||||
{
|
||||
return error(1, "存在下级课件分类,不允许删除");
|
||||
public AjaxResult remove(@PathVariable("id") Long id) {
|
||||
if (trainCoursewareCategoryService.selectCategoryCount( id ) > 0) {
|
||||
return error( 1, "存在下级课件分类,不允许删除" );
|
||||
}
|
||||
if (trainCoursewareCategoryService.checkDeptExistUser(deptId))
|
||||
{
|
||||
return error(1, "课件分类存在用户,不允许删除");
|
||||
if (trainCoursewareCategoryService.checkCategoryExistCourseware( id )) {
|
||||
return error( 1, "课件分类存在课件,不允许删除" );
|
||||
}
|
||||
return toAjax(trainCoursewareCategoryService.deleteDeptById(deptId));
|
||||
return toAjax( trainCoursewareCategoryService.deleteCategoryById( id ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验课件分类名称
|
||||
*/
|
||||
@PostMapping("/checkDeptNameUnique")
|
||||
@PostMapping("/checkCategoryNameUnique")
|
||||
@ResponseBody
|
||||
public String checkDeptNameUnique(TrainCoursewareCategory dept)
|
||||
{
|
||||
return trainCoursewareCategoryService.checkDeptNameUnique(dept);
|
||||
public String checkCategoryNameUnique(TrainCoursewareCategory category) {
|
||||
return trainCoursewareCategoryService.checkCategoryNameUnique( category );
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择课件分类树
|
||||
*/
|
||||
@GetMapping("/selectDeptTree/{deptId}")
|
||||
public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dept", trainCoursewareCategoryService.selectDeptById(deptId));
|
||||
@GetMapping("/selectCategoryTree/{id}")
|
||||
public String selectCategoryTree(@PathVariable("id") Long id, ModelMap mmap) {
|
||||
mmap.put( "category", trainCoursewareCategoryService.selectCategoryById( id ) );
|
||||
return prefix + "/tree";
|
||||
}
|
||||
|
||||
|
|
@ -143,9 +130,8 @@ public class TrainCoursewareCategoryController extends BaseController
|
|||
*/
|
||||
@GetMapping("/treeData")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> treeData()
|
||||
{
|
||||
List<Map<String, Object>> tree = trainCoursewareCategoryService.selectDeptTree();
|
||||
public List<Map<String, Object>> treeData() {
|
||||
List<Map<String, Object>> tree = trainCoursewareCategoryService.selectCategoryTree();
|
||||
return tree;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,86 +11,78 @@ import java.util.List;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface TrainCoursewareCategoryMapper extends MyMapper<TrainCoursewareCategory>
|
||||
{
|
||||
public interface TrainCoursewareCategoryMapper extends MyMapper<TrainCoursewareCategory> {
|
||||
/**
|
||||
* 查询课件分类人数
|
||||
*
|
||||
* @param dept 课件分类信息
|
||||
* @param category 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int selectDeptCount(TrainCoursewareCategory dept);
|
||||
public int selectCategoryCount(TrainCoursewareCategory category);
|
||||
|
||||
/**
|
||||
* 查询课件分类是否存在用户
|
||||
*
|
||||
* @param deptId 课件分类ID
|
||||
* @param id 课件分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int checkDeptExistUser(Long deptId);
|
||||
public int checkCategoryExistCourseware(Long id);
|
||||
|
||||
/**
|
||||
* 查询课件分类管理数据
|
||||
*
|
||||
* @param dept 课件分类信息
|
||||
* @param category 课件分类信息
|
||||
* @return 课件分类信息集合
|
||||
*/
|
||||
public List<TrainCoursewareCategory> selectDeptList(TrainCoursewareCategory dept);
|
||||
public List<TrainCoursewareCategory> selectCategoryList(TrainCoursewareCategory category);
|
||||
|
||||
/**
|
||||
* 删除课件分类管理信息
|
||||
*
|
||||
* @param deptId 课件分类ID
|
||||
* @param id 课件分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptById(Long deptId);
|
||||
public int deleteCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 新增课件分类信息
|
||||
*
|
||||
* @param dept 课件分类信息
|
||||
* @param category 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDept(TrainCoursewareCategory dept);
|
||||
public int insertCategory(TrainCoursewareCategory category);
|
||||
|
||||
/**
|
||||
* 修改课件分类信息
|
||||
*
|
||||
* @param dept 课件分类信息
|
||||
* @param category 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDept(TrainCoursewareCategory dept);
|
||||
public int updateCategory(TrainCoursewareCategory category);
|
||||
|
||||
/**
|
||||
* 修改子元素关系
|
||||
*
|
||||
* @param depts 子元素
|
||||
* @param categorys 子元素
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeptChildren(@Param("depts") List<TrainCoursewareCategory> depts);
|
||||
public int updateCategoryChildren(@Param("categorys") List<TrainCoursewareCategory> categorys);
|
||||
|
||||
/**
|
||||
* 根据课件分类ID查询信息
|
||||
*
|
||||
* @param deptId 课件分类ID
|
||||
* @param id 课件分类ID
|
||||
* @return 课件分类信息
|
||||
*/
|
||||
public TrainCoursewareCategory selectDeptById(Long deptId);
|
||||
public TrainCoursewareCategory selectCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 校验课件分类名称是否唯一
|
||||
*
|
||||
* @param deptName 课件分类名称
|
||||
* @param name 课件分类名称
|
||||
* @param parentId 父课件分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public TrainCoursewareCategory checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
|
||||
public TrainCoursewareCategory checkCategoryNameUnique(@Param("name") String name, @Param("parentId") Long parentId);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询课件分类
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 课件分类列表
|
||||
*/
|
||||
public List<String> selectRoleDeptTree(Long roleId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,81 +8,81 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* 课件分类管理 服务层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ITrainCoursewareCategoryService extends AbstractBaseService<TrainCoursewareCategory>
|
||||
{
|
||||
/**
|
||||
* 查询课件分类管理数据
|
||||
*
|
||||
* @param dept 课件分类信息
|
||||
*
|
||||
* @param category 课件分类信息
|
||||
* @return 课件分类信息集合
|
||||
*/
|
||||
public List<TrainCoursewareCategory> selectDeptList(TrainCoursewareCategory dept);
|
||||
public List<TrainCoursewareCategory> selectCategoryList(TrainCoursewareCategory category);
|
||||
|
||||
/**
|
||||
* 查询课件分类管理树
|
||||
*
|
||||
*
|
||||
* @return 所有课件分类信息
|
||||
*/
|
||||
public List<Map<String, Object>> selectDeptTree();
|
||||
public List<Map<String, Object>> selectCategoryTree();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询课件分类人数
|
||||
*
|
||||
*
|
||||
* @param parentId 父课件分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int selectDeptCount(Long parentId);
|
||||
public int selectCategoryCount(Long parentId);
|
||||
|
||||
/**
|
||||
* 查询课件分类是否存在用户
|
||||
*
|
||||
* @param deptId 课件分类ID
|
||||
*
|
||||
* @param id 课件分类ID
|
||||
* @return 结果 true 存在 false 不存在
|
||||
*/
|
||||
public boolean checkDeptExistUser(Long deptId);
|
||||
public boolean checkCategoryExistCourseware(Long id);
|
||||
|
||||
/**
|
||||
* 删除课件分类管理信息
|
||||
*
|
||||
* @param deptId 课件分类ID
|
||||
*
|
||||
* @param id 课件分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptById(Long deptId);
|
||||
public int deleteCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 新增保存课件分类信息
|
||||
*
|
||||
* @param dept 课件分类信息
|
||||
*
|
||||
* @param category 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDept(TrainCoursewareCategory dept);
|
||||
public int insertCategory(TrainCoursewareCategory category);
|
||||
|
||||
/**
|
||||
* 修改保存课件分类信息
|
||||
*
|
||||
* @param dept 课件分类信息
|
||||
*
|
||||
* @param category 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDept(TrainCoursewareCategory dept);
|
||||
public int updateCategory(TrainCoursewareCategory category);
|
||||
|
||||
/**
|
||||
* 根据课件分类ID查询信息
|
||||
*
|
||||
* @param deptId 课件分类ID
|
||||
*
|
||||
* @param id 课件分类ID
|
||||
* @return 课件分类信息
|
||||
*/
|
||||
public TrainCoursewareCategory selectDeptById(Long deptId);
|
||||
public TrainCoursewareCategory selectCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 校验课件分类名称是否唯一
|
||||
*
|
||||
* @param dept 课件分类信息
|
||||
*
|
||||
* @param category 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkDeptNameUnique(TrainCoursewareCategory dept);
|
||||
public String checkCategoryNameUnique(TrainCoursewareCategory category);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
|
|||
*/
|
||||
@Override
|
||||
@DataScope(tableAlias = "d")
|
||||
public List<TrainCoursewareCategory> selectDeptList(TrainCoursewareCategory dept) {
|
||||
return trainCoursewareCategoryMapper.selectDeptList( dept );
|
||||
public List<TrainCoursewareCategory> selectCategoryList(TrainCoursewareCategory dept) {
|
||||
return trainCoursewareCategoryMapper.selectCategoryList( dept );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -41,9 +41,9 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
|
|||
* @return 所有课件分类信息
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> selectDeptTree() {
|
||||
public List<Map<String, Object>> selectCategoryTree() {
|
||||
List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
|
||||
List<TrainCoursewareCategory> deptList = selectDeptList( new TrainCoursewareCategory() );
|
||||
List<TrainCoursewareCategory> deptList = selectCategoryList( new TrainCoursewareCategory() );
|
||||
trees = getTrees( deptList, false, null );
|
||||
return trees;
|
||||
}
|
||||
|
|
@ -54,10 +54,10 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
|
|||
*
|
||||
* @param deptList 课件分类列表
|
||||
* @param isCheck 是否需要选中
|
||||
* @param roleDeptList 角色已存在菜单列表
|
||||
* @param roleCategoryList 角色已存在菜单列表
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getTrees(List<TrainCoursewareCategory> deptList, boolean isCheck, List<String> roleDeptList) {
|
||||
public List<Map<String, Object>> getTrees(List<TrainCoursewareCategory> deptList, boolean isCheck, List<String> roleCategoryList) {
|
||||
|
||||
List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
|
||||
for (TrainCoursewareCategory dept : deptList) {
|
||||
|
|
@ -68,7 +68,7 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
|
|||
deptMap.put( "name", dept.getName() );
|
||||
deptMap.put( "title", dept.getName() );
|
||||
if (isCheck) {
|
||||
deptMap.put( "checked", roleDeptList.contains( dept.getDeptId() + dept.getName() ) );
|
||||
deptMap.put( "checked", roleCategoryList.contains( dept.getId() + dept.getName() ) );
|
||||
} else {
|
||||
deptMap.put( "checked", false );
|
||||
}
|
||||
|
|
@ -85,10 +85,10 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int selectDeptCount(Long parentId) {
|
||||
public int selectCategoryCount(Long parentId) {
|
||||
TrainCoursewareCategory dept = new TrainCoursewareCategory();
|
||||
dept.setParentId( parentId );
|
||||
return trainCoursewareCategoryMapper.selectDeptCount( dept );
|
||||
return trainCoursewareCategoryMapper.selectCategoryCount( dept );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -98,8 +98,8 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
|
|||
* @return 结果 true 存在 false 不存在
|
||||
*/
|
||||
@Override
|
||||
public boolean checkDeptExistUser(Long deptId) {
|
||||
int result = trainCoursewareCategoryMapper.checkDeptExistUser( deptId );
|
||||
public boolean checkCategoryExistCourseware(Long deptId) {
|
||||
int result = trainCoursewareCategoryMapper.checkCategoryExistCourseware( deptId );
|
||||
return result > 0 ? true : false;
|
||||
}
|
||||
|
||||
|
|
@ -110,8 +110,8 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDeptById(Long deptId) {
|
||||
return trainCoursewareCategoryMapper.deleteDeptById( deptId );
|
||||
public int deleteCategoryById(Long deptId) {
|
||||
return trainCoursewareCategoryMapper.deleteCategoryById( deptId );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -121,27 +121,27 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDept(TrainCoursewareCategory dept) {
|
||||
TrainCoursewareCategory info = trainCoursewareCategoryMapper.selectDeptById( dept.getParentId() );
|
||||
public int insertCategory(TrainCoursewareCategory dept) {
|
||||
TrainCoursewareCategory info = trainCoursewareCategoryMapper.selectCategoryById( dept.getParentId() );
|
||||
dept.setParentIds( info.getParentIds() + "," + dept.getParentId() );
|
||||
return trainCoursewareCategoryMapper.insertDept( dept );
|
||||
return trainCoursewareCategoryMapper.insertCategory( dept );
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存课件分类信息
|
||||
*
|
||||
* @param dept 课件分类信息
|
||||
* @param category 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDept(TrainCoursewareCategory dept) {
|
||||
TrainCoursewareCategory info = trainCoursewareCategoryMapper.selectDeptById( dept.getParentId() );
|
||||
public int updateCategory(TrainCoursewareCategory category) {
|
||||
TrainCoursewareCategory info = trainCoursewareCategoryMapper.selectCategoryById( category.getParentId() );
|
||||
if (StringUtils.isNotNull( info )) {
|
||||
String ancestors = info.getParentIds() + "," + dept.getParentId();
|
||||
dept.setParentIds( ancestors );
|
||||
updateDeptChildren( dept.getDeptId(), ancestors );
|
||||
String ancestors = info.getParentIds() + "," + category.getParentId();
|
||||
category.setParentIds( ancestors );
|
||||
updateCategoryChildren( category.getId(), ancestors );
|
||||
}
|
||||
return trainCoursewareCategoryMapper.updateDept( dept );
|
||||
return trainCoursewareCategoryMapper.updateCategory( category );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -150,15 +150,15 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
|
|||
* @param deptId 课件分类ID
|
||||
* @param ancestors 元素列表
|
||||
*/
|
||||
public void updateDeptChildren(Long deptId, String ancestors) {
|
||||
public void updateCategoryChildren(Long deptId, String ancestors) {
|
||||
TrainCoursewareCategory dept = new TrainCoursewareCategory();
|
||||
dept.setParentId( deptId );
|
||||
List<TrainCoursewareCategory> childrens = trainCoursewareCategoryMapper.selectDeptList( dept );
|
||||
List<TrainCoursewareCategory> childrens = trainCoursewareCategoryMapper.selectCategoryList( dept );
|
||||
for (TrainCoursewareCategory children : childrens) {
|
||||
children.setParentIds( ancestors + "," + dept.getParentId() );
|
||||
}
|
||||
if (childrens.size() > 0) {
|
||||
trainCoursewareCategoryMapper.updateDeptChildren( childrens );
|
||||
trainCoursewareCategoryMapper.updateCategoryChildren( childrens );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -169,8 +169,8 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
|
|||
* @return 课件分类信息
|
||||
*/
|
||||
@Override
|
||||
public TrainCoursewareCategory selectDeptById(Long deptId) {
|
||||
return trainCoursewareCategoryMapper.selectDeptById( deptId );
|
||||
public TrainCoursewareCategory selectCategoryById(Long id) {
|
||||
return trainCoursewareCategoryMapper.selectCategoryById( id );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -180,10 +180,10 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkDeptNameUnique(TrainCoursewareCategory dept) {
|
||||
Long deptId = StringUtils.isNull( dept.getDeptId() ) ? -1L : dept.getDeptId();
|
||||
TrainCoursewareCategory info = trainCoursewareCategoryMapper.checkDeptNameUnique( dept.getName(), dept.getParentId() );
|
||||
if (StringUtils.isNotNull( info ) && info.getDeptId().longValue() != deptId.longValue()) {
|
||||
public String checkCategoryNameUnique(TrainCoursewareCategory dept) {
|
||||
Long deptId = StringUtils.isNull( dept.getId() ) ? -1L : dept.getId();
|
||||
TrainCoursewareCategory info = trainCoursewareCategoryMapper.checkCategoryNameUnique( dept.getName(), dept.getParentId() );
|
||||
if (StringUtils.isNotNull( info ) && info.getId().longValue() != deptId.longValue()) {
|
||||
return UserConstants.DEPT_NAME_NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.DEPT_NAME_UNIQUE;
|
||||
|
|
|
|||
|
|
@ -1,126 +0,0 @@
|
|||
package com.ruoyi.web.controller.exam;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.exam.domain.TrainCourseCategory;
|
||||
import com.ruoyi.exam.service.ITrainCourseCategoryService;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.common.utils.ExcelUtil;
|
||||
|
||||
/**
|
||||
* 课程分类 信息操作处理
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-12
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/exam/trainCourseCategory")
|
||||
public class TrainCourseCategoryController extends BaseController
|
||||
{
|
||||
private String prefix = "exam/trainCourseCategory";
|
||||
|
||||
@Autowired
|
||||
private ITrainCourseCategoryService trainCourseCategoryService;
|
||||
|
||||
@RequiresPermissions("exam:trainCourseCategory:view")
|
||||
@GetMapping()
|
||||
public String trainCourseCategory()
|
||||
{
|
||||
return prefix + "/trainCourseCategory";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询课程分类列表
|
||||
*/
|
||||
@RequiresPermissions("exam:trainCourseCategory:list")
|
||||
@GetMapping("/list")
|
||||
@ResponseBody
|
||||
public List<TrainCourseCategory> list(TrainCourseCategory trainCourseCategory)
|
||||
{
|
||||
List<TrainCourseCategory> list = trainCourseCategoryService.selectTrainCourseCategoryPage(trainCourseCategory);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出课程分类列表
|
||||
*/
|
||||
@RequiresPermissions("exam:trainCourseCategory:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(TrainCourseCategory trainCourseCategory)
|
||||
{
|
||||
List<TrainCourseCategory> list = trainCourseCategoryService.selectTrainCourseCategoryList(trainCourseCategory);
|
||||
ExcelUtil<TrainCourseCategory> util = new ExcelUtil<TrainCourseCategory>(TrainCourseCategory.class);
|
||||
return util.exportExcel(list, "trainCourseCategory");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增课程分类
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存课程分类
|
||||
*/
|
||||
@RequiresPermissions("exam:trainCourseCategory:add")
|
||||
@Log(title = "课程分类", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(TrainCourseCategory trainCourseCategory)
|
||||
{
|
||||
return toAjax(trainCourseCategoryService.insert(trainCourseCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改课程分类
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||
{
|
||||
TrainCourseCategory trainCourseCategory = trainCourseCategoryService.selectById(id);
|
||||
mmap.put("trainCourseCategory", trainCourseCategory);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存课程分类
|
||||
*/
|
||||
@RequiresPermissions("exam:trainCourseCategory:edit")
|
||||
@Log(title = "课程分类", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(TrainCourseCategory trainCourseCategory)
|
||||
{
|
||||
return toAjax(trainCourseCategoryService.updateById(trainCourseCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除课程分类
|
||||
*/
|
||||
@RequiresPermissions("exam:trainCourseCategory:remove")
|
||||
@Log(title = "课程分类", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(trainCourseCategoryService.deleteByIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
package com.ruoyi.web.controller.exam;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.exam.domain.TrainCoursewareCategory;
|
||||
import com.ruoyi.exam.service.ITrainCoursewareCategoryService;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.common.utils.ExcelUtil;
|
||||
|
||||
/**
|
||||
* 课件分类 信息操作处理
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-12
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/exam/trainCoursewareCategory")
|
||||
public class TrainCoursewareCategoryController extends BaseController
|
||||
{
|
||||
private String prefix = "exam/trainCoursewareCategory";
|
||||
|
||||
@Autowired
|
||||
private ITrainCoursewareCategoryService trainCoursewareCategoryService;
|
||||
|
||||
@RequiresPermissions("exam:trainCoursewareCategory:view")
|
||||
@GetMapping()
|
||||
public String trainCoursewareCategory()
|
||||
{
|
||||
return prefix + "/trainCoursewareCategory";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询课件分类列表
|
||||
*/
|
||||
@RequiresPermissions("exam:trainCoursewareCategory:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(TrainCoursewareCategory trainCoursewareCategory)
|
||||
{
|
||||
List<TrainCoursewareCategory> list = trainCoursewareCategoryService.selectTrainCoursewareCategoryPage(trainCoursewareCategory);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出课件分类列表
|
||||
*/
|
||||
@RequiresPermissions("exam:trainCoursewareCategory:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(TrainCoursewareCategory trainCoursewareCategory)
|
||||
{
|
||||
List<TrainCoursewareCategory> list = trainCoursewareCategoryService.selectTrainCoursewareCategoryList(trainCoursewareCategory);
|
||||
ExcelUtil<TrainCoursewareCategory> util = new ExcelUtil<TrainCoursewareCategory>(TrainCoursewareCategory.class);
|
||||
return util.exportExcel(list, "trainCoursewareCategory");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增课件分类
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存课件分类
|
||||
*/
|
||||
@RequiresPermissions("exam:trainCoursewareCategory:add")
|
||||
@Log(title = "课件分类", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(TrainCoursewareCategory trainCoursewareCategory)
|
||||
{
|
||||
return toAjax(trainCoursewareCategoryService.insert(trainCoursewareCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改课件分类
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||
{
|
||||
TrainCoursewareCategory trainCoursewareCategory = trainCoursewareCategoryService.selectById(id);
|
||||
mmap.put("trainCoursewareCategory", trainCoursewareCategory);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存课件分类
|
||||
*/
|
||||
@RequiresPermissions("exam:trainCoursewareCategory:edit")
|
||||
@Log(title = "课件分类", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(TrainCoursewareCategory trainCoursewareCategory)
|
||||
{
|
||||
return toAjax(trainCoursewareCategoryService.updateById(trainCoursewareCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除课件分类
|
||||
*/
|
||||
@RequiresPermissions("exam:trainCoursewareCategory:remove")
|
||||
@Log(title = "课件分类", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(trainCoursewareCategoryService.deleteByIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,194 +0,0 @@
|
|||
package com.ruoyi.exam.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.base.BaseEntity;
|
||||
import javax.persistence.Id;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 课程分类表 train_course_category
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-12
|
||||
*/
|
||||
public class TrainCourseCategory
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 部门id */
|
||||
@Id
|
||||
private Integer id;
|
||||
/** 部门ID */
|
||||
private Integer deptId;
|
||||
/** 父部门id */
|
||||
private Integer parentId;
|
||||
/** 祖级列表 */
|
||||
private String parentIds;
|
||||
/** 分类名称 */
|
||||
private String name;
|
||||
/** 显示顺序 */
|
||||
private Integer orderNum;
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
/** 创建时间 */
|
||||
private Date createTime;
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
/** 更新时间 */
|
||||
private Date updateTime;
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 设置部门id */
|
||||
public void setId(Integer id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/** 获取部门id */
|
||||
public Integer getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
/** 设置部门ID */
|
||||
public void setDeptId(Integer deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
/** 获取部门ID */
|
||||
public Integer getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
/** 设置父部门id */
|
||||
public void setParentId(Integer parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
/** 获取父部门id */
|
||||
public Integer getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
/** 设置祖级列表 */
|
||||
public void setParentIds(String parentIds)
|
||||
{
|
||||
this.parentIds = parentIds;
|
||||
}
|
||||
|
||||
/** 获取祖级列表 */
|
||||
public String getParentIds()
|
||||
{
|
||||
return parentIds;
|
||||
}
|
||||
/** 设置分类名称 */
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/** 获取分类名称 */
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
/** 设置显示顺序 */
|
||||
public void setOrderNum(Integer orderNum)
|
||||
{
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
/** 获取显示顺序 */
|
||||
public Integer getOrderNum()
|
||||
{
|
||||
return orderNum;
|
||||
}
|
||||
/** 设置删除标志(0代表存在 2代表删除) */
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
/** 获取删除标志(0代表存在 2代表删除) */
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
/** 设置创建者 */
|
||||
public void setCreateBy(String createBy)
|
||||
{
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
/** 获取创建者 */
|
||||
public String getCreateBy()
|
||||
{
|
||||
return createBy;
|
||||
}
|
||||
/** 设置创建时间 */
|
||||
public void setCreateTime(Date createTime)
|
||||
{
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/** 获取创建时间 */
|
||||
public Date getCreateTime()
|
||||
{
|
||||
return createTime;
|
||||
}
|
||||
/** 设置更新者 */
|
||||
public void setUpdateBy(String updateBy)
|
||||
{
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
/** 获取更新者 */
|
||||
public String getUpdateBy()
|
||||
{
|
||||
return updateBy;
|
||||
}
|
||||
/** 设置更新时间 */
|
||||
public void setUpdateTime(Date updateTime)
|
||||
{
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/** 获取更新时间 */
|
||||
public Date getUpdateTime()
|
||||
{
|
||||
return updateTime;
|
||||
}
|
||||
/** 设置备注 */
|
||||
public void setRemark(String remark)
|
||||
{
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
/** 获取备注 */
|
||||
public String getRemark()
|
||||
{
|
||||
return remark;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("parentId", getParentId())
|
||||
.append("parentIds", getParentIds())
|
||||
.append("name", getName())
|
||||
.append("orderNum", getOrderNum())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,194 +0,0 @@
|
|||
package com.ruoyi.exam.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.base.BaseEntity;
|
||||
import javax.persistence.Id;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 课件分类表 train_courseware_category
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-12
|
||||
*/
|
||||
public class TrainCoursewareCategory
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 部门id */
|
||||
@Id
|
||||
private Integer id;
|
||||
/** 部门ID */
|
||||
private Integer deptId;
|
||||
/** 父部门id */
|
||||
private Integer parentId;
|
||||
/** 祖级列表 */
|
||||
private String parentIds;
|
||||
/** 部门名称 */
|
||||
private String name;
|
||||
/** 显示顺序 */
|
||||
private Integer orderNum;
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
/** 创建时间 */
|
||||
private Date createTime;
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
/** 更新时间 */
|
||||
private Date updateTime;
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 设置部门id */
|
||||
public void setId(Integer id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/** 获取部门id */
|
||||
public Integer getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
/** 设置部门ID */
|
||||
public void setDeptId(Integer deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
/** 获取部门ID */
|
||||
public Integer getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
/** 设置父部门id */
|
||||
public void setParentId(Integer parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
/** 获取父部门id */
|
||||
public Integer getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
/** 设置祖级列表 */
|
||||
public void setParentIds(String parentIds)
|
||||
{
|
||||
this.parentIds = parentIds;
|
||||
}
|
||||
|
||||
/** 获取祖级列表 */
|
||||
public String getParentIds()
|
||||
{
|
||||
return parentIds;
|
||||
}
|
||||
/** 设置部门名称 */
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/** 获取部门名称 */
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
/** 设置显示顺序 */
|
||||
public void setOrderNum(Integer orderNum)
|
||||
{
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
/** 获取显示顺序 */
|
||||
public Integer getOrderNum()
|
||||
{
|
||||
return orderNum;
|
||||
}
|
||||
/** 设置删除标志(0代表存在 2代表删除) */
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
/** 获取删除标志(0代表存在 2代表删除) */
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
/** 设置创建者 */
|
||||
public void setCreateBy(String createBy)
|
||||
{
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
/** 获取创建者 */
|
||||
public String getCreateBy()
|
||||
{
|
||||
return createBy;
|
||||
}
|
||||
/** 设置创建时间 */
|
||||
public void setCreateTime(Date createTime)
|
||||
{
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/** 获取创建时间 */
|
||||
public Date getCreateTime()
|
||||
{
|
||||
return createTime;
|
||||
}
|
||||
/** 设置更新者 */
|
||||
public void setUpdateBy(String updateBy)
|
||||
{
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
/** 获取更新者 */
|
||||
public String getUpdateBy()
|
||||
{
|
||||
return updateBy;
|
||||
}
|
||||
/** 设置更新时间 */
|
||||
public void setUpdateTime(Date updateTime)
|
||||
{
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/** 获取更新时间 */
|
||||
public Date getUpdateTime()
|
||||
{
|
||||
return updateTime;
|
||||
}
|
||||
/** 设置备注 */
|
||||
public void setRemark(String remark)
|
||||
{
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
/** 获取备注 */
|
||||
public String getRemark()
|
||||
{
|
||||
return remark;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("parentId", getParentId())
|
||||
.append("parentIds", getParentIds())
|
||||
.append("name", getName())
|
||||
.append("orderNum", getOrderNum())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package com.ruoyi.exam.mapper;
|
||||
|
||||
import com.ruoyi.exam.domain.TrainCourseCategory;
|
||||
import java.util.List;
|
||||
import com.ruoyi.framework.web.base.MyMapper;
|
||||
|
||||
/**
|
||||
* 课程分类 数据层
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-12
|
||||
*/
|
||||
public interface TrainCourseCategoryMapper extends MyMapper<TrainCourseCategory>
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询课程分类列表
|
||||
*
|
||||
* @param trainCourseCategory 课程分类信息
|
||||
* @return 课程分类集合
|
||||
*/
|
||||
public List<TrainCourseCategory> selectTrainCourseCategoryList(TrainCourseCategory trainCourseCategory);
|
||||
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package com.ruoyi.exam.mapper;
|
||||
|
||||
import com.ruoyi.exam.domain.TrainCoursewareCategory;
|
||||
import java.util.List;
|
||||
import com.ruoyi.framework.web.base.MyMapper;
|
||||
|
||||
/**
|
||||
* 课件分类 数据层
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-12
|
||||
*/
|
||||
public interface TrainCoursewareCategoryMapper extends MyMapper<TrainCoursewareCategory>
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询课件分类列表
|
||||
*
|
||||
* @param trainCoursewareCategory 课件分类信息
|
||||
* @return 课件分类集合
|
||||
*/
|
||||
public List<TrainCoursewareCategory> selectTrainCoursewareCategoryList(TrainCoursewareCategory trainCoursewareCategory);
|
||||
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
package com.ruoyi.exam.service;
|
||||
|
||||
import com.ruoyi.exam.domain.TrainCourseCategory;
|
||||
import java.util.List;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||
/**
|
||||
* 课程分类 服务层
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-12
|
||||
*/
|
||||
public interface ITrainCourseCategoryService extends AbstractBaseService<TrainCourseCategory>
|
||||
{
|
||||
/**
|
||||
* 查询课程分类分页列表
|
||||
*
|
||||
* @param trainCourseCategory 课程分类信息
|
||||
* @return 课程分类集合
|
||||
*/
|
||||
public List<TrainCourseCategory> selectTrainCourseCategoryPage(TrainCourseCategory trainCourseCategory);
|
||||
/**
|
||||
* 查询课程分类列表
|
||||
*
|
||||
* @param trainCourseCategory 课程分类信息
|
||||
* @return 课程分类集合
|
||||
*/
|
||||
public List<TrainCourseCategory> selectTrainCourseCategoryList(TrainCourseCategory trainCourseCategory);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
package com.ruoyi.exam.service;
|
||||
|
||||
import com.ruoyi.exam.domain.TrainCoursewareCategory;
|
||||
import java.util.List;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||
/**
|
||||
* 课件分类 服务层
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-12
|
||||
*/
|
||||
public interface ITrainCoursewareCategoryService extends AbstractBaseService<TrainCoursewareCategory>
|
||||
{
|
||||
/**
|
||||
* 查询课件分类分页列表
|
||||
*
|
||||
* @param trainCoursewareCategory 课件分类信息
|
||||
* @return 课件分类集合
|
||||
*/
|
||||
public List<TrainCoursewareCategory> selectTrainCoursewareCategoryPage(TrainCoursewareCategory trainCoursewareCategory);
|
||||
/**
|
||||
* 查询课件分类列表
|
||||
*
|
||||
* @param trainCoursewareCategory 课件分类信息
|
||||
* @return 课件分类集合
|
||||
*/
|
||||
public List<TrainCoursewareCategory> selectTrainCoursewareCategoryList(TrainCoursewareCategory trainCoursewareCategory);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
package com.ruoyi.exam.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.exam.mapper.TrainCourseCategoryMapper;
|
||||
import com.ruoyi.exam.domain.TrainCourseCategory;
|
||||
import com.ruoyi.exam.service.ITrainCourseCategoryService;
|
||||
import com.ruoyi.common.support.Convert;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
|
||||
/**
|
||||
* 课程分类 服务层实现
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-12
|
||||
*/
|
||||
@Service
|
||||
public class TrainCourseCategoryServiceImpl extends AbstractBaseServiceImpl<TrainCourseCategoryMapper,TrainCourseCategory> implements ITrainCourseCategoryService
|
||||
{
|
||||
@Autowired
|
||||
private TrainCourseCategoryMapper trainCourseCategoryMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询课程分类列表
|
||||
*
|
||||
* @param trainCourseCategory 课程分类信息
|
||||
* @return 课程分类集合
|
||||
*/
|
||||
@Override
|
||||
public List<TrainCourseCategory> selectTrainCourseCategoryList(TrainCourseCategory trainCourseCategory)
|
||||
{
|
||||
return trainCourseCategoryMapper.selectTrainCourseCategoryList(trainCourseCategory);
|
||||
}
|
||||
/**
|
||||
* 查询课程分类分页列表
|
||||
*
|
||||
* @param trainCourseCategory 课程分类信息
|
||||
* @return 课程分类集合
|
||||
*/
|
||||
@Override
|
||||
public List<TrainCourseCategory> selectTrainCourseCategoryPage(TrainCourseCategory trainCourseCategory)
|
||||
{
|
||||
startPage();
|
||||
return trainCourseCategoryMapper.selectTrainCourseCategoryList(trainCourseCategory);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
package com.ruoyi.exam.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.exam.mapper.TrainCoursewareCategoryMapper;
|
||||
import com.ruoyi.exam.domain.TrainCoursewareCategory;
|
||||
import com.ruoyi.exam.service.ITrainCoursewareCategoryService;
|
||||
import com.ruoyi.common.support.Convert;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
|
||||
/**
|
||||
* 课件分类 服务层实现
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-12
|
||||
*/
|
||||
@Service
|
||||
public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<TrainCoursewareCategoryMapper,TrainCoursewareCategory> implements ITrainCoursewareCategoryService
|
||||
{
|
||||
@Autowired
|
||||
private TrainCoursewareCategoryMapper trainCoursewareCategoryMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询课件分类列表
|
||||
*
|
||||
* @param trainCoursewareCategory 课件分类信息
|
||||
* @return 课件分类集合
|
||||
*/
|
||||
@Override
|
||||
public List<TrainCoursewareCategory> selectTrainCoursewareCategoryList(TrainCoursewareCategory trainCoursewareCategory)
|
||||
{
|
||||
return trainCoursewareCategoryMapper.selectTrainCoursewareCategoryList(trainCoursewareCategory);
|
||||
}
|
||||
/**
|
||||
* 查询课件分类分页列表
|
||||
*
|
||||
* @param trainCoursewareCategory 课件分类信息
|
||||
* @return 课件分类集合
|
||||
*/
|
||||
@Override
|
||||
public List<TrainCoursewareCategory> selectTrainCoursewareCategoryPage(TrainCoursewareCategory trainCoursewareCategory)
|
||||
{
|
||||
startPage();
|
||||
return trainCoursewareCategoryMapper.selectTrainCoursewareCategoryList(trainCoursewareCategory);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -21,11 +21,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<sql id="selectDeptVo">
|
||||
select d.id,d.dept_id, d.parent_id, d.parent_ids, d.name, d.order_num, d.del_flag, d.create_by, d.create_time
|
||||
from train_courseware_category d
|
||||
from train_course_category d
|
||||
</sql>
|
||||
<select id="selectRoleDeptTree" parameterType="Long" resultType="String">
|
||||
select concat(d.id, d.name) as name
|
||||
from train_courseware_category d
|
||||
from train_course_category d
|
||||
left join sys_role_dept rd on d.id = rd.id
|
||||
where d.del_flag = '0' and rd.role_id = #{roleId}
|
||||
order by d.parent_id, d.order_num
|
||||
|
|
@ -45,12 +45,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
|
||||
select count(1) from sys_user where id = #{id} and del_flag = '0'
|
||||
<select id="checkDeptExistCourse" parameterType="Long" resultType="int">
|
||||
select count(1) from train_course where train_course_category_id = #{id} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectDeptCount" parameterType="TrainCourseCategory" resultType="int">
|
||||
select count(1) from train_courseware_category
|
||||
select count(1) from train_course_category
|
||||
where del_flag = '0'
|
||||
<if test="id != null and id != 0"> and id = #{id} </if>
|
||||
<if test="parentId != null and parentId != 0"> and parent_id = #{parentId} </if>
|
||||
|
|
@ -62,14 +62,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="selectDeptById" parameterType="Long" resultMap="TrainCourseCategoryResult">
|
||||
select d.id, d.parent_id, d.parent_ids, d.name, d.order_num,
|
||||
(select name from train_courseware_category where id = d.parent_id) parent_name
|
||||
from train_courseware_category d
|
||||
select d.id, d.parent_id, d.parent_ids, d.name, d.order_num, d.del_flag,
|
||||
(select name from train_course_category where id = d.parent_id) parent_name
|
||||
from train_course_category d
|
||||
where d.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDept" parameterType="TrainCourseCategory">
|
||||
insert into train_courseware_category(
|
||||
insert into train_course_category(
|
||||
<if test="id != null and id != 0">id,</if>
|
||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
|
|
@ -91,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</insert>
|
||||
|
||||
<update id="updateDept" parameterType="TrainCourseCategory">
|
||||
update train_courseware_category
|
||||
update train_course_category
|
||||
<set>
|
||||
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
|
|
@ -105,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<update id="updateDeptChildren" parameterType="java.util.List">
|
||||
update train_courseware_category set parent_ids =
|
||||
update train_course_category set parent_ids =
|
||||
<foreach collection="depts" item="item" index="index"
|
||||
separator=" " open="case id" close="end">
|
||||
when #{item.id} then #{item.parent_ids}
|
||||
|
|
@ -118,7 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<delete id="deleteDeptById" parameterType="Long">
|
||||
update train_courseware_category set del_flag = '2' where id = #{id}
|
||||
update train_course_category set del_flag = '2' where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.courseware.mapper.TrainCoursewareCategoryMapper">
|
||||
|
||||
<resultMap type="TrainCourseCategory" id="TrainCoursewareCategoryResult">
|
||||
<resultMap type="TrainCoursewareCategory" id="TrainCoursewareCategoryResult">
|
||||
<id property="id" column="id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
|
|
@ -19,20 +19,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeptVo">
|
||||
<sql id="selectCategoryVo">
|
||||
select d.id,d.dept_id, d.parent_id, d.parent_ids, d.name, d.order_num, d.del_flag, d.create_by, d.create_time
|
||||
from train_courseware_category d
|
||||
</sql>
|
||||
<select id="selectRoleDeptTree" parameterType="Long" resultType="String">
|
||||
select concat(d.id, d.name) as name
|
||||
from train_courseware_category d
|
||||
left join sys_role_dept rd on d.id = rd.id
|
||||
where d.del_flag = '0' and rd.role_id = #{roleId}
|
||||
order by d.parent_id, d.order_num
|
||||
</select>
|
||||
|
||||
<select id="selectDeptList" parameterType="TrainCourseCategory" resultMap="TrainCoursewareCategoryResult">
|
||||
<include refid="selectDeptVo"/>
|
||||
<select id="selectCategoryList" parameterType="TrainCourseCategory" resultMap="TrainCoursewareCategoryResult">
|
||||
<include refid="selectCategoryVo"/>
|
||||
where d.del_flag = '0'
|
||||
<if test="parentId != null and parentId != 0">
|
||||
AND parent_id = #{parentId}
|
||||
|
|
@ -45,30 +38,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
|
||||
select count(1) from sys_user where id = #{id} and del_flag = '0'
|
||||
<select id="checkCategoryExistCourseware" parameterType="Long" resultType="int">
|
||||
select count(1) from train_courseware where train_courseware_category_id = #{id} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectDeptCount" parameterType="TrainCourseCategory" resultType="int">
|
||||
<select id="selectCategoryCount" parameterType="TrainCourseCategory" resultType="int">
|
||||
select count(1) from train_courseware_category
|
||||
where del_flag = '0'
|
||||
<if test="id != null and id != 0"> and id = #{id} </if>
|
||||
<if test="parentId != null and parentId != 0"> and parent_id = #{parentId} </if>
|
||||
</select>
|
||||
|
||||
<select id="checkDeptNameUnique" resultMap="TrainCoursewareCategoryResult">
|
||||
<include refid="selectDeptVo"/>
|
||||
<select id="checkCategoryNameUnique" resultMap="TrainCoursewareCategoryResult">
|
||||
<include refid="selectCategoryVo"/>
|
||||
where name=#{name} and parent_id = #{parentId}
|
||||
</select>
|
||||
|
||||
<select id="selectDeptById" parameterType="Long" resultMap="TrainCoursewareCategoryResult">
|
||||
select d.id, d.parent_id, d.parent_ids, d.name, d.order_num,
|
||||
<select id="selectCategoryById" parameterType="Long" resultMap="TrainCoursewareCategoryResult">
|
||||
select d.id, d.parent_id, d.parent_ids, d.name, d.order_num, d.del_flag,
|
||||
(select name from train_courseware_category where id = d.parent_id) parent_name
|
||||
from train_courseware_category d
|
||||
where d.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDept" parameterType="TrainCourseCategory">
|
||||
<insert id="insertCategory" parameterType="TrainCourseCategory">
|
||||
insert into train_courseware_category(
|
||||
<if test="id != null and id != 0">id,</if>
|
||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||
|
|
@ -90,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateDept" parameterType="TrainCourseCategory">
|
||||
<update id="updateCategory" parameterType="TrainCourseCategory">
|
||||
update train_courseware_category
|
||||
<set>
|
||||
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
||||
|
|
@ -104,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateDeptChildren" parameterType="java.util.List">
|
||||
<update id="updateCategoryChildren" parameterType="java.util.List">
|
||||
update train_courseware_category set parent_ids =
|
||||
<foreach collection="depts" item="item" index="index"
|
||||
separator=" " open="case id" close="end">
|
||||
|
|
@ -117,7 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</update>
|
||||
|
||||
<delete id="deleteDeptById" parameterType="Long">
|
||||
<delete id="deleteCategoryById" parameterType="Long">
|
||||
update train_courseware_category set del_flag = '2' where id = #{id}
|
||||
</delete>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.exam.mapper.TrainCourseCategoryMapper">
|
||||
|
||||
<resultMap type="TrainCourseCategory" id="TrainCourseCategoryResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="parentIds" column="parent_ids" />
|
||||
<result property="name" column="name" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTrainCourseCategoryVo">
|
||||
id, dept_id, parent_id, parent_ids, name, order_num, del_flag, create_by, create_time, update_by, update_time, remark </sql>
|
||||
|
||||
<select id="selectTrainCourseCategoryList" parameterType="TrainCourseCategory" resultMap="TrainCourseCategoryResult">
|
||||
select
|
||||
<include refid="selectTrainCourseCategoryVo"/>
|
||||
from train_course_category
|
||||
<where>
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||
<if test="parentIds != null and parentIds != '' "> and parent_ids = #{parentIds}</if>
|
||||
<if test="name != null and name != '' "> and name = #{name}</if>
|
||||
<if test="orderNum != null "> and order_num = #{orderNum}</if>
|
||||
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
|
||||
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
|
||||
<if test="createTime != null "> and create_time = #{createTime}</if>
|
||||
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
|
||||
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
||||
<if test="remark != null and remark != '' "> and remark = #{remark}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.exam.mapper.TrainCoursewareCategoryMapper">
|
||||
|
||||
<resultMap type="TrainCoursewareCategory" id="TrainCoursewareCategoryResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="parentIds" column="parent_ids" />
|
||||
<result property="name" column="name" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTrainCoursewareCategoryVo">
|
||||
id, dept_id, parent_id, parent_ids, name, order_num, del_flag, create_by, create_time, update_by, update_time, remark </sql>
|
||||
|
||||
<select id="selectTrainCoursewareCategoryList" parameterType="TrainCoursewareCategory" resultMap="TrainCoursewareCategoryResult">
|
||||
select
|
||||
<include refid="selectTrainCoursewareCategoryVo"/>
|
||||
from train_courseware_category
|
||||
<where>
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||
<if test="parentIds != null and parentIds != '' "> and parent_ids = #{parentIds}</if>
|
||||
<if test="name != null and name != '' "> and name = #{name}</if>
|
||||
<if test="orderNum != null "> and order_num = #{orderNum}</if>
|
||||
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
|
||||
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
|
||||
<if test="createTime != null "> and create_time = #{createTime}</if>
|
||||
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
|
||||
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
||||
<if test="remark != null and remark != '' "> and remark = #{remark}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -79,6 +79,7 @@
|
|||
title: '操作',
|
||||
align: 'left',
|
||||
formatter: function(value, row, index) {
|
||||
debugger
|
||||
if (row.parentId != 0) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit">编辑</i></a> ');
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">部门名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="deptName" th:field="*{deptName}" id="deptName">
|
||||
<input class="form-control" type="text" name="name" th:field="*{name}" id="name">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
@ -26,28 +26,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">负责人:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="leader" th:field="*{leader}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">联系电话:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="phone" th:field="*{phone}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">邮箱:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="email" th:field="*{email}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">部门状态:</label>
|
||||
<label class="col-sm-3 control-label">状态:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
|
||||
<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
|
||||
<input type="radio" th:id="${dict.dictCode}" name="delFlag" th:value="${dict.dictValue}" th:field="*{status}">
|
||||
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -56,11 +38,11 @@
|
|||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "course/category";
|
||||
var prefix = ctx + "train/course/category";
|
||||
|
||||
$("#form-dept-edit").validate({
|
||||
rules:{
|
||||
deptName:{
|
||||
name:{
|
||||
required:true,
|
||||
remote: {
|
||||
url: prefix + "/checkDeptNameUnique",
|
||||
|
|
@ -73,8 +55,8 @@
|
|||
"parentId": function() {
|
||||
return $("input[name='parentId']").val();
|
||||
},
|
||||
"deptName": function() {
|
||||
return $.common.trim($("#deptName").val());
|
||||
"name": function() {
|
||||
return $.common.trim($("#name").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
|
|
@ -94,7 +76,7 @@
|
|||
},
|
||||
},
|
||||
messages: {
|
||||
"deptName": {
|
||||
"name": {
|
||||
remote: "部门已经存在"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
<head th:include="include :: header"></head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-dept-add">
|
||||
<input id="treeId" name="parentId" type="hidden" th:value="${dept.deptId}" />
|
||||
<form class="form-horizontal m" id="form-category-add">
|
||||
<input id="treeId" name="parentId" type="hidden" th:value="${category.id}" />
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label ">上级部门:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${dept.name}"/>
|
||||
<input class="form-control" type="text" onclick="selectCategoryTree()" id="treeName" readonly="true" th:value="${category.name}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
@ -24,29 +24,11 @@
|
|||
<input class="form-control" type="text" name="orderNum">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">负责人:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="leader">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">联系电话:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="phone">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">邮箱:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">部门状态:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
|
||||
<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.isDefault == 'Y' ? true : false}">
|
||||
<input type="radio" th:id="${dict.dictCode}" name="delFlag" th:value="${dict.dictValue}" th:checked="${dict.isDefault == 'Y' ? true : false}">
|
||||
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -55,14 +37,14 @@
|
|||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "courseware/category";
|
||||
var prefix = ctx + "train/courseware/category";
|
||||
|
||||
$("#form-dept-add").validate({
|
||||
$("#form-category-add").validate({
|
||||
rules:{
|
||||
name:{
|
||||
required:true,
|
||||
remote: {
|
||||
url: prefix + "/checkDeptNameUnique",
|
||||
url: prefix + "/checkCategoryNameUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
|
|
@ -98,16 +80,16 @@
|
|||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-dept-add').serialize());
|
||||
$.operate.save(prefix + "/add", $('#form-category-add').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
/*部门管理-新增-选择父部门树*/
|
||||
function selectDeptTree() {
|
||||
function selectCategoryTree() {
|
||||
var options = {
|
||||
title: '部门选择',
|
||||
width: "380",
|
||||
url: prefix + "/selectDeptTree/" + $("#treeId").val(),
|
||||
url: prefix + "/selectCategoryTree/" + $("#treeId").val(),
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
|
|
|
|||
|
|
@ -81,9 +81,9 @@
|
|||
formatter: function(value, row, index) {
|
||||
if (row.parentId != 0) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.deptId + '\')"><i class="fa fa-edit">编辑</i></a> ');
|
||||
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="#" onclick="$.operate.add(\'' + row.deptId + '\')"><i class="fa fa-plus">新增</i></a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.deptId + '\')"><i class="fa fa-remove">删除</i></a>');
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit">编辑</i></a> ');
|
||||
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="#" onclick="$.operate.add(\'' + row.id + '\')"><i class="fa fa-plus">新增</i></a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.id + '\')"><i class="fa fa-remove">删除</i></a>');
|
||||
return actions.join('');
|
||||
} else {
|
||||
return "";
|
||||
|
|
@ -4,17 +4,17 @@
|
|||
<head th:include="include :: header"></head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-dept-edit" th:object="${dept}">
|
||||
<form class="form-horizontal m" id="form-category-edit" th:object="${category}">
|
||||
<input name="id" type="hidden" th:field="*{id}" />
|
||||
<input id="treeId" name="parentId" type="hidden" th:field="*{parentId}" />
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label ">上级部门:</label>
|
||||
<label class="col-sm-3 control-label ">上级分类:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" id="treeName" onclick="selectDeptTree()" readonly="true" th:field="*{parentName}"/>
|
||||
<input class="form-control" type="text" id="treeName" onclick="selectCategoryTree()" readonly="true" th:field="*{parentName}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">部门名称:</label>
|
||||
<label class="col-sm-3 control-label">分类名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="name" th:field="*{name}" id="name">
|
||||
</div>
|
||||
|
|
@ -26,28 +26,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">负责人:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="leader" th:field="*{leader}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">联系电话:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="phone" th:field="*{phone}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">邮箱:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="email" th:field="*{email}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">部门状态:</label>
|
||||
<label class="col-sm-3 control-label">分类状态:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
|
||||
<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
|
||||
<input type="radio" th:id="${dict.dictCode}" name="delFlag" th:value="${dict.dictValue}" th:field="*{delFlag}">
|
||||
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -56,14 +38,14 @@
|
|||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "courseware/category";
|
||||
var prefix = ctx + "train/courseware/category";
|
||||
|
||||
$("#form-dept-edit").validate({
|
||||
$("#form-category-edit").validate({
|
||||
rules:{
|
||||
name:{
|
||||
required:true,
|
||||
remote: {
|
||||
url: prefix + "/checkDeptNameUnique",
|
||||
url: prefix + "/checkCategoryNameUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
|
|
@ -102,18 +84,18 @@
|
|||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-dept-edit').serialize());
|
||||
$.operate.save(prefix + "/edit", $('#form-category-edit').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
/*部门管理-修改-选择部门树*/
|
||||
function selectDeptTree() {
|
||||
function selectCategoryTree() {
|
||||
var id = $("#treeId").val();
|
||||
if(id > 0) {
|
||||
var options = {
|
||||
title: '部门选择',
|
||||
width: "380",
|
||||
url: prefix + "/selectDeptTree/" + $("#treeId").val(),
|
||||
url: prefix + "/selectCategoryTree/" + $("#treeId").val(),
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ body{height:auto;font-family: "Microsoft YaHei";}
|
|||
button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
|
||||
</style>
|
||||
<body class="hold-transition box box-main">
|
||||
<input id="treeId" name="treeId" type="hidden" th:value="${dept.deptId}"/>
|
||||
<input id="treeName" name="treeName" type="hidden" th:value="${dept.deptName}"/>
|
||||
<input id="treeId" name="treeId" type="hidden" th:value="${category.id}"/>
|
||||
<input id="treeName" name="treeName" type="hidden" th:value="${category.name}"/>
|
||||
<div class="wrapper"><div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
|
||||
<label id="btnShow" title="显示搜索" style="display:none;">︾</label>
|
||||
<label id="btnHide" title="隐藏搜索">︽</label>
|
||||
|
|
@ -28,7 +28,7 @@ button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
|
|||
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
|
||||
<script th:inline="javascript">
|
||||
$(function() {
|
||||
var url = ctx + "courseware/category/treeData";
|
||||
var url = ctx + "train/courseware/category/treeData";
|
||||
var options = {
|
||||
url: url,
|
||||
expandLevel: 2,
|
||||
|
|
|
|||
Loading…
Reference in New Issue