11 changed files with 880 additions and 2 deletions
@ -0,0 +1,100 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
||||
|
<head> |
||||
|
<th:block th:include="zdxtInclude :: header('编辑')" /> |
||||
|
<th:block th:include="zdxtInclude :: summernote-css"/> |
||||
|
</head> |
||||
|
<body class="white-bg"> |
||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
||||
|
<form class="form-horizontal m" id="form-text-add"> |
||||
|
<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="title" id="title" required> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">消息内容:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input type="hidden" name="content" id="content" /> |
||||
|
<div id="itemContentSummernote" class="summernote"></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label is-required">是否公开:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<select name="open" class="form-control"> |
||||
|
<option value="0">是</option> |
||||
|
<option value="1">否</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
<th:block th:include="zdxtInclude :: footer" /> |
||||
|
<th:block th:include="zdxtInclude :: summernote-js"/> |
||||
|
<script type="text/javascript" th:inline="javascript"> |
||||
|
var prefix = ctx + "small/project/message"; |
||||
|
$("#form-text-add").validate({ |
||||
|
focusCleanup: true |
||||
|
}); |
||||
|
|
||||
|
function submitHandler() { |
||||
|
if ($.validate.form()) { |
||||
|
var formData = $("#form-text-add").serialize(); |
||||
|
formData = decodeURIComponent(formData, true); |
||||
|
var arr = formData.split("&"); |
||||
|
var data = {}; |
||||
|
for (var i=0; i<arr.length; i++) { |
||||
|
var item = arr[i].split('='); |
||||
|
var value = item[1].replace("+", " "); |
||||
|
data[item[0]] = value; |
||||
|
} |
||||
|
data.content = $('#itemContentSummernote').summernote('code'); |
||||
|
$.operate.save(prefix + "/add", data); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** 富文本 */ |
||||
|
$('.summernote').summernote({ |
||||
|
// placeholder: '请输入公告内容', |
||||
|
height: 330, |
||||
|
lang: 'zh-CN', |
||||
|
followingToolbar: false, |
||||
|
callbacks: { |
||||
|
onImageUpload: function (files) { |
||||
|
PlanVersion.summernoteImgUpload(files[0], this); |
||||
|
} |
||||
|
}, |
||||
|
toolbar: [ |
||||
|
['operate', ['undo','redo']], |
||||
|
['magic',['style']], |
||||
|
['style', ['bold', 'italic', 'underline', 'clear']], |
||||
|
['para', ['height','fontsize','ul', 'ol', 'paragraph']], |
||||
|
['font', ['strikethrough', 'superscript', 'subscript']], |
||||
|
['color', ['color']], |
||||
|
['insert',['video','link','table','hr','attachment']],//自定义按钮展示 |
||||
|
['layout',['codeview']], |
||||
|
], |
||||
|
buttons: { |
||||
|
attachment:AttachmentButton |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
var AttachmentButton = function (context) { |
||||
|
var ui = $.summernote.ui; |
||||
|
// create button |
||||
|
var button = ui.button({ |
||||
|
contents: '<i class="fa fa-folder-open"/>', //按钮样式 |
||||
|
tooltip: '上传文件', |
||||
|
click: function () { |
||||
|
$("#fileWord").click(); |
||||
|
} |
||||
|
}); |
||||
|
return button.render(); //按钮渲染 |
||||
|
} |
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,107 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
||||
|
<head> |
||||
|
<th:block th:include="zdxtInclude :: header('编辑')" /> |
||||
|
<th:block th:include="zdxtInclude :: summernote-css"/> |
||||
|
</head> |
||||
|
<body class="white-bg"> |
||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
||||
|
<form class="form-horizontal m" id="form-text-edit" th:object="${sceneMessage}"> |
||||
|
<input name="guid" th:field="*{guid}" type="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="title" id="title" th:field="*{title}" required> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">配置内容:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input type="hidden" name="content" id="content" th:field="*{content}"/> |
||||
|
<div id="itemContentSummernote" class="summernote"></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">是否公开:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<select name="open" class="form-control" th:field="*{open}"> |
||||
|
<option value="0">是</option> |
||||
|
<option value="1">否</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
<th:block th:include="zdxtInclude :: footer" /> |
||||
|
<th:block th:include="zdxtInclude :: summernote-js"/> |
||||
|
<script type="text/javascript" th:inline="javascript"> |
||||
|
var prefix = ctx + "small/project/message"; |
||||
|
$("#form-text-edit").validate({ |
||||
|
focusCleanup: true |
||||
|
}); |
||||
|
|
||||
|
$(function() { |
||||
|
$('#itemContentSummernote').summernote('code', $('#content').val()); |
||||
|
}) |
||||
|
|
||||
|
function submitHandler() { |
||||
|
if ($.validate.form()) { |
||||
|
var formData = $("#form-text-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; |
||||
|
// } |
||||
|
data.guid = $("[name = 'guid']").val(); |
||||
|
data.title = $("[name = 'title']").val(); |
||||
|
data.open = $("[name = 'open']").val(); |
||||
|
data.content = $('#itemContentSummernote').summernote('code'); |
||||
|
$.operate.save(prefix + "/edit", data); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 富文本 */ |
||||
|
$('.summernote').summernote({ |
||||
|
// placeholder: '请输入公告内容', |
||||
|
height: 330, |
||||
|
lang: 'zh-CN', |
||||
|
followingToolbar: false, |
||||
|
callbacks: { |
||||
|
onImageUpload: function (files) { |
||||
|
PlanVersion.summernoteImgUpload(files[0], this); |
||||
|
} |
||||
|
}, |
||||
|
toolbar: [ |
||||
|
['operate', ['undo','redo']], |
||||
|
['magic',['style']], |
||||
|
['style', ['bold', 'italic', 'underline', 'clear']], |
||||
|
['para', ['height','fontsize','ul', 'ol', 'paragraph']], |
||||
|
['font', ['strikethrough', 'superscript', 'subscript']], |
||||
|
['color', ['color']], |
||||
|
['insert',['video','link','table','hr','attachment']],//自定义按钮展示 |
||||
|
['layout',['codeview']], |
||||
|
], |
||||
|
buttons: { |
||||
|
attachment:AttachmentButton |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
var AttachmentButton = function (context) { |
||||
|
var ui = $.summernote.ui; |
||||
|
// create button |
||||
|
var button = ui.button({ |
||||
|
contents: '<i class="fa fa-folder-open"/>', //按钮样式 |
||||
|
tooltip: '上传文件', |
||||
|
click: function () { |
||||
|
$("#fileWord").click(); |
||||
|
} |
||||
|
}); |
||||
|
return button.render(); //按钮渲染 |
||||
|
} |
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,102 @@ |
|||||
|
<!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="title"/> |
||||
|
</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="$.form.reset()"><i |
||||
|
class="fa fa-refresh"></i> 重置</a> |
||||
|
</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
|
||||
|
<div class="btn-group-sm" id="toolbar" role="group"> |
||||
|
<a class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="project:scene:add"> |
||||
|
<i class="fa fa-plus"></i> 添加 |
||||
|
</a> |
||||
|
</div> |
||||
|
<div class="col-sm-12 select-table table-bordered"> |
||||
|
<table id="bootstrap-table"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<th:block th:include="zdxtInclude :: footer"/> |
||||
|
<script th:inline="javascript"> |
||||
|
var editFlag = [[${@permission.hasPermi('project:text:edit')}]]; |
||||
|
var removeFlag = [[${@permission.hasPermi('project:text:remove')}]]; |
||||
|
var detailFlag = [[${@permission.hasPermi('project:text:detail')}]]; |
||||
|
var prefix = ctx + "small/project/message"; |
||||
|
|
||||
|
$(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: 'title', |
||||
|
title: '消息标题' |
||||
|
// , formatter: function (value, index) { |
||||
|
// if (value.length > 10) { |
||||
|
// return "...."; |
||||
|
// } |
||||
|
// } |
||||
|
}, |
||||
|
{ |
||||
|
field: 'content', |
||||
|
title: '消息内容' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'open', |
||||
|
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>'); |
||||
|
return actions.join(''); |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
}; |
||||
|
$.table.init(options); |
||||
|
}); |
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,123 @@ |
|||||
|
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.SceneMessage; |
||||
|
import com.zdxt.knowledge.service.ISceneMessageService; |
||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.ModelMap; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 【请填写功能名称】Controller |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2023-01-22 |
||||
|
*/ |
||||
|
@Controller |
||||
|
@RequestMapping("/small/project/message") |
||||
|
public class SceneMessageController extends BaseController { |
||||
|
private String prefix = "project/mes"; |
||||
|
|
||||
|
@Autowired |
||||
|
private ISceneMessageService sceneMessageService; |
||||
|
|
||||
|
@RequiresPermissions("project:message:view") |
||||
|
@GetMapping("/view") |
||||
|
public String manage() { |
||||
|
return prefix + "/view"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 查询 |
||||
|
*/ |
||||
|
@RequiresPermissions("project:message:list") |
||||
|
@PostMapping("/list") |
||||
|
@ResponseBody |
||||
|
public TableDataInfo list(SceneMessage sceneMessage) { |
||||
|
startPage(); |
||||
|
List<SceneMessage> list = sceneMessageService.selectSceneMessageList(sceneMessage); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询 |
||||
|
*/ |
||||
|
@PostMapping("/listAll") |
||||
|
@ResponseBody |
||||
|
public ZDResponse listAll(@RequestBody SceneMessage sceneMessage) { |
||||
|
sceneMessage.setOpen(0); |
||||
|
List<SceneMessage> list = sceneMessageService.selectSceneMessageList(sceneMessage); |
||||
|
return ZDResponse.success("成功", list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查看详情 |
||||
|
*/ |
||||
|
@RequiresPermissions("project:message:detail") |
||||
|
@GetMapping("/detail/{guid}") |
||||
|
public String detail(@PathVariable("guid") String guid, ModelMap mmap) { |
||||
|
SceneMessage sceneMessage = sceneMessageService.selectSceneMessageById(guid); |
||||
|
mmap.put("sceneMessage", sceneMessage); |
||||
|
return prefix + "/detail"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增 |
||||
|
*/ |
||||
|
@GetMapping("/add") |
||||
|
public String add() { |
||||
|
return prefix + "/add"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增保存 |
||||
|
*/ |
||||
|
@RequiresPermissions("project:message:add") |
||||
|
@PostMapping("/add") |
||||
|
@ResponseBody |
||||
|
public ZDResponse addSave(SceneMessage sceneMessage) { |
||||
|
return sceneMessageService.insertSceneMessage(sceneMessage) > 0 |
||||
|
? ZDResponse.success() : ZDResponse.error("新增失败"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改 |
||||
|
*/ |
||||
|
@GetMapping("/edit/{guid}") |
||||
|
public String edit(@PathVariable("guid") String guid, ModelMap mmap) { |
||||
|
SceneMessage sceneMessage = sceneMessageService.selectSceneMessageById(guid); |
||||
|
mmap.put("sceneMessage", sceneMessage); |
||||
|
return prefix + "/edit"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改保存 |
||||
|
*/ |
||||
|
@RequiresPermissions("project:message:edit") |
||||
|
@PostMapping("/edit") |
||||
|
@ResponseBody |
||||
|
public ZDResponse editSave(SceneMessage sceneMessage) { |
||||
|
return sceneMessageService.updateSceneMessage(sceneMessage) > 0 |
||||
|
? ZDResponse.success() : ZDResponse.error("编辑失败"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除 |
||||
|
*/ |
||||
|
@RequiresPermissions("project:message:remove") |
||||
|
@PostMapping("/remove") |
||||
|
@ResponseBody |
||||
|
public ZDResponse remove(String ids) { |
||||
|
return sceneMessageService.deleteSceneMessageByIds(ids) > 0 |
||||
|
? ZDResponse.success() : ZDResponse.error("删除失败"); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,150 @@ |
|||||
|
package com.zdxt.knowledge.domain; |
||||
|
|
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 消息中心 scene_message |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2023-01-24 |
||||
|
*/ |
||||
|
public class SceneMessage implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键 |
||||
|
*/ |
||||
|
private String guid; |
||||
|
|
||||
|
/** |
||||
|
* 配置内容 |
||||
|
*/ |
||||
|
private String title; |
||||
|
|
||||
|
/** |
||||
|
* 配置内容 |
||||
|
*/ |
||||
|
private String content; |
||||
|
|
||||
|
/** |
||||
|
* 是否公开 |
||||
|
*/ |
||||
|
private Integer open; |
||||
|
|
||||
|
/** |
||||
|
* 上传地址 |
||||
|
*/ |
||||
|
private String uploadPath; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String creator; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date createTime; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String updateBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date updateTime; |
||||
|
|
||||
|
/** |
||||
|
* 请求参数 |
||||
|
*/ |
||||
|
private Map<String, Object> params; |
||||
|
|
||||
|
public String getGuid() { |
||||
|
return guid; |
||||
|
} |
||||
|
|
||||
|
public void setGuid(String guid) { |
||||
|
this.guid = guid; |
||||
|
} |
||||
|
|
||||
|
public String getContent() { |
||||
|
return content; |
||||
|
} |
||||
|
|
||||
|
public void setContent(String content) { |
||||
|
this.content = content; |
||||
|
} |
||||
|
|
||||
|
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 getUpdateBy() { |
||||
|
return updateBy; |
||||
|
} |
||||
|
|
||||
|
public void setUpdateBy(String updateBy) { |
||||
|
this.updateBy = updateBy; |
||||
|
} |
||||
|
|
||||
|
public Date getUpdateTime() { |
||||
|
return updateTime; |
||||
|
} |
||||
|
|
||||
|
public void setUpdateTime(Date updateTime) { |
||||
|
this.updateTime = updateTime; |
||||
|
} |
||||
|
|
||||
|
public String getTitle() { |
||||
|
return title; |
||||
|
} |
||||
|
|
||||
|
public void setTitle(String title) { |
||||
|
this.title = title; |
||||
|
} |
||||
|
|
||||
|
public Integer getOpen() { |
||||
|
return open; |
||||
|
} |
||||
|
|
||||
|
public void setOpen(Integer open) { |
||||
|
this.open = open; |
||||
|
} |
||||
|
|
||||
|
public String getUploadPath() { |
||||
|
return uploadPath; |
||||
|
} |
||||
|
|
||||
|
public void setUploadPath(String uploadPath) { |
||||
|
this.uploadPath = uploadPath; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,54 @@ |
|||||
|
package com.zdxt.knowledge.mapper; |
||||
|
|
||||
|
import com.zdxt.knowledge.domain.SceneMessage; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Mapper接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2023-12-26 |
||||
|
*/ |
||||
|
public interface SceneMessageMapper { |
||||
|
/** |
||||
|
* 查询 |
||||
|
* |
||||
|
* @param guid ID |
||||
|
* @return |
||||
|
*/ |
||||
|
public SceneMessage selectSceneMessageById(String guid); |
||||
|
|
||||
|
/** |
||||
|
* 查询列表 |
||||
|
* |
||||
|
* @param SceneMessage |
||||
|
* @return 集合 |
||||
|
*/ |
||||
|
public List<SceneMessage> selectSceneMessageList(SceneMessage SceneMessage); |
||||
|
|
||||
|
/** |
||||
|
* 新增 |
||||
|
* |
||||
|
* @param SceneMessage |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertSceneMessage(SceneMessage SceneMessage); |
||||
|
|
||||
|
/** |
||||
|
* 修改 |
||||
|
* |
||||
|
* @param SceneMessage |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateSceneMessage(SceneMessage SceneMessage); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param guids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteSceneMessageByIds(String[] guids); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,53 @@ |
|||||
|
package com.zdxt.knowledge.service; |
||||
|
|
||||
|
import com.zdxt.knowledge.domain.SceneMessage; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Service接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2023-12-26 |
||||
|
*/ |
||||
|
public interface ISceneMessageService { |
||||
|
/** |
||||
|
* 查询 |
||||
|
* |
||||
|
* @param guid ID |
||||
|
* @return |
||||
|
*/ |
||||
|
public SceneMessage selectSceneMessageById(String guid); |
||||
|
|
||||
|
/** |
||||
|
* 查询列表 |
||||
|
* |
||||
|
* @param sceneMessage |
||||
|
* @return 集合 |
||||
|
*/ |
||||
|
public List<SceneMessage> selectSceneMessageList(SceneMessage sceneMessage); |
||||
|
|
||||
|
/** |
||||
|
* 新增 |
||||
|
* |
||||
|
* @param sceneMessage |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertSceneMessage(SceneMessage sceneMessage); |
||||
|
|
||||
|
/** |
||||
|
* 修改 |
||||
|
* |
||||
|
* @param sceneMessage |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateSceneMessage(SceneMessage sceneMessage); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param guids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteSceneMessageByIds(String guids); |
||||
|
} |
||||
@ -0,0 +1,92 @@ |
|||||
|
package com.zdxt.knowledge.service.impl; |
||||
|
|
||||
|
import com.zdxt.auth.dto.UserBean; |
||||
|
import com.zdxt.auth.feign.UserApi; |
||||
|
import com.zdxt.common.util.Convert; |
||||
|
import com.zdxt.common.util.DateUtils; |
||||
|
import com.zdxt.common.util.StringUtils; |
||||
|
import com.zdxt.knowledge.domain.SceneMessage; |
||||
|
import com.zdxt.knowledge.mapper.SceneMessageMapper; |
||||
|
import com.zdxt.knowledge.service.ISceneMessageService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Objects; |
||||
|
|
||||
|
/** |
||||
|
* Service业务层处理 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2023-12-26 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class SceneMessageServiceImpl implements ISceneMessageService { |
||||
|
@Autowired |
||||
|
private SceneMessageMapper sceneMessageMapper; |
||||
|
@Autowired |
||||
|
private UserApi userApi; |
||||
|
|
||||
|
/** |
||||
|
* 查询 |
||||
|
* |
||||
|
* @param guid ID |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public SceneMessage selectSceneMessageById(String guid) { |
||||
|
return sceneMessageMapper.selectSceneMessageById(guid); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询列表 |
||||
|
* |
||||
|
* @param sceneMessage |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<SceneMessage> selectSceneMessageList(SceneMessage sceneMessage) { |
||||
|
return sceneMessageMapper.selectSceneMessageList(sceneMessage); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 新增 |
||||
|
* |
||||
|
* @param sceneMessage |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int insertSceneMessage(SceneMessage sceneMessage) { |
||||
|
UserBean userBean = userApi.getCurrentUser(); |
||||
|
if (Objects.nonNull(userBean)) { |
||||
|
sceneMessage.setCreator(userBean.getUserName()); |
||||
|
sceneMessage.setCreateTime(DateUtils.getNowDate()); |
||||
|
} |
||||
|
sceneMessage.setGuid(StringUtils.getUUID()); |
||||
|
return sceneMessageMapper.insertSceneMessage(sceneMessage); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改 |
||||
|
* |
||||
|
* @param sceneMessage |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int updateSceneMessage(SceneMessage sceneMessage) { |
||||
|
return sceneMessageMapper.updateSceneMessage(sceneMessage); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除对象 |
||||
|
* |
||||
|
* @param guids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteSceneMessageByIds(String guids) { |
||||
|
return sceneMessageMapper.deleteSceneMessageByIds(Convert.toStrArray(guids)); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,97 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.zdxt.knowledge.mapper.SceneMessageMapper"> |
||||
|
|
||||
|
<resultMap type="com.zdxt.knowledge.domain.SceneMessage" id="SceneMessageResult"> |
||||
|
<result property="guid" column="guid"/> |
||||
|
<result property="title" column="title"/> |
||||
|
<result property="content" column="content"/> |
||||
|
<result property="open" column="open"/> |
||||
|
<result property="uploadPath" column="upload_path"/> |
||||
|
<result property="creator" column="creator"/> |
||||
|
<result property="createTime" column="create_time"/> |
||||
|
<result property="updateBy" column="update_by"/> |
||||
|
<result property="updateTime" column="update_time"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<sql id="selectSceneMessageVo"> |
||||
|
select guid, |
||||
|
content, |
||||
|
title, |
||||
|
`open`, |
||||
|
upload_path, |
||||
|
creator, |
||||
|
create_time, |
||||
|
update_by, |
||||
|
update_time |
||||
|
from scene_message |
||||
|
</sql> |
||||
|
|
||||
|
<select id="selectSceneMessageList" parameterType="SceneMessage" resultMap="SceneMessageResult"> |
||||
|
<include refid="selectSceneMessageVo"/> |
||||
|
<where> |
||||
|
<if test="title != null and title != ''">and `title` = #{title}</if> |
||||
|
<if test="creator != null and creator != ''">and creator = #{creator}</if> |
||||
|
</where> |
||||
|
order by create_time desc |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectSceneMessageById" parameterType="String" resultMap="SceneMessageResult"> |
||||
|
<include refid="selectSceneMessageVo"/> |
||||
|
where guid = #{guid} |
||||
|
</select> |
||||
|
|
||||
|
<insert id="insertSceneMessage" parameterType="SceneMessage"> |
||||
|
insert into scene_message |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="guid != null ">guid,</if> |
||||
|
<if test="title != null and title != ''">`title`,</if> |
||||
|
<if test="content != null and content != ''">`content`,</if> |
||||
|
<if test="open != null ">`open`,</if> |
||||
|
<if test="uploadPath != null and uploadPath != ''">`upload_path`,</if> |
||||
|
<if test="creator != null and creator != ''">creator,</if> |
||||
|
<if test="createTime != null ">create_time,</if> |
||||
|
<if test="updateBy != null and updateBy != ''">update_by,</if> |
||||
|
<if test="updateTime != null ">updateTime,</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="guid != null ">#{guid},</if> |
||||
|
<if test="title != null and title != ''">#{title},</if> |
||||
|
<if test="content != null and content != ''">#{content},</if> |
||||
|
<if test="open != null ">#{open},</if> |
||||
|
<if test="uploadPath != null and uploadPath != ''">#{uploadPath},</if> |
||||
|
<if test="creator != null and creator != ''">#{creator},</if> |
||||
|
<if test="createTime != null ">#{createTime},</if> |
||||
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if> |
||||
|
<if test="updateTime != null ">#{updateTime},</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
|
||||
|
<update id="updateSceneMessage" parameterType="SceneMessage"> |
||||
|
update scene_message |
||||
|
<trim prefix="SET" suffixOverrides=","> |
||||
|
<if test="title != null and title != ''">title = #{title},</if> |
||||
|
<if test="content != null and content != ''">content = #{content},</if> |
||||
|
<if test="open != null ">`open` = #{open},</if> |
||||
|
<if test="uploadPath != null and uploadPath != ''">upload_path = #{uploadPath},</if> |
||||
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
||||
|
<if test="updateTime != null ">update_time = #{updateTime},</if> |
||||
|
</trim> |
||||
|
where guid = #{guid} |
||||
|
</update> |
||||
|
|
||||
|
<delete id="deleteSceneMessageById" parameterType="String"> |
||||
|
delete |
||||
|
from scene_message |
||||
|
where guid = #{guid} |
||||
|
</delete> |
||||
|
|
||||
|
<delete id="deleteSceneMessageByIds" parameterType="String"> |
||||
|
delete from scene_message where guid in |
||||
|
<foreach item="guid" collection="array" open="(" separator="," close=")"> |
||||
|
#{guid} |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
|
||||
|
</mapper> |
||||
Loading…
Reference in new issue