素材列表+minio初版+七牛云
This commit is contained in:
parent
399e1cdc27
commit
9ac3b60ad2
26
pom.xml
26
pom.xml
|
|
@ -30,12 +30,38 @@
|
|||
<poi.version>4.1.2</poi.version>
|
||||
<velocity.version>2.3</velocity.version>
|
||||
<lombok.version>1.18.12</lombok.version>
|
||||
<minio.version>8.5.5</minio.version>
|
||||
<qiniu.version>7.4.0</qiniu.version>
|
||||
</properties>
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
<version>${minio.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
<version>${qiniu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,16 @@
|
|||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot集成thymeleaf模板 -->
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,136 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
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.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.ClewMaterial;
|
||||
import com.ruoyi.system.service.IClewMaterialService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 素材Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/material")
|
||||
public class ClewMaterialController extends BaseController
|
||||
{
|
||||
private String prefix = "system/material";
|
||||
|
||||
@Autowired
|
||||
private IClewMaterialService clewMaterialService;
|
||||
|
||||
@RequiresPermissions("system:material:view")
|
||||
@GetMapping()
|
||||
public String material()
|
||||
{
|
||||
return prefix + "/material";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询素材列表
|
||||
*/
|
||||
@RequiresPermissions("system:material:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(ClewMaterial clewMaterial)
|
||||
{
|
||||
startPage();
|
||||
List<ClewMaterial> list = clewMaterialService.selectClewMaterialList(clewMaterial);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/app/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo appList(ClewMaterial clewMaterial)
|
||||
{
|
||||
startPage();
|
||||
List<ClewMaterial> list = clewMaterialService.selectClewMaterialList(clewMaterial);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出素材列表
|
||||
*/
|
||||
@RequiresPermissions("system:material:export")
|
||||
@Log(title = "素材", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(ClewMaterial clewMaterial)
|
||||
{
|
||||
List<ClewMaterial> list = clewMaterialService.selectClewMaterialList(clewMaterial);
|
||||
ExcelUtil<ClewMaterial> util = new ExcelUtil<ClewMaterial>(ClewMaterial.class);
|
||||
return util.exportExcel(list, "素材数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增素材
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存素材
|
||||
*/
|
||||
@RequiresPermissions("system:material:add")
|
||||
@Log(title = "素材", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(ClewMaterial clewMaterial)
|
||||
{
|
||||
return toAjax(clewMaterialService.insertClewMaterial(clewMaterial));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改素材
|
||||
*/
|
||||
@RequiresPermissions("system:material:edit")
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") Long id, ModelMap mmap)
|
||||
{
|
||||
ClewMaterial clewMaterial = clewMaterialService.selectClewMaterialById(id);
|
||||
mmap.put("clewMaterial", clewMaterial);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存素材
|
||||
*/
|
||||
@RequiresPermissions("system:material:edit")
|
||||
@Log(title = "素材", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(ClewMaterial clewMaterial)
|
||||
{
|
||||
return toAjax(clewMaterialService.updateClewMaterial(clewMaterial));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除素材
|
||||
*/
|
||||
@RequiresPermissions("system:material:remove")
|
||||
@Log(title = "素材", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(clewMaterialService.deleteClewMaterialByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.ruoyi.web.controller.tool;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.minio.MinioUtils;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* <p>minio文件服务</p>
|
||||
* @author clunt
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/tool/minio")
|
||||
public class MinioController {
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/upload")
|
||||
@ApiOperation(value = "文件上传管理-添加minio")
|
||||
public AjaxResult add(@RequestPart("file") MultipartFile file) throws IOException {
|
||||
String url = MinioUtils.uploadFile(file);
|
||||
return AjaxResult.success(url);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.ruoyi.web.controller.tool;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.QiniuUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 七牛云
|
||||
*
|
||||
* @author clunt
|
||||
*/
|
||||
@Api
|
||||
@Controller
|
||||
@RequestMapping("/tool/qiniu")
|
||||
public class QiniuController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(QiniuController.class);
|
||||
|
||||
/**
|
||||
* 七牛云上传(单个)
|
||||
*/
|
||||
@PostMapping(value = "/upload")
|
||||
@ResponseBody
|
||||
@ApiOperation("七牛云上传接口")
|
||||
public AjaxResult uploadFile(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
String name = request.getParameter("name");
|
||||
// 转型为MultipartHttpRequest:
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
// 获得实际:
|
||||
MultipartFile file= multipartRequest.getFile(name);
|
||||
// 上传后返回的文件路径
|
||||
String fileUrl = QiniuUtils.upload(file.getBytes());
|
||||
logger.info("upload return url is : " + fileUrl);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("url", fileUrl);
|
||||
return ajax;
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = "/app/upload")
|
||||
@ResponseBody
|
||||
@ApiOperation("app七牛云上传接口")
|
||||
public AjaxResult uploadFile(@RequestParam(value = "uploadFile", required = false) MultipartFile file) {
|
||||
try {
|
||||
// 上传后返回的文件路径
|
||||
String fileUrl = QiniuUtils.upload(file.getBytes());
|
||||
logger.info("upload return url is : " + fileUrl);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("url", fileUrl);
|
||||
return ajax;
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('新增素材')" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-material-add">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="title" 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="imgUrl" type="text" value="" hidden>
|
||||
<input type="file" name="imgUrlImg" id="imgUrlImg" multiple class="file" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">详情页:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="detail" type="text" value="" hidden>
|
||||
<input type="file" name="detailImg" id="detailImg" multiple class="file" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">视频:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="videoImg" type="text" value="" hidden>
|
||||
<input type="file" name="videoImgImg" id="videoImgImg" multiple class="file" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">标签:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="labels" 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="applyNum" 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 type="text" class="form-control" name="clewContent">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "system/material"
|
||||
$("#form-material-add").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
// 素材logo
|
||||
$('#imgUrlImg').fileinput({
|
||||
language: 'zh', //设置语言
|
||||
dropZoneEnabled: false, //是否显示拖拽区域
|
||||
showPreview: false,
|
||||
uploadExtraData: {
|
||||
"name": "imgUrlImg"
|
||||
},
|
||||
dropZoneTitle: "可以将图片拖放到这里", //拖拽区域显示文字
|
||||
uploadUrl: ctx + 'tool/qiniu/upload', //上传路径
|
||||
allowedFileExtensions: ['jpg', 'png', 'gif', 'jpeg'], //指定上传文件类型
|
||||
maxFileSize: 0,
|
||||
maxFileSize: 10240, //上传文件最大值,单位kb
|
||||
uploadAsync: true, //异步上传
|
||||
maxFileCount: 1 //上传文件最大个数。
|
||||
}).on("fileuploaded", function(event,data) { //异步上传成功后回调
|
||||
if(data.response.code === 0){
|
||||
$("input[name='imgUrl']").val(data.response.url)
|
||||
}else {
|
||||
alert("上传失败!");
|
||||
}
|
||||
});
|
||||
|
||||
// 详情页
|
||||
$('#detailImg').fileinput({
|
||||
language: 'zh', //设置语言
|
||||
dropZoneEnabled: false, //是否显示拖拽区域
|
||||
showPreview: false,
|
||||
uploadExtraData: {
|
||||
"name": "detailImg"
|
||||
},
|
||||
dropZoneTitle: "可以将图片拖放到这里", //拖拽区域显示文字
|
||||
uploadUrl: ctx + 'tool/qiniu/upload', //上传路径
|
||||
allowedFileExtensions: ['jpg', 'png', 'gif', 'jpeg'], //指定上传文件类型
|
||||
maxFileSize: 0,
|
||||
maxFileSize: 10240, //上传文件最大值,单位kb
|
||||
uploadAsync: true, //异步上传
|
||||
maxFileCount: 1 //上传文件最大个数。
|
||||
}).on("fileuploaded", function(event,data) { //异步上传成功后回调
|
||||
if(data.response.code === 0){
|
||||
$("input[name='detail']").val(data.response.url)
|
||||
}else {
|
||||
alert("上传失败!");
|
||||
}
|
||||
});
|
||||
|
||||
// 视频素材
|
||||
$('#videoImgImg').fileinput({
|
||||
language: 'zh', //设置语言
|
||||
dropZoneEnabled: false, //是否显示拖拽区域
|
||||
showPreview: false,
|
||||
uploadExtraData: {
|
||||
"name": "videoImgImg"
|
||||
},
|
||||
dropZoneTitle: "可以将视频拖放到这里", //拖拽区域显示文字
|
||||
uploadUrl: ctx + 'tool/qiniu/upload', //上传路径
|
||||
allowedFileExtensions: ['mp4', 'wmv', 'm4v', 'avi'], //指定上传文件类型
|
||||
maxFileSize: 0,
|
||||
maxFileSize: 204800, //上传文件最大值,单位kb
|
||||
uploadAsync: true, //异步上传
|
||||
maxFileCount: 1 //上传文件最大个数。
|
||||
}).on("fileuploaded", function(event,data) { //异步上传成功后回调
|
||||
if(data.response.code === 0){
|
||||
$("input[name='videoImg']").val(data.response.url)
|
||||
}else {
|
||||
alert("上传失败!");
|
||||
}
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-material-add').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('修改素材')" />
|
||||
<th:block th:include="include :: summernote-css" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-material-edit" th:object="${clewMaterial}">
|
||||
<input name="id" th:field="*{id}" type="hidden">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="title" th:field="*{title}" 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="imgUrl" th:field="*{imgUrl}" 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="videoImg" th:field="*{videoImg}" 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="labels" th:field="*{labels}" 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="applyNum" th:field="*{applyNum}" 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 type="text" name="clewContent" class="form-control" th:field="*{clewContent}">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "system/material";
|
||||
$("#form-material-edit").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-material-edit').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$('.summernote').each(function(i) {
|
||||
$('#' + this.id).summernote({
|
||||
lang: 'zh-CN',
|
||||
dialogsInBody: true,
|
||||
callbacks: {
|
||||
onChange: function(contents, $edittable) {
|
||||
$("input[name='" + this.id + "']").val(contents);
|
||||
},
|
||||
onImageUpload: function(files) {
|
||||
var obj = this;
|
||||
var data = new FormData();
|
||||
data.append("file", files[0]);
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: ctx + "common/upload",
|
||||
data: data,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
dataType: 'json',
|
||||
success: function(result) {
|
||||
if (result.code == web_status.SUCCESS) {
|
||||
$('#' + obj.id).summernote('insertImage', result.url);
|
||||
} else {
|
||||
$.modal.alertError(result.msg);
|
||||
}
|
||||
},
|
||||
error: function(error) {
|
||||
$.modal.alertWarning("图片上传失败。");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
var content = $("input[name='" + this.id + "']").val();
|
||||
$('#' + this.id).summernote('code', content);
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<head>
|
||||
<th:block th:include="include :: 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>
|
||||
<label>标题:</label>
|
||||
<input type="text" name="title"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>图片:</label>
|
||||
<input type="text" name="imgUrl"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>视频:</label>
|
||||
<input type="text" name="videoImg"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>标签:</label>
|
||||
<input type="text" name="labels"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>报名人数:</label>
|
||||
<input type="text" name="applyNum"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning 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.add()" shiro:hasPermission="system:material:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:material:edit">-->
|
||||
<!-- <i class="fa fa-edit"></i> 修改-->
|
||||
<!-- </a>-->
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:material:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:material:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('system:material:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('system:material:remove')}]];
|
||||
var prefix = ctx + "system/material";
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "素材",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: '${comment}',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
title: '标题'
|
||||
},
|
||||
{
|
||||
field: 'imgUrl',
|
||||
title: '图片'
|
||||
},
|
||||
{
|
||||
field: 'videoImg',
|
||||
title: '视频'
|
||||
},
|
||||
{
|
||||
field: 'labels',
|
||||
title: '标签'
|
||||
},
|
||||
{
|
||||
field: 'applyNum',
|
||||
title: '报名人数'
|
||||
},
|
||||
{
|
||||
field: 'clewContent',
|
||||
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.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -106,6 +106,22 @@
|
|||
<version>2.0.23</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.ruoyi.common.utils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.qiniu.common.QiniuException;
|
||||
import com.qiniu.http.Response;
|
||||
import com.qiniu.storage.Configuration;
|
||||
import com.qiniu.storage.Region;
|
||||
import com.qiniu.storage.UploadManager;
|
||||
import com.qiniu.storage.model.DefaultPutRet;
|
||||
import com.qiniu.util.Auth;
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
|
||||
/**
|
||||
* @author clunt
|
||||
*/
|
||||
public class QiniuUtils {
|
||||
|
||||
public static String getUpToken() {
|
||||
Auth auth = Auth.create("QTNOppkvtufxTxLjt1V7YZwvzV2Rc6WLD5yXLBVY", "V8SM9nkbO-dft4JmG7UaCH6RYxXdqzrvQ0zWO2W3");
|
||||
return auth.uploadToken("suteng");
|
||||
}
|
||||
|
||||
public static String upload(byte[] uploadBytes) throws QiniuException {
|
||||
|
||||
String key = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
|
||||
//设置华南的服务器
|
||||
Configuration cfg = new Configuration(Region.region2());
|
||||
UploadManager uploadManager = new UploadManager(cfg);
|
||||
|
||||
String upToken = getUpToken();
|
||||
Response response = uploadManager.put(uploadBytes, key, upToken);
|
||||
//解析上传成功的结果
|
||||
DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
|
||||
|
||||
return "http://st.opsoul.com/" + putRet.key;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
package com.ruoyi.common.utils.minio;
|
||||
|
||||
import io.minio.*;
|
||||
import io.minio.messages.Bucket;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.InputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>minio文件服务管理</p>
|
||||
*
|
||||
* @author clunt
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class MinioUtils {
|
||||
|
||||
private static final String MINIO_KEY = "Wiu3PA9eP6wNjrGe";
|
||||
private static final String MINIO_SECRET = "Q2th7VQEuUEc2r6wkywRdygn5c7T71LU";
|
||||
private static final String MINIO_URL = "http://211.99.98.27:9001";
|
||||
|
||||
private static final ThreadLocal<SimpleDateFormat> dateFormatThreadLocal = ThreadLocal.withInitial(()->new SimpleDateFormat("_yyyyMMddHHmmss"));
|
||||
|
||||
private static final String MINIO_BUCKET = "bwy";
|
||||
public static MinioClient minioClient;
|
||||
/**
|
||||
* 初始化minio配置
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
try {
|
||||
log.info("Minio Initialize........................");
|
||||
minioClient = MinioClient.builder().endpoint(MINIO_URL).credentials(MINIO_KEY, MINIO_SECRET).build();
|
||||
createBucket(MINIO_BUCKET);
|
||||
log.info("Minio Initialize........................successful");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("初始化minio配置异常:", e.fillInStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断bucket是否存在
|
||||
*/
|
||||
@SneakyThrows(Exception.class)
|
||||
public static boolean bucketExists(String bucketName) {
|
||||
return minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建bucket
|
||||
*/
|
||||
@SneakyThrows(Exception.class)
|
||||
public static void createBucket(String bucketName) {
|
||||
boolean isExist = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
|
||||
if (!isExist) {
|
||||
minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部bucket
|
||||
*/
|
||||
@SneakyThrows(Exception.class)
|
||||
public static List<Bucket> getAllBuckets() {
|
||||
return minioClient.listBuckets();
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*
|
||||
* @param bucketName: 桶名
|
||||
* @param fileName: 文件名
|
||||
* @param filePath: 文件路径
|
||||
*/
|
||||
@SneakyThrows(Exception.class)
|
||||
public static void upload(String bucketName, String fileName, String filePath) {
|
||||
minioClient.putObject(PutObjectArgs.builder().bucket(bucketName).object(fileName).build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* 返回可以直接预览文件的URL
|
||||
*/
|
||||
public static String uploadFile(MultipartFile file) {
|
||||
try {
|
||||
//如果存储桶不存在则创建
|
||||
if (!bucketExists(MINIO_BUCKET)) {
|
||||
createBucket(MINIO_BUCKET);
|
||||
}
|
||||
String contentType = file.getContentType();
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
//得到文件流
|
||||
InputStream inputStream = file.getInputStream();
|
||||
//保证文件不重名(并且没有特殊字符)
|
||||
String fileName = MINIO_BUCKET + dateFormatThreadLocal.get().format(new Date()) + originalFilename;
|
||||
minioClient.uploadObject(UploadObjectArgs.builder()
|
||||
.bucket(MINIO_BUCKET)
|
||||
.object(file.getName())
|
||||
.filename(originalFilename)
|
||||
.build()
|
||||
);
|
||||
return getPreviewFileUrl(MINIO_BUCKET, fileName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* 返回下载文件url地址 和下面upload方法仅传参不同
|
||||
* bucketName 也可以直接从ParamConfig对象中获取
|
||||
*/
|
||||
// @SneakyThrows(Exception.class)
|
||||
// public static String upload(String bucketName, String fileName, InputStream stream) {
|
||||
// //bucketName, fileName, stream, new PutObjectOptions(stream.available(), -1)
|
||||
// minioClient.putObject(PutObjectArgs.builder()..build()));
|
||||
// return getPreviewFileUrl(bucketName, fileName);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 文件上传
|
||||
// * 返回下载文件url地址 和上面upload方法仅传参不同
|
||||
// */
|
||||
// @SneakyThrows(Exception.class)
|
||||
// public static String upload(String bucketName, MultipartFile file) {
|
||||
// final InputStream is = file.getInputStream();
|
||||
// final String fileName = file.getOriginalFilename();
|
||||
// minioClient.putObject(bucketName, fileName, is, new PutObjectOptions(is.available(), -1));
|
||||
// is.close();
|
||||
// return getPreviewFileUrl(bucketName, fileName);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param bucketName: 桶名
|
||||
* @param fileName: 文件名
|
||||
*/
|
||||
@SneakyThrows(Exception.class)
|
||||
public static void deleteFile(String bucketName, String fileName) {
|
||||
minioClient.removeObject(RemoveObjectArgs.builder().bucket(bucketName).object(fileName).build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取minio文件的下载或者预览地址
|
||||
* 取决于调用本方法的方法中的PutObjectOptions对象有没有设置contentType
|
||||
*
|
||||
* @param bucketName: 桶名
|
||||
* @param fileName: 文件名
|
||||
*/
|
||||
@SneakyThrows(Exception.class)
|
||||
public static String getPreviewFileUrl(String bucketName, String fileName) {
|
||||
return minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder().bucket(bucketName).object(fileName).build());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -290,10 +290,16 @@ public class ShiroConfig
|
|||
filterChainDefinitionMap.put("/captcha/captchaImage**", "anon");
|
||||
// 短信验证码接口
|
||||
filterChainDefinitionMap.put("/tool/notice/**", "anon");
|
||||
// minio文件服务接口
|
||||
filterChainDefinitionMap.put("/tool/minio/**", "anon");
|
||||
// 七牛云
|
||||
filterChainDefinitionMap.put("/tool/qiniu/**", "anon");
|
||||
// app查询
|
||||
filterChainDefinitionMap.put("/system/app/app/**", "anon");
|
||||
// 线索接口
|
||||
filterChainDefinitionMap.put("/system/clew/app/**", "anon");
|
||||
// 素材接口
|
||||
filterChainDefinitionMap.put("/system/material/app/**", "anon");
|
||||
// 退出 logout地址,shiro去清除session
|
||||
filterChainDefinitionMap.put("/logout", "logout");
|
||||
// 不需要拦截的访问
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 素材对象 clew_material
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
@Data
|
||||
public class ClewMaterial extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 标题 */
|
||||
@Excel(name = "标题")
|
||||
private String title;
|
||||
|
||||
/** 图片 */
|
||||
@Excel(name = "图片")
|
||||
private String imgUrl;
|
||||
|
||||
@Excel(name = "详情")
|
||||
private String detail;
|
||||
|
||||
/** 视频 */
|
||||
@Excel(name = "视频")
|
||||
private String videoImg;
|
||||
|
||||
/** 标签 */
|
||||
@Excel(name = "标签")
|
||||
private String labels;
|
||||
|
||||
/** 报名人数 */
|
||||
@Excel(name = "报名人数")
|
||||
private String applyNum;
|
||||
|
||||
/** 线索提交内容 */
|
||||
@Excel(name = "线索提交内容")
|
||||
private String clewContent;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.ClewMaterial;
|
||||
|
||||
/**
|
||||
* 素材Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
public interface ClewMaterialMapper
|
||||
{
|
||||
/**
|
||||
* 查询素材
|
||||
*
|
||||
* @param id 素材主键
|
||||
* @return 素材
|
||||
*/
|
||||
public ClewMaterial selectClewMaterialById(Long id);
|
||||
|
||||
/**
|
||||
* 查询素材列表
|
||||
*
|
||||
* @param clewMaterial 素材
|
||||
* @return 素材集合
|
||||
*/
|
||||
public List<ClewMaterial> selectClewMaterialList(ClewMaterial clewMaterial);
|
||||
|
||||
/**
|
||||
* 新增素材
|
||||
*
|
||||
* @param clewMaterial 素材
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertClewMaterial(ClewMaterial clewMaterial);
|
||||
|
||||
/**
|
||||
* 修改素材
|
||||
*
|
||||
* @param clewMaterial 素材
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateClewMaterial(ClewMaterial clewMaterial);
|
||||
|
||||
/**
|
||||
* 删除素材
|
||||
*
|
||||
* @param id 素材主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteClewMaterialById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除素材
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteClewMaterialByIds(String[] ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.ClewMaterial;
|
||||
|
||||
/**
|
||||
* 素材Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
public interface IClewMaterialService
|
||||
{
|
||||
/**
|
||||
* 查询素材
|
||||
*
|
||||
* @param id 素材主键
|
||||
* @return 素材
|
||||
*/
|
||||
public ClewMaterial selectClewMaterialById(Long id);
|
||||
|
||||
/**
|
||||
* 查询素材列表
|
||||
*
|
||||
* @param clewMaterial 素材
|
||||
* @return 素材集合
|
||||
*/
|
||||
public List<ClewMaterial> selectClewMaterialList(ClewMaterial clewMaterial);
|
||||
|
||||
/**
|
||||
* 新增素材
|
||||
*
|
||||
* @param clewMaterial 素材
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertClewMaterial(ClewMaterial clewMaterial);
|
||||
|
||||
/**
|
||||
* 修改素材
|
||||
*
|
||||
* @param clewMaterial 素材
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateClewMaterial(ClewMaterial clewMaterial);
|
||||
|
||||
/**
|
||||
* 批量删除素材
|
||||
*
|
||||
* @param ids 需要删除的素材主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteClewMaterialByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除素材信息
|
||||
*
|
||||
* @param id 素材主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteClewMaterialById(Long id);
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.ClewMaterialMapper;
|
||||
import com.ruoyi.system.domain.ClewMaterial;
|
||||
import com.ruoyi.system.service.IClewMaterialService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 素材Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
@Service
|
||||
public class ClewMaterialServiceImpl implements IClewMaterialService
|
||||
{
|
||||
@Autowired
|
||||
private ClewMaterialMapper clewMaterialMapper;
|
||||
|
||||
/**
|
||||
* 查询素材
|
||||
*
|
||||
* @param id 素材主键
|
||||
* @return 素材
|
||||
*/
|
||||
@Override
|
||||
public ClewMaterial selectClewMaterialById(Long id)
|
||||
{
|
||||
return clewMaterialMapper.selectClewMaterialById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询素材列表
|
||||
*
|
||||
* @param clewMaterial 素材
|
||||
* @return 素材
|
||||
*/
|
||||
@Override
|
||||
public List<ClewMaterial> selectClewMaterialList(ClewMaterial clewMaterial)
|
||||
{
|
||||
return clewMaterialMapper.selectClewMaterialList(clewMaterial);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增素材
|
||||
*
|
||||
* @param clewMaterial 素材
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertClewMaterial(ClewMaterial clewMaterial)
|
||||
{
|
||||
clewMaterial.setCreateTime(DateUtils.getNowDate());
|
||||
return clewMaterialMapper.insertClewMaterial(clewMaterial);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改素材
|
||||
*
|
||||
* @param clewMaterial 素材
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateClewMaterial(ClewMaterial clewMaterial)
|
||||
{
|
||||
clewMaterial.setUpdateTime(DateUtils.getNowDate());
|
||||
return clewMaterialMapper.updateClewMaterial(clewMaterial);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除素材
|
||||
*
|
||||
* @param ids 需要删除的素材主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteClewMaterialByIds(String ids)
|
||||
{
|
||||
return clewMaterialMapper.deleteClewMaterialByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除素材信息
|
||||
*
|
||||
* @param id 素材主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteClewMaterialById(Long id)
|
||||
{
|
||||
return clewMaterialMapper.deleteClewMaterialById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
<?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.ruoyi.system.mapper.ClewMaterialMapper">
|
||||
|
||||
<resultMap type="ClewMaterial" id="ClewMaterialResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="title" column="title" />
|
||||
<result property="imgUrl" column="img_url" />
|
||||
<result property="videoImg" column="video_img" />
|
||||
<result property="labels" column="labels" />
|
||||
<result property="detail" column="detail" />
|
||||
<result property="applyNum" column="apply_num" />
|
||||
<result property="clewContent" column="clew_content" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectClewMaterialVo">
|
||||
select id, title, img_url, video_img, labels, detail, apply_num, clew_content, create_by, create_time, update_by, update_time from clew_material
|
||||
</sql>
|
||||
|
||||
<select id="selectClewMaterialList" parameterType="ClewMaterial" resultMap="ClewMaterialResult">
|
||||
<include refid="selectClewMaterialVo"/>
|
||||
<where>
|
||||
<if test="title != null and title != ''"> and title = #{title}</if>
|
||||
<if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if>
|
||||
<if test="videoImg != null and videoImg != ''"> and video_img = #{videoImg}</if>
|
||||
<if test="labels != null and labels != ''"> and labels = #{labels}</if>
|
||||
<if test="applyNum != null and applyNum != ''"> and apply_num = #{applyNum}</if>
|
||||
<if test="clewContent != null and clewContent != ''"> and clew_content = #{clewContent}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectClewMaterialById" parameterType="Long" resultMap="ClewMaterialResult">
|
||||
<include refid="selectClewMaterialVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertClewMaterial" parameterType="ClewMaterial" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into clew_material
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="title != null">title,</if>
|
||||
<if test="imgUrl != null">img_url,</if>
|
||||
<if test="videoImg != null">video_img,</if>
|
||||
<if test="labels != null">labels,</if>
|
||||
<if test="detail != null">detail,</if>
|
||||
<if test="applyNum != null">apply_num,</if>
|
||||
<if test="clewContent != null">clew_content,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="title != null">#{title},</if>
|
||||
<if test="imgUrl != null">#{imgUrl},</if>
|
||||
<if test="videoImg != null">#{videoImg},</if>
|
||||
<if test="labels != null">#{labels},</if>
|
||||
<if test="detail != null">#{detail},</if>
|
||||
<if test="applyNum != null">#{applyNum},</if>
|
||||
<if test="clewContent != null">#{clewContent},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateClewMaterial" parameterType="ClewMaterial">
|
||||
update clew_material
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="title != null">title = #{title},</if>
|
||||
<if test="imgUrl != null">img_url = #{imgUrl},</if>
|
||||
<if test="videoImg != null">video_img = #{videoImg},</if>
|
||||
<if test="labels != null">labels = #{labels},</if>
|
||||
<if test="detail != null">detail = #{detail},</if>
|
||||
<if test="applyNum != null">apply_num = #{applyNum},</if>
|
||||
<if test="clewContent != null">clew_content = #{clewContent},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteClewMaterialById" parameterType="Long">
|
||||
delete from clew_material where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteClewMaterialByIds" parameterType="String">
|
||||
delete from clew_material where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -23,6 +23,7 @@
|
|||
<include refid="selectClewPhoneVo"/>
|
||||
<where>
|
||||
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
|
||||
order by create_time desc
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue