Browse Source

场景管理顺序上移,字段修改

master
yanyan 3 years ago
parent
commit
0e2d399bca
  1. 137
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/add.html
  2. 2
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/bind.html
  3. 102
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/detail.html
  4. 129
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/edit.html
  5. 24
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/view.html
  6. 6
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/add.html
  7. 2
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/detail.html
  8. 2
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/edit.html
  9. 34
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/manage.html
  10. 24
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/controller/SceneManageController.java
  11. 32
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/controller/SceneQuestionController.java
  12. 21
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneImportDataModel.java
  13. 41
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneManage.java
  14. 45
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneQuestion.java
  15. 31
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/mapper/SceneManageMapper.java
  16. 12
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/mapper/SceneQuestionMapper.java
  17. 20
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/ISceneManageService.java
  18. 12
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/ISceneQuestionService.java
  19. 50
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/SceneManageServiceImpl.java
  20. 22
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/SceneQuestionServiceImpl.java
  21. 55
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneManageMapper.xml
  22. 40
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneQuestionMapper.xml

137
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/add.html

@ -6,16 +6,16 @@
</head> </head>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <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"> <form class="form-horizontal m" enctype="multipart/form-data" id="form-question-add" type="text/template">
<input name="parentId" type="text" hidden> <input name="parentId" type="text" hidden>
<div class="form-group" id="textTitle" hidden> <!-- <div class="form-group" id="textTitle" hidden>-->
<label class="col-sm-3 control-label">题目:</label> <!-- <label class="col-sm-3 control-label">题目:</label>-->
<div class="col-sm-8"> <!-- <div class="col-sm-8">-->
<input name="name" class="form-control" type="text"> <!-- <input name="name" class="form-control" type="text">-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="form-group" id="fileTitle" hidden> <div class="form-group" id="fileTitle">
<label class="col-sm-3 control-label">题目:</label> <label class="col-sm-3 control-label is-required">题目:</label>
<div id="fileIn" class="col-sm-8"> <div id="fileIn" class="col-sm-8">
<div class="file-loading"> <div class="file-loading">
<input id="fileInput" name="file" type="file" multiple> <input id="fileInput" name="file" type="file" multiple>
@ -23,7 +23,52 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">状态:</label> <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 is-required">选项:</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>
<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>
<div class="form-group">
<label class="col-sm-3 control-label is-required">状态:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="status" class="form-control"> <select name="status" class="form-control">
<option value="0">有效</option> <option value="0">有效</option>
@ -53,16 +98,16 @@
focusCleanup: true focusCleanup: true
}); });
$(function() { $(function () {
// 渲染文件要素信息 // 渲染文件要素信息
renderVersionAtt(); renderVersionAtt();
}) })
if (type === 0) { // if (type === 0) {
$("#textTitle").show(); // $("#textTitle").show();
} else { // } else {
$("#fileTitle").show(); // $("#fileTitle").show();
} // }
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
@ -85,7 +130,7 @@
/** 上传附件 */ /** 上传附件 */
function uploadFiles() { function uploadFiles() {
var filePreview = { fileList: null, previewRespDTOS: null } var filePreview = {fileList: null, previewRespDTOS: null}
initFile("fileInput", prefix + "/add", filePreview); initFile("fileInput", prefix + "/add", filePreview);
} }
@ -116,13 +161,25 @@
formData = decodeURIComponent(formData, true); formData = decodeURIComponent(formData, true);
var arr = formData.split("&"); var arr = formData.split("&");
var data = {}; var data = {};
for (var i=0; i<arr.length; i++) { for (var i = 0; i < arr.length; i++) {
var item = arr[i].split('='); var item = arr[i].split('=');
var value = item[1].replace("+", " "); var value = item[1].replace("+", " ");
data[item[0]] = value; data[item[0]] = value;
} }
var parentId = [[${parentId}]]; //选项
data.parentId = parentId; 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}]];
return data; return data;
}, },
// showBrowse: false, // showBrowse: false,
@ -190,6 +247,46 @@
$.modal.close(); $.modal.close();
parent.$.table.refresh(); parent.$.table.refresh();
} }
/** 动态表格 */
$(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='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> </script>
</body> </body>
</html> </html>

2
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/bind.html

@ -7,7 +7,7 @@
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-question-bind" th:object="${sceneQuestion}"> <form class="form-horizontal m" id="form-question-bind" th:object="${sceneQuestion}">
<h2 th:text="*{name}" style="margin-bottom: 30px;"></h2> <h2 th:text="*{name}" style="margin-bottom: 30px;"></h2>
<input name="id" th:field="*{id}" type="hidden"> <input name="guid" th:field="*{guid}" type="hidden">
<div class="form-group"> <div class="form-group">
<div class="col-sm-6"> <div class="col-sm-6">
<input name="answer" class="form-control" type="text" placeholder="A..."> <input name="answer" class="form-control" type="text" placeholder="A...">

102
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/detail.html

@ -12,14 +12,14 @@
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-question-detail" th:object="${sceneQuestion}"> <form class="form-horizontal m" id="form-question-detail" th:object="${sceneQuestion}">
<input name="id" th:field="*{id}" type="hidden"> <input name="guid" th:field="*{guid}" type="hidden">
<div class="form-group" id="textTitle" hidden> <!-- <div class="form-group" id="textTitle" hidden>-->
<label class="col-sm-3 control-label">题目:</label> <!-- <label class="col-sm-3 control-label">题目:</label>-->
<div class="col-sm-8"> <!-- <div class="col-sm-8">-->
<input name="name" th:field="*{name}" class="form-control" type="text" readonly> <!-- <input name="name" th:field="*{name}" class="form-control" type="text" readonly>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="form-group" id="fileTitle" hidden> <div class="form-group" id="fileTitle">
<label class="col-sm-3 control-label">题目:</label> <label class="col-sm-3 control-label">题目:</label>
<div id="fileIn" class="col-sm-8" readonly> <div id="fileIn" class="col-sm-8" readonly>
<div class="file-loading"> <div class="file-loading">
@ -32,6 +32,29 @@
</div> </div>
</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" th:field="*{answer}" disabled required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">选项:</label>
<div class="col-sm-8">
<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"> <div class="form-group">
<label class="col-sm-3 control-label">状态:</label> <label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8"> <div class="col-sm-8">
@ -71,11 +94,11 @@
var prefix = ctx + "project/question"; var prefix = ctx + "project/question";
var sceneObj = [[${sceneQuestion}]]; var sceneObj = [[${sceneQuestion}]];
if (sceneObj.name == null || sceneObj.name === "") { // if (sceneObj.name == null || sceneObj.name === "") {
$("#fileTitle").show(); // $("#fileTitle").show();
} else { // } else {
$("#textTitle").show(); // $("#textTitle").show();
} // }
$(function () { $(function () {
// 渲染文件要素信息 // 渲染文件要素信息
@ -87,7 +110,7 @@
/** 渲染附件信息 */ /** 渲染附件信息 */
function renderVersionAtt() { function renderVersionAtt() {
var key = $("[name='id']").val(); var key = $("[name='guid']").val();
$.getJSON(prefix + "/queryFiles/" + key, function (result) { $.getJSON(prefix + "/queryFiles/" + key, function (result) {
if (result.data != null) { if (result.data != null) {
@ -235,6 +258,57 @@
// $.modal.closeLoading(); // $.modal.closeLoading();
// $.modal.msgReload(result.message, modal_status.SUCCESS); // $.modal.msgReload(result.message, modal_status.SUCCESS);
} }
/** 动态表格 */
$(function () {
var sceneQuestion = [[${sceneQuestion}]]
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;" 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> </script>
</body> </body>
</html> </html>

129
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/edit.html

@ -7,14 +7,14 @@
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-question-edit" th:object="${sceneQuestion}"> <form class="form-horizontal m" id="form-question-edit" th:object="${sceneQuestion}">
<input name="id" th:field="*{id}" type="hidden"> <input name="guid" th:field="*{guid}" type="hidden">
<div class="form-group" id="textTitle" hidden> <!-- <div class="form-group" id="textTitle" hidden>-->
<label class="col-sm-3 control-label">题目名称:</label> <!-- <label class="col-sm-3 control-label">题目名称:</label>-->
<div class="col-sm-8"> <!-- <div class="col-sm-8">-->
<input name="name" th:field="*{name}" class="form-control" type="text"> <!-- <input name="name" th:field="*{name}" class="form-control" type="text">-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="form-group" id="fileTitle" hidden> <div class="form-group" id="fileTitle">
<label class="col-sm-3 control-label">题目:</label> <label class="col-sm-3 control-label">题目:</label>
<div id="fileIn" class="col-sm-8"> <div id="fileIn" class="col-sm-8">
<div class="file-loading"> <div class="file-loading">
@ -27,6 +27,47 @@
</div> </div>
</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" th:field="*{answer}" 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>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">状态:</label> <label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8"> <div class="col-sm-8">
@ -61,13 +102,13 @@
}) })
if (type === 0) { if (type === 0) {
$("#textTitle").show(); //$("#textTitle").show();
} else if (type === 1) { } else if (type === 1) {
$("#fileWarn").html("提示:请导入图片格式文件!"); $("#fileWarn").html("提示:请导入图片格式文件!");
$("#fileTitle").show(); //$("#fileTitle").show();
} else if (type === 2) { } else if (type === 2) {
$("#fileWarn").html("提示:请导入视频格式文件!"); $("#fileWarn").html("提示:请导入视频格式文件!");
$("#fileTitle").show(); //$("#fileTitle").show();
} }
function submitHandler() { function submitHandler() {
@ -81,7 +122,7 @@
/** 渲染附件信息 */ /** 渲染附件信息 */
function renderVersionAtt() { function renderVersionAtt() {
var key = $("[name='id']").val(); var key = $("[name='guid']").val();
$.getJSON(prefix + "/queryFiles/" + key, function (result) { $.getJSON(prefix + "/queryFiles/" + key, function (result) {
if (result.data != null) { if (result.data != null) {
@ -157,6 +198,19 @@
var value = item[1].replace("+", " "); var value = item[1].replace("+", " ");
data[item[0]] = value; 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);
return data; return data;
}, },
// showBrowse: false, // showBrowse: false,
@ -229,6 +283,57 @@
// $.modal.closeLoading(); // $.modal.closeLoading();
// $.modal.msgReload(result.message, modal_status.SUCCESS); // $.modal.msgReload(result.message, modal_status.SUCCESS);
} }
/** 动态表格 */
$(function () {
var sceneQuestion = [[${sceneQuestion}]]
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>';
}
$("#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> </script>
</body> </body>
</html> </html>

24
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/view.html

@ -59,19 +59,19 @@
updateUrl: prefix + "/edit/{id}", updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove", removeUrl: prefix + "/remove",
exportUrl: prefix + "/export", exportUrl: prefix + "/export",
detailUrl: prefix + "/detail/{id}", detailUrl: prefix + "/detail/{guid}",
modalName: "场景题目", modalName: "场景题目",
columns: [{ columns: [{
checkbox: true checkbox: true
}, },
{ {
field: 'id', field: 'code',
title: '题目序号' title: '题目序号'
}, },
{ // {
field: 'name', // field: 'name',
title: '题目名称' // title: '题目类型'
}, // },
{ {
field: 'roleIdStr', field: 'roleIdStr',
title: '角色', title: '角色',
@ -99,11 +99,11 @@
align: 'center', align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><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> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></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 ' + detailFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.id + '\',800,450)"><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.id + '\',800,450)"><i class="fa fa-eject"></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.id + '\',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 + '\',800,450)"><i class="fa fa-eject"></i>绑定新</a>');
return actions.join(''); return actions.join('');
} }
}] }]
@ -116,7 +116,7 @@
} }
function add() { function add() {
$.modal.open("查看场景题目", ctx + "project/question/add/" + parentId, 800, 450); $.modal.open("新增场景题目", ctx + "project/question/add/" + parentId, 800, 450);
} }
function bind(id, width, height) { function bind(id, width, height) {

6
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/add.html

@ -41,12 +41,6 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">入口排序:</label>
<div class="col-sm-8">
<input name="sort" class="form-control" type="text" required>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">演练背景:</label> <label class="col-sm-3 control-label">演练背景:</label>
<div class="col-sm-8"> <div class="col-sm-8">

2
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/detail.html

@ -6,7 +6,7 @@
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-manage-detail" th:object="${sceneManage}"> <form class="form-horizontal m" id="form-manage-detail" th:object="${sceneManage}">
<input name="id" th:field="*{id}" type="hidden"> <input name="guid" th:field="*{guid}" type="hidden">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">场景名称:</label> <label class="col-sm-3 control-label">场景名称:</label>
<div class="col-sm-8"> <div class="col-sm-8">

2
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/edit.html

@ -6,7 +6,7 @@
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-manage-edit" th:object="${sceneManage}"> <form class="form-horizontal m" id="form-manage-edit" th:object="${sceneManage}">
<input name="id" th:field="*{id}" type="hidden"> <input name="guid" th:field="*{guid}" type="hidden">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">场景名称:</label> <label class="col-sm-3 control-label">场景名称:</label>
<div class="col-sm-8"> <div class="col-sm-8">

34
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/manage.html

@ -70,7 +70,7 @@
createUrl: prefix + "/add", createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}", updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove", removeUrl: prefix + "/remove",
detailUrl: prefix + "/detail/{id}", detailUrl: prefix + "/detail/{guid}",
exportUrl: prefix + "/export", exportUrl: prefix + "/export",
importUrl: prefix + "/importData", importUrl: prefix + "/importData",
importTemplateUrl: prefix + "/importTemplate", importTemplateUrl: prefix + "/importTemplate",
@ -87,7 +87,12 @@
checkbox: true checkbox: true
}, },
{ {
field: 'id', field: 'guid',
title: '主键',
visible: false
},
{
field: 'code',
title: '场景序号' title: '场景序号'
}, },
{ {
@ -144,10 +149,11 @@
align: 'center', align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.id + '\')"><i class="fa fa-edit"></i> 编辑</a> '); actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull(\'' + 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.id + '\')"><i class="fa fa-remove"></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 ' + detailFlag + '" href="javascript:void(0)" onclick="detailFull(\'' + row.id + '\')"><i class="fa fa-eye"></i>查看</a> '); actions.push('<a class="btn btn-primary btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detailFull(\'' + row.guid + '\')"><i class="fa fa-eye"></i>查看</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="question(\'' + row.id + '\',\'' + row.name + '\')"><i class="fa fa-eject"></i>题目</a>'); actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="question(\'' + row.guid + '\',\'' + row.name + '\')"><i class="fa fa-eject"></i>题目</a>');
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sort(\'' + row.guid + '\')"><i class="fa fa-eject"></i>上移</a>');
return actions.join(''); return actions.join('');
} }
}] }]
@ -173,10 +179,10 @@
table.set(); table.set();
var url = "/404.html"; var url = "/404.html";
if ($.common.isNotEmpty(id)) { if ($.common.isNotEmpty(id)) {
url = table.options.detailUrl.replace("{id}", id); url = table.options.detailUrl.replace("{guid}", id);
} else { } else {
var row = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId); var row = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
url = table.options.detailUrl.replace("{id}", row); url = table.options.detailUrl.replace("{guid}", row);
} }
$.modal.openFull("场景详情", url); $.modal.openFull("场景详情", url);
} }
@ -186,6 +192,18 @@
$.modal.openFull("场景名称 >>" + name, ctx + "project/question/view/" + id); $.modal.openFull("场景名称 >>" + name, ctx + "project/question/view/" + id);
} }
function sort(id) {
$.get(ctx + "scene/manage/sort/" + id, null, function (res) {
if (res.success) {
//
$.table.refresh();
$.modal.alertSuccess(res.message);
} else {
$.modal.alertWarning(res.message);
}
});
}
</script> </script>
</body> </body>
<script id="importTpl" type="text/template"> <script id="importTpl" type="text/template">

24
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/controller/SceneManageController.java

@ -58,9 +58,9 @@ public class SceneManageController extends BaseController {
* 查看详情 * 查看详情
*/ */
@RequiresPermissions("project:manage:detail") @RequiresPermissions("project:manage:detail")
@GetMapping("/detail/{id}") @GetMapping("/detail/{guid}")
public String detail(@PathVariable("id") Long id, ModelMap mmap) { public String detail(@PathVariable("guid") String guid, ModelMap mmap) {
SceneManage sceneManage = sceneManageService.selectSceneManageById(id); SceneManage sceneManage = sceneManageService.selectSceneManageById(guid);
mmap.put("sceneManage", sceneManage); mmap.put("sceneManage", sceneManage);
return prefix + "/detail"; return prefix + "/detail";
} }
@ -87,9 +87,9 @@ public class SceneManageController extends BaseController {
/** /**
* 修改 * 修改
*/ */
@GetMapping("/edit/{id}") @GetMapping("/edit/{guid}")
public String edit(@PathVariable("id") Long id, ModelMap mmap) { public String edit(@PathVariable("guid") String guid, ModelMap mmap) {
SceneManage sceneManage = sceneManageService.selectSceneManageById(id); SceneManage sceneManage = sceneManageService.selectSceneManageById(guid);
mmap.put("sceneManage", sceneManage); mmap.put("sceneManage", sceneManage);
return prefix + "/edit"; return prefix + "/edit";
} }
@ -115,6 +115,16 @@ public class SceneManageController extends BaseController {
return sceneManageService.deleteSceneManageByIds(ids); return sceneManageService.deleteSceneManageByIds(ids);
} }
/**
* 排序上移
*/
@GetMapping("/sort/{guid}")
@ResponseBody
public ZDResponse sort(@PathVariable("guid") String guid) {
return sceneManageService.sort(guid);
}
/** /**
* 导出记录 * 导出记录
*/ */
@ -143,7 +153,7 @@ public class SceneManageController extends BaseController {
public ResponseEntity<Resource> exampleImportRecord() { public ResponseEntity<Resource> exampleImportRecord() {
SceneImportDataModel dataModel = new SceneImportDataModel(); SceneImportDataModel dataModel = new SceneImportDataModel();
dataModel.setName("消防演练"); dataModel.setName("消防演练");
dataModel.setType("文字"); dataModel.setType("图片");
dataModel.setSourceUnit("深圳消防"); dataModel.setSourceUnit("深圳消防");
dataModel.setIsOpen("是"); dataModel.setIsOpen("是");
dataModel.setSceneBackground("开展全员消防培训及演练活动,增强员工防火意识、提升火灾处理能力"); dataModel.setSceneBackground("开展全员消防培训及演练活动,增强员工防火意识、提升火灾处理能力");

32
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/controller/SceneQuestionController.java

@ -43,7 +43,7 @@ public class SceneQuestionController extends BaseController {
@RequiresPermissions("project:question:view") @RequiresPermissions("project:question:view")
@GetMapping("/view/{parentId}") @GetMapping("/view/{parentId}")
public String question(@PathVariable("parentId") Long parentId, ModelMap mmap) { public String question(@PathVariable("parentId") String parentId, ModelMap mmap) {
mmap.put("parentId", parentId); mmap.put("parentId", parentId);
return prefix + "/view"; return prefix + "/view";
} }
@ -61,21 +61,21 @@ public class SceneQuestionController extends BaseController {
} }
@RequiresPermissions("project:question:detail") @RequiresPermissions("project:question:detail")
@GetMapping("/detail/{id}") @GetMapping("/detail/{guid}")
public String detail(@PathVariable("id") Long id, ModelMap mmap) { public String detail(@PathVariable("guid") String guid, ModelMap mmap) {
SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(id); SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(guid);
mmap.put("sceneQuestion", sceneQuestion); mmap.put("sceneQuestion", sceneQuestion);
mmap.put("roles", roleApi.getRolesAll()); mmap.put("roles", roleApi.getRolesAll());
return prefix + "/detail"; return prefix + "/detail";
} }
@RequiresPermissions("project:question:bind") @RequiresPermissions("project:question:bind")
@GetMapping("/bind/{id}") @GetMapping("/bind/{guid}")
public String bind(@PathVariable("id") Long id, ModelMap mmap) { public String bind(@PathVariable("guid") String guid, ModelMap mmap) {
SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(id); SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(guid);
List<SceneQuestion> list = sceneQuestionService.selectSceneQuestionList(new SceneQuestion()); List<SceneQuestion> list = sceneQuestionService.selectSceneQuestionList(new SceneQuestion());
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
list = list.stream().filter(item -> !Objects.equals(item.getId(), id)).collect(Collectors.toList()); list = list.stream().filter(item -> !Objects.equals(item.getGuid(), guid)).collect(Collectors.toList());
} }
mmap.put("sceneQuestion", sceneQuestion); mmap.put("sceneQuestion", sceneQuestion);
mmap.put("list", list); mmap.put("list", list);
@ -83,12 +83,12 @@ public class SceneQuestionController extends BaseController {
} }
@RequiresPermissions("project:question:bind") @RequiresPermissions("project:question:bind")
@GetMapping("/bindNew/{id}") @GetMapping("/bindNew/{guid}")
public String bindNew(@PathVariable("id") Long id, ModelMap mmap) { public String bindNew(@PathVariable("guid") String guid, ModelMap mmap) {
SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(id); SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(guid);
List<SceneQuestion> list = sceneQuestionService.selectSceneQuestionList(new SceneQuestion()); List<SceneQuestion> list = sceneQuestionService.selectSceneQuestionList(new SceneQuestion());
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
list = list.stream().filter(item -> !Objects.equals(item.getId(), id)).collect(Collectors.toList()); list = list.stream().filter(item -> !Objects.equals(item.getGuid(), guid)).collect(Collectors.toList());
} }
mmap.put("sceneQuestion", sceneQuestion); mmap.put("sceneQuestion", sceneQuestion);
mmap.put("list", list); mmap.put("list", list);
@ -112,7 +112,7 @@ public class SceneQuestionController extends BaseController {
* 新增场景题目 * 新增场景题目
*/ */
@GetMapping("/add/{parentId}") @GetMapping("/add/{parentId}")
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) { public String add(@PathVariable("parentId") String parentId, ModelMap mmap) {
SceneManage sceneManage = sceneManageMapper.selectSceneManageById(parentId); SceneManage sceneManage = sceneManageMapper.selectSceneManageById(parentId);
mmap.put("parentId", parentId); mmap.put("parentId", parentId);
mmap.put("type", sceneManage.getType()); mmap.put("type", sceneManage.getType());
@ -134,9 +134,9 @@ public class SceneQuestionController extends BaseController {
/** /**
* 修改场景题目 * 修改场景题目
*/ */
@GetMapping("/edit/{id}") @GetMapping("/edit/{guid}")
public String edit(@PathVariable("id") Long id, ModelMap mmap) { public String edit(@PathVariable("guid") String guid, ModelMap mmap) {
SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(id); SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(guid);
SceneManage sceneManage = sceneManageMapper.selectSceneManageById(sceneQuestion.getParentId()); SceneManage sceneManage = sceneManageMapper.selectSceneManageById(sceneQuestion.getParentId());
mmap.put("sceneQuestion", sceneQuestion); mmap.put("sceneQuestion", sceneQuestion);
mmap.put("roles", roleApi.getRolesAll()); mmap.put("roles", roleApi.getRolesAll());

21
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneImportDataModel.java

@ -16,9 +16,9 @@ public class SceneImportDataModel {
private String name; private String name;
/** /**
* 题目类型0:文字 1:图片 2:视频 * 题目类型 1:图片 2:视频
*/ */
@ExcelProperty("题目类型(文字,图片,视频)") @ExcelProperty("题目类型(图片,视频)")
@ColumnWidth(20) @ColumnWidth(20)
private String type; private String type;
@ -36,14 +36,16 @@ public class SceneImportDataModel {
@ColumnWidth(20) @ColumnWidth(20)
private String isOpen; private String isOpen;
@ExcelProperty("入口排序") /**
@ColumnWidth(20) * 演练背景
private Integer sort; */
@ExcelProperty("演练背景") @ExcelProperty("演练背景")
@ColumnWidth(20) @ColumnWidth(20)
private String sceneBackground; private String sceneBackground;
/**
* 描述
*/
@ExcelProperty("描述") @ExcelProperty("描述")
@ColumnWidth(20) @ColumnWidth(20)
private String describe; private String describe;
@ -95,11 +97,4 @@ public class SceneImportDataModel {
public void setDescribe(String describe) { public void setDescribe(String describe) {
this.describe = describe; this.describe = describe;
} }
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
} }

41
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneManage.java

@ -22,7 +22,12 @@ public class SceneManage implements Serializable {
/** /**
* 主键 * 主键
*/ */
private Long id; private String guid;
/**
* 序号
*/
private Long code;
/** /**
* 场景名称 * 场景名称
@ -60,12 +65,6 @@ public class SceneManage implements Serializable {
@Excel(name = "状态") @Excel(name = "状态")
private Integer status; private Integer status;
/**
* 是否删除0是1否
*/
@Excel(name = "是否删除0是1否")
private Integer isDelete;
/** /**
* 创建人 * 创建人
*/ */
@ -115,12 +114,20 @@ public class SceneManage implements Serializable {
*/ */
private Map<String, Object> params; private Map<String, Object> params;
public void setId(Long id) { public String getGuid() {
this.id = id; return guid;
}
public void setGuid(String guid) {
this.guid = guid;
}
public Long getCode() {
return code;
} }
public Long getId() { public void setCode(Long code) {
return id; this.code = code;
} }
public void setName(String name) { public void setName(String name) {
@ -171,14 +178,6 @@ public class SceneManage implements Serializable {
return status; return status;
} }
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
public Integer getIsDelete() {
return isDelete;
}
public void setCreator(String creator) { public void setCreator(String creator) {
this.creator = creator; this.creator = creator;
} }
@ -214,14 +213,14 @@ public class SceneManage implements Serializable {
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("guid", getGuid())
.append("code", getCode())
.append("name", getName()) .append("name", getName())
.append("type", getType()) .append("type", getType())
.append("url", getUrl()) .append("url", getUrl())
.append("sourceUnit", getSourceUnit()) .append("sourceUnit", getSourceUnit())
.append("isOpen", getIsOpen()) .append("isOpen", getIsOpen())
.append("status", getStatus()) .append("status", getStatus())
.append("isDelete", getIsDelete())
.append("creator", getCreator()) .append("creator", getCreator())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.toString(); .toString();

45
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneQuestion.java

@ -21,7 +21,12 @@ public class SceneQuestion implements Serializable {
/** /**
* 主键 * 主键
*/ */
private Long id; private String guid;
/**
* 序号
*/
private Long code;
/** /**
* 题目名称 * 题目名称
@ -33,7 +38,7 @@ public class SceneQuestion implements Serializable {
* 分组 * 分组
*/ */
@Excel(name = "场景id") @Excel(name = "场景id")
private Long parentId; private String parentId;
/** /**
* 角色 * 角色
@ -77,6 +82,10 @@ public class SceneQuestion implements Serializable {
*/ */
private String answer; private String answer;
/**
* 答案
*/
private String option;
/** /**
* 下一个答案 * 下一个答案
@ -88,12 +97,20 @@ public class SceneQuestion implements Serializable {
*/ */
private Map<String, Object> params; private Map<String, Object> params;
public void setId(Long id) { public String getGuid() {
this.id = id; return guid;
}
public void setGuid(String guid) {
this.guid = guid;
}
public Long getCode() {
return code;
} }
public Long getId() { public void setCode(Long code) {
return id; this.code = code;
} }
public void setName(String name) { public void setName(String name) {
@ -131,11 +148,13 @@ public class SceneQuestion implements Serializable {
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("guid", getGuid())
.append("code", getCode())
.append("name", getName()) .append("name", getName())
.append("roleId", getRoleId()) .append("roleId", getRoleId())
.append("parentId", getParentId()) .append("parentId", getParentId())
.append("status", getStatus()) .append("status", getStatus())
.append("option", getOption())
.append("answer", getAnswer()) .append("answer", getAnswer())
.append("nextQuestionId", getNextQuestionId()) .append("nextQuestionId", getNextQuestionId())
.append("creator", getCreator()) .append("creator", getCreator())
@ -177,11 +196,11 @@ public class SceneQuestion implements Serializable {
this.createTimeEnd = createTimeEnd; this.createTimeEnd = createTimeEnd;
} }
public Long getParentId() { public String getParentId() {
return parentId; return parentId;
} }
public void setParentId(Long parentId) { public void setParentId(String parentId) {
this.parentId = parentId; this.parentId = parentId;
} }
@ -208,4 +227,12 @@ public class SceneQuestion implements Serializable {
public void setNextQuestionId(Long nextQuestionId) { public void setNextQuestionId(Long nextQuestionId) {
this.nextQuestionId = nextQuestionId; this.nextQuestionId = nextQuestionId;
} }
public String getOption() {
return option;
}
public void setOption(String option) {
this.option = option;
}
} }

31
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/mapper/SceneManageMapper.java

@ -16,10 +16,10 @@ public interface SceneManageMapper
/** /**
* 查询【请填写功能名称】 * 查询【请填写功能名称】
* *
* @param id 【请填写功能名称】ID * @param guid 【请填写功能名称】ID
* @return 【请填写功能名称】 * @return 【请填写功能名称】
*/ */
public SceneManage selectSceneManageById(Long id); public SceneManage selectSceneManageById(String guid);
/** /**
* 查询【请填写功能名称】列表 * 查询【请填写功能名称】列表
@ -56,25 +56,40 @@ public interface SceneManageMapper
/** /**
* 删除【请填写功能名称】 * 删除【请填写功能名称】
* *
* @param id 【请填写功能名称】ID * @param guid 【请填写功能名称】ID
* @return 结果 * @return 结果
*/ */
public int deleteSceneManageById(Long id); public int deleteSceneManageById(String guid);
/** /**
* 批量删除【请填写功能名称】 * 批量删除【请填写功能名称】
* *
* @param ids 需要删除的数据ID * @param guids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
public int deleteSceneManageByIds(String[] ids); public int deleteSceneManageByIds(String[] guids);
/** /**
* 批量查找【请填写功能名称】 * 批量查找【请填写功能名称】
* *
* @param ids 需要查找的数据ID * @param guids 需要查找的数据ID
* @return 结果 * @return 结果
*/ */
public List<SceneManage> selectSceneManageByIds(String[] ids); public List<SceneManage> selectSceneManageByIds(String[] guids);
/**
* 获取排序【请填写功能名称】
*
* @return 结果
*/
public int selectMinSort();
/**
* 获取排序【请填写功能名称】
*
* @return 结果
*/
public SceneManage selectLastSort(Integer sort);
} }

12
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/mapper/SceneQuestionMapper.java

@ -15,10 +15,10 @@ public interface SceneQuestionMapper
/** /**
* 查询场景题目 * 查询场景题目
* *
* @param id 场景题目ID * @param guid 场景题目ID
* @return 场景题目 * @return 场景题目
*/ */
public SceneQuestion selectSceneQuestionById(Long id); public SceneQuestion selectSceneQuestionById(String guid);
/** /**
* 查询场景题目列表 * 查询场景题目列表
@ -47,18 +47,18 @@ public interface SceneQuestionMapper
/** /**
* 删除场景题目 * 删除场景题目
* *
* @param id 场景题目ID * @param guid 场景题目ID
* @return 结果 * @return 结果
*/ */
public int deleteSceneQuestionById(Long id); public int deleteSceneQuestionById(String guid);
/** /**
* 批量删除场景题目 * 批量删除场景题目
* *
* @param ids 需要删除的数据ID * @param guids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
public int deleteSceneQuestionByIds(String[] ids); public int deleteSceneQuestionByIds(String[] guids);
/** /**
* 绑定场景题目 * 绑定场景题目

20
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/ISceneManageService.java

@ -19,10 +19,10 @@ public interface ISceneManageService
/** /**
* 查询【请填写功能名称】 * 查询【请填写功能名称】
* *
* @param id 【请填写功能名称】ID * @param guid 【请填写功能名称】ID
* @return 【请填写功能名称】 * @return 【请填写功能名称】
*/ */
public SceneManage selectSceneManageById(Long id); public SceneManage selectSceneManageById(String guid);
/** /**
* 查询【请填写功能名称】列表 * 查询【请填写功能名称】列表
@ -51,18 +51,26 @@ public interface ISceneManageService
/** /**
* 批量删除【请填写功能名称】 * 批量删除【请填写功能名称】
* *
* @param ids 需要删除的数据ID * @param guids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
public ZDResponse deleteSceneManageByIds(String ids); public ZDResponse deleteSceneManageByIds(String guids);
/** /**
* 删除【请填写功能名称】信息 * 删除【请填写功能名称】信息
* *
* @param id 【请填写功能名称】ID * @param guid 【请填写功能名称】ID
* @return 结果 * @return 结果
*/ */
public int deleteSceneManageById(Long id); public int deleteSceneManageById(String guid);
/**
* 排序上移【请填写功能名称】
*
* @param guid 需要删除的数据ID
* @return 结果
*/
public ZDResponse sort(String guid);
/** /**
* 导入【请填写功能名称】信息 * 导入【请填写功能名称】信息

12
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/ISceneQuestionService.java

@ -17,10 +17,10 @@ public interface ISceneQuestionService
/** /**
* 查询场景题目 * 查询场景题目
* *
* @param id 场景题目ID * @param guid 场景题目ID
* @return 场景题目 * @return 场景题目
*/ */
public SceneQuestion selectSceneQuestionById(Long id); public SceneQuestion selectSceneQuestionById(String guid);
/** /**
* 查询场景题目列表 * 查询场景题目列表
@ -49,18 +49,18 @@ public interface ISceneQuestionService
/** /**
* 批量删除场景题目 * 批量删除场景题目
* *
* @param ids 需要删除的数据ID * @param guids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
public int deleteSceneQuestionByIds(String ids); public int deleteSceneQuestionByIds(String guids);
/** /**
* 删除场景题目信息 * 删除场景题目信息
* *
* @param id 场景题目ID * @param guid 场景题目ID
* @return 结果 * @return 结果
*/ */
public int deleteSceneQuestionById(Long id); public int deleteSceneQuestionById(String guid);
/** /**
* 绑定场景题目信息 * 绑定场景题目信息

50
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/SceneManageServiceImpl.java

@ -8,6 +8,7 @@ import com.zdxt.auth.feign.UserApi;
import com.zdxt.common.ZDResponse; import com.zdxt.common.ZDResponse;
import com.zdxt.common.util.Convert; import com.zdxt.common.util.Convert;
import com.zdxt.common.util.DateUtils; import com.zdxt.common.util.DateUtils;
import com.zdxt.common.util.StringUtils;
import com.zdxt.knowledge.domain.SceneImportDataModel; import com.zdxt.knowledge.domain.SceneImportDataModel;
import com.zdxt.knowledge.domain.SceneManage; import com.zdxt.knowledge.domain.SceneManage;
import com.zdxt.knowledge.mapper.SceneManageMapper; import com.zdxt.knowledge.mapper.SceneManageMapper;
@ -25,6 +26,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -47,12 +49,12 @@ public class SceneManageServiceImpl implements ISceneManageService {
/** /**
* 查询【请填写功能名称】 * 查询【请填写功能名称】
* *
* @param id 【请填写功能名称】ID * @param guid 【请填写功能名称】ID
* @return 【请填写功能名称】 * @return 【请填写功能名称】
*/ */
@Override @Override
public SceneManage selectSceneManageById(Long id) { public SceneManage selectSceneManageById(String guid) {
return sceneManageMapper.selectSceneManageById(id); return sceneManageMapper.selectSceneManageById(guid);
} }
/** /**
@ -82,6 +84,9 @@ public class SceneManageServiceImpl implements ISceneManageService {
sceneManage.setCreator(userBean.getUserName()); sceneManage.setCreator(userBean.getUserName());
sceneManage.setCreateTime(DateUtils.getNowDate()); sceneManage.setCreateTime(DateUtils.getNowDate());
} }
int i = sceneManageMapper.selectMinSort();
sceneManage.setSort(i + 1);
sceneManage.setGuid(StringUtils.getUUID());
return sceneManageMapper.insertSceneManage(sceneManage); return sceneManageMapper.insertSceneManage(sceneManage);
} }
@ -100,31 +105,50 @@ public class SceneManageServiceImpl implements ISceneManageService {
/** /**
* 删除【请填写功能名称】对象 * 删除【请填写功能名称】对象
* *
* @param ids 需要删除的数据ID * @param guids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
@Override @Override
public ZDResponse deleteSceneManageByIds(String ids) { public ZDResponse deleteSceneManageByIds(String guids) {
List<SceneManage> sceneManageList = sceneManageMapper.selectSceneManageByIds(Convert.toStrArray(ids)); List<SceneManage> sceneManageList = sceneManageMapper.selectSceneManageByIds(Convert.toStrArray(guids));
if (CollectionUtils.isNotEmpty(sceneManageList)) { if (CollectionUtils.isNotEmpty(sceneManageList)) {
long count = sceneManageList.stream().filter(item -> !Objects.equals(item.getStatus(), 4)).count(); long count = sceneManageList.stream().filter(item -> !Objects.equals(item.getStatus(), 4)).count();
if (count > 0) { if (count > 0) {
return ZDResponse.error("仅支持已下架的场景进行删除操作"); return ZDResponse.error("仅支持已下架的场景进行删除操作");
} }
} }
return sceneManageMapper.deleteSceneManageByIds(Convert.toStrArray(ids))> 0 return sceneManageMapper.deleteSceneManageByIds(Convert.toStrArray(guids)) > 0
? ZDResponse.success() : ZDResponse.error("删除失败"); ? ZDResponse.success() : ZDResponse.error("删除失败");
} }
/** /**
* 删除【请填写功能名称】信息 * 删除【请填写功能名称】信息
* *
* @param id 【请填写功能名称】ID * @param guid 【请填写功能名称】ID
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteSceneManageById(Long id) { public int deleteSceneManageById(String guid) {
return sceneManageMapper.deleteSceneManageById(id); return sceneManageMapper.deleteSceneManageById(guid);
}
@Override
public ZDResponse sort(String guid) {
SceneManage sceneManage = sceneManageMapper.selectSceneManageById(guid);
if (Objects.isNull(sceneManage)) {
return ZDResponse.error("未找到改场景相关数据");
}
SceneManage lastSceneManage = sceneManageMapper.selectLastSort(sceneManage.getSort());
if (Objects.isNull(lastSceneManage)) {
return ZDResponse.error("上移达到最大限制");
}
Integer lastSceneManageSort = lastSceneManage.getSort();
lastSceneManage.setSort(sceneManage.getSort());
sceneManageMapper.updateSceneManage(lastSceneManage);
sceneManage.setSort(lastSceneManageSort);
sceneManageMapper.updateSceneManage(sceneManage);
return ZDResponse.success("上移成功");
} }
@Override @Override
@ -140,6 +164,7 @@ public class SceneManageServiceImpl implements ISceneManageService {
.collect(Collectors.toMap(DictDataBean::getDictLabel, DictDataBean::getDictValue)); .collect(Collectors.toMap(DictDataBean::getDictLabel, DictDataBean::getDictValue));
if (CollectionUtils.isNotEmpty(dataModelList)) { if (CollectionUtils.isNotEmpty(dataModelList)) {
AtomicInteger sort = new AtomicInteger(sceneManageMapper.selectMinSort());
List<SceneManage> sceneManageList = dataModelList.stream() List<SceneManage> sceneManageList = dataModelList.stream()
.filter(Objects::nonNull).peek(item -> { .filter(Objects::nonNull).peek(item -> {
String type = sceneTypeMap.get(item.getType()); String type = sceneTypeMap.get(item.getType());
@ -150,6 +175,9 @@ public class SceneManageServiceImpl implements ISceneManageService {
UserBean userBean = userApi.getCurrentUser(); UserBean userBean = userApi.getCurrentUser();
SceneManage sceneManage = new SceneManage(); SceneManage sceneManage = new SceneManage();
BeanUtils.copyProperties(item, sceneManage); BeanUtils.copyProperties(item, sceneManage);
sort.addAndGet(1);
sceneManage.setSort(sort.get());
sceneManage.setGuid(StringUtils.getUUID());
sceneManage.setIsOpen(Integer.valueOf(item.getIsOpen())); sceneManage.setIsOpen(Integer.valueOf(item.getIsOpen()));
sceneManage.setType(Integer.valueOf(item.getType())); sceneManage.setType(Integer.valueOf(item.getType()));
sceneManage.setCreator(userBean.getUserName()); sceneManage.setCreator(userBean.getUserName());

22
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/SceneQuestionServiceImpl.java

@ -11,6 +11,7 @@ import com.zdxt.auth.feign.UserApi;
import com.zdxt.auth.feign.ZdxtFileCommonApi; import com.zdxt.auth.feign.ZdxtFileCommonApi;
import com.zdxt.common.util.Convert; import com.zdxt.common.util.Convert;
import com.zdxt.common.util.DateUtils; import com.zdxt.common.util.DateUtils;
import com.zdxt.common.util.StringUtils;
import com.zdxt.common.zdxtFile.AttFileRespDTO; import com.zdxt.common.zdxtFile.AttFileRespDTO;
import com.zdxt.common.zdxtFile.FilePreviewUtilBean; import com.zdxt.common.zdxtFile.FilePreviewUtilBean;
import com.zdxt.common.zdxtFile.ZdxtFileCommon; import com.zdxt.common.zdxtFile.ZdxtFileCommon;
@ -50,12 +51,12 @@ public class SceneQuestionServiceImpl implements ISceneQuestionService {
/** /**
* 查询场景题目 * 查询场景题目
* *
* @param id 场景题目ID * @param guid 场景题目ID
* @return 场景题目 * @return 场景题目
*/ */
@Override @Override
public SceneQuestion selectSceneQuestionById(Long id) { public SceneQuestion selectSceneQuestionById(String guid) {
return sceneQuestionMapper.selectSceneQuestionById(id); return sceneQuestionMapper.selectSceneQuestionById(guid);
} }
/** /**
@ -100,11 +101,12 @@ public class SceneQuestionServiceImpl implements ISceneQuestionService {
sceneQuestion.setCreator(userBean.getUserName()); sceneQuestion.setCreator(userBean.getUserName());
sceneQuestion.setCreateTime(DateUtils.getNowDate()); sceneQuestion.setCreateTime(DateUtils.getNowDate());
} }
sceneQuestion.setGuid(StringUtils.getUUID());
int result = sceneQuestionMapper.insertSceneQuestion(sceneQuestion); int result = sceneQuestionMapper.insertSceneQuestion(sceneQuestion);
// 上传文件,并在附件表中添加记录 // 上传文件,并在附件表中添加记录
if (result > 0 && ObjectUtil.isNotEmpty(files)) { if (result > 0 && ObjectUtil.isNotEmpty(files)) {
for (MultipartFile file : files) { for (MultipartFile file : files) {
zdxtFileCommonApi.insertZdxtFile(file, sceneQuestion.getId() + "", fileUploadApi.upload(file)); zdxtFileCommonApi.insertZdxtFile(file, sceneQuestion.getGuid() + "", fileUploadApi.upload(file));
} }
} }
return result; return result;
@ -125,23 +127,23 @@ public class SceneQuestionServiceImpl implements ISceneQuestionService {
/** /**
* 删除场景题目对象 * 删除场景题目对象
* *
* @param ids 需要删除的数据ID * @param guids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteSceneQuestionByIds(String ids) { public int deleteSceneQuestionByIds(String guids) {
return sceneQuestionMapper.deleteSceneQuestionByIds(Convert.toStrArray(ids)); return sceneQuestionMapper.deleteSceneQuestionByIds(Convert.toStrArray(guids));
} }
/** /**
* 删除场景题目信息 * 删除场景题目信息
* *
* @param id 场景题目ID * @param guid 场景题目ID
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteSceneQuestionById(Long id) { public int deleteSceneQuestionById(String guid) {
return sceneQuestionMapper.deleteSceneQuestionById(id); return sceneQuestionMapper.deleteSceneQuestionById(guid);
} }
@Override @Override

55
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneManageMapper.xml

@ -5,14 +5,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.zdxt.knowledge.mapper.SceneManageMapper"> <mapper namespace="com.zdxt.knowledge.mapper.SceneManageMapper">
<resultMap type="com.zdxt.knowledge.domain.SceneManage" id="SceneManageResult"> <resultMap type="com.zdxt.knowledge.domain.SceneManage" id="SceneManageResult">
<result property="id" column="id" /> <result property="guid" column="guid" />
<result property="code" column="code" />
<result property="name" column="name" /> <result property="name" column="name" />
<result property="type" column="type" /> <result property="type" column="type" />
<result property="url" column="url" /> <result property="url" column="url" />
<result property="sourceUnit" column="source_unit" /> <result property="sourceUnit" column="source_unit" />
<result property="isOpen" column="is_open" /> <result property="isOpen" column="is_open" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="isDelete" column="is_delete" />
<result property="creator" column="creator" /> <result property="creator" column="creator" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="sceneBackground" column="scene_background" /> <result property="sceneBackground" column="scene_background" />
@ -22,13 +22,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectSceneManageVo"> <sql id="selectSceneManageVo">
select id, name, type, url, source_unit, is_open, status, is_delete, creator, create_time, scene_background, `describe`, sort, use_total from scene_manage select guid, code, name, type, url, source_unit, is_open, status, creator, create_time, scene_background, `describe`, sort, use_total from scene_manage
</sql> </sql>
<select id="selectSceneManageList" parameterType="com.zdxt.knowledge.domain.SceneManage" resultMap="SceneManageResult"> <select id="selectSceneManageList" parameterType="com.zdxt.knowledge.domain.SceneManage" resultMap="SceneManageResult">
<include refid="selectSceneManageVo"/> <include refid="selectSceneManageVo"/>
<where> <where>
and is_delete = 1
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="type != null "> and type = #{type}</if> <if test="type != null "> and type = #{type}</if>
<if test="url != null and url != ''"> and url = #{url}</if> <if test="url != null and url != ''"> and url = #{url}</if>
@ -43,23 +42,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and create_time <![CDATA[<=]]> #{createTimeEnd} and create_time <![CDATA[<=]]> #{createTimeEnd}
</if> </if>
</where> </where>
order by sort ASC
</select> </select>
<select id="selectSceneManageById" parameterType="Long" resultMap="SceneManageResult"> <select id="selectSceneManageById" parameterType="String" resultMap="SceneManageResult">
<include refid="selectSceneManageVo"/> <include refid="selectSceneManageVo"/>
where id = #{id} where guid = #{guid}
</select> </select>
<insert id="insertSceneManage" parameterType="SceneManage" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSceneManage" parameterType="SceneManage" >
insert into scene_manage insert into scene_manage
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="guid != null and guid != ''">guid,</if>
<if test="name != null and name != ''">name,</if> <if test="name != null and name != ''">name,</if>
<if test="type != null ">type,</if> <if test="type != null ">type,</if>
<if test="url != null and url != ''">url,</if> <if test="url != null and url != ''">url,</if>
<if test="sourceUnit != null and sourceUnit != ''">source_unit,</if> <if test="sourceUnit != null and sourceUnit != ''">source_unit,</if>
<if test="isOpen != null ">is_open,</if> <if test="isOpen != null ">is_open,</if>
<if test="status != null ">status,</if> <if test="status != null ">status,</if>
<if test="isDelete != null ">is_delete,</if>
<if test="creator != null and creator != ''">creator,</if> <if test="creator != null and creator != ''">creator,</if>
<if test="createTime != null ">create_time,</if> <if test="createTime != null ">create_time,</if>
<if test="sceneBackground != null and sceneBackground != ''">scene_background,</if> <if test="sceneBackground != null and sceneBackground != ''">scene_background,</if>
@ -67,13 +67,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sort != null and sort != '' ">`sort`,</if> <if test="sort != null and sort != '' ">`sort`,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="guid != null and guid != ''">#{guid},</if>
<if test="name != null and name != ''">#{name},</if> <if test="name != null and name != ''">#{name},</if>
<if test="type != null ">#{type},</if> <if test="type != null ">#{type},</if>
<if test="url != null and url != ''">#{url},</if> <if test="url != null and url != ''">#{url},</if>
<if test="sourceUnit != null and sourceUnit != ''">#{sourceUnit},</if> <if test="sourceUnit != null and sourceUnit != ''">#{sourceUnit},</if>
<if test="isOpen != null ">#{isOpen},</if> <if test="isOpen != null ">#{isOpen},</if>
<if test="status != null ">#{status},</if> <if test="status != null ">#{status},</if>
<if test="isDelete != null ">#{isDelete},</if>
<if test="creator != null and creator != ''">#{creator},</if> <if test="creator != null and creator != ''">#{creator},</if>
<if test="createTime != null ">#{createTime},</if> <if test="createTime != null ">#{createTime},</if>
<if test="sceneBackground != null and sceneBackground != ''">#{sceneBackground},</if> <if test="sceneBackground != null and sceneBackground != ''">#{sceneBackground},</if>
@ -91,47 +91,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sourceUnit != null and sourceUnit != ''">source_unit = #{sourceUnit},</if> <if test="sourceUnit != null and sourceUnit != ''">source_unit = #{sourceUnit},</if>
<if test="isOpen != null ">is_open = #{isOpen},</if> <if test="isOpen != null ">is_open = #{isOpen},</if>
<if test="status != null ">status = #{status},</if> <if test="status != null ">status = #{status},</if>
<if test="isDelete != null ">is_delete = #{isDelete},</if>
<if test="creator != null and creator != ''">creator = #{creator},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="sceneBackground != null and sceneBackground != ''">scene_background = #{sceneBackground},</if> <if test="sceneBackground != null and sceneBackground != ''">scene_background = #{sceneBackground},</if>
<if test="describe != null and describe != ''">`describe` = #{describe},</if> <if test="describe != null and describe != ''">`describe` = #{describe},</if>
<if test="sort != null and sort != ''">`sort` = #{sort},</if> <if test="sort != null and sort != ''">`sort` = #{sort},</if>
<if test="useTotal != null and useTotal != ''">`use_total` = #{useTotal},</if> <if test="useTotal != null and useTotal != ''">`use_total` = #{useTotal},</if>
</trim> </trim>
where id = #{id} where guid = #{guid}
</update> </update>
<delete id="deleteSceneManageById" parameterType="Long"> <delete id="deleteSceneManageById" parameterType="String">
delete from scene_manage where id = #{id} delete from scene_manage where guid = #{guid}
</delete> </delete>
<update id="deleteSceneManageByIds" parameterType="String"> <delete id="deleteSceneManageByIds" parameterType="String">
update scene_manage set is_delete = 0 where id in delete from scene_manage where guid in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="guid" collection="array" open="(" separator="," close=")">
#{id} #{guid}
</foreach> </foreach>
</update> </delete>
<select id="selectSceneManageByIds" parameterType="String" resultMap="SceneManageResult"> <select id="selectSceneManageByIds" parameterType="String" resultMap="SceneManageResult">
<include refid="selectSceneManageVo"/> <include refid="selectSceneManageVo"/>
<where> <where>
and is_delete = 1 and guid in
and id in <foreach item="guid" collection="array" open="(" separator="," close=")">
<foreach item="id" collection="array" open="(" separator="," close=")"> #{guid}
#{id}
</foreach> </foreach>
</where> </where>
</select> </select>
<insert id="batchInsertSceneManage"> <insert id="batchInsertSceneManage">
insert into scene_manage insert into scene_manage
(`name`, `type`, source_unit, is_open, creator, create_time,scene_background, `describe`, `sort`) values (`guid`,`name`, `type`, source_unit, is_open, creator, create_time,scene_background, `describe`, `sort`) values
<foreach collection="sceneManageList" item="sceneObj" separator=","> <foreach collection="sceneManageList" item="sceneObj" separator=",">
(#{sceneObj.name},#{sceneObj.type},#{sceneObj.sourceUnit},#{sceneObj.isOpen},#{sceneObj.creator},#{sceneObj.createTime},#{sceneObj.sceneBackground},#{sceneObj.describe},#{sceneObj.sort}) (#{sceneObj.guid},#{sceneObj.name},#{sceneObj.type},#{sceneObj.sourceUnit},#{sceneObj.isOpen},#{sceneObj.creator},#{sceneObj.createTime},#{sceneObj.sceneBackground},#{sceneObj.describe},#{sceneObj.sort})
</foreach> </foreach>
</insert> </insert>
<select id="selectMinSort" resultType="INTEGER">
select MAX(sort) as sort from scene_manage
</select>
<select id="selectLastSort" parameterType="INTEGER" resultMap="SceneManageResult">
SELECT guid, sort FROM scene_manage WHERE sort = (SELECT MAX(sort) FROM scene_manage where sort &lt; #{sort});
</select>
<!-- <delete id="deleteSceneManageByIds" parameterType="String">--> <!-- <delete id="deleteSceneManageByIds" parameterType="String">-->
<!-- delete from scene_manage where id in --> <!-- delete from scene_manage where id in -->
<!-- <foreach item="id" collection="array" open="(" separator="," close=")">--> <!-- <foreach item="id" collection="array" open="(" separator="," close=")">-->

40
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneQuestionMapper.xml

@ -5,12 +5,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.zdxt.knowledge.mapper.SceneQuestionMapper"> <mapper namespace="com.zdxt.knowledge.mapper.SceneQuestionMapper">
<resultMap type="com.zdxt.knowledge.domain.SceneQuestion" id="SceneQuestionResult"> <resultMap type="com.zdxt.knowledge.domain.SceneQuestion" id="SceneQuestionResult">
<result property="id" column="id" /> <result property="guid" column="guid" />
<result property="code" column="code" />
<result property="name" column="name" /> <result property="name" column="name" />
<result property="parentId" column="parent_id" /> <result property="parentId" column="parent_id" />
<result property="roleId" column="role_id" /> <result property="roleId" column="role_id" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="creator" column="creator" /> <result property="creator" column="creator" />
<result property="option" column="option" />
<result property="answer" column="answer" /> <result property="answer" column="answer" />
<result property="nextQuestionId" column="next_question_id" /> <result property="nextQuestionId" column="next_question_id" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
@ -18,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectSceneQuestionVo"> <sql id="selectSceneQuestionVo">
select id, name, parent_id, role_id, status, creator, create_time, answer, next_question_id, update_time from scene_question select guid, code, name, parent_id, role_id, status, creator, create_time, answer, `option`, next_question_id, update_time from scene_question
</sql> </sql>
<select id="selectSceneQuestionList" parameterType="SceneQuestion" resultMap="SceneQuestionResult"> <select id="selectSceneQuestionList" parameterType="SceneQuestion" resultMap="SceneQuestionResult">
@ -36,31 +38,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and create_time <![CDATA[<=]]> #{createTimeEnd} and create_time <![CDATA[<=]]> #{createTimeEnd}
</if> </if>
</where> </where>
order by create_time desc
</select> </select>
<select id="selectSceneQuestionById" parameterType="Long" resultMap="SceneQuestionResult"> <select id="selectSceneQuestionById" parameterType="String" resultMap="SceneQuestionResult">
<include refid="selectSceneQuestionVo"/> <include refid="selectSceneQuestionVo"/>
where id = #{id} where guid = #{guid}
</select> </select>
<insert id="insertSceneQuestion" parameterType="SceneQuestion" useGeneratedKeys="true" keyColumn="id" keyProperty="id"> <insert id="insertSceneQuestion" parameterType="SceneQuestion">
insert into scene_question insert into scene_question
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null ">id,</if> <if test="guid != null ">guid,</if>
<if test="name != null and name != ''">name,</if> <if test="name != null and name != ''">`name`,</if>
<if test="parentId != null and parentId != ''">parent_id,</if> <if test="parentId != null and parentId != ''">parent_id,</if>
<if test="roleId != null and roleId != ''">role_id,</if> <if test="roleId != null and roleId != ''">role_id,</if>
<if test="status != null ">status,</if> <if test="status != null ">status,</if>
<if test="option != null and option != ''">`option`,</if>
<if test="answer != null and answer != ''">answer,</if>
<if test="creator != null and creator != ''">creator,</if> <if test="creator != null and creator != ''">creator,</if>
<if test="createTime != null ">create_time,</if> <if test="createTime != null ">create_time,</if>
<if test="updateTime != null ">update_time,</if> <if test="updateTime != null ">update_time,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null ">#{id},</if> <if test="guid != null ">#{guid},</if>
<if test="name != null and name != ''">#{name},</if> <if test="name != null and name != ''">#{name},</if>
<if test="parentId != null and parentId != ''">#{parentId},</if> <if test="parentId != null and parentId != ''">#{parentId},</if>
<if test="roleId != null and roleId != ''">#{roleId},</if> <if test="roleId != null and roleId != ''">#{roleId},</if>
<if test="status != null ">#{status},</if> <if test="status != null ">#{status},</if>
<if test="option != null and option != ''">#{option},</if>
<if test="answer != null and creator != ''">#{answer},</if>
<if test="creator != null and creator != ''">#{creator},</if> <if test="creator != null and creator != ''">#{creator},</if>
<if test="createTime != null ">#{createTime},</if> <if test="createTime != null ">#{createTime},</if>
<if test="updateTime != null ">#{updateTime},</if> <if test="updateTime != null ">#{updateTime},</if>
@ -74,21 +81,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="parentId != null and parentId != ''">parent_id = #{parentId},</if> <if test="parentId != null and parentId != ''">parent_id = #{parentId},</if>
<if test="roleId != null and roleId != ''">role_id = #{roleId},</if> <if test="roleId != null and roleId != ''">role_id = #{roleId},</if>
<if test="status != null ">status = #{status},</if> <if test="status != null ">status = #{status},</if>
<if test="option != null and option != ''">`option` = #{option},</if>
<if test="answer != null and answer != ''">answer = #{answer},</if>
<if test="creator != null and creator != ''">creator = #{creator},</if> <if test="creator != null and creator != ''">creator = #{creator},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if> <if test="updateTime != null ">update_time = #{updateTime},</if>
</trim> </trim>
where id = #{id} where guid = #{guid}
</update> </update>
<delete id="deleteSceneQuestionById" parameterType="Long"> <delete id="deleteSceneQuestionById" parameterType="String">
delete from scene_question where id = #{id} delete from scene_question where guid = #{guid}
</delete> </delete>
<delete id="deleteSceneQuestionByIds" parameterType="String"> <delete id="deleteSceneQuestionByIds" parameterType="String">
delete from scene_question where id in delete from scene_question where guid in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="guid" collection="array" open="(" separator="," close=")">
#{id} #{guid}
</foreach> </foreach>
</delete> </delete>
@ -98,7 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="answer != null and answer != ''">answer = #{answer},</if> <if test="answer != null and answer != ''">answer = #{answer},</if>
<if test="nextQuestionId != null and nextQuestionId != ''">next_question_id = #{nextQuestionId},</if> <if test="nextQuestionId != null and nextQuestionId != ''">next_question_id = #{nextQuestionId},</if>
</trim> </trim>
where id = #{id} where guid = #{guid}
</update> </update>
</mapper> </mapper>
Loading…
Cancel
Save