mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-09-01 22:53:29 +08:00
前端对象列表页面;文件对象管理页面后端Api;后端Api添加管理员身份验证
This commit is contained in:
@@ -102,6 +102,21 @@ router.get('/dashboard/:group/:page/:subpage?', function (req, res) {
|
||||
baseTemplate: "table",
|
||||
pageTemplate: "FileManage",
|
||||
childPage: {
|
||||
"detail": {
|
||||
title: "文件详情",
|
||||
baseTemplate: "blank",
|
||||
pageTemplate: "FileManage_Detail",
|
||||
},
|
||||
"object-manage": {
|
||||
title: "文件对象管理",
|
||||
baseTemplate: "table",
|
||||
pageTemplate: "FileManage_ObjectManage",
|
||||
},
|
||||
"object-detail": {
|
||||
title: "文件对象详情",
|
||||
baseTemplate: "blank",
|
||||
pageTemplate: "FileManage_ObjectManage_Detail",
|
||||
},
|
||||
"upload": {
|
||||
title: "上传文件",
|
||||
baseTemplate: "blank",
|
||||
|
@@ -4,11 +4,13 @@
|
||||
td>*:nth-child(8) {
|
||||
max-width: 100px;
|
||||
}
|
||||
|
||||
/* 限制 哈希 列的宽度 */
|
||||
tr>*:nth-child(10),
|
||||
td>*:nth-child(10) {
|
||||
max-width: 100px;
|
||||
}
|
||||
|
||||
/* 限制 时间 列的宽度 */
|
||||
tr>*:nth-child(11),
|
||||
td>*:nth-child(11) {
|
||||
@@ -16,6 +18,8 @@
|
||||
}
|
||||
</style>
|
||||
<p>
|
||||
<a href="<%= pageUrl %>object-manage">文件对象管理</a>
|
||||
|
||||
<a href="<%= pageUrl %>upload">上传文件</a><br>
|
||||
删除文件前必须先删除该文件关联的所有文件对象
|
||||
</p>
|
||||
@@ -25,7 +29,7 @@
|
||||
});
|
||||
|
||||
function list({ tableElementId }) {
|
||||
getRequest("/file/list", {})
|
||||
getRequest("/file/list", { token: localStorageUtils.getToken() })
|
||||
.then(function (responseData) {
|
||||
var axiosData = responseData.data;
|
||||
var status = axiosData.status;
|
||||
@@ -57,7 +61,7 @@
|
||||
修改: ${new Date(element.fileModifiedAt).toLocaleString()}
|
||||
</nobr></span>`,
|
||||
管理: `<span class="overflow-omit" style="margin: 0 auto;">
|
||||
<a href="<%= pageUrl %>detail?id=${element.id}">修改</a>
|
||||
<a href="<%= pageUrl %>detail?id=${element.id}">管理文件对象</a>
|
||||
<a href="javascript:deleteBook(${element.id});">删除</a>
|
||||
</span>`,
|
||||
})
|
||||
@@ -82,4 +86,32 @@
|
||||
alert("无法连接到服务器,请检查网络连接!");
|
||||
});
|
||||
}
|
||||
|
||||
// function deleteBook(deleteBookId) {
|
||||
// if (!confirm(`确认要删除编号为 ${deleteBookId} 的书籍吗?`)) return;
|
||||
|
||||
// postRequest("/book/delete", { token: localStorageUtils.getToken(), id: deleteBookId })
|
||||
// .then(function (responseData) {
|
||||
// var axiosData = responseData.data;
|
||||
// var status = axiosData.status;
|
||||
// var data = axiosData.data;
|
||||
// if (status === "success") {
|
||||
// console.log(data)
|
||||
// if (data == "success") {
|
||||
// search({
|
||||
// tableElementId: "book-table",
|
||||
// searchText: $("#searchInput").val(),
|
||||
// categoryId: null
|
||||
// });
|
||||
// } else {
|
||||
// alert("删除失败!");
|
||||
// }
|
||||
// } else {
|
||||
// alert(`出错啦!${data.errMsg} (错误码: ${data.errCode}) `);
|
||||
// }
|
||||
// }).catch(function (error) {
|
||||
// console.log(error);
|
||||
// alert("无法连接到服务器,请检查网络连接!");
|
||||
// });
|
||||
// }
|
||||
</script>
|
@@ -0,0 +1,65 @@
|
||||
<p>
|
||||
<a href="<%= pageUrl %>../">返回上一级</a>
|
||||
|
||||
<a href="<%= pageUrl %>../upload">上传文件</a><br><br>
|
||||
您现在在「文件管理 > 文件对象管理」,以下是系统所有文件对象信息
|
||||
</p>
|
||||
<script>
|
||||
list({
|
||||
tableElementId: "book-table"
|
||||
});
|
||||
|
||||
function list({ tableElementId }) {
|
||||
getRequest("/file/object/list", { token: localStorageUtils.getToken() })
|
||||
.then(function (responseData) {
|
||||
var axiosData = responseData.data;
|
||||
var status = axiosData.status;
|
||||
var data = axiosData.data;
|
||||
if (status === "success") {
|
||||
// console.log(data);
|
||||
|
||||
// 数据进行转换
|
||||
var renderData = [];
|
||||
data.forEach(element => {
|
||||
console.log(element);
|
||||
renderData.push({
|
||||
编号: `${element.id}`,
|
||||
关联文件: `<span class="overflow-omit" style="margin: 0 auto;">
|
||||
ID: ${element.fileId}
|
||||
<a href="<%= pageUrl %>../detail?id=${element.bookId}">查看</a>
|
||||
</span>`,
|
||||
文件路径: `${element.filePath}`,
|
||||
文件密码: `${element.filePwd}`,
|
||||
提取码: `${element.fileShareCode}`,
|
||||
存储介质: `${element.storageMediumType}`,
|
||||
// 时间: `<span class="overflow-omit" style="font-size: 12px; line-height: 1.2em; display: block;"><nobr>
|
||||
// 创建: ${new Date(element.fileCreateAt).toLocaleString()}<br>
|
||||
// 修改: ${new Date(element.fileModifiedAt).toLocaleString()}
|
||||
// </nobr></span>`,
|
||||
管理: `<span class="overflow-omit" style="margin: 0 auto;">
|
||||
<a href="<%= pageUrl %>../object-detail?id=${element.id}">修改</a>
|
||||
<a href="javascript:deleteBook(${element.id});">删除</a>
|
||||
</span>`,
|
||||
})
|
||||
});
|
||||
if (renderData.length == 0) {
|
||||
function htmlEncode(str) {
|
||||
// refer: https://stackoverflow.com/questions/4183801/escape-html-chracters
|
||||
var div = document.createElement('div');
|
||||
var txt = document.createTextNode(str);
|
||||
div.appendChild(txt);
|
||||
return div.innerHTML;
|
||||
}
|
||||
renderTable({ data: `暂无文件`, tableId: tableElementId, renderTableHead: true });
|
||||
} else {
|
||||
renderTable({ data: renderData, tableId: tableElementId, renderTableHead: true });
|
||||
}
|
||||
} else {
|
||||
alert(`出错啦!${data.errMsg} (错误码: ${data.errCode}) `);
|
||||
}
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
alert("无法连接到服务器,请检查网络连接!");
|
||||
});
|
||||
}
|
||||
</script>
|
@@ -55,7 +55,7 @@
|
||||
}
|
||||
</style>
|
||||
<p>
|
||||
<a href="<%= pageUrl %>../">返回上一级</a>
|
||||
<a href="<%= pageUrl %>../">返回文件管理</a>
|
||||
</p>
|
||||
<div id="dropbox" class="lightgrey">
|
||||
<p>
|
||||
|
@@ -11,7 +11,7 @@
|
||||
Target Server Version : 50726
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 10/04/2022 17:11:27
|
||||
Date: 10/04/2022 18:06:07
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
@@ -162,12 +162,12 @@ CREATE TABLE `file_info` (
|
||||
DROP TABLE IF EXISTS `file_object_info`;
|
||||
CREATE TABLE `file_object_info` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
`fileId` int(11) NOT NULL,
|
||||
`storage_medium_type` tinyint(4) NOT NULL DEFAULT 0,
|
||||
`file_id` int(11) NOT NULL,
|
||||
`storage_medium_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0',
|
||||
`file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '本地文件保存相对路径(本地维护用,非线上使用)',
|
||||
`file_pwd` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
|
||||
`file_share_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
|
||||
`additional_fields` json NULL,
|
||||
`additional_fields` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
|
@@ -7,15 +7,19 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import plus.bookshelf.Common.Enum.FileStorageMediumEnum;
|
||||
import plus.bookshelf.Common.Error.BusinessErrorCode;
|
||||
import plus.bookshelf.Common.Error.BusinessException;
|
||||
import plus.bookshelf.Common.FileManager.QCloudCosUtils;
|
||||
import plus.bookshelf.Common.Response.CommonReturnType;
|
||||
import plus.bookshelf.Config.QCloudCosConfig;
|
||||
import plus.bookshelf.Controller.VO.FileObjectVO;
|
||||
import plus.bookshelf.Controller.VO.FileVO;
|
||||
import plus.bookshelf.Service.Impl.FileObjectServiceImpl;
|
||||
import plus.bookshelf.Service.Impl.FileServiceImpl;
|
||||
import plus.bookshelf.Service.Impl.UserServiceImpl;
|
||||
import plus.bookshelf.Service.Model.FileModel;
|
||||
import plus.bookshelf.Service.Model.FileObjectModel;
|
||||
import plus.bookshelf.Service.Model.UserModel;
|
||||
import plus.bookshelf.Service.Service.CosPresignedUrlGenerateLogService;
|
||||
|
||||
@@ -37,20 +41,26 @@ public class FileController extends BaseController {
|
||||
@Autowired
|
||||
CosPresignedUrlGenerateLogService cosPresignedUrlGenerateLogService;
|
||||
|
||||
@Autowired
|
||||
FileServiceImpl fileService;
|
||||
|
||||
@Autowired
|
||||
FileObjectServiceImpl fileObjectService;
|
||||
|
||||
@ApiOperation(value = "查询文件列表", notes = "查询文件列表")
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET})
|
||||
@ResponseBody
|
||||
public CommonReturnType list() throws InvocationTargetException, IllegalAccessException {
|
||||
List<FileModel> fileModels = fileService.list();
|
||||
public CommonReturnType list(@RequestParam(value = "token", required = false) String token) throws InvocationTargetException, IllegalAccessException {
|
||||
List<FileModel> fileModels = fileService.list(token);
|
||||
List<FileVO> fileVOS = new ArrayList<>();
|
||||
for (FileModel fileModel : fileModels) {
|
||||
FileVO fileVO = convertFromModel(fileModel);
|
||||
FileVO fileVO = convertFileVOFromModel(fileModel);
|
||||
fileVOS.add(fileVO);
|
||||
}
|
||||
return CommonReturnType.create(fileVOS);
|
||||
}
|
||||
|
||||
private FileVO convertFromModel(FileModel fileModel) {
|
||||
private FileVO convertFileVOFromModel(FileModel fileModel) {
|
||||
FileVO fileVO = new FileVO();
|
||||
BeanUtils.copyProperties(fileModel, fileVO);
|
||||
fileVO.setFileCreateAt(fileModel.getFileCreateAt().getTime());
|
||||
@@ -58,6 +68,30 @@ public class FileController extends BaseController {
|
||||
return fileVO;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询文件对象列表", notes = "查询文件列表")
|
||||
@RequestMapping(value = "object/list", method = {RequestMethod.GET})
|
||||
@ResponseBody
|
||||
public CommonReturnType objectList(@RequestParam(value = "token", required = false) String token) throws InvocationTargetException, IllegalAccessException, BusinessException {
|
||||
List<FileObjectModel> fileObjectModels = fileObjectService.list(token);
|
||||
List<FileObjectVO> fileObjectVOS = new ArrayList<>();
|
||||
for (FileObjectModel fileObjectModel : fileObjectModels) {
|
||||
FileObjectVO fileObjectVO = convertFileObjectVOFromModel(fileObjectModel);
|
||||
fileObjectVOS.add(fileObjectVO);
|
||||
}
|
||||
return CommonReturnType.create(fileObjectVOS);
|
||||
}
|
||||
|
||||
private FileObjectVO convertFileObjectVOFromModel(FileObjectModel fileObjectModel) {
|
||||
FileObjectVO fileObjectVO = new FileObjectVO();
|
||||
BeanUtils.copyProperties(fileObjectModel, fileObjectVO);
|
||||
try {
|
||||
// 尝试将 FileStorageMedium 转为中文,如果没有成功,那么就保留英文
|
||||
fileObjectVO.setStorageMediumType(FileStorageMediumEnum.valueOf(fileObjectModel.getStorageMediumType()).getStorageMediumDisplayName());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return fileObjectVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建文件操作预授权URL
|
||||
*
|
||||
|
@@ -0,0 +1,29 @@
|
||||
package plus.bookshelf.Controller.VO;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FileObjectVO {
|
||||
|
||||
// 文件存储介质Id
|
||||
private Integer id;
|
||||
|
||||
// 存储的文件Id
|
||||
private Integer fileId;
|
||||
|
||||
// 文件存储介质类型
|
||||
String storageMediumType;
|
||||
|
||||
// 文件地址
|
||||
// 如果是网盘就是分享链接,如果是本地存储就是文件路径
|
||||
String filePath;
|
||||
|
||||
// 如果文件有压缩,那么就是压缩包密码
|
||||
String filePwd;
|
||||
|
||||
// 文件提取码
|
||||
String fileShareCode;
|
||||
|
||||
// 附加字段(JSON存储)
|
||||
String additionalFields;
|
||||
}
|
@@ -13,11 +13,11 @@ public class FileObjectDO {
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column file_object_info.fileId
|
||||
* This field corresponds to the database column file_object_info.file_id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private Integer fileid;
|
||||
private Integer fileId;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -26,7 +26,7 @@ public class FileObjectDO {
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private Byte storageMediumType;
|
||||
private String storageMediumType;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -90,26 +90,26 @@ public class FileObjectDO {
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column file_object_info.fileId
|
||||
* This method returns the value of the database column file_object_info.file_id
|
||||
*
|
||||
* @return the value of file_object_info.fileId
|
||||
* @return the value of file_object_info.file_id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Integer getFileid() {
|
||||
return fileid;
|
||||
public Integer getFileId() {
|
||||
return fileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column file_object_info.fileId
|
||||
* This method sets the value of the database column file_object_info.file_id
|
||||
*
|
||||
* @param fileid the value for file_object_info.fileId
|
||||
* @param fileId the value for file_object_info.file_id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setFileid(Integer fileid) {
|
||||
this.fileid = fileid;
|
||||
public void setFileId(Integer fileId) {
|
||||
this.fileId = fileId;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,7 +120,7 @@ public class FileObjectDO {
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Byte getStorageMediumType() {
|
||||
public String getStorageMediumType() {
|
||||
return storageMediumType;
|
||||
}
|
||||
|
||||
@@ -132,8 +132,8 @@ public class FileObjectDO {
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setStorageMediumType(Byte storageMediumType) {
|
||||
this.storageMediumType = storageMediumType;
|
||||
public void setStorageMediumType(String storageMediumType) {
|
||||
this.storageMediumType = storageMediumType == null ? null : storageMediumType.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package plus.bookshelf.Dao.Mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
import plus.bookshelf.Dao.DO.FileDO;
|
||||
import plus.bookshelf.Dao.DO.FileObjectDO;
|
||||
|
||||
@Repository // 添加这个注解,Autowired的时候idea就不会报错了
|
||||
@@ -51,13 +52,12 @@ public interface FileObjectDOMapper {
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByPrimaryKeyWithBLOBs(FileObjectDO record);
|
||||
int updateByPrimaryKey(FileObjectDO record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table file_object_info
|
||||
* 查询系统中的所有文件对象
|
||||
*
|
||||
* @mbg.generated
|
||||
* @return
|
||||
*/
|
||||
int updateByPrimaryKey(FileObjectDO record);
|
||||
FileObjectDO[] selectAll();
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
package plus.bookshelf.Service.Impl;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import plus.bookshelf.Common.Error.BusinessException;
|
||||
import plus.bookshelf.Dao.DO.FileObjectDO;
|
||||
import plus.bookshelf.Dao.Mapper.FileObjectDOMapper;
|
||||
import plus.bookshelf.Service.Model.FileObjectModel;
|
||||
import plus.bookshelf.Service.Model.UserModel;
|
||||
import plus.bookshelf.Service.Service.FileObjectService;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FileObjectServiceImpl implements FileObjectService {
|
||||
|
||||
@Autowired
|
||||
FileObjectDOMapper fileObjectDOMapper;
|
||||
|
||||
@Autowired
|
||||
RedisTemplate redisTemplate;
|
||||
|
||||
@Autowired
|
||||
UserServiceImpl userService;
|
||||
|
||||
/**
|
||||
* 列出所有文件对象
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<FileObjectModel> list(String token) throws InvocationTargetException, IllegalAccessException, BusinessException {
|
||||
|
||||
// 已经在 getUserByToken 方法中判断了 token 为空、不合法;用户不存在情况,此处无需再判断
|
||||
UserModel userModel = userService.getUserByToken(redisTemplate, token);
|
||||
|
||||
FileObjectDO[] fileObjectDOS = fileObjectDOMapper.selectAll();
|
||||
|
||||
List<FileObjectModel> fileObjectModels = new ArrayList<>();
|
||||
for (FileObjectDO fileObjectDO : fileObjectDOS) {
|
||||
FileObjectModel fileObjectModel = convertFromDataObject(fileObjectDO);
|
||||
fileObjectModels.add(fileObjectModel);
|
||||
}
|
||||
|
||||
return fileObjectModels;
|
||||
}
|
||||
|
||||
private FileObjectModel convertFromDataObject(FileObjectDO fileObjectDO) throws InvocationTargetException, IllegalAccessException {
|
||||
FileObjectModel fileObjectModel = new FileObjectModel();
|
||||
BeanUtils.copyProperties(fileObjectDO, fileObjectModel);
|
||||
return fileObjectModel;
|
||||
}
|
||||
}
|
@@ -1,11 +1,14 @@
|
||||
package plus.bookshelf.Service.Impl;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import plus.bookshelf.Dao.DO.FileDO;
|
||||
import plus.bookshelf.Dao.Mapper.FileDOMapper;
|
||||
import plus.bookshelf.Service.Model.FileModel;
|
||||
import plus.bookshelf.Service.Model.UserModel;
|
||||
import plus.bookshelf.Service.Service.FileService;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@@ -18,13 +21,24 @@ public class FileServiceImpl implements FileService {
|
||||
@Autowired
|
||||
FileDOMapper fileDOMapper;
|
||||
|
||||
@Autowired
|
||||
RedisTemplate redisTemplate;
|
||||
|
||||
@Autowired
|
||||
UserServiceImpl userService;
|
||||
|
||||
/**
|
||||
* 列出所有文件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public List<FileModel> list() throws InvocationTargetException, IllegalAccessException {
|
||||
public List<FileModel> list(String token) throws InvocationTargetException, IllegalAccessException {
|
||||
|
||||
// 已经在 getUserByToken 方法中判断了 token 为空、不合法;用户不存在情况,此处无需再判断
|
||||
UserModel userModel = userService.getUserByToken(redisTemplate, token);
|
||||
|
||||
FileDO[] fileDOS = fileDOMapper.selectAll();
|
||||
|
||||
List<FileModel> fileModels = new ArrayList<>();
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package plus.bookshelf.Service.Model;
|
||||
|
||||
import lombok.Data;
|
||||
import plus.bookshelf.Common.Enum.FileStorageMediumEnum;
|
||||
|
||||
@Data
|
||||
public class FileObjectModel {
|
||||
@@ -13,7 +12,7 @@ public class FileObjectModel {
|
||||
private Integer fileId;
|
||||
|
||||
// 文件存储介质类型
|
||||
FileStorageMediumEnum storageMediumType;
|
||||
String storageMediumType;
|
||||
|
||||
// 文件地址
|
||||
// 如果是网盘就是分享链接,如果是本地存储就是文件路径
|
||||
@@ -26,5 +25,5 @@ public class FileObjectModel {
|
||||
String fileShareCode;
|
||||
|
||||
// 附加字段(JSON存储)
|
||||
Object additionalFields;
|
||||
String additionalFields;
|
||||
}
|
||||
|
@@ -0,0 +1,16 @@
|
||||
package plus.bookshelf.Service.Service;
|
||||
|
||||
import plus.bookshelf.Common.Error.BusinessException;
|
||||
import plus.bookshelf.Service.Model.FileObjectModel;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
|
||||
public interface FileObjectService {
|
||||
/**
|
||||
* 列出所有文件对象
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FileObjectModel> list(String token) throws InvocationTargetException, IllegalAccessException, BusinessException;
|
||||
}
|
@@ -11,5 +11,5 @@ public interface FileService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FileModel> list() throws InvocationTargetException, IllegalAccessException;
|
||||
List<FileModel> list(String token) throws InvocationTargetException, IllegalAccessException;
|
||||
}
|
||||
|
@@ -7,42 +7,27 @@
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="fileId" jdbcType="INTEGER" property="fileid" />
|
||||
<result column="storage_medium_type" jdbcType="TINYINT" property="storageMediumType" />
|
||||
<result column="file_id" jdbcType="INTEGER" property="fileId" />
|
||||
<result column="storage_medium_type" jdbcType="VARCHAR" property="storageMediumType" />
|
||||
<result column="file_path" jdbcType="VARCHAR" property="filePath" />
|
||||
<result column="file_pwd" jdbcType="VARCHAR" property="filePwd" />
|
||||
<result column="file_share_code" jdbcType="VARCHAR" property="fileShareCode" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="plus.bookshelf.Dao.DO.FileObjectDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<result column="additional_fields" jdbcType="LONGVARCHAR" property="additionalFields" />
|
||||
<result column="additional_fields" jdbcType="VARCHAR" property="additionalFields" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
id, fileId, storage_medium_type, file_path, file_pwd, file_share_code
|
||||
id, file_id, storage_medium_type, file_path, file_pwd, file_share_code, additional_fields
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
additional_fields
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from file_object_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
@@ -59,12 +44,12 @@
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
insert into file_object_info (id, fileId, storage_medium_type,
|
||||
file_path, file_pwd, file_share_code,
|
||||
insert into file_object_info (id, file_id, storage_medium_type,
|
||||
file_path, file_pwd, file_share_code,
|
||||
additional_fields)
|
||||
values (#{id,jdbcType=INTEGER}, #{fileid,jdbcType=INTEGER}, #{storageMediumType,jdbcType=TINYINT},
|
||||
#{filePath,jdbcType=VARCHAR}, #{filePwd,jdbcType=VARCHAR}, #{fileShareCode,jdbcType=VARCHAR},
|
||||
#{additionalFields,jdbcType=LONGVARCHAR})
|
||||
values (#{id,jdbcType=INTEGER}, #{fileId,jdbcType=INTEGER}, #{storageMediumType,jdbcType=VARCHAR},
|
||||
#{filePath,jdbcType=VARCHAR}, #{filePwd,jdbcType=VARCHAR}, #{fileShareCode,jdbcType=VARCHAR},
|
||||
#{additionalFields,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="plus.bookshelf.Dao.DO.FileObjectDO">
|
||||
<!--
|
||||
@@ -76,8 +61,8 @@
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="fileid != null">
|
||||
fileId,
|
||||
<if test="fileId != null">
|
||||
file_id,
|
||||
</if>
|
||||
<if test="storageMediumType != null">
|
||||
storage_medium_type,
|
||||
@@ -99,11 +84,11 @@
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="fileid != null">
|
||||
#{fileid,jdbcType=INTEGER},
|
||||
<if test="fileId != null">
|
||||
#{fileId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="storageMediumType != null">
|
||||
#{storageMediumType,jdbcType=TINYINT},
|
||||
#{storageMediumType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="filePath != null">
|
||||
#{filePath,jdbcType=VARCHAR},
|
||||
@@ -115,7 +100,7 @@
|
||||
#{fileShareCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="additionalFields != null">
|
||||
#{additionalFields,jdbcType=LONGVARCHAR},
|
||||
#{additionalFields,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
@@ -126,11 +111,11 @@
|
||||
-->
|
||||
update file_object_info
|
||||
<set>
|
||||
<if test="fileid != null">
|
||||
fileId = #{fileid,jdbcType=INTEGER},
|
||||
<if test="fileId != null">
|
||||
file_id = #{fileId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="storageMediumType != null">
|
||||
storage_medium_type = #{storageMediumType,jdbcType=TINYINT},
|
||||
storage_medium_type = #{storageMediumType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="filePath != null">
|
||||
file_path = #{filePath,jdbcType=VARCHAR},
|
||||
@@ -142,36 +127,28 @@
|
||||
file_share_code = #{fileShareCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="additionalFields != null">
|
||||
additional_fields = #{additionalFields,jdbcType=LONGVARCHAR},
|
||||
additional_fields = #{additionalFields,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="plus.bookshelf.Dao.DO.FileObjectDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update file_object_info
|
||||
set fileId = #{fileid,jdbcType=INTEGER},
|
||||
storage_medium_type = #{storageMediumType,jdbcType=TINYINT},
|
||||
file_path = #{filePath,jdbcType=VARCHAR},
|
||||
file_pwd = #{filePwd,jdbcType=VARCHAR},
|
||||
file_share_code = #{fileShareCode,jdbcType=VARCHAR},
|
||||
additional_fields = #{additionalFields,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="plus.bookshelf.Dao.DO.FileObjectDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update file_object_info
|
||||
set fileId = #{fileid,jdbcType=INTEGER},
|
||||
storage_medium_type = #{storageMediumType,jdbcType=TINYINT},
|
||||
set file_id = #{fileId,jdbcType=INTEGER},
|
||||
storage_medium_type = #{storageMediumType,jdbcType=VARCHAR},
|
||||
file_path = #{filePath,jdbcType=VARCHAR},
|
||||
file_pwd = #{filePwd,jdbcType=VARCHAR},
|
||||
file_share_code = #{fileShareCode,jdbcType=VARCHAR}
|
||||
file_share_code = #{fileShareCode,jdbcType=VARCHAR},
|
||||
additional_fields = #{additionalFields,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<select id="selectAll" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from file_object_info
|
||||
</select>
|
||||
</mapper>
|
Reference in New Issue
Block a user