新增用户文件关联表
This commit is contained in:
parent
3646db5880
commit
31c69e84a8
@ -0,0 +1,7 @@
|
||||
package com.qiwenshare.file.api;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qiwenshare.file.domain.UserFile;
|
||||
|
||||
public interface IUserFileService extends IService<UserFile> {
|
||||
}
|
@ -15,10 +15,12 @@ import com.qiwenshare.file.config.QiwenFileConfig;
|
||||
import com.qiwenshare.file.domain.FileBean;
|
||||
import com.qiwenshare.file.domain.TreeNode;
|
||||
import com.qiwenshare.file.domain.UserBean;
|
||||
import com.qiwenshare.file.domain.UserFile;
|
||||
import com.qiwenshare.file.dto.BatchDeleteFileDto;
|
||||
import com.qiwenshare.file.dto.BatchMoveFileDto;
|
||||
import com.qiwenshare.file.dto.MoveFileDto;
|
||||
import com.qiwenshare.file.dto.RenameFileDto;
|
||||
import com.qiwenshare.file.service.UserFileService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -39,6 +41,8 @@ public class FileController {
|
||||
IFileService fileService;
|
||||
@Resource
|
||||
IUserService userService;
|
||||
@Resource
|
||||
UserFileService userFileService;
|
||||
|
||||
@Resource
|
||||
QiwenFileConfig qiwenFileConfig;
|
||||
@ -65,11 +69,18 @@ public class FileController {
|
||||
}
|
||||
UserBean sessionUserBean = userService.getUserBeanByToken(token);
|
||||
|
||||
fileBean.setUserId(sessionUserBean.getUserId());
|
||||
// fileBean.setUserId(sessionUserBean.getUserId());
|
||||
|
||||
fileBean.setUploadTime(DateUtil.getCurrentTime());
|
||||
|
||||
fileService.save(fileBean);
|
||||
|
||||
UserFile userFile = new UserFile();
|
||||
userFile.setFileId(fileBean.getFileId());
|
||||
userFile.setUserId(sessionUserBean.getUserId());
|
||||
userFile.setDeleteFlag(0);
|
||||
userFileService.save(userFile);
|
||||
|
||||
restResult.setSuccess(true);
|
||||
return restResult;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.qiwenshare.file.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
@ -26,9 +25,6 @@ public class FileBean {
|
||||
@Column(columnDefinition="bigint(20) comment '文件id'")
|
||||
private Long fileId;
|
||||
|
||||
@Column(columnDefinition="bigint(20) comment '用户id'")
|
||||
private Long userId;
|
||||
|
||||
@Column(columnDefinition="varchar(500) comment '文件url'")
|
||||
private String fileUrl;
|
||||
|
||||
@ -59,50 +55,7 @@ public class FileBean {
|
||||
@Column(columnDefinition="int(11) comment '文件引用数量'")
|
||||
private Integer pointCount;
|
||||
|
||||
@Column(columnDefinition="int(11) comment '文件删除标志 0/null-正常, 1-删除'")
|
||||
private Integer deleteFlag;
|
||||
|
||||
@Column(columnDefinition="varchar(25) comment '删除时间'")
|
||||
private String deleteTime;
|
||||
|
||||
@Column(columnDefinition="varchar(32) comment 'md5标识'")
|
||||
private String identifier;
|
||||
|
||||
// @Transient
|
||||
// @TableField(exist = false)
|
||||
// private String oldFilePath;
|
||||
//
|
||||
// @Transient
|
||||
// @TableField(exist = false)
|
||||
// private String oldFileName;
|
||||
|
||||
// @Transient
|
||||
// @TableField(exist = false)
|
||||
// private String files;
|
||||
|
||||
// @Transient
|
||||
// @TableField(exist = false)
|
||||
// private Integer fileType;
|
||||
|
||||
//切片上传相关参数
|
||||
// @Transient
|
||||
// @TableField(exist = false)
|
||||
// private String taskId;
|
||||
// @Transient
|
||||
// @TableField(exist = false)
|
||||
// private int chunkNumber;
|
||||
// @Transient
|
||||
// @TableField(exist = false)
|
||||
// private long chunkSize;
|
||||
// @Transient
|
||||
// @TableField(exist = false)
|
||||
// private int totalChunks;
|
||||
// @Transient
|
||||
// @TableField(exist = false)
|
||||
// private long totalSize;
|
||||
// @Transient
|
||||
// @TableField(exist = false)
|
||||
// private long currentChunkSize;
|
||||
|
||||
|
||||
}
|
||||
|
@ -47,9 +47,9 @@ public class UserBean {
|
||||
/**
|
||||
* 重复密码
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String passwordAgain;
|
||||
// @Transient
|
||||
// @TableField(exist = false)
|
||||
// private String passwordAgain;
|
||||
|
||||
@Column(columnDefinition = "varchar(15) comment '手机号码'")
|
||||
private String telephone;
|
||||
@ -92,21 +92,6 @@ public class UserBean {
|
||||
@Column(columnDefinition = "varchar(30) comment '注册时间'")
|
||||
private String registerTime;
|
||||
|
||||
|
||||
/**
|
||||
* 与某个客户端的连接会话,需要通过它来给客户端发送数据
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Session session;
|
||||
|
||||
/**
|
||||
* 消息未读数
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Integer notReadCount;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
*/
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.qiwenshare.file.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Data
|
||||
@Table(name = "userfile")
|
||||
@Entity
|
||||
@TableName("userfile")
|
||||
public class UserFile {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(columnDefinition = "bigint(20) comment '用户文件id'")
|
||||
private Long userFileId;
|
||||
|
||||
@Column(columnDefinition = "bigint(20) comment '用户id'")
|
||||
private Long userId;
|
||||
|
||||
@Column(columnDefinition="bigint(20) comment '文件id'")
|
||||
private Long fileId;
|
||||
|
||||
@Column(columnDefinition="int(11) comment '文件删除标志 0/null-正常, 1-删除'")
|
||||
private Integer deleteFlag;
|
||||
|
||||
@Column(columnDefinition="varchar(25) comment '删除时间'")
|
||||
private String deleteTime;
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.qiwenshare.file.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.qiwenshare.file.domain.UserBean;
|
||||
import com.qiwenshare.file.domain.UserFile;
|
||||
|
||||
public interface UserFileMapper extends BaseMapper<UserFile> {
|
||||
|
||||
}
|
@ -78,7 +78,8 @@ public class FileService extends ServiceImpl<FileMapper, FileBean> implements IF
|
||||
public List<FileBean> selectFileListByPath(FileBean fileBean) {
|
||||
LambdaQueryWrapper<FileBean> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(FileBean::getFilePath, fileBean.getFilePath())
|
||||
.eq(FileBean::getUserId, fileBean.getUserId()).orderByDesc(FileBean::getIsDir);
|
||||
.eq(FileBean::getUserId, fileBean.getUserId())
|
||||
.orderByDesc(FileBean::getIsDir);
|
||||
return fileMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
package com.qiwenshare.file.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qiwenshare.file.api.IUserFileService;
|
||||
import com.qiwenshare.file.domain.UserFile;
|
||||
import com.qiwenshare.file.mapper.UserFileMapper;
|
||||
|
||||
public class UserFileService extends ServiceImpl<UserFileMapper, UserFile> implements IUserFileService {
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<?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.qiwenshare.file.mapper.UserFileMapper">
|
||||
|
||||
<select id="selectFileListByPath" >
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user