20 changed files with 1465 additions and 704 deletions
@ -0,0 +1,315 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('新增题目')"/> |
|||
<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" enctype="multipart/form-data" id="form-question-add" type="text/template" th:object="${sceneQuestion}"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">题目:</label> |
|||
<div class="col-sm-8"> |
|||
<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> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label is-required">答案:</label> |
|||
<div class="col-sm-8"> |
|||
<input class="form-control" type="text" name="answer" id="answer" placeholder="多选以逗号分隔" required> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">选项:</label> |
|||
<div class="col-sm-8"> |
|||
<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="identify" 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="identify" 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> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer"/> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-js"/> |
|||
<script type="text/javascript" th:inline="javascript"> |
|||
var prefix = ctx + "project/question" |
|||
|
|||
$("#form-question-add").validate({ |
|||
focusCleanup: true |
|||
}); |
|||
|
|||
// 当前文件框id,是不是fileInput |
|||
var isFlieIn = true; |
|||
|
|||
$(function() { |
|||
// 渲染要素信息 |
|||
renderVersionAtt(); |
|||
}) |
|||
|
|||
function submitHandler() { |
|||
if (isFlieIn) { |
|||
$('#fileInput').fileinput('upload'); |
|||
} else { |
|||
$('#fileOutput').fileinput('upload'); |
|||
} |
|||
} |
|||
/** 附件相关 */ |
|||
|
|||
/** 渲染附件信息 */ |
|||
function renderVersionAtt() { |
|||
var key = [[${guid}]]; |
|||
|
|||
$.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 + "/addSaveNew", result.data.filePreview); |
|||
} |
|||
}, |
|||
error: function (error) { |
|||
$.modal.alertWarning("附件预览失败!"); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** 上传附件 */ |
|||
function uploadFiles() { |
|||
var filePreview = { fileList: null, previewRespDTOS: null } |
|||
initFile("fileInput", prefix + "/addSaveNew", 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-question-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; |
|||
} |
|||
//选项 |
|||
var optionList = new Array(); |
|||
var j = 0; |
|||
$('input[name="identify"]').each(function () { |
|||
if (j !== 0) { |
|||
let option = {} |
|||
option.identify = $(this).val(); |
|||
option.content = $(this).parent().next().children().val(); |
|||
optionList.push(option); |
|||
} |
|||
j++; |
|||
}); |
|||
data.option = JSON.stringify(optionList); |
|||
data.parentId = [[${parentId}]]; |
|||
data.guid = [[${guid}]]; |
|||
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 sceneQuestion = [[${sceneQuestion}]] |
|||
if(sceneQuestion!=null){ |
|||
var answers = JSON.parse(sceneQuestion.option); |
|||
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="identify" value="'+answer.identify+'" style="width: 30px; text-align: center;"/></td>'; |
|||
html += '<td align="center"><input type="text" name="qContent" value="'+answer.content+'" style="width: 100%;"/></td>'; |
|||
html += '</tr>'; |
|||
} |
|||
$("input[name='answer']").val(sceneQuestion.answer); |
|||
$("#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='identify']").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> |
|||
@ -1,125 +0,0 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('场景题目绑定')"/> |
|||
</head> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-question-bind" th:object="${sceneQuestion}"> |
|||
<h2 th:text="*{name}" style="margin-bottom: 30px;"></h2> |
|||
<input name="guid" th:field="*{guid}" type="hidden"> |
|||
<div class="form-group"> |
|||
<div class="col-sm-6"> |
|||
<input name="answer" class="form-control" type="text" placeholder="A..."> |
|||
</div> |
|||
<div class="col-sm-2" style="width: 12%"> |
|||
<input type="checkbox" name="check" onclick="inputCheck(this)"> |
|||
<span>正确</span> |
|||
</div> |
|||
<div class="col-sm-4" style="display: none"> |
|||
<select class="form-control"> |
|||
<option th:each="li : ${list}" th:text="${li.id}" th:value="${li.id}"></option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-sm-6"> |
|||
<input name="answer" class="form-control" type="text" placeholder="B..."> |
|||
</div> |
|||
<div class="col-sm-2" style="width: 12%"> |
|||
<input type="checkbox" name="check" onclick="inputCheck(this)"> |
|||
<span>正确</span> |
|||
</div> |
|||
<div class="col-sm-4" style="display: none"> |
|||
<select class="form-control"> |
|||
<option th:each="li : ${list}" th:text="${li.id}" th:value="${li.id}"></option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-sm-6"> |
|||
<input name="answer" class="form-control" type="text" placeholder="C..."> |
|||
</div> |
|||
<div class="col-sm-2" style="width: 12%"> |
|||
<input type="checkbox" name="check" onclick="inputCheck(this)"> |
|||
<span>正确</span> |
|||
</div> |
|||
<div class="col-sm-4" style="display: none"> |
|||
<select class="form-control"> |
|||
<option th:each="li : ${list}" th:text="${li.id}" th:value="${li.id}"></option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-sm-6"> |
|||
<input name="answer" class="form-control" type="text" placeholder="D..."> |
|||
</div> |
|||
<div class="col-sm-2" style="width: 12%"> |
|||
<input type="checkbox" name="check" onclick="inputCheck(this)"> |
|||
<span>正确</span> |
|||
</div> |
|||
<div class="col-sm-4" style="display: none"> |
|||
<select class="form-control"> |
|||
<option th:each="li : ${list}" th:text="${li.id}" th:value="${li.id}"></option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer"/> |
|||
<script th:inline="javascript"> |
|||
var prefix = ctx + "project/question" |
|||
$("#form-question-add").validate({ |
|||
focusCleanup: true |
|||
}); |
|||
|
|||
function inputCheck(obj) { |
|||
if ($(obj).prop('checked')) { |
|||
// 还原之前样式 |
|||
$("[name='check']").prop('checked', false); |
|||
// $("[name='select']").val(""); |
|||
$(".col-sm-4").hide(); |
|||
//选中当前样式 |
|||
$(obj).prop('checked', true) |
|||
$(obj).parent().next().show(); |
|||
} else { |
|||
$(obj).parent().next().hide(); |
|||
} |
|||
} |
|||
|
|||
function submitHandler() { |
|||
if ($.validate.form()) { |
|||
var reqData = {}; |
|||
var nextQuestionId; |
|||
var reqList = new Array(); |
|||
var checkFlag = false; |
|||
var elements = document.getElementsByName("answer"); |
|||
for (let i = 0; i < document.getElementsByName("answer").length; i++) { |
|||
if (elements[i].value === "") { |
|||
$.modal.alertWarning("请将选项填写完整"); |
|||
return; |
|||
} |
|||
var req = {}; |
|||
req.answer = elements[i].value; |
|||
req.check = elements[i].parentElement.nextElementSibling.firstElementChild.checked; |
|||
checkFlag = checkFlag === true ? true : req.check; |
|||
reqList.push(req); |
|||
debugger |
|||
if (req.check) { |
|||
let divData = elements[i].parentElement.nextElementSibling.nextElementSibling; |
|||
nextQuestionId = $(divData).find("select").val(); |
|||
} |
|||
} |
|||
if (!checkFlag) { |
|||
$.modal.alertWarning("请勾选一个正确选项"); |
|||
return; |
|||
} |
|||
reqData.id = $("[name = 'id']").val(); |
|||
reqData.nextQuestionId = nextQuestionId; |
|||
reqData.answer = JSON.stringify(reqList); |
|||
$.operate.save(prefix + "/bindAnswer", reqData); |
|||
} |
|||
} |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -1,143 +0,0 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<title>Tree Diagram with Tooltips</title> |
|||
<style> |
|||
.card { |
|||
fill: #fff; |
|||
stroke: steelblue; |
|||
stroke-width: 3px; |
|||
width: 120px; |
|||
height: 50px; |
|||
cursor: pointer; |
|||
} |
|||
|
|||
.card text { |
|||
font-size: 14px; |
|||
font-family: sans-serif; |
|||
} |
|||
|
|||
.tooltip { |
|||
position: absolute; |
|||
text-align: center; |
|||
padding: 10px; |
|||
font-size: 14px; |
|||
font-family: sans-serif; |
|||
background-color: #f0f0f0; |
|||
border: 1px solid #ccc; |
|||
border-radius: 5px; |
|||
pointer-events: none; |
|||
visibility: hidden; |
|||
} |
|||
|
|||
.link { |
|||
fill: none; |
|||
stroke: #ccc; |
|||
stroke-width: 2px; |
|||
} |
|||
</style> |
|||
</head> |
|||
<body> |
|||
<div id="tree"></div> |
|||
<script src="https://d3js.org/d3.v5.min.js"></script> |
|||
<script> |
|||
// 树形结构数据 |
|||
// var treeData = { |
|||
// "name": "Root", |
|||
// "children": [ |
|||
// { |
|||
// "name": "Node 1", |
|||
// "children": [ |
|||
// {"name": "Leaf 1"}, |
|||
// ] |
|||
// }, |
|||
// { |
|||
// "name": "Node 2", |
|||
// "children": [ |
|||
// {"name": "Leaf 1"} |
|||
// ] |
|||
// } |
|||
// ] |
|||
// }; |
|||
var treeData = { |
|||
"name": "Root", |
|||
"children": [ |
|||
{ |
|||
"name": "Node 1", |
|||
"children": [ |
|||
{"name": "Leaf 1"}, |
|||
] |
|||
} |
|||
] |
|||
}; |
|||
|
|||
// 定义画布大小和边距 |
|||
var margin = {top: 20, right: 120, bottom: 20, left: 120}, |
|||
width = 600 - margin.right - margin.left, |
|||
height = 300 - margin.top - margin.bottom; |
|||
|
|||
// 定义树形布局 |
|||
var treemap = d3.tree() |
|||
.size([height, width]); |
|||
|
|||
// 为数据设置层级关系 |
|||
var root = d3.hierarchy(treeData); |
|||
|
|||
// 计算节点位置 |
|||
treemap(root); |
|||
|
|||
// 创建SVG画布 |
|||
var svg = d3.select("#tree") |
|||
.append("svg") |
|||
.attr("width", width + margin.right + margin.left) |
|||
.attr("height", height + margin.top + margin.bottom) |
|||
.append("g") |
|||
.attr("transform", "translate(" + margin.left + "," + margin.top + ")"); |
|||
|
|||
// 添加节点组 |
|||
var node = svg.selectAll(".node") |
|||
.data(root.descendants()) |
|||
.enter() |
|||
.append("g") |
|||
.attr("class", "node") |
|||
.attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; }) |
|||
.on("mouseover", function(d) { |
|||
tooltip.style("visibility", "visible"); |
|||
tooltip.text(d.data.name); |
|||
}) |
|||
.on("mousemove", function(d) { |
|||
tooltip.style("top", (d3.event.pageY-10)+"px").style("left",(d3.event.pageX+10)+"px"); |
|||
}) |
|||
.on("mouseout", function(d) { |
|||
tooltip.style("visibility", "hidden"); |
|||
}); |
|||
|
|||
// 添加节点卡片 |
|||
node.append("rect") |
|||
.attr("class", "card"); |
|||
|
|||
// 添加节点标签 |
|||
node.append("text") |
|||
.attr("dy", 20) |
|||
.attr("dx", 6) |
|||
.text(function(d) { return d.data.name; }); |
|||
|
|||
// 添加连线 |
|||
var link = svg.selectAll(".link") |
|||
.data(root.links()) |
|||
.enter() |
|||
.append("path") |
|||
.attr("class", "link") |
|||
.attr("d", d3.linkHorizontal() |
|||
.x(function(d) { return d.y; }) |
|||
.y(function(d) { return d.x; })); |
|||
|
|||
// 添加提示框 |
|||
var tooltip = d3.select("body") |
|||
.append("div") |
|||
.attr("class", "tooltip"); |
|||
|
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,46 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('新增场景角色')"/> |
|||
</head> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-role-add" type="text/template"> |
|||
<input name="sceneId" type="text" hidden> |
|||
<div class="form-group" id="fileTitle"> |
|||
<label class="col-sm-3 control-label is-required">角色名称:</label> |
|||
<div class="col-sm-6"> |
|||
<div class="file-loading"> |
|||
<input name="name" type="text" class="form-control"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label is-required">状态:</label> |
|||
<div class="col-sm-6"> |
|||
<select name="status" class="form-control"> |
|||
<option value="0">有效</option> |
|||
<option value="1">无效</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer"/> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-js"/> |
|||
<script type="text/javascript" th:inline="javascript"> |
|||
var sceneId = [[${sceneId}]]; |
|||
$('input[name="sceneId"]').val(sceneId); |
|||
var prefix = ctx + "small/project/role" |
|||
$("#form-manage-add").validate({ |
|||
focusCleanup: true |
|||
}); |
|||
|
|||
function submitHandler() { |
|||
if ($.validate.form()) { |
|||
$.operate.save(prefix + "/add", $('#form-role-add').serialize()); |
|||
} |
|||
} |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,41 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('编辑场景角色')" /> |
|||
</head> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-role-edit" th:object="${sceneRole}"> |
|||
<input name="guid" th:field="*{guid}" type="hidden"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">角色名称:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="name" th:field="*{name}" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">状态:</label> |
|||
<div class="col-sm-8"> |
|||
<select name="status" class="form-control" th:field="*{status}"> |
|||
<option value="0">有效</option> |
|||
<option value="1">无效</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer" /> |
|||
<script type="text/javascript"> |
|||
var prefix = ctx + "small/project/role" |
|||
$("#form-manage-edit").validate({ |
|||
focusCleanup: true |
|||
}); |
|||
|
|||
function submitHandler() { |
|||
if ($.validate.form()) { |
|||
$.operate.save(prefix + "/edit", $('#form-role-edit').serialize()); |
|||
} |
|||
} |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,136 @@ |
|||
<!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="formId"> |
|||
<div class="select-list"> |
|||
<input type="text" name="sceneId" hidden/> |
|||
<ul> |
|||
<li> |
|||
<p>名称:</p> |
|||
<input type="text" name="name"/> |
|||
</li> |
|||
<li> |
|||
<p>状态:</p> |
|||
<select name="status"> |
|||
<option value="">请选择</option> |
|||
<option value="0">有效</option> |
|||
<option value="1">无效</option> |
|||
</select> |
|||
</li> |
|||
<li> |
|||
<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.search()"><i |
|||
class="fa fa-search"></i> 搜索</a> |
|||
<a class="btn btn-reset btn-rounded btn-sm" onclick="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="add()" shiro:hasPermission="system:role:add"> |
|||
<i class="fa fa-plus"></i> 新增角色 |
|||
</a> |
|||
</div> |
|||
<div class="col-sm-12 select-table table-striped"> |
|||
<table id="bootstrap-table"></table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer"/> |
|||
<script th:inline="javascript"> |
|||
var editFlag = [[${@permission.hasPermi('project:role:edit')}]]; |
|||
var removeFlag = [[${@permission.hasPermi('project:role:remove')}]]; |
|||
var detailFlag = [[${@permission.hasPermi('project:role:detail')}]]; |
|||
var prefix = ctx + "small/project/role"; |
|||
var sceneId = [[${sceneId}]]; |
|||
|
|||
$(function () { |
|||
var sceneId = [[${sceneId}]]; |
|||
$("[name='sceneId']").val(sceneId); |
|||
var options = { |
|||
url: prefix + "/list", |
|||
createUrl: prefix + "/add/{}", |
|||
updateUrl: prefix + "/edit/{id}", |
|||
removeUrl: prefix + "/remove", |
|||
detailUrl: prefix + "/detail/{guid}", |
|||
modalName: "场景角色", |
|||
columns: [{ |
|||
checkbox: true |
|||
}, |
|||
{ |
|||
title: '序号', |
|||
align: 'center', |
|||
formatter: function (value, row, index) { |
|||
return $.table.serialNumber(index); |
|||
} |
|||
}, |
|||
{ |
|||
field: 'name', |
|||
title: '角色名称' |
|||
}, |
|||
{ |
|||
field: 'status', |
|||
title: '状态', |
|||
formatter: function (value, index) { |
|||
return value === 0 ? "有效" : "无效"; |
|||
} |
|||
}, |
|||
{ |
|||
field: 'creator', |
|||
title: '创建人' |
|||
}, |
|||
{ |
|||
field: 'createTime', |
|||
title: '创建时间' |
|||
}, |
|||
{ |
|||
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="edit(\'' + row.guid + '\')"><i class="fa fa-edit"></i>编辑</a> '); |
|||
actions.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>'); |
|||
actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)" onclick="question(\'' + row.guid + '\')"><i class="fa fa-eye"></i>绑定</a> '); |
|||
//actions.push('<a class="btn btn-primary btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.guid + '\',800,450)"><i class="fa fa-eye"></i>查看</a> '); |
|||
// actions.push('<a class="btn btn-danger btn-xs ' + bindFlag + '" href="javascript:void(0)" onclick="bind(\'' + row.guid + '\',800,450)"><i class="fa fa-eject"></i>绑定</a>'); |
|||
//actions.push('<a class="btn btn-danger btn-xs ' + bindFlag + '" href="javascript:void(0)" onclick="bindNew(\'' + row.guid + '\',900,500)"><i class="fa fa-eject"></i>绑定</a>'); |
|||
return actions.join(''); |
|||
} |
|||
}] |
|||
}; |
|||
$.table.init(options); |
|||
}); |
|||
|
|||
function detail(id, width, height) { |
|||
$.modal.open("查看场景角色", ctx + "small/project/role/detail/" + id, width, height); |
|||
} |
|||
|
|||
function add() { |
|||
$.modal.open("新增场景角色", ctx + "small/project/role/add/" + sceneId, 600, 350); |
|||
} |
|||
|
|||
function edit(id) { |
|||
$.modal.open("编辑场景角色", ctx + "small/project/role/edit/" + id, 600, 350); |
|||
} |
|||
|
|||
function question(id) { |
|||
table.set(); |
|||
$.modal.openFull("", ctx + "small/project/role/bindNew/" + id); |
|||
} |
|||
|
|||
function reset() { |
|||
$("[name='name']").val(""); |
|||
$("[name='status']").val(""); |
|||
$.table.search() |
|||
} |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,116 @@ |
|||
package com.zdxt.knowledge.controller; |
|||
|
|||
import com.zdxt.common.ZDResponse; |
|||
import com.zdxt.common.controller.BaseController; |
|||
import com.zdxt.common.util.TableDataInfo; |
|||
import com.zdxt.knowledge.domain.SceneRole; |
|||
import com.zdxt.knowledge.service.ISceneRoleService; |
|||
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 java.util.List; |
|||
|
|||
/** |
|||
* 场景角色Controller |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-26 |
|||
*/ |
|||
@Controller |
|||
@RequestMapping("/small/project/role") |
|||
public class SceneRoleController extends BaseController { |
|||
private String prefix = "project/role"; |
|||
|
|||
@Autowired |
|||
private ISceneRoleService sceneRoleService; |
|||
|
|||
@RequiresPermissions("project:role:view") |
|||
@GetMapping("/view/{sceneId}") |
|||
public String view(@PathVariable("sceneId") String sceneId, ModelMap mmap) { |
|||
mmap.put("sceneId", sceneId); |
|||
return prefix + "/view"; |
|||
} |
|||
|
|||
/** |
|||
* 查询场景角色列表 |
|||
*/ |
|||
@RequiresPermissions("project:role:list") |
|||
@PostMapping("/list") |
|||
@ResponseBody |
|||
public TableDataInfo list(SceneRole sceneRole) { |
|||
startPage(); |
|||
List<SceneRole> list = sceneRoleService.selectSceneRoleList(sceneRole); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
@RequiresPermissions("project:role:detail") |
|||
@GetMapping("/detail/{guid}") |
|||
public String detail(@PathVariable("guid") String guid, ModelMap mmap) { |
|||
SceneRole SceneRole = sceneRoleService.selectSceneRoleById(guid); |
|||
mmap.put("sceneRole", SceneRole); |
|||
return prefix + "/detail"; |
|||
} |
|||
|
|||
/** |
|||
* 新增场景角色 |
|||
*/ |
|||
@GetMapping("/add/{sceneId}") |
|||
public String add(@PathVariable("sceneId") String sceneId, ModelMap mmap) { |
|||
mmap.put("sceneId", sceneId); |
|||
return prefix + "/add"; |
|||
} |
|||
|
|||
/** |
|||
* 新增保存场景角色 |
|||
*/ |
|||
@RequiresPermissions("project:role:add") |
|||
@PostMapping("/add") |
|||
@ResponseBody |
|||
public ZDResponse addSave(SceneRole sceneRole) { |
|||
return sceneRoleService.insertSceneRole(sceneRole) > 0 |
|||
? ZDResponse.success() : ZDResponse.error("新增失败"); |
|||
} |
|||
|
|||
/** |
|||
* 修改场景角色 |
|||
*/ |
|||
@GetMapping("/edit/{guid}") |
|||
public String edit(@PathVariable("guid") String guid, ModelMap mmap) { |
|||
SceneRole sceneRole = sceneRoleService.selectSceneRoleById(guid); |
|||
mmap.put("sceneRole", sceneRole); |
|||
return prefix + "/edit"; |
|||
} |
|||
|
|||
/** |
|||
* 修改保存场景角色 |
|||
*/ |
|||
@RequiresPermissions("project:role:edit") |
|||
@PostMapping("/edit") |
|||
@ResponseBody |
|||
public ZDResponse editSave(SceneRole sceneRole) { |
|||
return sceneRoleService.updateSceneRole(sceneRole) > 0 |
|||
? ZDResponse.success() : ZDResponse.error("修改失败"); |
|||
} |
|||
|
|||
/** |
|||
* 删除场景角色 |
|||
*/ |
|||
@RequiresPermissions("project:role:remove") |
|||
@PostMapping("/remove") |
|||
@ResponseBody |
|||
public ZDResponse remove(String ids) { |
|||
return sceneRoleService.deleteSceneRoleByIds(ids) > 0 |
|||
? ZDResponse.success() : ZDResponse.error("删除失败"); |
|||
} |
|||
|
|||
@RequiresPermissions("project:role:bind") |
|||
@GetMapping("/bindNew/{guid}") |
|||
public String bindNew(@PathVariable("guid") String guid, ModelMap mmap) { |
|||
SceneRole sceneRole = sceneRoleService.selectSceneRoleById(guid); |
|||
mmap.put("sceneRole", sceneRole); |
|||
return "project/question/index"; |
|||
} |
|||
} |
|||
@ -0,0 +1,147 @@ |
|||
package com.zdxt.knowledge.domain; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 场景角色 scene_role |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-26 |
|||
*/ |
|||
public class SceneRole implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String guid; |
|||
|
|||
/** |
|||
* 题目名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 场景id |
|||
*/ |
|||
private String sceneId; |
|||
|
|||
|
|||
/** |
|||
* 状态0有效1无效 |
|||
*/ |
|||
private Integer status; |
|||
|
|||
/** |
|||
* 绑定的题目流程图内容 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String creator; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createTime; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String updateBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updateTime; |
|||
|
|||
/** |
|||
* 请求参数 |
|||
*/ |
|||
private Map<String, Object> params; |
|||
|
|||
public String getGuid() { |
|||
return guid; |
|||
} |
|||
|
|||
public void setGuid(String guid) { |
|||
this.guid = guid; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public void setName(String name) { |
|||
this.name = name; |
|||
} |
|||
|
|||
public String getSceneId() { |
|||
return sceneId; |
|||
} |
|||
|
|||
public void setSceneId(String sceneId) { |
|||
this.sceneId = sceneId; |
|||
} |
|||
|
|||
public Integer getStatus() { |
|||
return status; |
|||
} |
|||
|
|||
public void setStatus(Integer status) { |
|||
this.status = status; |
|||
} |
|||
|
|||
public String getCreator() { |
|||
return creator; |
|||
} |
|||
|
|||
public void setCreator(String creator) { |
|||
this.creator = creator; |
|||
} |
|||
|
|||
public Date getCreateTime() { |
|||
return createTime; |
|||
} |
|||
|
|||
public void setCreateTime(Date createTime) { |
|||
this.createTime = createTime; |
|||
} |
|||
|
|||
public String getUpdateBy() { |
|||
return updateBy; |
|||
} |
|||
|
|||
public void setUpdateBy(String updateBy) { |
|||
this.updateBy = updateBy; |
|||
} |
|||
|
|||
public Date getUpdateTime() { |
|||
return updateTime; |
|||
} |
|||
|
|||
public void setUpdateTime(Date updateTime) { |
|||
this.updateTime = updateTime; |
|||
} |
|||
|
|||
public Map<String, Object> getParams() { |
|||
return params; |
|||
} |
|||
|
|||
public void setParams(Map<String, Object> params) { |
|||
this.params = params; |
|||
} |
|||
|
|||
public String getContent() { |
|||
return content; |
|||
} |
|||
|
|||
public void setContent(String content) { |
|||
this.content = content; |
|||
} |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
package com.zdxt.knowledge.mapper; |
|||
|
|||
import com.zdxt.knowledge.domain.SceneRole; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 场景角色Mapper接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-26 |
|||
*/ |
|||
public interface SceneRoleMapper { |
|||
/** |
|||
* 查询场景角色 |
|||
* |
|||
* @param guid 场景角色ID |
|||
* @return 场景角色 |
|||
*/ |
|||
public SceneRole selectSceneRoleById(String guid); |
|||
|
|||
/** |
|||
* 查询场景角色列表 |
|||
* |
|||
* @param sceneRole 场景角色 |
|||
* @return 场景角色集合 |
|||
*/ |
|||
public List<SceneRole> selectSceneRoleList(SceneRole sceneRole); |
|||
|
|||
/** |
|||
* 新增场景角色 |
|||
* |
|||
* @param sceneRole 场景角色 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertSceneRole(SceneRole sceneRole); |
|||
|
|||
/** |
|||
* 修改场景角色 |
|||
* |
|||
* @param sceneRole 场景角色 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateSceneRole(SceneRole sceneRole); |
|||
|
|||
/** |
|||
* 批量删除场景角色 |
|||
* |
|||
* @param guids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteSceneRoleByIds(String[] guids); |
|||
} |
|||
@ -0,0 +1,54 @@ |
|||
package com.zdxt.knowledge.service; |
|||
|
|||
import com.zdxt.knowledge.domain.SceneRole; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 场景角色Service接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-26 |
|||
*/ |
|||
public interface ISceneRoleService { |
|||
/** |
|||
* 查询场景角色 |
|||
* |
|||
* @param guid 场景角色ID |
|||
* @return 场景角色 |
|||
*/ |
|||
public SceneRole selectSceneRoleById(String guid); |
|||
|
|||
/** |
|||
* 查询场景角色列表 |
|||
* |
|||
* @param sceneRole 场景角色 |
|||
* @return 场景角色集合 |
|||
*/ |
|||
public List<SceneRole> selectSceneRoleList(SceneRole sceneRole); |
|||
|
|||
/** |
|||
* 新增场景角色 |
|||
* |
|||
* @param sceneRole 场景角色 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertSceneRole(SceneRole sceneRole); |
|||
|
|||
/** |
|||
* 修改场景角色 |
|||
* |
|||
* @param sceneRole 场景角色 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateSceneRole(SceneRole sceneRole); |
|||
|
|||
/** |
|||
* 批量删除场景角色 |
|||
* |
|||
* @param guids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteSceneRoleByIds(String guids); |
|||
} |
|||
@ -0,0 +1,97 @@ |
|||
package com.zdxt.knowledge.service.impl; |
|||
|
|||
import com.zdxt.auth.dto.UserBean; |
|||
import com.zdxt.auth.feign.UserApi; |
|||
import com.zdxt.common.util.Convert; |
|||
import com.zdxt.common.util.DateUtils; |
|||
import com.zdxt.common.util.StringUtils; |
|||
import com.zdxt.knowledge.domain.SceneRole; |
|||
import com.zdxt.knowledge.mapper.SceneRoleMapper; |
|||
import com.zdxt.knowledge.service.ISceneRoleService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.util.List; |
|||
import java.util.Objects; |
|||
|
|||
/** |
|||
* 场景题目Service业务层处理 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-26 |
|||
*/ |
|||
@Service |
|||
public class SceneRoleServiceImpl implements ISceneRoleService { |
|||
@Autowired |
|||
private SceneRoleMapper sceneRoleMapper; |
|||
@Autowired |
|||
private UserApi userApi; |
|||
|
|||
/** |
|||
* 查询场景题目 |
|||
* |
|||
* @param guid 场景题目ID |
|||
* @return 场景题目 |
|||
*/ |
|||
@Override |
|||
public SceneRole selectSceneRoleById(String guid) { |
|||
return sceneRoleMapper.selectSceneRoleById(guid); |
|||
} |
|||
|
|||
/** |
|||
* 查询场景题目列表 |
|||
* |
|||
* @param sceneRole 场景题目 |
|||
* @return 场景题目 |
|||
*/ |
|||
@Override |
|||
public List<SceneRole> selectSceneRoleList(SceneRole sceneRole) { |
|||
return sceneRoleMapper.selectSceneRoleList(sceneRole); |
|||
} |
|||
|
|||
/** |
|||
* 新增场景题目 |
|||
* |
|||
* @param sceneRole 场景题目 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertSceneRole(SceneRole sceneRole) { |
|||
UserBean userBean = userApi.getCurrentUser(); |
|||
if (Objects.nonNull(userBean)) { |
|||
sceneRole.setCreator(userBean.getUserName()); |
|||
sceneRole.setCreateTime(DateUtils.getNowDate()); |
|||
} |
|||
sceneRole.setGuid(StringUtils.getUUID()); |
|||
return sceneRoleMapper.insertSceneRole(sceneRole); |
|||
} |
|||
|
|||
/** |
|||
* 修改场景题目 |
|||
* |
|||
* @param sceneRole 场景题目 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int updateSceneRole( SceneRole sceneRole) { |
|||
UserBean userBean = userApi.getCurrentUser(); |
|||
if (Objects.nonNull(userBean)) { |
|||
sceneRole.setUpdateBy(userBean.getUserName()); |
|||
} |
|||
sceneRole.setUpdateTime(DateUtils.getNowDate()); |
|||
return sceneRoleMapper.updateSceneRole(sceneRole); |
|||
} |
|||
|
|||
/** |
|||
* 删除场景题目对象 |
|||
* |
|||
* @param guids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteSceneRoleByIds(String guids) { |
|||
return sceneRoleMapper.deleteSceneRoleByIds(Convert.toStrArray(guids)); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,97 @@ |
|||
<?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.SceneRoleMapper"> |
|||
|
|||
<resultMap type="com.zdxt.knowledge.domain.SceneRole" id="SceneRoleResult"> |
|||
<result property="guid" column="guid"/> |
|||
<result property="name" column="name"/> |
|||
<result property="sceneId" column="scene_id"/> |
|||
<result property="status" column="status"/> |
|||
<result property="content" column="content"/> |
|||
<result property="creator" column="creator"/> |
|||
<result property="updateBy" column="update_by"/> |
|||
<result property="createTime" column="create_time"/> |
|||
<result property="updateTime" column="update_time"/> |
|||
</resultMap> |
|||
|
|||
<sql id="selectSceneRoleVo"> |
|||
select guid, |
|||
name, |
|||
scene_id, |
|||
status, |
|||
content, |
|||
creator, |
|||
create_time, |
|||
update_by, |
|||
update_time |
|||
from scene_role |
|||
</sql> |
|||
|
|||
<select id="selectSceneRoleList" parameterType="SceneRole" resultMap="SceneRoleResult"> |
|||
<include refid="selectSceneRoleVo"/> |
|||
<where> |
|||
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if> |
|||
<if test="sceneId != null and sceneId != ''">and scene_id = #{sceneId}</if> |
|||
<if test="status != null ">and status = #{status}</if> |
|||
<if test="creator != null and creator != ''">and creator = #{creator}</if> |
|||
</where> |
|||
order by create_time desc |
|||
</select> |
|||
|
|||
<select id="selectSceneRoleById" parameterType="String" resultMap="SceneRoleResult"> |
|||
<include refid="selectSceneRoleVo"/> |
|||
where guid = #{guid} |
|||
</select> |
|||
|
|||
<insert id="insertSceneRole" parameterType="SceneRole"> |
|||
insert into scene_role |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="guid != null ">guid,</if> |
|||
<if test="name != null and name != ''">`name`,</if> |
|||
<if test="sceneId != null and sceneId != ''">scene_id,</if> |
|||
<if test="status != null ">status,</if> |
|||
<if test="creator != null and creator != ''">creator,</if> |
|||
<if test="updateBy != null and updateBy != ''">update_by,</if> |
|||
<if test="createTime != null ">create_time,</if> |
|||
<if test="updateTime != null ">update_time,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="guid != null ">#{guid},</if> |
|||
<if test="name != null and name != ''">#{name},</if> |
|||
<if test="sceneId != null and sceneId != ''">#{sceneId},</if> |
|||
<if test="status != null ">#{status},</if> |
|||
<if test="creator != null and creator != ''">#{creator},</if> |
|||
<if test="updateBy != null and updateBy != ''">#{updateBy},</if> |
|||
<if test="createTime != null ">#{createTime},</if> |
|||
<if test="updateTime != null ">#{updateTime},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateSceneRole" parameterType="SceneRole"> |
|||
update scene_role |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="name != null and name != ''">name = #{name},</if> |
|||
<if test="content != null and content != ''">content = #{content},</if> |
|||
<if test="status != null ">status = #{status},</if> |
|||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
|||
<if test="updateTime != null ">update_time = #{updateTime},</if> |
|||
</trim> |
|||
where guid = #{guid} |
|||
</update> |
|||
|
|||
<delete id="deleteSceneRoleById" parameterType="String"> |
|||
delete |
|||
from scene_role |
|||
where guid = #{guid} |
|||
</delete> |
|||
|
|||
<delete id="deleteSceneRoleByIds" parameterType="String"> |
|||
delete from scene_role where guid in |
|||
<foreach item="guid" collection="array" open="(" separator="," close=")"> |
|||
#{guid} |
|||
</foreach> |
|||
</delete> |
|||
|
|||
</mapper> |
|||
Loading…
Reference in new issue