Commit a27e7f3e by 龙于生 Committed by 284718418@qq.com

新增云盘最近查看列表、我的收藏列表、我转发的列表、我收到的列表及删除功能

parent 56bedfd3
package cn.timer.api.bean.disk;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
......@@ -10,10 +11,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import java.util.Date;
......@@ -88,4 +86,14 @@ public class DiskFilesLog extends Model<DiskFilesLog> {
*/
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@Transient
@TableField(exist = false)
private DiskFiles diskFiles;
@Transient
@TableField(exist = false)
private DiskFileImage diskFileImage;
}
package cn.timer.api.bean.disk;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
......@@ -10,10 +11,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
......@@ -96,4 +94,12 @@ public class DiskReceived extends Model<DiskReceived> {
*/
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@Transient
@TableField(exist = false)
private DiskFiles diskFiles;
@Transient
@TableField(exist = false)
private DiskFileImage diskFileImage;
}
package cn.timer.api.bean.disk;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
......@@ -10,10 +11,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
......@@ -101,4 +99,12 @@ public class DiskShare extends Model<DiskShare> {
@ApiModelProperty(value = "创建时间")
private Date createTime;
@Transient
@TableField(exist = false)
private DiskFiles diskFiles;
@Transient
@TableField(exist = false)
private DiskFileImage diskFileImage;
}
package cn.timer.api.controller.disk;
import cn.timer.api.bean.admin.AdminAssoTxjlb;
import cn.timer.api.bean.disk.DiskCatalogue;
import cn.timer.api.bean.disk.DiskFilesLog;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.dao.disk.DiskFilesLogMapper;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.ISelect;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.transaction.Transactional;
import java.util.List;
/**
......@@ -20,4 +37,54 @@ import javax.transaction.Transactional;
@RequestMapping("diskfileslog")
public class DiskFilesLogController{
@Autowired
private DiskFilesLogMapper diskFilesLogMapper;
/**
* 云盘-最近查看列表
*
* @param userBean
* @return
*/
@GetMapping(value = "/recent_file_list")
@ApiOperation(value = "11.最近查看", httpMethod = "GET", notes = "云盘-最近查看列表")
@ApiOperationSupport(order = 11)
public Result<List<DiskFilesLog>> recentFileList(@CurrentUser UserBean userBean,
@ApiParam("当前页") @RequestParam(required = false, defaultValue = "1") Integer pageNum,
@ApiParam("每页条数") @RequestParam(required = false, defaultValue = "10") Integer pageSize,
@ApiParam("搜索关键字") @RequestParam(required = false) String query,
@ApiParam("类型:0查看,1下载,2创建") @RequestParam(required = false) String type) {
Integer empNum = userBean.getEmpNum();
DiskFilesLog diskFilesLog = new DiskFilesLog();
diskFilesLog.setTitle(query);
diskFilesLog.setUserId(empNum);
try{
diskFilesLog.setType(Integer.valueOf(type));
}catch(Exception e){}
List<DiskFilesLog> diskFilesLogs = diskFilesLogMapper.queryDiskFilesLog(diskFilesLog,pageNum,pageSize);
long total = PageHelper.count(new ISelect() {
@Override
public void doSelect() {
diskFilesLogMapper.queryDiskFilesLog(diskFilesLog,pageNum,pageSize);
}
});
return ResultUtil.pageData(diskFilesLogs,total, "查询成功");
}
/**
* 云盘-移除最近查看文件-最近查看文件id
*/
@DeleteMapping(value = "/remove_recent_file/{id}")
@ApiOperation(value = "13.云盘-移除最近查看文件-最近查看文件id", httpMethod = "DELETE", notes = "云盘-移除最近查看文件-最近查看文件id")
@ApiOperationSupport(order = 13)
public Result<Object> removeRecentFile(@PathVariable Integer id){
DiskFilesLog.builder().id(id).type(5).build().updateById();
return ResultUtil.success();
}
}
package cn.timer.api.controller.disk;
import cn.timer.api.bean.disk.DiskFilesLog;
import cn.timer.api.bean.disk.DiskReceived;
import cn.timer.api.bean.disk.DiskShare;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.dao.disk.DiskReceivedMapper;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import com.github.pagehelper.ISelect;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.transaction.Transactional;
import java.util.List;
/**
......@@ -20,4 +34,50 @@ import javax.transaction.Transactional;
@RequestMapping("diskreceived")
public class DiskReceivedController{
@Autowired
private DiskReceivedMapper diskReceivedMapper;
/**
* 云盘-我收到的
*
* @param userBean
* @return
*/
@GetMapping(value = "/received_file_list")
@ApiOperation(value = "13.我收到的", httpMethod = "GET", notes = "云盘-我收到的")
@ApiOperationSupport(order = 13)
public Result<List<DiskReceived>> receivedFileList(@CurrentUser UserBean userBean,
@ApiParam("当前页") @RequestParam(required = false, defaultValue = "1") Integer pageNum,
@ApiParam("每页条数") @RequestParam(required = false, defaultValue = "10") Integer pageSize,
@ApiParam("搜索关键字") @RequestParam(required = false) String query) {
Integer empNum = userBean.getEmpNum();
DiskReceived diskReceived = new DiskReceived();
diskReceived.setTitle(query);
diskReceived.setUserId(empNum);
List<DiskReceived> diskReceiveds = diskReceivedMapper.queryDiskReceived(diskReceived,pageNum,pageSize);
long total = PageHelper.count(new ISelect() {
@Override
public void doSelect() {
diskReceivedMapper.queryDiskReceived(diskReceived,pageNum,pageSize);
}
});
return ResultUtil.pageData(diskReceiveds,total, "查询成功");
}
/**
* 云盘-移除我收到的文件-我收到的文件id
*/
@DeleteMapping(value = "/remove_received_file/{id}")
@ApiOperation(value = "14.云盘-移除我收到的文件-我收到的文件id", httpMethod = "DELETE", notes = "云盘-移除我收到的文件-我收到的文件id")
@ApiOperationSupport(order = 14)
public Result<Object> removeReceivedFile(@PathVariable Integer id){
DiskReceived.builder().id(id).deleteFlag(1).build().updateById();
return ResultUtil.success();
}
}
package cn.timer.api.controller.disk;
import cn.timer.api.bean.disk.DiskFilesLog;
import cn.timer.api.bean.disk.DiskReceived;
import cn.timer.api.bean.disk.DiskShare;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.dao.disk.DiskShareMapper;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import com.github.pagehelper.ISelect;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.transaction.Transactional;
import java.util.List;
/**
......@@ -20,4 +34,50 @@ import javax.transaction.Transactional;
@RequestMapping("diskshare")
public class DiskShareController{
@Autowired
private DiskShareMapper diskShareMapper;
/**
* 云盘-我转发的
*
* @param userBean
* @return
*/
@GetMapping(value = "/forwarded_file_list")
@ApiOperation(value = "12.我转发的", httpMethod = "GET", notes = "云盘-我转发的")
@ApiOperationSupport(order = 12)
public Result<List<DiskShare>> forwardedFileList(@CurrentUser UserBean userBean,
@ApiParam("当前页") @RequestParam(required = false, defaultValue = "1") Integer pageNum,
@ApiParam("每页条数") @RequestParam(required = false, defaultValue = "10") Integer pageSize,
@ApiParam("搜索关键字") @RequestParam(required = false) String query) {
Integer empNum = userBean.getEmpNum();
DiskShare diskShare = new DiskShare();
diskShare.setTitle(query);
diskShare.setUserId(empNum);
List<DiskShare> diskShares = diskShareMapper.queryDiskShare(diskShare,pageNum,pageSize);
long total = PageHelper.count(new ISelect() {
@Override
public void doSelect() {
diskShareMapper.queryDiskShare(diskShare,pageNum,pageSize);
}
});
return ResultUtil.pageData(diskShares,total, "查询成功");
}
/**
* 云盘-移除我转发的文件-我转发的文件id
*/
@DeleteMapping(value = "/remove_share_file/{id}")
@ApiOperation(value = "14.云盘-移除我转发的文件-我转发的文件id", httpMethod = "DELETE", notes = "云盘-移除我转发的文件-我转发的文件id")
@ApiOperationSupport(order = 14)
public Result<Object> removeShareFile(@PathVariable Integer id){
DiskShare.builder().id(id).deleteFlag(1).build().updateById();
return ResultUtil.success();
}
}
......@@ -3,8 +3,11 @@ package cn.timer.api.dao.disk;
import cn.timer.api.bean.disk.DiskFilesLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 云盘-文件浏览记录表
*
......@@ -15,4 +18,9 @@ import org.springframework.stereotype.Repository;
@Repository
public interface DiskFilesLogMapper extends BaseMapper<DiskFilesLog> {
List<DiskFilesLog> queryDiskFilesLog(@Param("diskFilesLog") DiskFilesLog diskFilesLog,
@Param(value = "pageNum") Integer pageNum,
@Param(value = "pageSize") Integer pageSize);
}
......@@ -3,8 +3,11 @@ package cn.timer.api.dao.disk;
import cn.timer.api.bean.disk.DiskReceived;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 云盘-文件接收表
*
......@@ -15,4 +18,8 @@ import org.springframework.stereotype.Repository;
@Repository
public interface DiskReceivedMapper extends BaseMapper<DiskReceived> {
List<DiskReceived> queryDiskReceived(@Param("diskReceived") DiskReceived diskReceived,
@Param(value = "pageNum") Integer pageNum,
@Param(value = "pageSize") Integer pageSize);
}
......@@ -3,8 +3,11 @@ package cn.timer.api.dao.disk;
import cn.timer.api.bean.disk.DiskShare;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 云盘-文件分享表
*
......@@ -15,4 +18,7 @@ import org.springframework.stereotype.Repository;
@Repository
public interface DiskShareMapper extends BaseMapper<DiskShare> {
List<DiskShare> queryDiskShare(@Param("diskShare") DiskShare diskShare,
@Param(value = "pageNum") Integer pageNum,
@Param(value = "pageSize") Integer pageSize);
}
......@@ -15,6 +15,61 @@
<result property="userName" column="user_name"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<association property="diskFiles" javaType="diskFiles">
<id property="id" column="diskFiles_id"/>
<result property="title" column="diskFiles_title"/>
<result property="urlPath" column="diskFiles_url_path"/>
<result property="diskPath" column="diskFiles_disk_path"/>
<result property="fileSize" column="diskFiles_file_size"/>
<result property="showSize" column="diskFiles_show_size"/>
<result property="fileType" column="diskFiles_file_type"/>
<result property="uploadIp" column="diskFiles_upload_ip"/>
<result property="deleteFlag" column="diskFiles_delete_flag"/>
<result property="createUserId" column="diskFiles_create_user_id"/>
<result property="updateUserId" column="diskFiles_update_user_id"/>
<result property="createTime" column="diskFiles_create_time"/>
<result property="updateTime" column="diskFiles_update_time"/>
</association>
<association property="diskFileImage" javaType="diskFileImage">
<id property="id" column="diskFileImage_id"/>
<result property="type" column="diskFileImage_type"/>
<result property="title" column="diskFileImage_title"/>
<result property="url" column="diskFileImage_url"/>
<result property="deleteFlag" column="diskFileImage_delete_flag"/>
<result property="createUserId" column="diskFileImage_create_user_id"/>
<result property="createTime" column="diskFileImage_create_time"/>
</association>
</resultMap>
<select id="queryDiskFilesLog" resultMap="BaseResultMap">
SELECT
log.*,
df.show_size diskFiles_show_size,
df.file_type diskFiles_file_type,
dfi.url diskFileImage_url
FROM
( SELECT * FROM disk_files_log
WHERE user_id = #{diskFilesLog.userId}
and `type` != 5
<if test="diskFilesLog.title != null and diskFilesLog.title != '' and diskFilesLog.title != 'null'">
and title like CONCAT('%',#{diskFilesLog.title},'%')
</if>
<if test="diskFilesLog.type != null">
and `type` = #{diskFilesLog.type}
</if>
ORDER BY id DESC ) AS log
LEFT JOIN disk_files df ON log.files_id = df.id
LEFT JOIN disk_file_image dfi ON df.file_type = dfi.type
GROUP BY
log.files_id
ORDER BY
log.id DESC
</select>
</mapper>
\ No newline at end of file
......@@ -16,6 +16,50 @@
<result property="deleteFlag" column="delete_flag"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<association property="diskFiles" javaType="diskFiles">
<id property="id" column="diskFiles_id"/>
<result property="title" column="diskFiles_title"/>
<result property="urlPath" column="diskFiles_url_path"/>
<result property="diskPath" column="diskFiles_disk_path"/>
<result property="fileSize" column="diskFiles_file_size"/>
<result property="showSize" column="diskFiles_show_size"/>
<result property="fileType" column="diskFiles_file_type"/>
<result property="uploadIp" column="diskFiles_upload_ip"/>
<result property="deleteFlag" column="diskFiles_delete_flag"/>
<result property="createUserId" column="diskFiles_create_user_id"/>
<result property="updateUserId" column="diskFiles_update_user_id"/>
<result property="createTime" column="diskFiles_create_time"/>
<result property="updateTime" column="diskFiles_update_time"/>
</association>
<association property="diskFileImage" javaType="diskFileImage">
<id property="id" column="diskFileImage_id"/>
<result property="type" column="diskFileImage_type"/>
<result property="title" column="diskFileImage_title"/>
<result property="url" column="diskFileImage_url"/>
<result property="deleteFlag" column="diskFileImage_delete_flag"/>
<result property="createUserId" column="diskFileImage_create_user_id"/>
<result property="createTime" column="diskFileImage_create_time"/>
</association>
</resultMap>
<select id="queryDiskReceived" resultMap="BaseResultMap">
SELECT
dr.*,
df.show_size diskFiles_show_size,
df.file_type diskFiles_file_type,
dfi.url diskFileImage_url
FROM
`disk_received` dr
LEFT JOIN `disk_files` df ON dr.`files_id` = df.`id`
LEFT JOIN disk_file_image dfi ON df.file_type = dfi.type
WHERE dr.user_id = #{diskReceived.userId} and dr.delete_flag = 0
<if test="diskReceived.title != null and diskReceived.title != '' and diskReceived.title != 'null'">
and dr.title LIKE CONCAT('%',#{diskReceived.title},'%')
</if>
ORDER BY dr.`create_time` DESC
</select>
</mapper>
\ No newline at end of file
......@@ -17,6 +17,50 @@
<result property="deleteFlag" column="delete_flag"/>
<result property="expireTime" column="expire_time"/>
<result property="createTime" column="create_time"/>
<association property="diskFiles" javaType="diskFiles">
<id property="id" column="diskFiles_id"/>
<result property="title" column="diskFiles_title"/>
<result property="urlPath" column="diskFiles_url_path"/>
<result property="diskPath" column="diskFiles_disk_path"/>
<result property="fileSize" column="diskFiles_file_size"/>
<result property="showSize" column="diskFiles_show_size"/>
<result property="fileType" column="diskFiles_file_type"/>
<result property="uploadIp" column="diskFiles_upload_ip"/>
<result property="deleteFlag" column="diskFiles_delete_flag"/>
<result property="createUserId" column="diskFiles_create_user_id"/>
<result property="updateUserId" column="diskFiles_update_user_id"/>
<result property="createTime" column="diskFiles_create_time"/>
<result property="updateTime" column="diskFiles_update_time"/>
</association>
<association property="diskFileImage" javaType="diskFileImage">
<id property="id" column="diskFileImage_id"/>
<result property="type" column="diskFileImage_type"/>
<result property="title" column="diskFileImage_title"/>
<result property="url" column="diskFileImage_url"/>
<result property="deleteFlag" column="diskFileImage_delete_flag"/>
<result property="createUserId" column="diskFileImage_create_user_id"/>
<result property="createTime" column="diskFileImage_create_time"/>
</association>
</resultMap>
<select id="queryDiskShare" resultMap="BaseResultMap">
SELECT
ds.*,
df.show_size diskFiles_show_size,
df.file_type diskFiles_file_type,
dfi.url diskFileImage_url
FROM
`disk_share` ds
LEFT JOIN `disk_files` df ON ds.`files_id` = df.`id`
LEFT JOIN disk_file_image dfi ON df.file_type = dfi.type
WHERE ds.user_id = #{diskShare.userId} and ds.delete_flag = 0
<if test="diskShare.title != null and diskShare.title != '' and diskShare.title != 'null'">
and ds.title LIKE CONCAT('%',#{diskShare.title},'%')
</if>
ORDER BY ds.`create_time` DESC
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment