17 changed files with 2695 additions and 0 deletions
@ -0,0 +1,327 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('新增题库')" /> |
|||
<th:block th:include="zdxtInclude :: select2-css" /> |
|||
<th:block th:include="zdxtInclude :: summernote-css"/> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-css"/> |
|||
</head> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-item-add"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-2 control-label is-required">标题:</label> |
|||
<div class="col-sm-10"> |
|||
<input class="form-control" type="text" name="title" id="title" required> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-2 control-label">内容:</label> |
|||
<div class="col-sm-10"> |
|||
<input type="hidden" name="content" id="content" /> |
|||
<div id="itemContentSummernote" class="summernote"></div> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-2 control-label is-required">类型:</label> |
|||
<div class="col-sm-4"> |
|||
<select name="type" class="form-control m-b" th:with="type=${@dict.getType('question_type')}"> |
|||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-2 control-label">选项:</label> |
|||
<div class="col-sm-10"> |
|||
<table id="tab11" style="display: none"> |
|||
<tbody> |
|||
<tr> |
|||
<td height="30" align="center"><input type="text" name="NO" size="2" value="1" style="text-align: center;" disabled /></td> |
|||
<td width="30" align="center"><input type="text" name="code" value="A" style="width: 30px; text-align: center;"/></td> |
|||
<td align="center"><input type="text" name="qContent" style="width: 100%;" /></td> |
|||
<td><input type="button" id="Button1" onClick="deltr(this)" value="删行"></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
<input type="button" id="btn_addtr" value="增行"> |
|||
<table id="dynamicTable" width="500" border="0" cellspacing="0" cellpadding="0"> |
|||
<thead> |
|||
<tr> |
|||
<td height="30" align="center" bgcolor="#CCCCCC">ID</td> |
|||
<td width="30" align="center" bgcolor="#CCCCCC">标识</td> |
|||
<td align="center" bgcolor="#CCCCCC">内容</td> |
|||
<td width="30" align="center" bgcolor="#CCCCCC">操作</td> |
|||
<td></td> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<td height="30" align="center"><input type="text" name="NO" size="2" value="1" style="text-align: center;" disabled /></td> |
|||
<td width="30" align="center"><input type="text" name="code" value="A" style="width: 30px; text-align: center;"/></td> |
|||
<td align="center"><input type="text" name="qContent" style="width: 100%;" /></td> |
|||
<td><input type="button" id="Button2" onClick="deltr(this)" value="删行"></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-2 control-label">封面:</label> |
|||
<div class="col-sm-10"> |
|||
<div id="fileIn"> |
|||
<div class="file-loading"> |
|||
<input id="fileInput" name="file" type="file" multiple> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer" /> |
|||
<th:block th:include="zdxtInclude :: summernote-js"/> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-js"/> |
|||
<script type="text/javascript"> |
|||
var prefix = ctx + "small/question"; |
|||
|
|||
$(function() { |
|||
// 渲染要素信息 |
|||
renderVersionAtt(); |
|||
}) |
|||
|
|||
function submitHandler() { |
|||
console.log("============== submitHandler =============="); |
|||
if ($.validate.form()) { |
|||
console.log("============== form =============="); |
|||
$('#fileInput').fileinput('upload'); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
/** 富文本 */ |
|||
$('.summernote').summernote({ |
|||
// placeholder: '请输入公告内容', |
|||
height: 330, |
|||
lang: 'zh-CN', |
|||
followingToolbar: false, |
|||
callbacks: { |
|||
onImageUpload: function (files) { |
|||
PlanVersion.summernoteImgUpload(files[0], this); |
|||
} |
|||
}, |
|||
toolbar: [ |
|||
['operate', ['undo','redo']], |
|||
['magic',['style']], |
|||
['style', ['bold', 'italic', 'underline', 'clear']], |
|||
['para', ['height','fontsize','ul', 'ol', 'paragraph']], |
|||
['font', ['strikethrough', 'superscript', 'subscript']], |
|||
['color', ['color']], |
|||
['insert',['video','link','table','hr','attachment']],//自定义按钮展示 |
|||
['layout',['codeview']], |
|||
], |
|||
buttons: { |
|||
attachment:AttachmentButton |
|||
}, |
|||
}); |
|||
|
|||
var AttachmentButton = function (context) { |
|||
var ui = $.summernote.ui; |
|||
// create button |
|||
var button = ui.button({ |
|||
contents: '<i class="fa fa-folder-open"/>', //按钮样式 |
|||
tooltip: '上传文件', |
|||
click: function () { |
|||
$("#fileWord").click(); |
|||
} |
|||
}); |
|||
return button.render(); //按钮渲染 |
|||
} |
|||
|
|||
|
|||
/** 附件相关 */ |
|||
|
|||
/** 渲染附件信息 */ |
|||
function renderVersionAtt() { |
|||
$("#fileIn").show(); |
|||
$("#fileOut").hide(); |
|||
uploadFiles(); |
|||
$("#fileInput").fileinput('clear') |
|||
} |
|||
|
|||
/** 上传附件 */ |
|||
function uploadFiles() { |
|||
var filePreview = { fileList: null, previewRespDTOS: null } |
|||
initFile("fileInput", prefix + "/add", filePreview); |
|||
} |
|||
|
|||
/** 初始化文件 */ |
|||
function initFile(elementId, url, filePreview) { |
|||
var preview = filePreview.previewRespDTOS; |
|||
|
|||
if (preview != null) { |
|||
for (var i = 0; i < preview.length; i++) { |
|||
// 图片删除的地址 |
|||
preview[i].url = prefix + "/removeFile" |
|||
} |
|||
} |
|||
|
|||
$("#" + elementId).fileinput({ |
|||
'theme': 'explorer', |
|||
initialPreviewAsData: true, |
|||
dropZoneEnabled: true, |
|||
dropZoneTitle: "上传图片或视频", |
|||
uploadUrl: url, |
|||
uploadAsync: false,//异步上传 |
|||
enctype: 'multipart/form-data', |
|||
showClose: false, |
|||
showPreview: true, |
|||
showUpload: false, |
|||
uploadExtraData: function () { |
|||
var formData = $("#form-item-add").serialize(); |
|||
formData = decodeURIComponent(formData, true); |
|||
var arr = formData.split("&"); |
|||
var data = {}; |
|||
for (var i=0; i<arr.length; i++) { |
|||
var item = arr[i].split('='); |
|||
var value = item[1].replace("+", " "); |
|||
data[item[0]] = value; |
|||
} |
|||
data.content = $('#itemContentSummernote').summernote('code'); |
|||
data.flag = $.form.selectSelects("flag"); |
|||
|
|||
// code |
|||
var codes = []; // 存放结果的数组 |
|||
$('input[name="code"]').each(function() { |
|||
var value = $(this).val(); |
|||
if (value !== '') { |
|||
codes.push(value); |
|||
} |
|||
}); |
|||
codes.shift(); |
|||
// value |
|||
var values = []; // 存放结果的数组 |
|||
$('input[name="qContent"]').each(function() { |
|||
var value = $(this).val(); |
|||
if (value !== '') { |
|||
values.push(value); |
|||
} |
|||
}); |
|||
|
|||
data["codes"] = codes.join(','); |
|||
data["values"] = values.join(','); |
|||
|
|||
return data; |
|||
}, |
|||
// showBrowse: false, |
|||
previewFileIcon: '<i class="fas fa-file"></i>', |
|||
preferIconicPreview: true, |
|||
previewFileIconSettings: { // configure your icon file extensions |
|||
'doc': '<i class="fa fa-file-word-o text-primary"></i>', |
|||
'xls': '<i class="fa fa-file-excel-o text-success"></i>', |
|||
'ppt': '<i class="fa fa-file-powerpoint-o text-danger"></i>', |
|||
'pdf': '<i class="fa fa-file-pdf-o text-danger"></i>', |
|||
'txt': '<i class="fa fa-file-text-o text-info"></i>', |
|||
'zip': '<i class="fa fa-file-archive-o text-muted"></i>', |
|||
'htm': '<i class="fa fa-file-code-o text-info"></i>', |
|||
'mov': '<i class="fa fa-file-movie-o text-warning"></i>', |
|||
'mp3': '<i class="fa fa-file-audio-o text-warning"></i>' |
|||
}, |
|||
previewFileExtSettings: { |
|||
'doc': function (ext) { |
|||
return ext.match(/(doc|docx)$/i); |
|||
}, |
|||
'xls': function (ext) { |
|||
return ext.match(/(xls|xlsx)$/i); |
|||
}, |
|||
'ppt': function (ext) { |
|||
return ext.match(/(ppt|pptx)$/i); |
|||
}, |
|||
'zip': function (ext) { |
|||
return ext.match(/(zip|rar|tar|gzip|gz|7z)$/i); |
|||
}, |
|||
'htm': function (ext) { |
|||
return ext.match(/(htm|html)$/i); |
|||
}, |
|||
'mov': function (ext) { |
|||
return ext.match(/(avi|mpg|mkv|mov|mp4|3gp|webm|wmv)$/i); |
|||
}, |
|||
'mp3': function (ext) { |
|||
return ext.match(/(mp3|wav)$/i); |
|||
}, |
|||
'txt': function (ext) { |
|||
return ext.match(/(txt|ini|csv|java|php|js|css)$/i); |
|||
} |
|||
}, |
|||
layoutTemplates: { |
|||
// actionDelete: ''//去掉删除按钮 |
|||
actionUpload: '' // 去掉上传按钮 |
|||
}, |
|||
initialPreview: filePreview.fileList == null ? [] : filePreview.fileList, |
|||
initialPreviewConfig: preview == null ? [] : preview |
|||
}); |
|||
|
|||
// 同步上传成功回调 |
|||
$("#fileInput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
fileUploadCallBack(data.response); |
|||
}) |
|||
// // 同步上传成功回调 |
|||
// $("#fileOutput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
// fileUploadCallBack(data.response); |
|||
// }) |
|||
}; |
|||
|
|||
/** 文件上传回调 */ |
|||
function fileUploadCallBack(result) { |
|||
var parent = window.parent; |
|||
if (result.success) { |
|||
parent.$.modal.msgSuccess(result.message); |
|||
} else { |
|||
$.modal.alertError(result.message); |
|||
} |
|||
$.modal.close(); |
|||
parent.$.table.refresh(); |
|||
// $.modal.closeLoading(); |
|||
// $.modal.msgReload(result.message, modal_status.SUCCESS); |
|||
} |
|||
|
|||
/** 动态表格 */ |
|||
$(function () { |
|||
var show_count = 8; //要显示的条数 |
|||
var count = 1; //递增的开始值,这里是你的ID |
|||
$("#btn_addtr").click(function () { |
|||
|
|||
var length = $("#dynamicTable tbody tr").length; |
|||
//alert(length); |
|||
if (length < show_count) //点击时候,如果当前的数字小于递增结束的条件 |
|||
{ |
|||
$("#tab11 tbody tr").clone().appendTo("#dynamicTable tbody"); //在表格后面添加一行 |
|||
changeIndex();//更新行号 |
|||
} |
|||
}); |
|||
|
|||
|
|||
}); |
|||
function changeIndex() { |
|||
var c = ['0', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] |
|||
var i = 1; |
|||
$("#dynamicTable tbody tr").each(function () { //循环tab tbody下的tr |
|||
// console.log(i) |
|||
$(this).find("input[name='NO']").val(i);//更新行号 |
|||
$(this).find("input[name='code']").val(c[i]);//更新标号 |
|||
i++; |
|||
}); |
|||
} |
|||
|
|||
function deltr(opp) { |
|||
var length = $("#dynamicTable tbody tr").length; |
|||
//alert(length); |
|||
if (length <= 1) { |
|||
alert("至少保留一行"); |
|||
} else { |
|||
$(opp).parent().parent().remove();//移除当前行 |
|||
changeIndex(); |
|||
} |
|||
} |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,345 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('题库详情')" /> |
|||
<th:block th:include="zdxtInclude :: summernote-css"/> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-css"/> |
|||
|
|||
<style> |
|||
.file-caption-main { |
|||
display: none; |
|||
} |
|||
</style> |
|||
</head> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-item-add" th:object="${questionBank}"> |
|||
<input id="guid" name="guid" th:value="${questionBank.guid}" class="form-control" type="hidden"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-2 control-label is-required">标题:</label> |
|||
<div class="col-sm-10"> |
|||
<input class="form-control" type="text" name="title" id="title" th:field="*{title}" required> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-2 control-label">内容:</label> |
|||
<div class="col-sm-10"> |
|||
<input type="hidden" name="content" id="content" th:field="*{content}" /> |
|||
<div id="itemContentSummernote" class="summernote"></div> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-2 control-label is-required">类型:</label> |
|||
<div class="col-sm-4"> |
|||
<select name="type" class="form-control m-b" th:with="type=${@dict.getType('question_type')}"> |
|||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:field="*{type}" th:value="${dict.dictValue}"></option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-2 control-label">选项:</label> |
|||
<div class="col-sm-10"> |
|||
<table id="dynamicTable" width="500" border="0" cellspacing="0" cellpadding="0"> |
|||
<thead> |
|||
<tr> |
|||
<td height="30" align="center" bgcolor="#CCCCCC">ID</td> |
|||
<td width="30" align="center" bgcolor="#CCCCCC">标识</td> |
|||
<td align="center" bgcolor="#CCCCCC">内容</td> |
|||
<td></td> |
|||
</tr> |
|||
</thead> |
|||
<tbody id="answerTrFlag"> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-2 control-label">封面:</label> |
|||
<div class="col-sm-10"> |
|||
<div id="fileIn"> |
|||
<div class="file-loading"> |
|||
<input id="fileInput" name="file" type="file" multiple> |
|||
</div> |
|||
</div> |
|||
<div id="fileOut" style="display: none"> |
|||
<div class="file-loading"> |
|||
<input id="fileOutput" name="file" type="file" multiple> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer" /> |
|||
<th:block th:include="zdxtInclude :: summernote-js"/> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-js"/> |
|||
<script type="text/javascript" th:inline="javascript"> |
|||
var prefix = ctx + "small/question"; |
|||
|
|||
// 当前文件框id,是不是fileInput |
|||
var isFlieIn = true; |
|||
|
|||
$(function() { |
|||
$('#itemContentSummernote').summernote('code', $('#content').val()); |
|||
$('#itemContentSummernote').summernote('disable'); |
|||
// 渲染要素信息 |
|||
renderVersionAtt(); |
|||
}) |
|||
|
|||
function submitHandler() { |
|||
if (isFlieIn) { |
|||
$('#fileInput').fileinput('upload'); |
|||
} else { |
|||
$('#fileOutput').fileinput('upload'); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
/** 富文本 */ |
|||
$('.summernote').summernote({ |
|||
// placeholder: '请输入公告内容', |
|||
height: 330, |
|||
lang: 'zh-CN', |
|||
followingToolbar: false, |
|||
callbacks: { |
|||
onImageUpload: function (files) { |
|||
PlanVersion.summernoteImgUpload(files[0], this); |
|||
} |
|||
}, |
|||
toolbar: [ |
|||
['operate', ['undo','redo']], |
|||
['magic',['style']], |
|||
['style', ['bold', 'italic', 'underline', 'clear']], |
|||
['para', ['height','fontsize','ul', 'ol', 'paragraph']], |
|||
['font', ['strikethrough', 'superscript', 'subscript']], |
|||
['color', ['color']], |
|||
['insert',['video','link','table','hr','attachment']],//自定义按钮展示 |
|||
['layout',['codeview']], |
|||
], |
|||
buttons: { |
|||
attachment:AttachmentButton |
|||
}, |
|||
}); |
|||
|
|||
var AttachmentButton = function (context) { |
|||
var ui = $.summernote.ui; |
|||
// create button |
|||
var button = ui.button({ |
|||
contents: '<i class="fa fa-folder-open"/>', //按钮样式 |
|||
tooltip: '上传文件', |
|||
click: function () { |
|||
$("#fileWord").click(); |
|||
} |
|||
}); |
|||
return button.render(); //按钮渲染 |
|||
} |
|||
|
|||
|
|||
/** 附件相关 */ |
|||
|
|||
/** 渲染附件信息 */ |
|||
function renderVersionAtt() { |
|||
var key = $("#guid").val(); |
|||
|
|||
$.getJSON(prefix + "/queryFiles/" + key, function (result) { |
|||
if (result.data != null) { |
|||
$("#fileIn").hide(); |
|||
$("#fileOut").show(); |
|||
// 重置文件预览框 |
|||
$("#fileOut").html("<div class=\"file-loading\"><input id=\"fileOutput\" name=\"file\" type=\"file\" multiple></div>"); |
|||
queryFiles(key); |
|||
isFlieIn = false; |
|||
} else { |
|||
$("#fileIn").show(); |
|||
$("#fileOut").hide(); |
|||
uploadFiles(); |
|||
isFlieIn = true; |
|||
$("#fileInput").fileinput('clear') |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** 预览附件 */ |
|||
function queryFiles(key) { |
|||
$.ajax({ |
|||
type: "POST", |
|||
url: prefix + "/queryFilesPost", |
|||
data: {"key": key}, |
|||
dataType: 'json', |
|||
success: function (result) { |
|||
if (result.success == true) { |
|||
initFile("fileOutput", prefix + "/edit", result.data.filePreview); |
|||
} |
|||
}, |
|||
error: function (error) { |
|||
$.modal.alertWarning("附件预览失败!"); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** 上传附件 */ |
|||
function uploadFiles() { |
|||
var filePreview = { fileList: null, previewRespDTOS: null } |
|||
initFile("fileInput", prefix + "/edit", filePreview); |
|||
} |
|||
|
|||
/** 初始化文件 */ |
|||
function initFile(elementId, url, filePreview) { |
|||
var preview = filePreview.previewRespDTOS; |
|||
|
|||
if (preview != null) { |
|||
for (var i = 0; i < preview.length; i++) { |
|||
// 图片删除的地址 |
|||
preview[i].url = prefix + "/removeFile" |
|||
} |
|||
} |
|||
|
|||
$("#" + elementId).fileinput({ |
|||
'theme': 'explorer', |
|||
initialPreviewAsData: true, |
|||
dropZoneEnabled: true, |
|||
dropZoneTitle: "上传图片或视频", |
|||
uploadUrl: url, |
|||
uploadAsync: false,//异步上传 |
|||
enctype: 'multipart/form-data', |
|||
showClose: false, |
|||
showPreview: true, |
|||
showUpload: false, |
|||
uploadExtraData: function () { |
|||
var formData = $("#form-item-add").serialize(); |
|||
formData = decodeURIComponent(formData, true); |
|||
var arr = formData.split("&"); |
|||
var data = {}; |
|||
for (var i=0; i<arr.length; i++) { |
|||
var item = arr[i].split('='); |
|||
var value = item[1].replace("+", " "); |
|||
data[item[0]] = value; |
|||
} |
|||
data.content = $('#itemContentSummernote').summernote('code'); |
|||
data.flag = $.form.selectSelects("flag"); |
|||
return data; |
|||
}, |
|||
// showBrowse: false, |
|||
previewFileIcon: '<i class="fas fa-file"></i>', |
|||
preferIconicPreview: true, |
|||
previewFileIconSettings: { // configure your icon file extensions |
|||
'doc': '<i class="fa fa-file-word-o text-primary"></i>', |
|||
'xls': '<i class="fa fa-file-excel-o text-success"></i>', |
|||
'ppt': '<i class="fa fa-file-powerpoint-o text-danger"></i>', |
|||
'pdf': '<i class="fa fa-file-pdf-o text-danger"></i>', |
|||
'txt': '<i class="fa fa-file-text-o text-info"></i>', |
|||
'zip': '<i class="fa fa-file-archive-o text-muted"></i>', |
|||
'htm': '<i class="fa fa-file-code-o text-info"></i>', |
|||
'mov': '<i class="fa fa-file-movie-o text-warning"></i>', |
|||
'mp3': '<i class="fa fa-file-audio-o text-warning"></i>' |
|||
}, |
|||
previewFileExtSettings: { |
|||
'doc': function (ext) { |
|||
return ext.match(/(doc|docx)$/i); |
|||
}, |
|||
'xls': function (ext) { |
|||
return ext.match(/(xls|xlsx)$/i); |
|||
}, |
|||
'ppt': function (ext) { |
|||
return ext.match(/(ppt|pptx)$/i); |
|||
}, |
|||
'zip': function (ext) { |
|||
return ext.match(/(zip|rar|tar|gzip|gz|7z)$/i); |
|||
}, |
|||
'htm': function (ext) { |
|||
return ext.match(/(htm|html)$/i); |
|||
}, |
|||
'mov': function (ext) { |
|||
return ext.match(/(avi|mpg|mkv|mov|mp4|3gp|webm|wmv)$/i); |
|||
}, |
|||
'mp3': function (ext) { |
|||
return ext.match(/(mp3|wav)$/i); |
|||
}, |
|||
'txt': function (ext) { |
|||
return ext.match(/(txt|ini|csv|java|php|js|css)$/i); |
|||
} |
|||
}, |
|||
layoutTemplates: { |
|||
actionDelete: '',//去掉删除按钮 |
|||
actionUpload: '' // 去掉上传按钮 |
|||
}, |
|||
initialPreview: filePreview.fileList == null ? [] : filePreview.fileList, |
|||
initialPreviewConfig: preview == null ? [] : preview |
|||
}); |
|||
|
|||
// 同步上传成功回调 |
|||
$("#fileInput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
fileUploadCallBack(data.response); |
|||
}) |
|||
// 同步上传成功回调 |
|||
$("#fileOutput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
fileUploadCallBack(data.response); |
|||
}) |
|||
}; |
|||
|
|||
function fileUploadCallBack(result) { |
|||
var parent = window.parent; |
|||
if (result.success) { |
|||
parent.$.modal.msgSuccess(result.message); |
|||
} else { |
|||
$.modal.alertError(result.message); |
|||
} |
|||
$.modal.close(); |
|||
parent.$.table.refresh(); |
|||
// $.modal.closeLoading(); |
|||
// $.modal.msgReload(result.message, modal_status.SUCCESS); |
|||
} |
|||
|
|||
/** 动态表格 */ |
|||
$(function () { |
|||
var answers = [[${answerBanks}]] |
|||
var html; |
|||
for (var i=0; i<answers.length; i++) { |
|||
var answer = answers[i]; |
|||
html += '<tr>'; |
|||
html += '<td height="30" align="center"><input type="text" name="NO" size="2" value="'+(i+1)+'" style="text-align: center;" disabled /></td>'; |
|||
html += '<td width="30" align="center"><input type="text" name="code" value="'+answer.title+'" style="width: 30px; text-align: center;" disabled/></td>'; |
|||
html += '<td align="center"><input type="text" name="qContent" value="'+answer.content+'" style="width: 100%;" disabled/></td>'; |
|||
html += '</tr>'; |
|||
} |
|||
$("#answerTrFlag").html(html); |
|||
var show_count = 8; //要显示的条数 |
|||
var count = 1; //递增的开始值,这里是你的ID |
|||
$("#btn_addtr").click(function () { |
|||
|
|||
var length = $("#dynamicTable tbody tr").length; |
|||
//alert(length); |
|||
if (length < show_count) //点击时候,如果当前的数字小于递增结束的条件 |
|||
{ |
|||
$("#tab11 tbody tr").clone().appendTo("#dynamicTable tbody"); //在表格后面添加一行 |
|||
changeIndex();//更新行号 |
|||
} |
|||
}); |
|||
|
|||
|
|||
}); |
|||
function changeIndex() { |
|||
var c = ['0', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] |
|||
var i = 1; |
|||
$("#dynamicTable tbody tr").each(function () { //循环tab tbody下的tr |
|||
// console.log(i) |
|||
$(this).find("input[name='NO']").val(i);//更新行号 |
|||
$(this).find("input[name='code']").val(c[i]);//更新标号 |
|||
i++; |
|||
}); |
|||
} |
|||
|
|||
function deltr(opp) { |
|||
var length = $("#dynamicTable tbody tr").length; |
|||
//alert(length); |
|||
if (length <= 1) { |
|||
alert("至少保留一行"); |
|||
} else { |
|||
$(opp).parent().parent().remove();//移除当前行 |
|||
changeIndex(); |
|||
} |
|||
} |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,380 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('修改题库')" /> |
|||
<th:block th:include="zdxtInclude :: select2-css" /> |
|||
<th:block th:include="zdxtInclude :: summernote-css"/> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-css"/> |
|||
</head> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-item-add" th:object="${questionBank}"> |
|||
<input id="guid" name="guid" th:value="${questionBank.guid}" class="form-control" type="hidden"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-2 control-label is-required">标题:</label> |
|||
<div class="col-sm-10"> |
|||
<input class="form-control" type="text" name="title" id="title" th:field="*{title}" required> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-2 control-label">内容:</label> |
|||
<div class="col-sm-10"> |
|||
<input type="hidden" name="content" id="content" th:field="*{content}" /> |
|||
<div id="itemContentSummernote" class="summernote"></div> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-2 control-label is-required">类型:</label> |
|||
<div class="col-sm-4"> |
|||
<select name="type" class="form-control m-b" th:with="type=${@dict.getType('question_type')}"> |
|||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:field="*{type}" th:value="${dict.dictValue}"></option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-2 control-label">选项:</label> |
|||
<div class="col-sm-10"> |
|||
<table id="tab11" style="display: none"> |
|||
<tbody> |
|||
<tr> |
|||
<td height="30" align="center"><input type="text" name="NO" size="2" value="1" style="text-align: center;" disabled /></td> |
|||
<td width="30" align="center"><input type="text" name="code" value="A" style="width: 30px; text-align: center;"/></td> |
|||
<td align="center"><input type="text" name="qContent" style="width: 100%;" /></td> |
|||
<td><input type="button" id="Button1" onClick="deltr(this)" value="删行"></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
<input type="button" id="btn_addtr" value="增行"> |
|||
<table id="dynamicTable" width="500" border="0" cellspacing="0" cellpadding="0"> |
|||
<thead> |
|||
<tr> |
|||
<td height="30" align="center" bgcolor="#CCCCCC">ID</td> |
|||
<td width="30" align="center" bgcolor="#CCCCCC">标识</td> |
|||
<td align="center" bgcolor="#CCCCCC">内容</td> |
|||
<td width="30" align="center" bgcolor="#CCCCCC">操作</td> |
|||
<td></td> |
|||
</tr> |
|||
</thead> |
|||
<tbody id="answerTrFlag"> |
|||
<tr> |
|||
<td height="30" align="center"><input type="text" name="NO" size="2" value="1" style="text-align: center;" disabled /></td> |
|||
<td width="30" align="center"><input type="text" name="code" value="A" style="width: 30px; text-align: center;"/></td> |
|||
<td align="center"><input type="text" name="qContent" style="width: 100%;" /></td> |
|||
<td><input type="button" id="Button2" onClick="deltr(this)" value="删行"></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-2 control-label">封面:</label> |
|||
<div class="col-sm-10"> |
|||
<div id="fileIn"> |
|||
<div class="file-loading"> |
|||
<input id="fileInput" name="file" type="file" multiple> |
|||
</div> |
|||
</div> |
|||
<div id="fileOut" style="display: none"> |
|||
<div class="file-loading"> |
|||
<input id="fileOutput" name="file" type="file" multiple> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer" /> |
|||
<th:block th:include="zdxtInclude :: summernote-js"/> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-js"/> |
|||
<script type="text/javascript" th:inline="javascript"> |
|||
var prefix = ctx + "small/question"; |
|||
|
|||
// 当前文件框id,是不是fileInput |
|||
var isFlieIn = true; |
|||
|
|||
$(function() { |
|||
$('#itemContentSummernote').summernote('code', $('#content').val()); |
|||
// 渲染要素信息 |
|||
renderVersionAtt(); |
|||
}) |
|||
|
|||
function submitHandler() { |
|||
if (isFlieIn) { |
|||
$('#fileInput').fileinput('upload'); |
|||
} else { |
|||
$('#fileOutput').fileinput('upload'); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
/** 富文本 */ |
|||
$('.summernote').summernote({ |
|||
// placeholder: '请输入公告内容', |
|||
height: 330, |
|||
lang: 'zh-CN', |
|||
followingToolbar: false, |
|||
callbacks: { |
|||
onImageUpload: function (files) { |
|||
PlanVersion.summernoteImgUpload(files[0], this); |
|||
} |
|||
}, |
|||
toolbar: [ |
|||
['operate', ['undo','redo']], |
|||
['magic',['style']], |
|||
['style', ['bold', 'italic', 'underline', 'clear']], |
|||
['para', ['height','fontsize','ul', 'ol', 'paragraph']], |
|||
['font', ['strikethrough', 'superscript', 'subscript']], |
|||
['color', ['color']], |
|||
['insert',['video','link','table','hr','attachment']],//自定义按钮展示 |
|||
['layout',['codeview']], |
|||
], |
|||
buttons: { |
|||
attachment:AttachmentButton |
|||
}, |
|||
}); |
|||
|
|||
var AttachmentButton = function (context) { |
|||
var ui = $.summernote.ui; |
|||
// create button |
|||
var button = ui.button({ |
|||
contents: '<i class="fa fa-folder-open"/>', //按钮样式 |
|||
tooltip: '上传文件', |
|||
click: function () { |
|||
$("#fileWord").click(); |
|||
} |
|||
}); |
|||
return button.render(); //按钮渲染 |
|||
} |
|||
|
|||
|
|||
/** 附件相关 */ |
|||
|
|||
/** 渲染附件信息 */ |
|||
function renderVersionAtt() { |
|||
var key = $("#guid").val(); |
|||
|
|||
$.getJSON(prefix + "/queryFiles/" + key, function (result) { |
|||
if (result.data != null) { |
|||
$("#fileIn").hide(); |
|||
$("#fileOut").show(); |
|||
// 重置文件预览框 |
|||
$("#fileOut").html("<div class=\"file-loading\"><input id=\"fileOutput\" name=\"file\" type=\"file\" multiple></div>"); |
|||
queryFiles(key); |
|||
isFlieIn = false; |
|||
} else { |
|||
$("#fileIn").show(); |
|||
$("#fileOut").hide(); |
|||
uploadFiles(); |
|||
isFlieIn = true; |
|||
$("#fileInput").fileinput('clear') |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** 预览附件 */ |
|||
function queryFiles(key) { |
|||
$.ajax({ |
|||
type: "POST", |
|||
url: prefix + "/queryFilesPost", |
|||
data: {"key": key}, |
|||
dataType: 'json', |
|||
success: function (result) { |
|||
if (result.success == true) { |
|||
initFile("fileOutput", prefix + "/edit", result.data.filePreview); |
|||
} |
|||
}, |
|||
error: function (error) { |
|||
$.modal.alertWarning("附件预览失败!"); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** 上传附件 */ |
|||
function uploadFiles() { |
|||
var filePreview = { fileList: null, previewRespDTOS: null } |
|||
initFile("fileInput", prefix + "/edit", filePreview); |
|||
} |
|||
|
|||
/** 初始化文件 */ |
|||
function initFile(elementId, url, filePreview) { |
|||
var preview = filePreview.previewRespDTOS; |
|||
|
|||
if (preview != null) { |
|||
for (var i = 0; i < preview.length; i++) { |
|||
// 图片删除的地址 |
|||
preview[i].url = prefix + "/removeFile" |
|||
} |
|||
} |
|||
|
|||
$("#" + elementId).fileinput({ |
|||
'theme': 'explorer', |
|||
initialPreviewAsData: true, |
|||
dropZoneEnabled: true, |
|||
dropZoneTitle: "上传图片或视频", |
|||
uploadUrl: url, |
|||
uploadAsync: false,//异步上传 |
|||
enctype: 'multipart/form-data', |
|||
showClose: false, |
|||
showPreview: true, |
|||
showUpload: false, |
|||
uploadExtraData: function () { |
|||
var formData = $("#form-item-add").serialize(); |
|||
formData = decodeURIComponent(formData, true); |
|||
var arr = formData.split("&"); |
|||
var data = {}; |
|||
for (var i=0; i<arr.length; i++) { |
|||
var item = arr[i].split('='); |
|||
var value = item[1].replace("+", " "); |
|||
data[item[0]] = value; |
|||
} |
|||
data.content = $('#itemContentSummernote').summernote('code'); |
|||
data.flag = $.form.selectSelects("flag"); |
|||
|
|||
// code |
|||
var codes = []; // 存放结果的数组 |
|||
$('input[name="code"]').each(function() { |
|||
var value = $(this).val(); |
|||
if (value !== '') { |
|||
codes.push(value); |
|||
} |
|||
}); |
|||
codes.shift(); |
|||
// value |
|||
var values = []; // 存放结果的数组 |
|||
$('input[name="qContent"]').each(function() { |
|||
var value = $(this).val(); |
|||
if (value !== '') { |
|||
values.push(value); |
|||
} |
|||
}); |
|||
|
|||
data["codes"] = codes.join(','); |
|||
data["values"] = values.join(','); |
|||
|
|||
return data; |
|||
}, |
|||
// showBrowse: false, |
|||
previewFileIcon: '<i class="fas fa-file"></i>', |
|||
preferIconicPreview: true, |
|||
previewFileIconSettings: { // configure your icon file extensions |
|||
'doc': '<i class="fa fa-file-word-o text-primary"></i>', |
|||
'xls': '<i class="fa fa-file-excel-o text-success"></i>', |
|||
'ppt': '<i class="fa fa-file-powerpoint-o text-danger"></i>', |
|||
'pdf': '<i class="fa fa-file-pdf-o text-danger"></i>', |
|||
'txt': '<i class="fa fa-file-text-o text-info"></i>', |
|||
'zip': '<i class="fa fa-file-archive-o text-muted"></i>', |
|||
'htm': '<i class="fa fa-file-code-o text-info"></i>', |
|||
'mov': '<i class="fa fa-file-movie-o text-warning"></i>', |
|||
'mp3': '<i class="fa fa-file-audio-o text-warning"></i>' |
|||
}, |
|||
previewFileExtSettings: { |
|||
'doc': function (ext) { |
|||
return ext.match(/(doc|docx)$/i); |
|||
}, |
|||
'xls': function (ext) { |
|||
return ext.match(/(xls|xlsx)$/i); |
|||
}, |
|||
'ppt': function (ext) { |
|||
return ext.match(/(ppt|pptx)$/i); |
|||
}, |
|||
'zip': function (ext) { |
|||
return ext.match(/(zip|rar|tar|gzip|gz|7z)$/i); |
|||
}, |
|||
'htm': function (ext) { |
|||
return ext.match(/(htm|html)$/i); |
|||
}, |
|||
'mov': function (ext) { |
|||
return ext.match(/(avi|mpg|mkv|mov|mp4|3gp|webm|wmv)$/i); |
|||
}, |
|||
'mp3': function (ext) { |
|||
return ext.match(/(mp3|wav)$/i); |
|||
}, |
|||
'txt': function (ext) { |
|||
return ext.match(/(txt|ini|csv|java|php|js|css)$/i); |
|||
} |
|||
}, |
|||
layoutTemplates: { |
|||
// actionDelete: ''//去掉删除按钮 |
|||
actionUpload: '' // 去掉上传按钮 |
|||
}, |
|||
initialPreview: filePreview.fileList == null ? [] : filePreview.fileList, |
|||
initialPreviewConfig: preview == null ? [] : preview |
|||
}); |
|||
|
|||
// 同步上传成功回调 |
|||
$("#fileInput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
fileUploadCallBack(data.response); |
|||
}) |
|||
// 同步上传成功回调 |
|||
$("#fileOutput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
fileUploadCallBack(data.response); |
|||
}) |
|||
}; |
|||
|
|||
function fileUploadCallBack(result) { |
|||
var parent = window.parent; |
|||
if (result.success) { |
|||
parent.$.modal.msgSuccess(result.message); |
|||
} else { |
|||
$.modal.alertError(result.message); |
|||
} |
|||
$.modal.close(); |
|||
parent.$.table.refresh(); |
|||
// $.modal.closeLoading(); |
|||
// $.modal.msgReload(result.message, modal_status.SUCCESS); |
|||
} |
|||
|
|||
/** 动态表格 */ |
|||
$(function () { |
|||
var answers = [[${answerBanks}]] |
|||
var html; |
|||
for (var i=0; i<answers.length; i++) { |
|||
var answer = answers[i]; |
|||
html += '<tr>'; |
|||
html += '<td height="30" align="center"><input type="text" name="NO" size="2" value="'+(i+1)+'" style="text-align: center;" disabled /></td>'; |
|||
html += '<td width="30" align="center"><input type="text" name="code" value="'+answer.title+'" style="width: 30px; text-align: center;"/></td>'; |
|||
html += '<td align="center"><input type="text" name="qContent" value="'+answer.content+'" style="width: 100%;" /></td>'; |
|||
html += '<td><input type="button" id="Button2" onClick="deltr(this)" value="删行"></td>'; |
|||
html += '</tr>'; |
|||
} |
|||
$("#answerTrFlag").html(html); |
|||
var show_count = 8; //要显示的条数 |
|||
var count = 1; //递增的开始值,这里是你的ID |
|||
$("#btn_addtr").click(function () { |
|||
|
|||
var length = $("#dynamicTable tbody tr").length; |
|||
//alert(length); |
|||
if (length < show_count) //点击时候,如果当前的数字小于递增结束的条件 |
|||
{ |
|||
$("#tab11 tbody tr").clone().appendTo("#dynamicTable tbody"); //在表格后面添加一行 |
|||
changeIndex();//更新行号 |
|||
} |
|||
}); |
|||
|
|||
|
|||
}); |
|||
function changeIndex() { |
|||
var c = ['0', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] |
|||
var i = 1; |
|||
$("#dynamicTable tbody tr").each(function () { //循环tab tbody下的tr |
|||
// console.log(i) |
|||
$(this).find("input[name='NO']").val(i);//更新行号 |
|||
$(this).find("input[name='code']").val(c[i]);//更新标号 |
|||
i++; |
|||
}); |
|||
} |
|||
|
|||
function deltr(opp) { |
|||
var length = $("#dynamicTable tbody tr").length; |
|||
//alert(length); |
|||
if (length <= 1) { |
|||
alert("至少保留一行"); |
|||
} else { |
|||
$(opp).parent().parent().remove();//移除当前行 |
|||
changeIndex(); |
|||
} |
|||
} |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,195 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('题库列表')"/> |
|||
</head> |
|||
<body class="gray-bg"> |
|||
<div class="container-div"> |
|||
<div class="row"> |
|||
<div class="col-sm-12 search-collapse"> |
|||
<form id="post-form"> |
|||
<div class="select-list"> |
|||
<ul> |
|||
<li> |
|||
标题:<input type="text" name="title" placeholder="请输入标题"/> |
|||
</li> |
|||
<li> |
|||
<a class="btn btn-success btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> |
|||
<a class="btn btn-reset btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
|
|||
<div class="btn-group-sm" id="toolbar" role="group"> |
|||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="banner:manage:add"> |
|||
<i class="fa fa-plus"></i> 新增 |
|||
</a> |
|||
<a class="btn btn-danger multiple disabled" onclick="removeAll()" shiro:hasPermission="small:question:remove"> |
|||
<i class="fa fa-remove"></i> 全部删除 |
|||
</a> |
|||
<a class="btn btn-success" onclick="publishState(1)" shiro:hasPermission="small:question:add"> |
|||
<i class="fa fa-plus"></i> 发布 |
|||
</a> |
|||
<a class="btn btn-success" onclick="publishState(3)" shiro:hasPermission="small:question:add"> |
|||
<i class="fa fa-plus"></i> 下线 |
|||
</a> |
|||
</div> |
|||
|
|||
<div class="col-sm-12 select-table table-bordered"> |
|||
<table id="bootstrap-table"></table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer"/> |
|||
<script th:inline="javascript"> |
|||
var editFlag = [[${@permission.hasPermi('small:question:edit')}]]; |
|||
var removeFlag = [[${@permission.hasPermi('small:question:remove')}]]; |
|||
var publishStates = [[${@dict.getType('publish_state')}]]; |
|||
var prefix = ctx + "small/question"; |
|||
|
|||
$(function () { |
|||
initTable(); |
|||
}); |
|||
|
|||
function initTable() { |
|||
var options = { |
|||
url: prefix + "/list", |
|||
createUrl: prefix + "/add", |
|||
updateUrl: prefix + "/edit/{id}", |
|||
detailUrl: prefix + "/detail/{id}", |
|||
removeUrl: prefix + "/remove", |
|||
sortName: "srot", |
|||
modalName: "知识点", |
|||
uniqueId:"guid", |
|||
columns: [{ |
|||
checkbox: true |
|||
}, |
|||
{ |
|||
title: '序号', |
|||
align: 'center', |
|||
formatter: function (value, row, index) { |
|||
return $.table.serialNumber(index); |
|||
} |
|||
}, |
|||
{ |
|||
field: 'guid', |
|||
title: '主键', |
|||
visible: false |
|||
}, |
|||
{ |
|||
field: 'title', |
|||
title: '标题' |
|||
}, |
|||
{ |
|||
field : 'status', |
|||
title : '状态', |
|||
visible: false, |
|||
formatter : function (value, row, index) { |
|||
return $.table.selectDictLabel(statuss, value); |
|||
} |
|||
}, |
|||
{ |
|||
field: 'publishdate', |
|||
title: '发布时间', |
|||
align: 'center', |
|||
sortable: true |
|||
}, |
|||
{ |
|||
field: 'publishstate', |
|||
title: '发布状态', |
|||
align: 'center', |
|||
formatter: function (value, row, index) { |
|||
return $.table.selectDictLabel(publishStates, value); |
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
align: 'center', |
|||
formatter: function (value, row, index) { |
|||
var actions = []; |
|||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.guid + '\')"><i class="fa fa-edit"></i> 详情</a> '); |
|||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.guid + '\')"><i class="fa fa-edit"></i> 编辑</a> '); |
|||
if (row.publishstate == 0) { |
|||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="toPublishState(\'' + row.guid + '\',1)"><i class="fa fa-edit"></i> 发布</a> '); |
|||
} else if (row.publishstate == 1) { |
|||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="toPublishState(\'' + row.guid + '\',3)"><i class="fa fa-edit"></i> 下线</a> '); |
|||
} |
|||
// more.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.guid + '\')"><i class="fa fa-remove"></i> 删除</a>'); |
|||
return actions.join(''); |
|||
} |
|||
}] |
|||
}; |
|||
$.table.init(options); |
|||
} |
|||
|
|||
/** 发布 */ |
|||
function toPublishState(key, state) { |
|||
$.ajax({ |
|||
type: "POST", |
|||
url: prefix + "/toPublishState", |
|||
data: {guid:key,publishstate:state}, |
|||
dataType: 'json', |
|||
success: function (result) { |
|||
console.log(result); |
|||
$.table.refresh(); |
|||
}, |
|||
error: function (error) { |
|||
$.modal.alertWarning("操作失败"); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** 批量发布/下线 */ |
|||
function publishState(state) { |
|||
var ids = ""; |
|||
var isRemove = true; |
|||
var row = $("#" + table.options.id).bootstrapTable('getSelections'); |
|||
for (var i=0; i<row.length; i++) { |
|||
if (row[i].publishstate == 0 && state == 3) { |
|||
$.modal.msgWarning("所选存在未发布数据, 无法执行下线操作!"); |
|||
isRemove = false; |
|||
return; |
|||
} |
|||
if (state == 1 && row[i].publishstate == 1) { |
|||
} else { |
|||
ids += row[i].guid +","; |
|||
} |
|||
} |
|||
if (isRemove && ids.length>0) { |
|||
$.modal.confirm("确定执行【所选数据】吗?", function() { |
|||
$.operate.submit(prefix+"/toPublishState", "post", "json", {ids: ids, state: state}, function(result) { |
|||
$.table.search(); |
|||
}) |
|||
}); |
|||
} else { |
|||
$.modal.msgWarning("没有需要执行的数据!"); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
function removeAll() { |
|||
var ids = ""; |
|||
var isRemove = true; |
|||
var row = $("#" + table.options.id).bootstrapTable('getSelections'); |
|||
for (var i=0; i<row.length; i++) { |
|||
if (row[i].publishstate == 1) { |
|||
$.modal.msgWarning("所选存在已发布数据, 无法执行删除操作!"); |
|||
isRemove = false; |
|||
return; |
|||
} |
|||
ids += row[i].guid +","; |
|||
} |
|||
if (isRemove) { |
|||
$.modal.confirm("确定删除【所选数据】吗?", function() { |
|||
$.operate.submit(prefix+"/remove", "post", "json", {ids: ids}, function(result) { |
|||
$.table.search(); |
|||
}) |
|||
}); |
|||
} |
|||
} |
|||
|
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,110 @@ |
|||
package com.zdxt.knowledge.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import com.zdxt.common.ZDResponse; |
|||
import com.zdxt.common.controller.BaseController; |
|||
import com.zdxt.common.util.TableDataInfo; |
|||
import com.zdxt.knowledge.domain.AnswerBank; |
|||
import com.zdxt.knowledge.service.IAnswerBankService; |
|||
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; |
|||
|
|||
/** |
|||
* 答案库Controller |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-29 |
|||
*/ |
|||
@Controller |
|||
@RequestMapping("/small/answer") |
|||
public class AnswerBankController extends BaseController |
|||
{ |
|||
private String prefix = "project/smallProgram/answer"; |
|||
|
|||
@Autowired |
|||
private IAnswerBankService answerBankService; |
|||
|
|||
@RequiresPermissions("small:answer:view") |
|||
@GetMapping() |
|||
public String bank() |
|||
{ |
|||
return prefix + "/view"; |
|||
} |
|||
|
|||
/** |
|||
* 查询答案库列表 |
|||
*/ |
|||
@RequiresPermissions("small:answer:list") |
|||
@PostMapping("/list") |
|||
@ResponseBody |
|||
public TableDataInfo list(AnswerBank answerBank) |
|||
{ |
|||
startPage(); |
|||
List<AnswerBank> list = answerBankService.selectAnswerBankList(answerBank); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 新增答案库 |
|||
*/ |
|||
@GetMapping("/add") |
|||
public String add() |
|||
{ |
|||
return prefix + "/add"; |
|||
} |
|||
|
|||
/** |
|||
* 新增保存答案库 |
|||
*/ |
|||
@RequiresPermissions("small:answer:add") |
|||
@PostMapping("/add") |
|||
@ResponseBody |
|||
public ZDResponse addSave(AnswerBank answerBank) |
|||
{ |
|||
int resNum = answerBankService.insertAnswerBank(answerBank); |
|||
return resNum>0?ZDResponse.success("操作成功", resNum):ZDResponse.error("操作失败", resNum); |
|||
} |
|||
|
|||
/** |
|||
* 修改答案库 |
|||
*/ |
|||
@GetMapping("/edit/{guid}") |
|||
public String edit(@PathVariable("guid") String guid, ModelMap mmap) |
|||
{ |
|||
AnswerBank answerBank = answerBankService.selectAnswerBankById(guid); |
|||
mmap.put("answerBank", answerBank); |
|||
return prefix + "/edit"; |
|||
} |
|||
|
|||
/** |
|||
* 修改保存答案库 |
|||
*/ |
|||
@RequiresPermissions("small:answer:edit") |
|||
@PostMapping("/edit") |
|||
@ResponseBody |
|||
public ZDResponse editSave(AnswerBank answerBank) |
|||
{ |
|||
int resNum = answerBankService.updateAnswerBank(answerBank); |
|||
return resNum>0?ZDResponse.success("操作成功", resNum):ZDResponse.error("操作失败", resNum); |
|||
} |
|||
|
|||
/** |
|||
* 删除答案库 |
|||
*/ |
|||
@RequiresPermissions("small:answer:remove") |
|||
@PostMapping( "/remove") |
|||
@ResponseBody |
|||
public ZDResponse remove(String ids) |
|||
{ |
|||
int resNum = answerBankService.deleteAnswerBankByIds(ids); |
|||
return resNum>0?ZDResponse.success("操作成功", resNum):ZDResponse.error("操作失败", resNum); |
|||
} |
|||
} |
|||
@ -0,0 +1,184 @@ |
|||
package com.zdxt.knowledge.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import com.zdxt.common.ZDResponse; |
|||
import com.zdxt.common.controller.BaseController; |
|||
import com.zdxt.common.util.TableDataInfo; |
|||
import com.zdxt.knowledge.domain.AnswerBank; |
|||
import com.zdxt.knowledge.domain.QuestionBank; |
|||
import com.zdxt.knowledge.dto.QuestionBankBean; |
|||
import com.zdxt.knowledge.service.IAnswerBankService; |
|||
import com.zdxt.knowledge.service.IQuestionBankService; |
|||
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.*; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
/** |
|||
* 题库Controller |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-29 |
|||
*/ |
|||
@Controller |
|||
@RequestMapping("/small/question") |
|||
public class QuestionBankController extends BaseController |
|||
{ |
|||
private String prefix = "project/smallProgram/question"; |
|||
|
|||
@Autowired private IQuestionBankService questionBankService; |
|||
@Autowired private IAnswerBankService answerBankService; |
|||
|
|||
@RequiresPermissions("small:question:view") |
|||
@GetMapping() |
|||
public String bank() |
|||
{ |
|||
return prefix + "/view"; |
|||
} |
|||
|
|||
/** |
|||
* 查询题库列表 |
|||
*/ |
|||
@RequiresPermissions("small:question:view") |
|||
@PostMapping("/list") |
|||
@ResponseBody |
|||
public TableDataInfo list(QuestionBank questionBank) |
|||
{ |
|||
startPage(); |
|||
List<QuestionBank> list = questionBankService.selectQuestionBankList(questionBank); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 新增题库 |
|||
*/ |
|||
@GetMapping("/add") |
|||
public String add() |
|||
{ |
|||
return prefix + "/add"; |
|||
} |
|||
|
|||
/** |
|||
* 新增保存题库 |
|||
*/ |
|||
@RequiresPermissions("small:question:add") |
|||
@PostMapping("/add") |
|||
@ResponseBody |
|||
public ZDResponse addSave(@RequestParam("file") MultipartFile[] files, QuestionBankBean bean) |
|||
{ |
|||
int resNum = questionBankService.insertQuestionBank(bean, files); |
|||
return resNum>0?ZDResponse.success("操作成功", resNum):ZDResponse.error("操作失败", resNum); |
|||
} |
|||
|
|||
/** |
|||
* 修改题库 |
|||
*/ |
|||
@GetMapping("/edit/{guid}") |
|||
public String edit(@PathVariable("guid") String guid, ModelMap mmap) |
|||
{ |
|||
QuestionBank questionBank = questionBankService.selectQuestionBankById(guid); |
|||
mmap.put("questionBank", questionBank); |
|||
AnswerBank answerBank = new AnswerBank(); |
|||
answerBank.setQuestionBankId(questionBank.getGuid()); |
|||
List<AnswerBank> answerBankList = answerBankService.selectAnswerBankList(answerBank); |
|||
mmap.put("answerBanks", answerBankList); |
|||
return prefix + "/edit"; |
|||
} |
|||
|
|||
/** |
|||
* 修改保存题库 |
|||
*/ |
|||
@RequiresPermissions("small:question:edit") |
|||
@PostMapping("/edit") |
|||
@ResponseBody |
|||
public ZDResponse editSave(@RequestParam("file") MultipartFile[] files, QuestionBankBean bean) |
|||
{ |
|||
int resNum = questionBankService.updateQuestionBank(bean, files); |
|||
return resNum>0?ZDResponse.success("操作成功", resNum):ZDResponse.error("操作失败", resNum); |
|||
} |
|||
|
|||
/** |
|||
* 删除题库 |
|||
*/ |
|||
@RequiresPermissions("small:question:remove") |
|||
@PostMapping( "/remove") |
|||
@ResponseBody |
|||
public ZDResponse remove(String ids) |
|||
{ |
|||
int resNum = questionBankService.deleteQuestionBankByIds(ids); |
|||
return resNum>0? ZDResponse.success("操作成功", resNum):ZDResponse.error("操作失败", resNum); |
|||
} |
|||
|
|||
/** |
|||
* 修改题库 |
|||
*/ |
|||
@GetMapping("/detail/{guid}") |
|||
public String detail(@PathVariable("guid") String guid, ModelMap mmap) |
|||
{ |
|||
QuestionBank questionBank = questionBankService.selectQuestionBankById(guid); |
|||
mmap.put("questionBank", questionBank); |
|||
AnswerBank answerBank = new AnswerBank(); |
|||
answerBank.setQuestionBankId(questionBank.getGuid()); |
|||
List<AnswerBank> answerBankList = answerBankService.selectAnswerBankList(answerBank); |
|||
mmap.put("answerBanks", answerBankList); |
|||
return prefix + "/detail"; |
|||
} |
|||
|
|||
/** |
|||
* 修改发布状态 |
|||
*/ |
|||
@RequiresPermissions("small:library:edit") |
|||
@PostMapping("/toPublishState") |
|||
@ResponseBody |
|||
public ZDResponse toPublishState(String ids, String state) |
|||
{ |
|||
int resNum = questionBankService.updatePublishState(ids, state); |
|||
return resNum>0?ZDResponse.success("操作成功", resNum):ZDResponse.error("操作失败", resNum); |
|||
} |
|||
|
|||
/** |
|||
* 查询附件信息 |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
@GetMapping( "/queryFiles/{key}") |
|||
@ResponseBody |
|||
public ZDResponse queryFiles(@PathVariable String key){ |
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
map.put("filePreview", questionBankService.queryFiles(key)); |
|||
return ZDResponse.success("获取成功",map); |
|||
} |
|||
|
|||
/** |
|||
* 查询附件信息 |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
@PostMapping( "/queryFilesPost") |
|||
@ResponseBody |
|||
public ZDResponse queryFilesPost(String key){ |
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
map.put("filePreview", questionBankService.queryFiles(key)); |
|||
return ZDResponse.success("获取成功",map); |
|||
} |
|||
|
|||
/** |
|||
* 删除案例要素附件 |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
@PostMapping("/removeFile") |
|||
@ResponseBody |
|||
public ZDResponse removeFile(String key) { |
|||
if (questionBankService.removeFile(key) > 0) { |
|||
return ZDResponse.success("操作成功"); |
|||
} else { |
|||
return ZDResponse.error("操作失败"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,80 @@ |
|||
package com.zdxt.knowledge.domain; |
|||
|
|||
import com.zdxt.common.BaseDomain; |
|||
|
|||
/** |
|||
* 答案库对象 answer_bank |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-29 |
|||
*/ |
|||
public class AnswerBank extends BaseDomain |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** 主键 */ |
|||
private String guid; |
|||
|
|||
/** 关联问题库 */ |
|||
private String questionBankId; |
|||
|
|||
/** 标题 */ |
|||
private String title; |
|||
|
|||
/** 内容 */ |
|||
private String content; |
|||
|
|||
/** 状态(0:正常,1:停用) */ |
|||
private Integer status; |
|||
|
|||
/** 排序 */ |
|||
private Integer sort; |
|||
|
|||
public String getGuid() { |
|||
return guid; |
|||
} |
|||
|
|||
public void setGuid(String guid) { |
|||
this.guid = guid; |
|||
} |
|||
|
|||
public String getQuestionBankId() { |
|||
return questionBankId; |
|||
} |
|||
|
|||
public void setQuestionBankId(String questionBankId) { |
|||
this.questionBankId = questionBankId; |
|||
} |
|||
|
|||
public String getTitle() { |
|||
return title; |
|||
} |
|||
|
|||
public void setTitle(String title) { |
|||
this.title = title; |
|||
} |
|||
|
|||
public String getContent() { |
|||
return content; |
|||
} |
|||
|
|||
public void setContent(String content) { |
|||
this.content = content; |
|||
} |
|||
|
|||
public Integer getStatus() { |
|||
return status; |
|||
} |
|||
|
|||
public void setStatus(Integer status) { |
|||
this.status = status; |
|||
} |
|||
|
|||
public Integer getSort() { |
|||
return sort; |
|||
} |
|||
|
|||
public void setSort(Integer sort) { |
|||
this.sort = sort; |
|||
} |
|||
} |
|||
@ -0,0 +1,124 @@ |
|||
package com.zdxt.knowledge.domain; |
|||
|
|||
import com.zdxt.common.BaseDomain; |
|||
|
|||
/** |
|||
* 题库对象 question_bank |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-29 |
|||
*/ |
|||
public class QuestionBank extends BaseDomain |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** 主键 */ |
|||
private String guid; |
|||
|
|||
/** 标题 */ |
|||
private String title; |
|||
|
|||
/** 内容 */ |
|||
private String content; |
|||
|
|||
/** 提示 */ |
|||
private String tips; |
|||
|
|||
/** 答案 */ |
|||
private String answer; |
|||
|
|||
/** 排序 */ |
|||
private Long srot; |
|||
|
|||
/** 状态(0:正常,1:停用) */ |
|||
private Integer status; |
|||
|
|||
/** 类型(0:单选,1:多选,2:判断) */ |
|||
private Integer type; |
|||
|
|||
/** 发布时间 */ |
|||
private String publishdate; |
|||
|
|||
/** 发布状态(0:待发布,1:已发布,2:已上线,3:已下线) */ |
|||
private Integer publishstate; |
|||
|
|||
public String getGuid() { |
|||
return guid; |
|||
} |
|||
|
|||
public void setGuid(String guid) { |
|||
this.guid = guid; |
|||
} |
|||
|
|||
public String getTitle() { |
|||
return title; |
|||
} |
|||
|
|||
public void setTitle(String title) { |
|||
this.title = title; |
|||
} |
|||
|
|||
public String getContent() { |
|||
return content; |
|||
} |
|||
|
|||
public void setContent(String content) { |
|||
this.content = content; |
|||
} |
|||
|
|||
public String getTips() { |
|||
return tips; |
|||
} |
|||
|
|||
public void setTips(String tips) { |
|||
this.tips = tips; |
|||
} |
|||
|
|||
public String getAnswer() { |
|||
return answer; |
|||
} |
|||
|
|||
public void setAnswer(String answer) { |
|||
this.answer = answer; |
|||
} |
|||
|
|||
public Long getSrot() { |
|||
return srot; |
|||
} |
|||
|
|||
public void setSrot(Long srot) { |
|||
this.srot = srot; |
|||
} |
|||
|
|||
public Integer getStatus() { |
|||
return status; |
|||
} |
|||
|
|||
public void setStatus(Integer status) { |
|||
this.status = status; |
|||
} |
|||
|
|||
public Integer getType() { |
|||
return type; |
|||
} |
|||
|
|||
public void setType(Integer type) { |
|||
this.type = type; |
|||
} |
|||
|
|||
public String getPublishdate() { |
|||
return publishdate; |
|||
} |
|||
|
|||
public void setPublishdate(String publishdate) { |
|||
this.publishdate = publishdate; |
|||
} |
|||
|
|||
public Integer getPublishstate() { |
|||
return publishstate; |
|||
} |
|||
|
|||
public void setPublishstate(Integer publishstate) { |
|||
this.publishstate = publishstate; |
|||
} |
|||
} |
|||
@ -0,0 +1,63 @@ |
|||
package com.zdxt.knowledge.mapper; |
|||
|
|||
import com.zdxt.knowledge.domain.AnswerBank; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 答案库Mapper接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-29 |
|||
*/ |
|||
public interface AnswerBankMapper |
|||
{ |
|||
/** |
|||
* 查询答案库 |
|||
* |
|||
* @param guid 答案库ID |
|||
* @return 答案库 |
|||
*/ |
|||
public AnswerBank selectAnswerBankById(String guid); |
|||
|
|||
/** |
|||
* 查询答案库列表 |
|||
* |
|||
* @param answerBank 答案库 |
|||
* @return 答案库集合 |
|||
*/ |
|||
public List<AnswerBank> selectAnswerBankList(AnswerBank answerBank); |
|||
|
|||
/** |
|||
* 新增答案库 |
|||
* |
|||
* @param answerBank 答案库 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertAnswerBank(AnswerBank answerBank); |
|||
|
|||
/** |
|||
* 修改答案库 |
|||
* |
|||
* @param answerBank 答案库 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateAnswerBank(AnswerBank answerBank); |
|||
|
|||
/** |
|||
* 删除答案库 |
|||
* |
|||
* @param guid 答案库ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteAnswerBankById(String guid); |
|||
|
|||
/** |
|||
* 批量删除答案库 |
|||
* |
|||
* @param guids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteAnswerBankByIds(String[] guids); |
|||
public int deleteAnswerBankByQusetionIds(String[] guids); |
|||
} |
|||
@ -0,0 +1,70 @@ |
|||
package com.zdxt.knowledge.mapper; |
|||
|
|||
import com.zdxt.knowledge.domain.QuestionBank; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 题库Mapper接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-29 |
|||
*/ |
|||
public interface QuestionBankMapper |
|||
{ |
|||
/** |
|||
* 查询题库 |
|||
* |
|||
* @param guid 题库ID |
|||
* @return 题库 |
|||
*/ |
|||
public QuestionBank selectQuestionBankById(String guid); |
|||
|
|||
/** |
|||
* 查询题库列表 |
|||
* |
|||
* @param questionBank 题库 |
|||
* @return 题库集合 |
|||
*/ |
|||
public List<QuestionBank> selectQuestionBankList(QuestionBank questionBank); |
|||
|
|||
/** |
|||
* 新增题库 |
|||
* |
|||
* @param questionBank 题库 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertQuestionBank(QuestionBank questionBank); |
|||
|
|||
/** |
|||
* 修改题库 |
|||
* |
|||
* @param questionBank 题库 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateQuestionBank(QuestionBank questionBank); |
|||
|
|||
/** |
|||
* 删除题库 |
|||
* |
|||
* @param guid 题库ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteQuestionBankById(String guid); |
|||
|
|||
/** |
|||
* 批量删除题库 |
|||
* |
|||
* @param guids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteQuestionBankByIds(String[] guids); |
|||
|
|||
/** |
|||
* 批量修改发布状态 |
|||
* @param guids |
|||
* @return |
|||
*/ |
|||
public int updatePublishState(@Param("guids") String[] guids, @Param("state") String state, @Param("publishdate") String publishdate); |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
package com.zdxt.knowledge.service; |
|||
|
|||
import com.zdxt.knowledge.domain.AnswerBank; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 答案库Service接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-29 |
|||
*/ |
|||
public interface IAnswerBankService |
|||
{ |
|||
/** |
|||
* 查询答案库 |
|||
* |
|||
* @param guid 答案库ID |
|||
* @return 答案库 |
|||
*/ |
|||
public AnswerBank selectAnswerBankById(String guid); |
|||
|
|||
/** |
|||
* 查询答案库列表 |
|||
* |
|||
* @param answerBank 答案库 |
|||
* @return 答案库集合 |
|||
*/ |
|||
public List<AnswerBank> selectAnswerBankList(AnswerBank answerBank); |
|||
|
|||
/** |
|||
* 新增答案库 |
|||
* |
|||
* @param answerBank 答案库 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertAnswerBank(AnswerBank answerBank); |
|||
|
|||
/** |
|||
* 修改答案库 |
|||
* |
|||
* @param answerBank 答案库 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateAnswerBank(AnswerBank answerBank); |
|||
|
|||
/** |
|||
* 批量删除答案库 |
|||
* |
|||
* @param ids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteAnswerBankByIds(String ids); |
|||
|
|||
/** |
|||
* 删除答案库信息 |
|||
* |
|||
* @param guid 答案库ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteAnswerBankById(String guid); |
|||
} |
|||
@ -0,0 +1,86 @@ |
|||
package com.zdxt.knowledge.service; |
|||
|
|||
import com.zdxt.common.zdxtFile.AttFileRespDTO; |
|||
import com.zdxt.knowledge.domain.QuestionBank; |
|||
import com.zdxt.knowledge.dto.QuestionBankBean; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 题库Service接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-29 |
|||
*/ |
|||
public interface IQuestionBankService |
|||
{ |
|||
/** |
|||
* 查询题库 |
|||
* |
|||
* @param guid 题库ID |
|||
* @return 题库 |
|||
*/ |
|||
public QuestionBank selectQuestionBankById(String guid); |
|||
|
|||
/** |
|||
* 查询题库列表 |
|||
* |
|||
* @param questionBank 题库 |
|||
* @return 题库集合 |
|||
*/ |
|||
public List<QuestionBank> selectQuestionBankList(QuestionBank questionBank); |
|||
|
|||
/** |
|||
* 新增题库 |
|||
* |
|||
* @param bean 题库 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertQuestionBank(QuestionBankBean bean, MultipartFile[] files); |
|||
|
|||
/** |
|||
* 修改题库 |
|||
* |
|||
* @param bean 题库 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateQuestionBank(QuestionBankBean bean, MultipartFile[] files); |
|||
|
|||
/** |
|||
* 批量删除题库 |
|||
* |
|||
* @param ids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteQuestionBankByIds(String ids); |
|||
|
|||
/** |
|||
* 删除题库信息 |
|||
* |
|||
* @param guid 题库ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteQuestionBankById(String guid); |
|||
|
|||
/** |
|||
* 批量修改发布状态 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
public int updatePublishState(String ids, String state); |
|||
|
|||
/** |
|||
* 查询附件 |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
AttFileRespDTO queryFiles(String key); |
|||
|
|||
/** |
|||
* 删除案例要素图片 |
|||
* @param key 图片id |
|||
* @return |
|||
*/ |
|||
public int removeFile(String key); |
|||
} |
|||
@ -0,0 +1,95 @@ |
|||
package com.zdxt.knowledge.service.impl; |
|||
|
|||
import java.util.List; |
|||
|
|||
import com.zdxt.common.util.Convert; |
|||
import com.zdxt.knowledge.domain.AnswerBank; |
|||
import com.zdxt.knowledge.mapper.AnswerBankMapper; |
|||
import com.zdxt.knowledge.service.IAnswerBankService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* 答案库Service业务层处理 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-29 |
|||
*/ |
|||
@Service |
|||
public class AnswerBankServiceImpl implements IAnswerBankService |
|||
{ |
|||
@Autowired |
|||
private AnswerBankMapper answerBankMapper; |
|||
|
|||
/** |
|||
* 查询答案库 |
|||
* |
|||
* @param guid 答案库ID |
|||
* @return 答案库 |
|||
*/ |
|||
@Override |
|||
public AnswerBank selectAnswerBankById(String guid) |
|||
{ |
|||
return answerBankMapper.selectAnswerBankById(guid); |
|||
} |
|||
|
|||
/** |
|||
* 查询答案库列表 |
|||
* |
|||
* @param answerBank 答案库 |
|||
* @return 答案库 |
|||
*/ |
|||
@Override |
|||
public List<AnswerBank> selectAnswerBankList(AnswerBank answerBank) |
|||
{ |
|||
return answerBankMapper.selectAnswerBankList(answerBank); |
|||
} |
|||
|
|||
/** |
|||
* 新增答案库 |
|||
* |
|||
* @param answerBank 答案库 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertAnswerBank(AnswerBank answerBank) |
|||
{ |
|||
return answerBankMapper.insertAnswerBank(answerBank); |
|||
} |
|||
|
|||
/** |
|||
* 修改答案库 |
|||
* |
|||
* @param answerBank 答案库 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int updateAnswerBank(AnswerBank answerBank) |
|||
{ |
|||
return answerBankMapper.updateAnswerBank(answerBank); |
|||
} |
|||
|
|||
/** |
|||
* 删除答案库对象 |
|||
* |
|||
* @param ids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteAnswerBankByIds(String ids) |
|||
{ |
|||
return answerBankMapper.deleteAnswerBankByIds(Convert.toStrArray(ids)); |
|||
} |
|||
|
|||
/** |
|||
* 删除答案库信息 |
|||
* |
|||
* @param guid 答案库ID |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteAnswerBankById(String guid) |
|||
{ |
|||
return answerBankMapper.deleteAnswerBankById(guid); |
|||
} |
|||
} |
|||
@ -0,0 +1,197 @@ |
|||
package com.zdxt.knowledge.service.impl; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.zdxt.auth.dto.ZdxtFileBean; |
|||
import com.zdxt.auth.feign.FileUploadApi; |
|||
import com.zdxt.auth.feign.ZdxtFileCommonApi; |
|||
import com.zdxt.common.util.Convert; |
|||
import com.zdxt.common.util.DateUtils; |
|||
import com.zdxt.common.util.StringUtils; |
|||
import com.zdxt.common.zdxtFile.AttFileRespDTO; |
|||
import com.zdxt.common.zdxtFile.FilePreviewUtilBean; |
|||
import com.zdxt.common.zdxtFile.ZdxtFileCommon; |
|||
import com.zdxt.knowledge.domain.AnswerBank; |
|||
import com.zdxt.knowledge.domain.QuestionBank; |
|||
import com.zdxt.knowledge.dto.QuestionBankBean; |
|||
import com.zdxt.knowledge.mapper.AnswerBankMapper; |
|||
import com.zdxt.knowledge.mapper.QuestionBankMapper; |
|||
import com.zdxt.knowledge.service.IQuestionBankService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
/** |
|||
* 题库Service业务层处理 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-29 |
|||
*/ |
|||
@Service |
|||
public class QuestionBankServiceImpl implements IQuestionBankService |
|||
{ |
|||
@Autowired private QuestionBankMapper questionBankMapper; |
|||
@Autowired private AnswerBankMapper answerBankMapper; |
|||
@Autowired private FileUploadApi fileUploadApi; |
|||
@Autowired private ZdxtFileCommonApi zdxtFileCommonApi; |
|||
|
|||
/** |
|||
* 查询题库 |
|||
* |
|||
* @param guid 题库ID |
|||
* @return 题库 |
|||
*/ |
|||
@Override |
|||
public QuestionBank selectQuestionBankById(String guid) |
|||
{ |
|||
return questionBankMapper.selectQuestionBankById(guid); |
|||
} |
|||
|
|||
/** |
|||
* 查询题库列表 |
|||
* |
|||
* @param questionBank 题库 |
|||
* @return 题库 |
|||
*/ |
|||
@Override |
|||
public List<QuestionBank> selectQuestionBankList(QuestionBank questionBank) |
|||
{ |
|||
return questionBankMapper.selectQuestionBankList(questionBank); |
|||
} |
|||
|
|||
/** |
|||
* 新增题库 |
|||
* |
|||
* @param bean 题库 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertQuestionBank(QuestionBankBean bean, MultipartFile[] files) |
|||
{ |
|||
QuestionBank questionBank = new QuestionBank(); |
|||
BeanUtil.copyProperties(bean, questionBank); |
|||
|
|||
questionBank.setGuid(StringUtils.getUUID()); |
|||
questionBank.setSrot(0L); |
|||
int resNum = questionBankMapper.insertQuestionBank(questionBank); |
|||
String[] codes = bean.getCodes().split(","); |
|||
String[] values = bean.getValues().split(","); |
|||
if (resNum > 0 && codes.length > 0) { |
|||
for (int i=0; i<codes.length; i++) { |
|||
AnswerBank answerBank = new AnswerBank(); |
|||
answerBank.setGuid(StringUtils.getUUID()); |
|||
answerBank.setTitle(codes[i]); |
|||
answerBank.setContent(values[i]); |
|||
answerBank.setQuestionBankId(questionBank.getGuid()); |
|||
answerBank.setSort(i+1); |
|||
answerBankMapper.insertAnswerBank(answerBank); |
|||
} |
|||
} |
|||
|
|||
// 上传文件,并在附件表中添加记录
|
|||
if (resNum > 0 && ObjectUtil.isNotEmpty(files)) { |
|||
for (MultipartFile file : files) { |
|||
// todo 将原有关联附件删除在重新上传比较好
|
|||
zdxtFileCommonApi.insertZdxtFile(file, questionBank.getGuid(), fileUploadApi.upload(file)); |
|||
} |
|||
} |
|||
return resNum; |
|||
} |
|||
|
|||
/** |
|||
* 修改题库 |
|||
* |
|||
* @param bean 题库 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int updateQuestionBank(QuestionBankBean bean, MultipartFile[] files) |
|||
{ |
|||
QuestionBank questionBank = new QuestionBank(); |
|||
BeanUtil.copyProperties(bean, questionBank); |
|||
int resNum = questionBankMapper.updateQuestionBank(questionBank); |
|||
|
|||
String[] codes = bean.getCodes().split(","); |
|||
String[] values = bean.getValues().split(","); |
|||
if (resNum > 0 && codes.length > 0) { |
|||
answerBankMapper.deleteAnswerBankByQusetionIds(Convert.toStrArray(questionBank.getGuid())); |
|||
for (int i=0; i<codes.length; i++) { |
|||
AnswerBank answerBank = new AnswerBank(); |
|||
answerBank.setGuid(StringUtils.getUUID()); |
|||
answerBank.setTitle(codes[i]); |
|||
answerBank.setContent(values[i]); |
|||
answerBank.setQuestionBankId(questionBank.getGuid()); |
|||
answerBank.setSort(i+1); |
|||
answerBankMapper.insertAnswerBank(answerBank); |
|||
} |
|||
} |
|||
|
|||
// 上传文件,并在附件表中添加记录
|
|||
if (resNum > 0 && ObjectUtil.isNotEmpty(files)) { |
|||
for (MultipartFile file : files) { |
|||
// todo 将原有关联附件删除在重新上传比较好
|
|||
zdxtFileCommonApi.insertZdxtFile(file, questionBank.getGuid(), fileUploadApi.upload(file)); |
|||
} |
|||
} |
|||
return resNum; |
|||
} |
|||
|
|||
/** |
|||
* 删除题库对象 |
|||
* |
|||
* @param ids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteQuestionBankByIds(String ids) |
|||
{ |
|||
int resNum = questionBankMapper.deleteQuestionBankByIds(Convert.toStrArray(ids)); |
|||
if (resNum > 0) { |
|||
resNum = answerBankMapper.deleteAnswerBankByQusetionIds(Convert.toStrArray(ids)); |
|||
} |
|||
return resNum; |
|||
} |
|||
|
|||
/** |
|||
* 删除题库信息 |
|||
* |
|||
* @param guid 题库ID |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteQuestionBankById(String guid) |
|||
{ |
|||
return questionBankMapper.deleteQuestionBankById(guid); |
|||
} |
|||
|
|||
@Override |
|||
public int updatePublishState(String ids, String state) { |
|||
String publishdate = DateUtils.getTime(); |
|||
return questionBankMapper.updatePublishState(Convert.toStrArray(ids), state, publishdate); |
|||
} |
|||
|
|||
@Override |
|||
public AttFileRespDTO queryFiles(String key) { |
|||
ZdxtFileBean zdxtFileBeanCondition = new ZdxtFileBean(); |
|||
zdxtFileBeanCondition.setBusinessId(key); |
|||
List<ZdxtFileBean> fileBeanList = zdxtFileCommonApi.selectZdxtFileList(zdxtFileBeanCondition); |
|||
|
|||
ArrayList<ZdxtFileCommon> fileList = new ArrayList<>(); |
|||
for (ZdxtFileBean fileBean : fileBeanList) { |
|||
ZdxtFileCommon zdxtFileCommon = new ZdxtFileCommon(); |
|||
BeanUtil.copyProperties(fileBean, zdxtFileCommon); |
|||
fileList.add(zdxtFileCommon); |
|||
} |
|||
|
|||
FilePreviewUtilBean filePreviewUtilBean = new FilePreviewUtilBean(); |
|||
return filePreviewUtilBean.attachementToAttFileRespDTO(fileList); |
|||
} |
|||
|
|||
@Override |
|||
public int removeFile(String key) { |
|||
return zdxtFileCommonApi.deleteZdxtFileById(key); |
|||
} |
|||
} |
|||
@ -0,0 +1,104 @@ |
|||
<?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.zdxt.knowledge.mapper.AnswerBankMapper"> |
|||
|
|||
<resultMap type="com.zdxt.knowledge.domain.AnswerBank" id="AnswerBankResult"> |
|||
<result property="guid" column="guid" /> |
|||
<result property="questionBankId" column="question_bank_id" /> |
|||
<result property="title" column="title" /> |
|||
<result property="content" column="content" /> |
|||
<result property="status" column="status" /> |
|||
<result property="sort" column="sort" /> |
|||
<result property="creator" column="creator" /> |
|||
<result property="createTime" column="create_time" /> |
|||
<result property="updator" column="updator" /> |
|||
<result property="updateTime" column="update_time" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectAnswerBankVo"> |
|||
select guid, question_bank_id, title, content, status, sort, creator, create_time, updator, update_time from answer_bank |
|||
</sql> |
|||
|
|||
<select id="selectAnswerBankList" parameterType="AnswerBank" resultMap="AnswerBankResult"> |
|||
<include refid="selectAnswerBankVo"/> |
|||
<where> |
|||
<if test="questionBankId != null and questionBankId != ''"> and question_bank_id = #{questionBankId}</if> |
|||
<if test="title != null and title != ''"> and title = #{title}</if> |
|||
<if test="content != null and content != ''"> and content = #{content}</if> |
|||
<if test="status != null "> and status = #{status}</if> |
|||
<if test="creator != null and creator != ''"> and creator = #{creator}</if> |
|||
<if test="updator != null and updator != ''"> and updator = #{updator}</if> |
|||
</where> |
|||
ORDER BY sort ASC |
|||
</select> |
|||
|
|||
<select id="selectAnswerBankById" parameterType="String" resultMap="AnswerBankResult"> |
|||
<include refid="selectAnswerBankVo"/> |
|||
where guid = #{guid} |
|||
</select> |
|||
|
|||
<insert id="insertAnswerBank" parameterType="AnswerBank"> |
|||
insert into answer_bank |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="guid != null and guid != ''">guid,</if> |
|||
<if test="questionBankId != null and questionBankId != ''">question_bank_id,</if> |
|||
<if test="title != null and title != ''">title,</if> |
|||
<if test="content != null and content != ''">content,</if> |
|||
<if test="status != null ">status,</if> |
|||
<if test="sort != null ">sort,</if> |
|||
<if test="creator != null and creator != ''">creator,</if> |
|||
<if test="createTime != null ">create_time,</if> |
|||
<if test="updator != null and updator != ''">updator,</if> |
|||
<if test="updateTime != null ">update_time,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="guid != null and guid != ''">#{guid},</if> |
|||
<if test="questionBankId != null and questionBankId != ''">#{questionBankId},</if> |
|||
<if test="title != null and title != ''">#{title},</if> |
|||
<if test="content != null and content != ''">#{content},</if> |
|||
<if test="status != null ">#{status},</if> |
|||
<if test="sort != null ">#{sort},</if> |
|||
<if test="creator != null and creator != ''">#{creator},</if> |
|||
<if test="createTime != null ">#{createTime},</if> |
|||
<if test="updator != null and updator != ''">#{updator},</if> |
|||
<if test="updateTime != null ">#{updateTime},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateAnswerBank" parameterType="AnswerBank"> |
|||
update answer_bank |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="questionBankId != null and questionBankId != ''">question_bank_id = #{questionBankId},</if> |
|||
<if test="title != null and title != ''">title = #{title},</if> |
|||
<if test="content != null and content != ''">content = #{content},</if> |
|||
<if test="status != null ">status = #{status},</if> |
|||
<if test="sort != null ">sort = #{sort},</if> |
|||
<if test="creator != null and creator != ''">creator = #{creator},</if> |
|||
<if test="createTime != null ">create_time = #{createTime},</if> |
|||
<if test="updator != null and updator != ''">updator = #{updator},</if> |
|||
<if test="updateTime != null ">update_time = #{updateTime},</if> |
|||
</trim> |
|||
where guid = #{guid} |
|||
</update> |
|||
|
|||
<delete id="deleteAnswerBankById" parameterType="String"> |
|||
delete from answer_bank where guid = #{guid} |
|||
</delete> |
|||
|
|||
<delete id="deleteAnswerBankByIds" parameterType="String"> |
|||
delete from answer_bank where guid in |
|||
<foreach item="guid" collection="array" open="(" separator="," close=")"> |
|||
#{guid} |
|||
</foreach> |
|||
</delete> |
|||
|
|||
<delete id="deleteAnswerBankByQusetionIds" parameterType="String"> |
|||
delete from answer_bank where question_bank_id in |
|||
<foreach item="guid" collection="array" open="(" separator="," close=")"> |
|||
#{guid} |
|||
</foreach> |
|||
</delete> |
|||
|
|||
</mapper> |
|||
@ -0,0 +1,129 @@ |
|||
<?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.zdxt.knowledge.mapper.QuestionBankMapper"> |
|||
|
|||
<resultMap type="com.zdxt.knowledge.domain.QuestionBank" id="QuestionBankResult"> |
|||
<result property="guid" column="guid" /> |
|||
<result property="title" column="title" /> |
|||
<result property="content" column="content" /> |
|||
<result property="tips" column="tips" /> |
|||
<result property="answer" column="answer" /> |
|||
<result property="srot" column="srot" /> |
|||
<result property="status" column="status" /> |
|||
<result property="type" column="type" /> |
|||
<result property="publishdate" column="publishDate" /> |
|||
<result property="publishstate" column="publishState" /> |
|||
<result property="creator" column="creator" /> |
|||
<result property="createTime" column="create_time" /> |
|||
<result property="updator" column="updator" /> |
|||
<result property="updateTime" column="update_time" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectQuestionBankVo"> |
|||
select guid, title, content, tips, answer, srot, status, type, publishDate, publishState, creator, create_time, updator, update_time from question_bank |
|||
</sql> |
|||
|
|||
<select id="selectQuestionBankList" parameterType="QuestionBank" resultMap="QuestionBankResult"> |
|||
<include refid="selectQuestionBankVo"/> |
|||
<where> |
|||
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if> |
|||
<if test="content != null and content != ''"> and content = #{content}</if> |
|||
<if test="tips != null and tips != ''"> and tips = #{tips}</if> |
|||
<if test="answer != null and answer != ''"> and answer = #{answer}</if> |
|||
<if test="srot != null "> and srot = #{srot}</if> |
|||
<if test="status != null "> and status = #{status}</if> |
|||
<if test="type != null "> and type = #{type}</if> |
|||
<if test="publishdate != null and publishdate != ''"> and publishDate = #{publishdate}</if> |
|||
<if test="publishstate != null "> and publishState = #{publishstate}</if> |
|||
<if test="creator != null and creator != ''"> and creator = #{creator}</if> |
|||
<if test="updator != null and updator != ''"> and updator = #{updator}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectQuestionBankById" parameterType="String" resultMap="QuestionBankResult"> |
|||
<include refid="selectQuestionBankVo"/> |
|||
where guid = #{guid} |
|||
</select> |
|||
|
|||
<insert id="insertQuestionBank" parameterType="QuestionBank"> |
|||
insert into question_bank |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="guid != null and guid != ''">guid,</if> |
|||
<if test="title != null and title != ''">title,</if> |
|||
<if test="content != null and content != ''">content,</if> |
|||
<if test="tips != null and tips != ''">tips,</if> |
|||
<if test="answer != null and answer != ''">answer,</if> |
|||
<if test="srot != null ">srot,</if> |
|||
<if test="status != null ">status,</if> |
|||
<if test="type != null ">type,</if> |
|||
<if test="publishdate != null and publishdate != ''">publishDate,</if> |
|||
<if test="publishstate != null ">publishState,</if> |
|||
<if test="creator != null and creator != ''">creator,</if> |
|||
<if test="createTime != null ">create_time,</if> |
|||
<if test="updator != null and updator != ''">updator,</if> |
|||
<if test="updateTime != null ">update_time,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="guid != null and guid != ''">#{guid},</if> |
|||
<if test="title != null and title != ''">#{title},</if> |
|||
<if test="content != null and content != ''">#{content},</if> |
|||
<if test="tips != null and tips != ''">#{tips},</if> |
|||
<if test="answer != null and answer != ''">#{answer},</if> |
|||
<if test="srot != null ">#{srot},</if> |
|||
<if test="status != null ">#{status},</if> |
|||
<if test="type != null ">#{type},</if> |
|||
<if test="publishdate != null and publishdate != ''">#{publishdate},</if> |
|||
<if test="publishstate != null ">#{publishstate},</if> |
|||
<if test="creator != null and creator != ''">#{creator},</if> |
|||
<if test="createTime != null ">#{createTime},</if> |
|||
<if test="updator != null and updator != ''">#{updator},</if> |
|||
<if test="updateTime != null ">#{updateTime},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateQuestionBank" parameterType="QuestionBank"> |
|||
update question_bank |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="title != null and title != ''">title = #{title},</if> |
|||
<if test="content != null and content != ''">content = #{content},</if> |
|||
<if test="tips != null and tips != ''">tips = #{tips},</if> |
|||
<if test="answer != null and answer != ''">answer = #{answer},</if> |
|||
<if test="srot != null ">srot = #{srot},</if> |
|||
<if test="status != null ">status = #{status},</if> |
|||
<if test="type != null ">type = #{type},</if> |
|||
<if test="publishdate != null and publishdate != ''">publishDate = #{publishdate},</if> |
|||
<if test="publishstate != null ">publishState = #{publishstate},</if> |
|||
<if test="creator != null and creator != ''">creator = #{creator},</if> |
|||
<if test="createTime != null ">create_time = #{createTime},</if> |
|||
<if test="updator != null and updator != ''">updator = #{updator},</if> |
|||
<if test="updateTime != null ">update_time = #{updateTime},</if> |
|||
</trim> |
|||
where guid = #{guid} |
|||
</update> |
|||
|
|||
<delete id="deleteQuestionBankById" parameterType="String"> |
|||
delete from question_bank where guid = #{guid} |
|||
</delete> |
|||
|
|||
<delete id="deleteQuestionBankByIds" parameterType="String"> |
|||
delete from question_bank where guid in |
|||
<foreach item="guid" collection="array" open="(" separator="," close=")"> |
|||
#{guid} |
|||
</foreach> |
|||
</delete> |
|||
|
|||
<update id="updatePublishState" parameterType="String"> |
|||
update question_bank |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="state == 1">publishDate = #{publishdate},</if> |
|||
<if test="state != null">publishState = #{state},</if> |
|||
</trim> |
|||
where guid in |
|||
<foreach item="guid" collection="guids" open="(" separator="," close=")"> |
|||
#{guid} |
|||
</foreach> |
|||
</update> |
|||
|
|||
</mapper> |
|||
@ -0,0 +1,144 @@ |
|||
package com.zdxt.knowledge.dto; |
|||
|
|||
import com.zdxt.common.BaseDomain; |
|||
|
|||
/** |
|||
* 题库对象 question_bank |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-29 |
|||
*/ |
|||
public class QuestionBankBean extends BaseDomain |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** 主键 */ |
|||
private String guid; |
|||
|
|||
/** 标题 */ |
|||
private String title; |
|||
|
|||
/** 内容 */ |
|||
private String content; |
|||
|
|||
/** 提示 */ |
|||
private String tips; |
|||
|
|||
/** 答案 */ |
|||
private String answer; |
|||
|
|||
/** 排序 */ |
|||
private Long srot; |
|||
|
|||
/** 状态(0:正常,1:停用) */ |
|||
private Integer status; |
|||
|
|||
/** 类型(0:单选,1:多选,2:判断) */ |
|||
private Integer type; |
|||
|
|||
/** 发布时间 */ |
|||
private String publishdate; |
|||
|
|||
/** 发布状态(0:待发布,1:已发布,2:已上线,3:已下线) */ |
|||
private Integer publishstate; |
|||
|
|||
private String codes; |
|||
|
|||
private String values; |
|||
|
|||
public String getGuid() { |
|||
return guid; |
|||
} |
|||
|
|||
public void setGuid(String guid) { |
|||
this.guid = guid; |
|||
} |
|||
|
|||
public String getTitle() { |
|||
return title; |
|||
} |
|||
|
|||
public void setTitle(String title) { |
|||
this.title = title; |
|||
} |
|||
|
|||
public String getContent() { |
|||
return content; |
|||
} |
|||
|
|||
public void setContent(String content) { |
|||
this.content = content; |
|||
} |
|||
|
|||
public String getTips() { |
|||
return tips; |
|||
} |
|||
|
|||
public void setTips(String tips) { |
|||
this.tips = tips; |
|||
} |
|||
|
|||
public String getAnswer() { |
|||
return answer; |
|||
} |
|||
|
|||
public void setAnswer(String answer) { |
|||
this.answer = answer; |
|||
} |
|||
|
|||
public Long getSrot() { |
|||
return srot; |
|||
} |
|||
|
|||
public void setSrot(Long srot) { |
|||
this.srot = srot; |
|||
} |
|||
|
|||
public Integer getStatus() { |
|||
return status; |
|||
} |
|||
|
|||
public void setStatus(Integer status) { |
|||
this.status = status; |
|||
} |
|||
|
|||
public Integer getType() { |
|||
return type; |
|||
} |
|||
|
|||
public void setType(Integer type) { |
|||
this.type = type; |
|||
} |
|||
|
|||
public String getPublishdate() { |
|||
return publishdate; |
|||
} |
|||
|
|||
public void setPublishdate(String publishdate) { |
|||
this.publishdate = publishdate; |
|||
} |
|||
|
|||
public Integer getPublishstate() { |
|||
return publishstate; |
|||
} |
|||
|
|||
public void setPublishstate(Integer publishstate) { |
|||
this.publishstate = publishstate; |
|||
} |
|||
|
|||
public String getCodes() { |
|||
return codes; |
|||
} |
|||
|
|||
public void setCodes(String codes) { |
|||
this.codes = codes; |
|||
} |
|||
|
|||
public String getValues() { |
|||
return values; |
|||
} |
|||
|
|||
public void setValues(String values) { |
|||
this.values = values; |
|||
} |
|||
} |
|||
Loading…
Reference in new issue