Browse Source

主页配置及场景列表

master
yanyan 3 years ago
parent
commit
68b59236ee
  1. 227
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/home/add.html
  2. 216
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/home/edit.html
  3. 117
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/home/view.html
  4. 161
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/add.html
  5. 202
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/detail.html
  6. 207
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/edit.html
  7. 27
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/manage.html
  8. 2
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/controller/CustomImageController.java
  9. 171
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/controller/SceneHomeController.java
  10. 66
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/controller/SceneManageController.java
  11. 131
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneHome.java
  12. 10
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneManage.java
  13. 63
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/mapper/SceneHomeMapper.java
  14. 23
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/mapper/SceneManageMapper.java
  15. 83
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/ISceneHomeService.java
  16. 46
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/ISceneManageService.java
  17. 168
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/SceneHomeServiceImpl.java
  18. 77
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/SceneManageServiceImpl.java
  19. 1
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/CustomImageMapper.xml
  20. 96
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneHomeMapper.xml
  21. 11
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneManageMapper.xml

227
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/home/add.html

@ -0,0 +1,227 @@
<!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-home-add" type="text/template">
<input name="parentId" type="text" hidden>
<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="name" id="name" required>
</div>
</div>
<div class="form-group" id="fileTitle">
<label class="col-sm-3 control-label is-required">图标:</label>
<div id="fileIn" class="col-sm-8">
<div class="file-loading">
<input id="fileInput" name="file" type="file" multiple>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">隐藏:</label>
<div class="col-sm-8">
<select name="hide" class="form-control">
<option value="1">否</option>
<option value="0">是</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 prefix = ctx + "small/project/home"
$("#form-home-add").validate({
focusCleanup: true
});
$(function () {
// 渲染文件要素信息
renderVersionAtt();
})
function submitHandler() {
if ($.validate.form()) {
$('#fileInput').fileinput('upload');
}
}
/** 附件相关 */
/** 渲染附件信息 */
function renderVersionAtt() {
$("#fileIn").show();
$("#fileOut").hide();
uploadFiles();
$("#fileInput").fileinput('clear')
}
/** 上传附件 */
function uploadFiles() {
var filePreview = {fileList: null, previewRespDTOS: null}
initFile("fileInput", prefix + "/add", filePreview);
}
/** 初始化文件 */
function initFile(elementId, url, filePreview) {
var preview = filePreview.previewRespDTOS;
if (preview != null) {
for (var i = 0; i < preview.length; i++) {
// 图片删除的地址
preview[i].url = prefix + "/removeFile"
}
}
$("#" + elementId).fileinput({
'theme': 'explorer',
initialPreviewAsData: true,
dropZoneEnabled: true,
dropZoneTitle: "上传图片或视频",
uploadUrl: url,
uploadAsync: false,//异步上传
enctype: 'multipart/form-data',
showClose: false,
showPreview: true,
showUpload: false,
uploadExtraData: function () {
var formData = $("#form-home-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}]];
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);
})
};
/** 文件上传回调 */
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();
}
/** 动态表格 */
$(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>
</body>
</html>

216
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/home/edit.html

@ -0,0 +1,216 @@
<!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" id="form-home-edit" th:object="${sceneHome}">
<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="hide" class="form-control" th:field="*{hide}">
<option value="1">否</option>
<option value="0">是</option>
</select>
</div>
</div>
<div class="form-group" id="fileTitle">
<label class="col-sm-3 control-label">图标:</label>
<div id="fileIn" class="col-sm-8" readonly>
<div class="file-loading">
<input id="fileInput" name="file" type="file" multiple>
</div>
</div>
<div id="fileOut" class="col-sm-8" style="display: none" readonly>
<div class="file-loading">
<input id="fileOutput" name="file" type="file" multiple>
</div>
</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 + "small/project/home"
$("#form-home-edit").validate({
focusCleanup: true
});
var isFlieIn = true;
$(function() {
// 渲染要素信息
renderVersionAtt();
})
function submitHandler() {
if (isFlieIn) {
$('#fileInput').fileinput('upload');
} else {
$('#fileOutput').fileinput('upload');
}
}
/** 附件相关 */
/** 渲染附件信息 */
function renderVersionAtt() {
var key = $("[name='guid']").val();
$.getJSON(prefix + "/queryFiles/" + key, function (result) {
if (result.data != null) {
$("#fileIn").hide();
$("#fileOut").show();
// 重置文件预览框
$("#fileOut").html("<div class=\"file-loading\"><input id=\"fileOutput\" name=\"file\" type=\"file\" multiple></div>");
queryFiles(key);
isFlieIn = false;
} else {
$("#fileIn").show();
$("#fileOut").hide();
uploadFiles();
isFlieIn = true;
$("#fileInput").fileinput('clear')
}
});
}
/** 预览附件 */
function queryFiles(key) {
$.ajax({
type: "POST",
url: prefix + "/queryFilesPost",
data: {"key": key},
dataType: 'json',
success: function (result) {
if (result.success == true) {
initFile("fileOutput", prefix + "/edit", result.data.filePreview);
}
},
error: function (error) {
$.modal.alertWarning("附件预览失败!");
}
});
}
/** 上传附件 */
function uploadFiles() {
var filePreview = { fileList: null, previewRespDTOS: null }
initFile("fileInput", prefix + "/edit", filePreview);
}
/** 初始化文件 */
function initFile(elementId, url, filePreview) {
var preview = filePreview.previewRespDTOS;
if (preview != null) {
for (var i = 0; i < preview.length; i++) {
// 图片删除的地址
preview[i].url = prefix + "/removeFile"
}
}
$("#" + elementId).fileinput({
'theme': 'explorer',
initialPreviewAsData: true,
dropZoneEnabled: true,
dropZoneTitle: "上传图片或视频",
uploadUrl: url,
uploadAsync: false,//异步上传
enctype: 'multipart/form-data',
showClose: false,
showPreview: true,
showUpload: false,
uploadExtraData: function () {
var formData = $("#form-home-edit").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;
}
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();
}
</script>
</body>
</html>

117
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/home/view.html

@ -0,0 +1,117 @@
<!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">
<ul>
<li>
<p>名称:</p>
<input type="text" name="name"/>
</li>
<li>
<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-reset btn-rounded btn-sm" onclick="reset()"><i
class="fa fa-refresh"></i>&nbsp;重置</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:home: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:home:edit')}]];
var removeFlag = [[${@permission.hasPermi('project:home:remove')}]];
var detailFlag = [[${@permission.hasPermi('project:home:detail')}]];
var prefix = ctx + "small/project/home";
$(function () {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add/{}",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
detailUrl: prefix + "/detail/{guid}",
modalName: "主页",
columns: [{
checkbox: true
},
{
field: 'name',
title: '名称'
},
{
field: 'hide',
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="$.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.guid + '\')"><i class="fa fa-remove"></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('');
}
}]
};
$.table.init(options);
});
function detail(id, width, height) {
$.modal.open("查看", ctx + "small/project/home/detail/" + id, width, height);
}
function add() {
$.modal.open("新增", ctx + "small/project/home/add", 800, 450);
}
function sort(id) {
$.get(ctx + "small/project/home/sort/" + id, null, function (res) {
if (res.success) {
//
$.table.refresh();
$.modal.alertSuccess(res.message);
} else {
$.modal.alertWarning(res.message);
}
});
}
function reset() {
$("[name='name']").val("");
$.table.search()
}
</script>
</body>
</html>

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

@ -2,10 +2,11 @@
<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" id="form-manage-add">
<form class="form-horizontal m" enctype="multipart/form-data" id="form-manage-add" type="text/template">
<div class="form-group">
<label class="col-sm-3 control-label is-required">场景名称:</label>
<div class="col-sm-8">
@ -18,20 +19,15 @@
<input name="sourceUnit" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">题目类型:</label>
<div class="col-sm-8">
<!-- <select name="type" class="form-control m-b">-->
<!-- <option value="1">文字型</option>-->
<!-- <option value="2">视频型</option>-->
<!-- <option value="3">图片型</option>-->
<!-- <div class="form-group">-->
<!-- <label class="col-sm-3 control-label is-required">题目类型:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <select name="type" class="form-control" th:with="type=${@dict.getType('scene_type')}" required>-->
<!-- <option th:each="dict : ${type}" th:text="${dict.dictLabel}"-->
<!-- th:value="${dict.dictValue}"></option>-->
<!-- </select>-->
<select name="type" class="form-control" th:with="type=${@dict.getType('scene_type')}" required>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label is-required">是否公开:</label>
<div class="col-sm-8">
@ -53,19 +49,150 @@
<textarea name="describe" class="form-control" type="text" style="height: 200px;width: 770px"></textarea>
</div>
</div>
<div class="form-group" id="fileTitle">
<label class="col-sm-3 control-label is-required">入口图标:</label>
<div id="fileIn" class="col-sm-8">
<div class="file-loading">
<input id="fileInput" name="file" type="file" multiple>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="zdxtInclude :: footer" />
<th:block th:include="zdxtInclude :: footer"/>
<th:block th:include="zdxtInclude :: bootstrap-fileinput-js"/>
<script type="text/javascript">
var prefix = ctx + "scene/manage"
var prefix = ctx + "small/scene/manage"
$("#form-manage-add").validate({
focusCleanup: true
});
$(function () {
// 渲染文件要素信息
renderVersionAtt();
})
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-manage-add').serialize());
$('#fileInput').fileinput('upload');
// $.operate.save(prefix + "/add", $('#form-manage-add').serialize());
}
}
/** 附件相关 */
/** 渲染附件信息 */
function renderVersionAtt() {
$("#fileIn").show();
$("#fileOut").hide();
uploadFiles();
$("#fileInput").fileinput('clear')
}
/** 上传附件 */
function uploadFiles() {
var filePreview = {fileList: null, previewRespDTOS: null}
initFile("fileInput", prefix + "/add", filePreview);
}
/** 初始化文件 */
function initFile(elementId, url, filePreview) {
var preview = filePreview.previewRespDTOS;
if (preview != null) {
for (var i = 0; i < preview.length; i++) {
// 图片删除的地址
preview[i].url = prefix + "/removeFile"
}
}
$("#" + elementId).fileinput({
'theme': 'explorer',
initialPreviewAsData: true,
dropZoneEnabled: true,
dropZoneTitle: "上传图片或视频",
uploadUrl: url,
uploadAsync: false,//异步上传
enctype: 'multipart/form-data',
showClose: false,
showPreview: true,
showUpload: false,
uploadExtraData: function () {
var formData = $("#form-manage-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;
}
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);
})
};
/** 文件上传回调 */
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();
}
</script>
</body>

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

@ -2,6 +2,7 @@
<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">
@ -13,12 +14,12 @@
<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">
<input name="type" th:field="*{type}" class="form-control" type="text">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="col-sm-3 control-label">题目类型:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <input name="type" th:field="*{type}" class="form-control" type="text">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label">二维码链接:</label>
<div class="col-sm-8">
@ -67,26 +68,45 @@
<textarea name="describe" th:field="*{describe}" class="form-control" type="text" style="height: 200px;width: 770px"></textarea>
</div>
</div>
<div class="form-group" id="fileTitle">
<label class="col-sm-3 control-label">入口图标:</label>
<div id="fileIn" class="col-sm-8" readonly>
<div class="file-loading">
<input id="fileInput" name="file" type="file" multiple>
</div>
</div>
<div id="fileOut" class="col-sm-8" style="display: none" readonly>
<div class="file-loading">
<input id="fileOutput" name="file" type="file" multiple>
</div>
</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 + "small/scene/manage"
var sceneObj = [[${sceneManage}]];
var sceneType = [[${@dict.getType('scene_type')}]];
var sceneStatus = [[${@dict.getType('scene_status')}]];
$("[name = 'isOpen']").val(sceneObj.isOpen === 0 ? "是" : "否");
$(function () {
// 渲染文件要素信息
renderVersionAtt();
})
var type = $("[name = 'type']").val();
debugger
if (sceneType.length > 0) {
for (var i = 0; i <= sceneType.length; i++) {
if (type === sceneType[i].dictValue) {
$("[name = 'type']").val(sceneType[i].dictLabel)
break
}
}
}
//var type = $("[name = 'type']").val();
// debugger
// if (sceneType.length > 0) {
// for (var i = 0; i <= sceneType.length; i++) {
// if (type === sceneType[i].dictValue) {
// $("[name = 'type']").val(sceneType[i].dictLabel)
// break
// }
// }
// }
var status = $("[name = 'status']").val();
if (sceneStatus.length > 0) {
for (var i = 0; i <= sceneStatus.length; i++) {
@ -96,6 +116,156 @@
}
}
}
/** 附件相关 */
var isFlieIn = true;
/** 渲染附件信息 */
function renderVersionAtt() {
var key = $("[name='guid']").val();
$.getJSON(prefix + "/queryFiles/" + key, function (result) {
if (result.data != null) {
$("#fileIn").hide();
$("#fileOut").show();
// 重置文件预览框
$("#fileOut").html("<div class=\"file-loading\"><input id=\"fileOutput\" name=\"file\" type=\"file\" multiple></div>");
queryFiles(key);
isFlieIn = false;
} else {
$("#fileIn").show();
$("#fileOut").hide();
uploadFiles();
isFlieIn = true;
$("#fileInput").fileinput('clear')
}
});
}
/** 预览附件 */
function queryFiles(key) {
$.ajax({
type: "POST",
url: prefix + "/queryFilesPost",
data: {"key": key},
dataType: 'json',
success: function (result) {
if (result.success == true) {
initFile("fileOutput", prefix + "/edit", result.data.filePreview);
}
},
error: function (error) {
$.modal.alertWarning("附件预览失败!");
}
});
}
/** 上传附件 */
function uploadFiles() {
var filePreview = {fileList: null, previewRespDTOS: null}
initFile("fileInput", prefix + "/edit", filePreview);
}
/** 初始化文件 */
function initFile(elementId, url, filePreview) {
var preview = filePreview.previewRespDTOS;
if (preview != null) {
for (var i = 0; i < preview.length; i++) {
// 图片删除的地址
preview[i].url = prefix + "/removeFile"
}
}
$("#" + elementId).fileinput({
'theme': 'explorer',
initialPreviewAsData: true,
dropZoneEnabled: true,
dropZoneTitle: "上传图片或视频",
uploadUrl: url,
uploadAsync: false,//异步上传
enctype: 'multipart/form-data',
showClose: false,
showPreview: true,
showUpload: false,
uploadExtraData: function () {
var formData = $("#form-manage-detail").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;
}
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();
}
</script>
</body>
</html>

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

@ -2,6 +2,7 @@
<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">
@ -13,15 +14,15 @@
<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="type" class="form-control" th:field="*{type}" th:with="type=${@dict.getType('scene_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="col-sm-3 control-label">题目类型:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <select name="type" class="form-control" th:field="*{type}" th:with="type=${@dict.getType('scene_type')}">-->
<!-- <option th:each="dict : ${type}" th:text="${dict.dictLabel}"-->
<!-- th:value="${dict.dictValue}"></option>-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label">二维码链接:</label>
<div class="col-sm-8">
@ -76,20 +77,200 @@
<textarea name="describe" th:field="*{describe}" class="form-control" type="text" style="height: 200px;width: 770px"></textarea>
</div>
</div>
<div class="form-group" id="fileTitle">
<label class="col-sm-3 control-label">入口图标:</label>
<div id="fileIn" class="col-sm-8" readonly>
<div class="file-loading">
<input id="fileInput" name="file" type="file" multiple>
</div>
</div>
<div id="fileOut" class="col-sm-8" style="display: none" readonly>
<div class="file-loading">
<input id="fileOutput" name="file" type="file" multiple>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="zdxtInclude :: footer" />
<script type="text/javascript">
var prefix = ctx + "scene/manage"
<th:block th:include="zdxtInclude :: bootstrap-fileinput-js"/>
<script type="text/javascript" th:inline="javascript">
var prefix = ctx + "small/scene/manage"
$("#form-manage-edit").validate({
focusCleanup: true
});
// function submitHandler() {
// if ($.validate.form()) {
// $.operate.save(prefix + "/edit", $('#form-manage-edit').serialize());
// }
// }
// 当前文件框id,是不是fileInput
var isFlieIn = true;
$(function() {
// 渲染要素信息
renderVersionAtt();
})
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-manage-edit').serialize());
if (isFlieIn) {
$('#fileInput').fileinput('upload');
} else {
$('#fileOutput').fileinput('upload');
}
}
/** 附件相关 */
/** 渲染附件信息 */
function renderVersionAtt() {
var key = $("[name='guid']").val();
$.getJSON(prefix + "/queryFiles/" + key, function (result) {
if (result.data != null) {
$("#fileIn").hide();
$("#fileOut").show();
// 重置文件预览框
$("#fileOut").html("<div class=\"file-loading\"><input id=\"fileOutput\" name=\"file\" type=\"file\" multiple></div>");
queryFiles(key);
isFlieIn = false;
} else {
$("#fileIn").show();
$("#fileOut").hide();
uploadFiles();
isFlieIn = true;
$("#fileInput").fileinput('clear')
}
});
}
/** 预览附件 */
function queryFiles(key) {
$.ajax({
type: "POST",
url: prefix + "/queryFilesPost",
data: {"key": key},
dataType: 'json',
success: function (result) {
if (result.success == true) {
initFile("fileOutput", prefix + "/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-manage-edit").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;
}
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();
}
</script>
</body>
</html>

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

@ -2,6 +2,7 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="zdxtInclude :: header('场景列表')"/>
<th:block th:include="zdxtInclude :: bootstrap-fileinput-css"/>
</head>
<body class="gray-bg">
<div class="container-div">
@ -63,7 +64,7 @@
var exportFlag = [[${@permission.hasPermi('project:manage:export')}]];
var importboolen = (importFlag == "" ? true : false)
var exportboolen = (exportFlag == "" ? true : false)
var prefix = ctx + "scene/manage";
var prefix = ctx + "small/scene/manage";
$(function () {
var options = {
url: prefix + "/list",
@ -99,17 +100,17 @@
field: 'name',
title: '场景名称'
},
{
field: 'type',
title: '题目类型',
formatter: function (value, index) {
for (var i = 0; i <= sceneType.length; i++) {
if (value + "" === sceneType[i].dictValue) {
return sceneType[i].dictLabel;
}
}
}
},
// {
// field: 'type',
// title: '题目类型',
// formatter: function (value, index) {
// for (var i = 0; i <= sceneType.length; i++) {
// if (value + "" === sceneType[i].dictValue) {
// return sceneType[i].dictLabel;
// }
// }
// }
// },
{
field: 'url',
title: '二维码'
@ -194,7 +195,7 @@
// }
function sort(id) {
$.get(ctx + "scene/manage/sort/" + id, null, function (res) {
$.get(ctx + "small/scene/manage/sort/" + id, null, function (res) {
if (res.success) {
//
$.table.refresh();

2
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/controller/CustomImageController.java

@ -60,7 +60,7 @@ public class CustomImageController extends BaseController {
*/
@PostMapping("/listAll")
@ResponseBody
public ZDResponse listAll(CustomImage customImage) {
public ZDResponse listAll(@RequestBody CustomImage customImage) {
List<CustomImage> list = customImageService.selectCustomImageListAll(customImage);
return ZDResponse.success("成功", list);
}

171
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/controller/SceneHomeController.java

@ -0,0 +1,171 @@
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.SceneHome;
import com.zdxt.knowledge.service.ISceneHomeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.List;
/**
* Controller
*
* @author ruoyi
* @date 2023-12-26
*/
@Controller
@RequestMapping("/small/project/home")
public class SceneHomeController extends BaseController {
private String prefix = "project/home";
@Autowired
private ISceneHomeService sceneHomeService;
@RequiresPermissions("project:home:view")
@GetMapping("/view")
public String view() {
return prefix + "/view";
}
/**
* 查询列表
*/
@RequiresPermissions("project:home:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SceneHome sceneHome) {
startPage();
List<SceneHome> list = sceneHomeService.selectSceneHomeList(sceneHome);
return getDataTable(list);
}
/**
* 查询列表
*/
@PostMapping("/listAll")
@ResponseBody
public ZDResponse listAll(@RequestBody SceneHome sceneHome) {
List<SceneHome> list = sceneHomeService.selectSceneHomeListAll(sceneHome);
return ZDResponse.success("成功", list);
}
@RequiresPermissions("project:home:detail")
@GetMapping("/detail/{guid}")
public String detail(@PathVariable("guid") String guid, ModelMap mmap) {
SceneHome sceneHome = sceneHomeService.selectSceneHomeById(guid);
mmap.put("sceneHome", sceneHome);
return prefix + "/detail";
}
/**
* 新增跳转
*/
@GetMapping("/add")
public String add() {
return prefix + "/add";
}
/**
* 新增保存
*/
@RequiresPermissions("project:home:add")
@PostMapping("/add")
@ResponseBody
public ZDResponse addSave(@RequestParam("file") MultipartFile[] files, SceneHome sceneHome) {
return sceneHomeService.insertSceneHome(files, sceneHome) > 0
? ZDResponse.success() : ZDResponse.error("新增失败");
}
/**
* 修改
*/
@GetMapping("/edit/{guid}")
public String edit(@PathVariable("guid") String guid, ModelMap mmap) {
SceneHome sceneHome = sceneHomeService.selectSceneHomeById(guid);
mmap.put("sceneHome", sceneHome);
return prefix + "/edit";
}
/**
* 修改保存
*/
@RequiresPermissions("project:home:edit")
@PostMapping("/edit")
@ResponseBody
public ZDResponse editSave(@RequestParam("file") MultipartFile[] files, SceneHome sceneHome) {
return sceneHomeService.updateSceneHome(files, sceneHome) > 0
? ZDResponse.success() : ZDResponse.error("修改失败");
}
/**
* 删除
*/
@RequiresPermissions("project:home:remove")
@PostMapping("/remove")
@ResponseBody
public ZDResponse remove(String ids) {
return sceneHomeService.deleteSceneHomeByIds(ids) > 0
? ZDResponse.success() : ZDResponse.error("删除失败");
}
/**
* 排序上移
*/
@GetMapping("/sort/{guid}")
@ResponseBody
public ZDResponse sort(@PathVariable("guid") String guid) {
return sceneHomeService.sort(guid);
}
/**
* 查询附件信息
*
* @param key
* @return
*/
@GetMapping("/queryFiles/{key}")
@ResponseBody
public ZDResponse queryFiles(@PathVariable String key) {
HashMap<String, Object> map = new HashMap<>();
map.put("filePreview", sceneHomeService.queryFiles(key));
return ZDResponse.success("获取成功", map);
}
/**
* 查询附件信息
*
* @param key
* @return
*/
@PostMapping("/queryFilesPost")
@ResponseBody
public ZDResponse queryFilesPost(String key) {
HashMap<String, Object> map = new HashMap<>();
map.put("filePreview", sceneHomeService.queryFiles(key));
return ZDResponse.success("获取成功", map);
}
/**
* 删除案例要素附件
*
* @param key
* @return
*/
@PostMapping("/removeFile")
@ResponseBody
public ZDResponse removeFile(String key) {
if (sceneHomeService.removeFile(key) > 0) {
return ZDResponse.success("操作成功");
} else {
return ZDResponse.error("操作失败");
}
}
}

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

@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@ -28,7 +29,7 @@ import java.util.List;
* @date 2023-12-25
*/
@Controller
@RequestMapping("/scene/manage")
@RequestMapping("/small/scene/manage")
public class SceneManageController extends BaseController {
private String prefix = "project/scene";
@ -54,6 +55,16 @@ public class SceneManageController extends BaseController {
return getDataTable(list);
}
/**
* 查询
*/
@PostMapping("/listAll")
@ResponseBody
public ZDResponse listAll(@RequestBody SceneManage sceneManage) {
List<SceneManage> list = sceneManageService.selectSceneManageListAll(sceneManage);
return ZDResponse.success("成功", list);
}
/**
* 查看详情
*/
@ -79,8 +90,8 @@ public class SceneManageController extends BaseController {
@RequiresPermissions("project:manage:add")
@PostMapping("/add")
@ResponseBody
public ZDResponse addSave(SceneManage sceneManage) {
return sceneManageService.insertSceneManage(sceneManage) > 0
public ZDResponse addSave(@RequestParam("file") MultipartFile[] files, SceneManage sceneManage) {
return sceneManageService.insertSceneManage(files, sceneManage) > 0
? ZDResponse.success() : ZDResponse.error("新增失败");
}
@ -100,8 +111,8 @@ public class SceneManageController extends BaseController {
@RequiresPermissions("project:manage:edit")
@PostMapping("/edit")
@ResponseBody
public ZDResponse editSave(SceneManage sceneManage) {
return sceneManageService.updateSceneManage(sceneManage) > 0
public ZDResponse editSave(@RequestParam("file") MultipartFile[] files, SceneManage sceneManage) {
return sceneManageService.updateSceneManage(files, sceneManage) > 0
? ZDResponse.success() : ZDResponse.error("编辑失败");
}
@ -164,4 +175,49 @@ public class SceneManageController extends BaseController {
SceneImportDataModel.class
);
}
/**
* 查询附件信息
*
* @param key
* @return
*/
@GetMapping("/queryFiles/{key}")
@ResponseBody
public ZDResponse queryFiles(@PathVariable String key) {
HashMap<String, Object> map = new HashMap<>();
map.put("filePreview", sceneManageService.queryFiles(key));
return ZDResponse.success("获取成功", map);
}
/**
* 查询附件信息
*
* @param key
* @return
*/
@PostMapping("/queryFilesPost")
@ResponseBody
public ZDResponse queryFilesPost(String key) {
HashMap<String, Object> map = new HashMap<>();
map.put("filePreview", sceneManageService.queryFiles(key));
return ZDResponse.success("获取成功", map);
}
/**
* 删除案例要素附件
*
* @param key
* @return
*/
@PostMapping("/removeFile")
@ResponseBody
public ZDResponse removeFile(String key) {
if (sceneManageService.removeFile(key) > 0) {
return ZDResponse.success("操作成功");
} else {
return ZDResponse.error("操作失败");
}
}
}

131
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneHome.java

@ -0,0 +1,131 @@
package com.zdxt.knowledge.domain;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
/**
* 场景题目对象 scene_question
*
* @author ruoyi
* @date 2023-12-26
*/
public class SceneHome implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String guid;
/**
* 名称
*/
private String name;
/**
* 隐藏0是1否
*/
private Integer hide;
/**
* 图标
*/
private String picIcon;
/**
* 名称
*/
private Integer sort;
/**
* 创建人
*/
private String creator;
/**
* 创建时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
private String uploadPath;
/**
* 请求参数
*/
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 Integer getHide() {
return hide;
}
public void setHide(Integer hide) {
this.hide = hide;
}
public String getPicIcon() {
return picIcon;
}
public void setPicIcon(String picIcon) {
this.picIcon = picIcon;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
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 Map<String, Object> getParams() {
return params;
}
public void setParams(Map<String, Object> params) {
this.params = params;
}
public String getUploadPath() {
return uploadPath;
}
public void setUploadPath(String uploadPath) {
this.uploadPath = uploadPath;
}
}

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

@ -109,6 +109,8 @@ public class SceneManage implements Serializable {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private String uploadPath;
/**
* 请求参数
*/
@ -265,4 +267,12 @@ public class SceneManage implements Serializable {
public void setUseTotal(Long useTotal) {
this.useTotal = useTotal;
}
public String getUploadPath() {
return uploadPath;
}
public void setUploadPath(String uploadPath) {
this.uploadPath = uploadPath;
}
}

63
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/mapper/SceneHomeMapper.java

@ -0,0 +1,63 @@
package com.zdxt.knowledge.mapper;
import com.zdxt.knowledge.domain.SceneHome;
import java.util.List;
/**
* Mapper接口
*
* @author ruoyi
* @date 2023-12-26
*/
public interface SceneHomeMapper {
/**
* 查询
*
* @param guid ID
* @return
*/
public SceneHome selectSceneHomeById(String guid);
/**
* 查询列表
*
* @param sceneHome
* @return 集合
*/
public List<SceneHome> selectSceneHomeList(SceneHome sceneHome);
public List<SceneHome> selectSceneHomeListAll(SceneHome sceneHome);
/**
* 新增
*
* @param sceneHome
* @return 结果
*/
public int insertSceneHome(SceneHome sceneHome);
/**
* 修改
*
* @param sceneHome
* @return 结果
*/
public int updateSceneHome(SceneHome sceneHome);
/**
* 批量删除
*
* @param guids 需要删除的数据ID
* @return 结果
*/
public int deleteSceneHomeByIds(String[] guids);
/**
* 获取排序【请填写功能名称】
*
* @return 结果
*/
public SceneHome selectLastSort(Integer sort);
}

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

@ -7,31 +7,32 @@ import java.util.List;
/**
* 【请填写功能名称】Mapper接口
*
*
* @author ruoyi
* @date 2023-12-25
*/
public interface SceneManageMapper
{
public interface SceneManageMapper {
/**
* 查询【请填写功能名称】
*
*
* @param guid 【请填写功能名称】ID
* @return 【请填写功能名称】
*/
public SceneManage selectSceneManageById(String guid);
public SceneManage selectSceneManageById(String guid);
/**
* 查询【请填写功能名称】列表
*
*
* @param sceneManage 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
public List<SceneManage> selectSceneManageList(SceneManage sceneManage);
public List<SceneManage> selectSceneManageListAll(SceneManage sceneManage);
/**
* 新增【请填写功能名称】
*
*
* @param sceneManage 【请填写功能名称】
* @return 结果
*/
@ -47,7 +48,7 @@ public interface SceneManageMapper
/**
* 修改【请填写功能名称】
*
*
* @param sceneManage 【请填写功能名称】
* @return 结果
*/
@ -55,7 +56,7 @@ public interface SceneManageMapper
/**
* 删除【请填写功能名称】
*
*
* @param guid 【请填写功能名称】ID
* @return 结果
*/
@ -63,7 +64,7 @@ public interface SceneManageMapper
/**
* 批量删除【请填写功能名称】
*
*
* @param guids 需要删除的数据ID
* @return 结果
*/
@ -84,7 +85,7 @@ public interface SceneManageMapper
*
* @return 结果
*/
public int selectMinSort();
public Integer selectMinSort();
/**
* 获取排序【请填写功能名称】

83
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/ISceneHomeService.java

@ -0,0 +1,83 @@
package com.zdxt.knowledge.service;
import com.zdxt.common.ZDResponse;
import com.zdxt.common.zdxtFile.AttFileRespDTO;
import com.zdxt.knowledge.domain.SceneHome;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* Service接口
*
* @author ruoyi
* @date 2023-12-26
*/
public interface ISceneHomeService {
/**
* 查询
*
* @param guid ID
* @return
*/
public SceneHome selectSceneHomeById(String guid);
/**
* 查询列表
*
* @param sceneHome
* @return 集合
*/
public List<SceneHome> selectSceneHomeList(SceneHome sceneHome);
public List<SceneHome> selectSceneHomeListAll(SceneHome sceneHome);
/**
* 新增
*
* @param sceneHome
* @return 结果
*/
public int insertSceneHome(MultipartFile[] files, SceneHome sceneHome);
/**
* 修改
*
* @param sceneHome
* @return 结果
*/
public int updateSceneHome(MultipartFile[] files, SceneHome sceneHome);
/**
* 批量删除
*
* @param guids 需要删除的数据ID
* @return 结果
*/
public int deleteSceneHomeByIds(String guids);
/**
* 排序上移【请填写功能名称】
*
* @param guid
* @return 结果
*/
public ZDResponse sort(String guid);
/**
* 查询附件
*
* @param key
* @return
*/
AttFileRespDTO queryFiles(String key);
/**
* 删除案例要素图片
*
* @param key 图片id
* @return
*/
public int removeFile(String key);
}

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

@ -1,6 +1,7 @@
package com.zdxt.knowledge.service;
import com.zdxt.common.ZDResponse;
import com.zdxt.common.zdxtFile.AttFileRespDTO;
import com.zdxt.knowledge.domain.SceneManage;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
@ -10,15 +11,14 @@ import java.util.List;
/**
* 【请填写功能名称】Service接口
*
*
* @author ruoyi
* @date 2023-12-25
*/
public interface ISceneManageService
{
public interface ISceneManageService {
/**
* 查询【请填写功能名称】
*
*
* @param guid 【请填写功能名称】ID
* @return 【请填写功能名称】
*/
@ -26,31 +26,39 @@ public interface ISceneManageService
/**
* 查询【请填写功能名称】列表
*
*
* @param sceneManage 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
public List<SceneManage> selectSceneManageList(SceneManage sceneManage);
/**
* 查询列表
*
* @param sceneManage 【请填写功能名称】
* @return 请填写功能名称】集合
*/
public List<SceneManage> selectSceneManageListAll(SceneManage sceneManage);
/**
* 新增【请填写功能名称】
*
*
* @param sceneManage 【请填写功能名称】
* @return 结果
*/
public int insertSceneManage(SceneManage sceneManage);
public int insertSceneManage(MultipartFile[] files, SceneManage sceneManage);
/**
* 修改【请填写功能名称】
*
*
* @param sceneManage 【请填写功能名称】
* @return 结果
*/
public int updateSceneManage(SceneManage sceneManage);
public int updateSceneManage(MultipartFile[] files, SceneManage sceneManage);
/**
* 批量删除【请填写功能名称】
*
*
* @param guids 需要删除的数据ID
* @return 结果
*/
@ -58,7 +66,7 @@ public interface ISceneManageService
/**
* 删除【请填写功能名称】信息
*
*
* @param guid 【请填写功能名称】ID
* @return 结果
*/
@ -86,4 +94,20 @@ public interface ISceneManageService
* @return 结果
*/
ResponseEntity<Resource> exportData();
/**
* 查询附件
*
* @param key
* @return
*/
AttFileRespDTO queryFiles(String key);
/**
* 删除案例要素图片
*
* @param key 图片id
* @return
*/
public int removeFile(String key);
}

168
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/SceneHomeServiceImpl.java

@ -0,0 +1,168 @@
package com.zdxt.knowledge.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.zdxt.auth.dto.UserBean;
import com.zdxt.auth.dto.ZdxtFileBean;
import com.zdxt.auth.feign.FileUploadApi;
import com.zdxt.auth.feign.UserApi;
import com.zdxt.auth.feign.ZdxtFileCommonApi;
import com.zdxt.common.ZDResponse;
import com.zdxt.common.util.Convert;
import com.zdxt.common.util.DateUtils;
import com.zdxt.common.util.StringUtils;
import com.zdxt.common.zdxtFile.AttFileRespDTO;
import com.zdxt.common.zdxtFile.FilePreviewUtilBean;
import com.zdxt.common.zdxtFile.ZdxtFileCommon;
import com.zdxt.knowledge.domain.SceneHome;
import com.zdxt.knowledge.domain.SceneManage;
import com.zdxt.knowledge.mapper.SceneHomeMapper;
import com.zdxt.knowledge.service.ISceneHomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2023-12-26
*/
@Service
public class SceneHomeServiceImpl implements ISceneHomeService {
@Autowired
private SceneHomeMapper sceneHomeMapper;
@Autowired
private UserApi userApi;
@Autowired
private FileUploadApi fileUploadApi;
@Autowired
private ZdxtFileCommonApi zdxtFileCommonApi;
/**
* 查询
*
* @param guid ID
* @return
*/
@Override
public SceneHome selectSceneHomeById(String guid) {
return sceneHomeMapper.selectSceneHomeById(guid);
}
/**
* 查询列表
*
* @param sceneHome
* @return
*/
@Override
public List<SceneHome> selectSceneHomeList(SceneHome sceneHome) {
return sceneHomeMapper.selectSceneHomeList(sceneHome);
}
@Override
public List<SceneHome> selectSceneHomeListAll(SceneHome sceneHome) {
return sceneHomeMapper.selectSceneHomeListAll(sceneHome);
}
/**
* 新增
*
* @param sceneHome
* @return 结果
*/
@Override
public int insertSceneHome(MultipartFile[] files, SceneHome sceneHome) {
UserBean userBean = userApi.getCurrentUser();
if (Objects.nonNull(userBean)) {
sceneHome.setCreator(userBean.getUserName());
sceneHome.setCreateTime(DateUtils.getNowDate());
}
sceneHome.setGuid(StringUtils.getUUID());
int result = sceneHomeMapper.insertSceneHome(sceneHome);
// 上传文件,并在附件表中添加记录
if (result > 0 && ObjectUtil.isNotEmpty(files)) {
for (MultipartFile file : files) {
zdxtFileCommonApi.insertZdxtFile(file, sceneHome.getGuid() + "", fileUploadApi.upload(file));
}
}
return result;
}
/**
* 修改
*
* @param sceneHome
* @return 结果
*/
@Override
public int updateSceneHome(MultipartFile[] files, SceneHome sceneHome) {
int result = sceneHomeMapper.updateSceneHome(sceneHome);
// 上传文件,并在附件表中添加记录
if (result > 0 && ObjectUtil.isNotEmpty(files)) {
zdxtFileCommonApi.deleteZdxtFileByIds(sceneHome.getGuid());
for (MultipartFile file : files) {
zdxtFileCommonApi.insertZdxtFile(file, sceneHome.getGuid() + "", fileUploadApi.upload(file));
}
}
return result;
}
/**
* 删除对象
*
* @param guids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteSceneHomeByIds(String guids) {
return sceneHomeMapper.deleteSceneHomeByIds(Convert.toStrArray(guids));
}
@Override
public ZDResponse sort(String guid) {
SceneHome sceneHome = sceneHomeMapper.selectSceneHomeById(guid);
if (Objects.isNull(sceneHome)) {
return ZDResponse.error("未找到相关数据");
}
SceneHome lastSceneHome = sceneHomeMapper.selectLastSort(sceneHome.getSort());
if (Objects.isNull(lastSceneHome)) {
return ZDResponse.error("上移达到最大限制");
}
Integer lastSceneManageSort = lastSceneHome.getSort();
lastSceneHome.setSort(sceneHome.getSort());
sceneHomeMapper.updateSceneHome(lastSceneHome);
sceneHome.setSort(lastSceneManageSort);
sceneHomeMapper.updateSceneHome(sceneHome);
return ZDResponse.success("上移成功");
}
@Override
public AttFileRespDTO queryFiles(String key) {
ZdxtFileBean zdxtFileBeanCondition = new ZdxtFileBean();
zdxtFileBeanCondition.setBusinessId(key);
List<ZdxtFileBean> fileBeanList = zdxtFileCommonApi.selectZdxtFileList(zdxtFileBeanCondition);
ArrayList<ZdxtFileCommon> fileList = new ArrayList<>();
for (ZdxtFileBean fileBean : fileBeanList) {
ZdxtFileCommon zdxtFileCommon = new ZdxtFileCommon();
BeanUtil.copyProperties(fileBean, zdxtFileCommon);
fileList.add(zdxtFileCommon);
}
FilePreviewUtilBean filePreviewUtilBean = new FilePreviewUtilBean();
return filePreviewUtilBean.attachementToAttFileRespDTO(fileList);
}
@Override
public int removeFile(String key) {
return zdxtFileCommonApi.deleteZdxtFileById(key);
}
}

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

@ -1,14 +1,22 @@
package com.zdxt.knowledge.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.zdxt.auth.dto.DictDataBean;
import com.zdxt.auth.dto.UserBean;
import com.zdxt.auth.dto.ZdxtFileBean;
import com.zdxt.auth.feign.DictDataApi;
import com.zdxt.auth.feign.FileUploadApi;
import com.zdxt.auth.feign.UserApi;
import com.zdxt.auth.feign.ZdxtFileCommonApi;
import com.zdxt.common.ZDResponse;
import com.zdxt.common.util.Convert;
import com.zdxt.common.util.DateUtils;
import com.zdxt.common.util.StringUtils;
import com.zdxt.common.zdxtFile.AttFileRespDTO;
import com.zdxt.common.zdxtFile.FilePreviewUtilBean;
import com.zdxt.common.zdxtFile.ZdxtFileCommon;
import com.zdxt.knowledge.domain.SceneImportDataModel;
import com.zdxt.knowledge.domain.SceneManage;
import com.zdxt.knowledge.mapper.SceneManageMapper;
@ -46,6 +54,12 @@ public class SceneManageServiceImpl implements ISceneManageService {
@Autowired
private DictDataApi dictDataApi;
@Autowired
private FileUploadApi fileUploadApi;
@Autowired
private ZdxtFileCommonApi zdxtFileCommonApi;
/**
* 查询【请填写功能名称】
*
@ -71,6 +85,17 @@ public class SceneManageServiceImpl implements ISceneManageService {
return sceneManageMapper.selectSceneManageList(sceneManage);
}
/**
* 查询列表
*
* @param sceneManage 【请填写功能名称】
* @return 【请填写功能名称】
*/
@Override
public List<SceneManage> selectSceneManageListAll(SceneManage sceneManage) {
return sceneManageMapper.selectSceneManageListAll(sceneManage);
}
/**
* 新增【请填写功能名称】
*
@ -78,16 +103,23 @@ public class SceneManageServiceImpl implements ISceneManageService {
* @return 结果
*/
@Override
public int insertSceneManage(SceneManage sceneManage) {
public int insertSceneManage(MultipartFile[] files, SceneManage sceneManage) {
UserBean userBean = userApi.getCurrentUser();
if (Objects.nonNull(userBean)) {
sceneManage.setCreator(userBean.getUserName());
sceneManage.setCreateTime(DateUtils.getNowDate());
}
int i = sceneManageMapper.selectMinSort();
sceneManage.setSort(i + 1);
Integer i = sceneManageMapper.selectMinSort();
sceneManage.setSort(Objects.isNull(i) ? 1 : i + 1);
sceneManage.setGuid(StringUtils.getUUID());
return sceneManageMapper.insertSceneManage(sceneManage);
int result = sceneManageMapper.insertSceneManage(sceneManage);
// 上传文件,并在附件表中添加记录
if (result > 0 && ObjectUtil.isNotEmpty(files)) {
for (MultipartFile file : files) {
zdxtFileCommonApi.insertZdxtFile(file, sceneManage.getGuid() + "", fileUploadApi.upload(file));
}
}
return result;
}
/**
@ -97,9 +129,17 @@ public class SceneManageServiceImpl implements ISceneManageService {
* @return 结果
*/
@Override
public int updateSceneManage(SceneManage sceneManage) {
public int updateSceneManage(MultipartFile[] files, SceneManage sceneManage) {
sceneManage.setUpdateTime(DateUtils.getNowDate());
return sceneManageMapper.updateSceneManage(sceneManage);
int result = sceneManageMapper.updateSceneManage(sceneManage);
// 上传文件,并在附件表中添加记录
if (result > 0 && ObjectUtil.isNotEmpty(files)) {
zdxtFileCommonApi.deleteZdxtFileByIds(sceneManage.getGuid());
for (MultipartFile file : files) {
zdxtFileCommonApi.insertZdxtFile(file, sceneManage.getGuid() + "", fileUploadApi.upload(file));
}
}
return result;
}
/**
@ -140,7 +180,7 @@ public class SceneManageServiceImpl implements ISceneManageService {
}
SceneManage lastSceneManage = sceneManageMapper.selectLastSort(sceneManage.getSort());
if (Objects.isNull(lastSceneManage)) {
return ZDResponse.error("上移达到最大限制");
return ZDResponse.error("上移达到最大限制");
}
Integer lastSceneManageSort = lastSceneManage.getSort();
@ -207,4 +247,27 @@ public class SceneManageServiceImpl implements ISceneManageService {
return ExcelUtil.getExcelSimpleResponseEntity(new ArrayList<>(), dataModelList, SceneImportDataModel.class);
}
@Override
public AttFileRespDTO queryFiles(String key) {
ZdxtFileBean zdxtFileBeanCondition = new ZdxtFileBean();
zdxtFileBeanCondition.setBusinessId(key);
List<ZdxtFileBean> fileBeanList = zdxtFileCommonApi.selectZdxtFileList(zdxtFileBeanCondition);
ArrayList<ZdxtFileCommon> fileList = new ArrayList<>();
for (ZdxtFileBean fileBean : fileBeanList) {
ZdxtFileCommon zdxtFileCommon = new ZdxtFileCommon();
BeanUtil.copyProperties(fileBean, zdxtFileCommon);
fileList.add(zdxtFileCommon);
}
FilePreviewUtilBean filePreviewUtilBean = new FilePreviewUtilBean();
return filePreviewUtilBean.attachementToAttFileRespDTO(fileList);
}
@Override
public int removeFile(String key) {
return zdxtFileCommonApi.deleteZdxtFileById(key);
}
}

1
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/CustomImageMapper.xml

@ -45,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="page != null and page != ''"> and cu.page = #{page}</if>
<if test="position != null and position != ''"> and cu.position = #{position}</if>
</where>
order by cu.srot ASC
</select>
<select id="selectCustomImageById" parameterType="String" resultMap="CustomImageResult">

96
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneHomeMapper.xml

@ -0,0 +1,96 @@
<?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.SceneHomeMapper">
<resultMap type="com.zdxt.knowledge.domain.SceneHome" id="SceneHomeResult">
<result property="guid" column="guid" />
<result property="name" column="name" />
<result property="sort" column="sort" />
<result property="hide" column="hide" />
<result property="picIcon" column="pic_icon" />
<result property="creator" column="creator" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectSceneHomeVo">
select guid, name, sort, hide, pic_icon, creator, create_time from scene_home
</sql>
<select id="selectSceneHomeList" parameterType="SceneHome" resultMap="SceneHomeResult">
<include refid="selectSceneHomeVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="creator != null and creator != ''"> and creator = #{creator}</if>
</where>
order by sort ASC
</select>
<select id="selectSceneHomeById" parameterType="String" resultMap="SceneHomeResult">
<include refid="selectSceneHomeVo"/>
where guid = #{guid}
</select>
<insert id="insertSceneHome" parameterType="SceneHome">
insert into scene_home
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="guid != null ">guid,</if>
<if test="name != null and name != ''">`name`,</if>
<if test="picIcon != null and picIcon != ''">pic_icon,</if>
<if test="sort != null ">sort,</if>
<if test="hide != null and hide != ''">`hide`,</if>
<if test="creator != null and creator != ''">creator,</if>
<if test="createTime != null ">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="guid != null ">#{guid},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="picIcon != null and picIcon != ''">#{picIcon},</if>
<if test="sort != null ">#{sort},</if>
<if test="hide != null and hide != ''">#{hide},</if>
<if test="creator != null and creator != ''">#{creator},</if>
<if test="createTime != null ">#{createTime},</if>
</trim>
</insert>
<update id="updateSceneHome" parameterType="SceneHome">
update scene_home
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="picIcon != null and picIcon != ''">pic_icon = #{picIcon},</if>
<if test="sort != null ">sort = #{sort},</if>
<if test="hide != null ">hide = #{hide},</if>
<if test="creator != null and creator != ''">creator = #{creator},</if>
</trim>
where guid = #{guid}
</update>
<delete id="deleteSceneHomeById" parameterType="String">
delete from scene_home where guid = #{guid}
</delete>
<delete id="deleteSceneHomeByIds" parameterType="String">
delete from scene_home where guid in
<foreach item="guid" collection="array" open="(" separator="," close=")">
#{guid}
</foreach>
</delete>
<select id="selectMinSort" resultType="INTEGER">
select MAX(sort) as sort from scene_home
</select>
<select id="selectLastSort" parameterType="INTEGER" resultMap="SceneHomeResult">
SELECT guid, sort FROM scene_home WHERE sort = (SELECT MAX(sort) FROM scene_home where sort &lt; #{sort});
</select>
<select id="selectSceneHomeListAll" parameterType="SceneHome" resultMap="SceneHomeResult">
select cu.guid, cu.name, zd.upload_path from scene_home as cu
inner join zdxt_file as zd
on cu.guid = zd.business_id
where cu.hide = 1
order by cu.sort ASC
</select>
</mapper>

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

@ -141,5 +141,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- #{id}-->
<!-- </foreach>-->
<!-- </delete>-->
<select id="selectSceneManageListAll" parameterType="SceneManage" resultMap="SceneManageResult">
select cu.guid, cu.name, cu.sort, cu.status, cu.is_open, zd.upload_path from scene_manage as cu
inner join zdxt_file as zd
on cu.guid = zd.business_id
<where>
<if test="name != null and name != ''"> and cu.name like concat('%', #{name}, '%')</if>
<if test="status != null "> and cu.status = #{status}</if>
</where>
order by cu.sort ASC
</select>
</mapper>
Loading…
Cancel
Save