21 changed files with 2011 additions and 94 deletions
@ -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> |
||||
@ -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> |
||||
@ -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> 搜索</a> |
||||
|
<a class="btn btn-reset btn-rounded btn-sm" onclick="reset()"><i |
||||
|
class="fa fa-refresh"></i> 重置</a> |
||||
|
</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
|
||||
|
<div class="btn-group-sm" id="toolbar" role="group"> |
||||
|
<a class="btn btn-success" onclick="add()" shiro:hasPermission="system: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> |
||||
@ -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("操作失败"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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; |
||||
|
} |
||||
|
} |
||||
@ -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); |
||||
|
|
||||
|
} |
||||
@ -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); |
||||
|
} |
||||
@ -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); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -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 < #{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> |
||||
Loading…
Reference in new issue