Commit daf83d2f by 龙于生

云盘 查看文件新增记录接口

parent 5f8bb5e1
......@@ -283,4 +283,22 @@ public class DiskFilesController {
}
}
@ApiOperation(value = "新增文件查看记录", httpMethod = "GET", notes = "新增文件查看记录")
@GetMapping(value = "/look_log/{fileId}")
public Result<Object> lookLog(@CurrentUser UserBean userBean, @ApiParam("文件ID") @PathVariable Integer fileId){
DiskFiles diskFiles = DiskFiles.builder().id(fileId).build().selectById();
DiskFilesLog diskFilesLog = DiskFilesLog.builder().build();
//新增 文件浏览记录
diskFilesLog.setFilePath(diskFiles.getUrlPath());
diskFilesLog.setFilesId(diskFiles.getId());
diskFilesLog.setFileSize(diskFiles.getFileSize() + "B");
diskFilesLog.setTitle(diskFiles.getTitle());
diskFilesLog.setType(JxglEnumInterface.DiskFilesLogType.LOOK_LOG.getType());
diskFilesLog.setUserId(userBean.getEmpNum());
diskFilesLog.setUserName(userBean.getQyzxEmpLogin().getUsername());
diskFilesLog.insert();
return ResultUtil.success();
}
}
......@@ -6,6 +6,7 @@ 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.dto.disk.DiskFilesDto;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -49,7 +50,7 @@ public class DiskFilesLogController{
@GetMapping(value = "/recent_file_list")
@ApiOperation(value = "11.最近查看", httpMethod = "GET", notes = "云盘-最近查看列表")
@ApiOperationSupport(order = 11)
public Result<List<DiskFilesLog>> recentFileList(@CurrentUser UserBean userBean,
public Result<List<DiskFilesDto>> 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,
......@@ -64,7 +65,7 @@ public class DiskFilesLogController{
diskFilesLog.setType(Integer.valueOf(type));
}catch(Exception e){}
List<DiskFilesLog> diskFilesLogs = diskFilesLogMapper.queryDiskFilesLog(diskFilesLog,orgCode,pageNum,pageSize);
List<DiskFilesDto> diskFilesLogs = diskFilesLogMapper.queryDiskFilesLog(diskFilesLog,orgCode,pageNum,pageSize);
long total = PageHelper.count(new ISelect() {
@Override
......
......@@ -6,6 +6,7 @@ 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.dto.disk.DiskFilesDto;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import com.github.pagehelper.ISelect;
......@@ -46,7 +47,7 @@ public class DiskReceivedController{
@GetMapping(value = "/received_file_list")
@ApiOperation(value = "13.我收到的", httpMethod = "GET", notes = "云盘-我收到的")
@ApiOperationSupport(order = 13)
public Result<List<DiskReceived>> receivedFileList(@CurrentUser UserBean userBean,
public Result<List<DiskFilesDto>> 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) {
......@@ -57,7 +58,7 @@ public class DiskReceivedController{
diskReceived.setTitle(query);
diskReceived.setUserId(empNum);
List<DiskReceived> diskReceiveds = diskReceivedMapper.queryDiskReceived(diskReceived,orgCode,pageNum,pageSize);
List<DiskFilesDto> diskReceiveds = diskReceivedMapper.queryDiskReceived(diskReceived,orgCode,pageNum,pageSize);
long total = PageHelper.count(new ISelect() {
@Override
......
......@@ -6,6 +6,7 @@ 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.dto.disk.DiskFilesDto;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import com.github.pagehelper.ISelect;
......@@ -46,7 +47,7 @@ public class DiskShareController{
@GetMapping(value = "/forwarded_file_list")
@ApiOperation(value = "12.我转发的", httpMethod = "GET", notes = "云盘-我转发的")
@ApiOperationSupport(order = 12)
public Result<List<DiskShare>> forwardedFileList(@CurrentUser UserBean userBean,
public Result<List<DiskFilesDto>> 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) {
......@@ -57,7 +58,7 @@ public class DiskShareController{
diskShare.setTitle(query);
diskShare.setUserId(empNum);
List<DiskShare> diskShares = diskShareMapper.queryDiskShare(diskShare,orgCode,pageNum,pageSize);
List<DiskFilesDto> diskShares = diskShareMapper.queryDiskShare(diskShare,orgCode,pageNum,pageSize);
long total = PageHelper.count(new ISelect() {
@Override
......
......@@ -2,6 +2,7 @@ package cn.timer.api.dao.disk;
import cn.timer.api.bean.disk.DiskFilesLog;
import cn.timer.api.dto.disk.DiskFilesDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -18,10 +19,15 @@ import java.util.List;
@Repository
public interface DiskFilesLogMapper extends BaseMapper<DiskFilesLog> {
List<DiskFilesLog> queryDiskFilesLog(@Param("diskFilesLog") DiskFilesLog diskFilesLog,
// List<DiskFilesLog> queryDiskFilesLog(@Param("diskFilesLog") DiskFilesLog diskFilesLog,
// @Param("orgId") Integer orgId,
// @Param(value = "pageNum") Integer pageNum,
// @Param(value = "pageSize") Integer pageSize);
List<DiskFilesDto> queryDiskFilesLog(@Param("diskFilesLog") DiskFilesLog diskFilesLog,
@Param("orgId") Integer orgId,
@Param(value = "pageNum") Integer pageNum,
@Param(value = "pageSize") Integer pageSize);
}
......@@ -2,6 +2,7 @@ package cn.timer.api.dao.disk;
import cn.timer.api.bean.disk.DiskReceived;
import cn.timer.api.dto.disk.DiskFilesDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -18,9 +19,16 @@ import java.util.List;
@Repository
public interface DiskReceivedMapper extends BaseMapper<DiskReceived> {
List<DiskReceived> queryDiskReceived(@Param("diskReceived") DiskReceived diskReceived,
// List<DiskReceived> queryDiskReceived(@Param("diskReceived") DiskReceived diskReceived,
// @Param("orgId") Integer orgId,
// @Param(value = "pageNum") Integer pageNum,
// @Param(value = "pageSize") Integer pageSize);
List<DiskFilesDto> queryDiskReceived(@Param("diskReceived") DiskReceived diskReceived,
@Param("orgId") Integer orgId,
@Param(value = "pageNum") Integer pageNum,
@Param(value = "pageSize") Integer pageSize);
}
......@@ -2,6 +2,7 @@ package cn.timer.api.dao.disk;
import cn.timer.api.bean.disk.DiskShare;
import cn.timer.api.dto.disk.DiskFilesDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -18,8 +19,13 @@ import java.util.List;
@Repository
public interface DiskShareMapper extends BaseMapper<DiskShare> {
List<DiskShare> queryDiskShare(@Param("diskShare") DiskShare diskShare,
@Param("orgId") Integer orgId,
@Param(value = "pageNum") Integer pageNum,
@Param(value = "pageSize") Integer pageSize);
// List<DiskShare> queryDiskShare(@Param("diskShare") DiskShare diskShare,
// @Param("orgId") Integer orgId,
// @Param(value = "pageNum") Integer pageNum,
// @Param(value = "pageSize") Integer pageSize);
List<DiskFilesDto> queryDiskShare(@Param("diskShare") DiskShare diskShare,
@Param("orgId") Integer orgId,
@Param(value = "pageNum") Integer pageNum,
@Param(value = "pageSize") Integer pageSize);
}
package cn.timer.api.dto.disk;
import cn.timer.api.config.exception.ValidationMsg;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* @author wuqingjun
......@@ -24,17 +31,91 @@ public class DiskFilesDto implements Serializable{
private static final long serialVersionUID = -1230023773946170921L;
/**
* 资源目录ID
* 主键ID
*/
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "资源目录ID")
private Integer catalogueId;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号")
private Integer id;
/**
* 文件标题
*/
@ApiModelProperty(value = "文件标题")
private String title;
/**
* 文件路径
*/
@ApiModelProperty(value = "文件路径")
private String urlPath;
/**
* 文件物理路径
*/
@ApiModelProperty(value = "文件物理路径")
private String diskPath;
/**
* 文件大小,单位kb
*/
@ApiModelProperty(value = "文件大小,单位kb")
private Long fileSize;
/**
* 显示大小
*/
@ApiModelProperty(value = "显示大小:10KB,5M,2G")
private String showSize;
/**
* 文件格式类型
*/
@ApiModelProperty(value = "文件格式类型")
private String fileType;
/**
* 上传文件时的IP
*/
@ApiModelProperty(value = "上传文件时的IP")
private String uploadIp;
/**
* 逻辑删除标记0.未删除 1.删除
*/
@ApiModelProperty(value = "")
private Integer deleteFlag;
/**
* 创建者
*/
@ApiModelProperty(value = "")
private Integer createUserId;
/**
* 用户姓名
*/
@ApiModelProperty(value = "用户姓名")
private String userName;
/**
* 更新者
*/
@ApiModelProperty(value = "")
private Integer updateUserId;
/**
* 创建时间
*/
@ApiModelProperty(value = "")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "")
private Date updateTime;
/**
* 文件图标
*/
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "文件图标")
private String url;
/**
* 0云盘,1文件夹
* 对象id
*/
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "0云盘,1文件夹")
private Integer type;
@ApiModelProperty(value = "对象id")
private Integer objId;
}
......@@ -17,62 +17,46 @@
<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 id="queryDiskFilesLog" resultType="cn.timer.api.dto.disk.DiskFilesDto">
SELECT
log.*,
df.id diskFiles_id,
df.show_size diskFiles_show_size,
df.file_type diskFiles_file_type,
dfi.url diskFileImage_url
df.id,
df.show_size,
df.file_type,
df.url_path,
dfi.url,
log.id obj_id,
log.title,
log.update_time,
log.user_name
FROM
(SELECT * FROM disk_files_log WHERE id IN (SELECT MAX(id) 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">
(SELECT * FROM disk_files_log WHERE id IN (SELECT MAX(id) FROM disk_files_log
WHERE
user_id = #{diskFilesLog.userId}
and `delete_flag` = 0
<if test="diskFilesLog.title != null and diskFilesLog.title != '' and diskFilesLog.title != 'null'">
and title like CONCAT('%',#{diskFilesLog.title},'%')
</if>
<choose>
<when test="diskFilesLog.type != null">
and `type` = #{diskFilesLog.type}
</if>
GROUP BY files_id )) 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
LEFT JOIN disk_catalogue_files dcf ON df.id = dcf.files_id
LEFT JOIN disk_catalogue dc ON dc.id = dcf.catalogue_id
WHERE dc.org_id=#{orgId}
</when>
<otherwise>
and `type` <![CDATA[ <= ]]> 1
</otherwise>
</choose>
GROUP BY files_id )) 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
LEFT JOIN disk_catalogue_files dcf ON df.id = dcf.files_id
LEFT JOIN disk_catalogue dc ON dc.id = dcf.catalogue_id
WHERE dc.org_id=#{orgId}
GROUP BY
log.files_id
log.files_id
ORDER BY
log.id DESC
log.id DESC
</select>
......
......@@ -17,40 +17,20 @@
<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 id="queryDiskReceived" resultType="cn.timer.api.dto.disk.DiskFilesDto">
SELECT
dr.*,
df.id diskFiles_id,
df.show_size diskFiles_show_size,
df.file_type diskFiles_file_type,
dfi.url diskFileImage_url
df.id,
df.show_size,
df.file_type,
df.url_path,
dfi.url,
dr.id obj_id,
dr.title,
dr.update_time,
dr.user_name
FROM
`disk_received` dr
LEFT JOIN `disk_files` df ON dr.`files_id` = df.`id`
......
......@@ -18,50 +18,30 @@
<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 id="queryDiskShare" resultType="cn.timer.api.dto.disk.DiskFilesDto">
SELECT
ds.*,
df.id diskFiles_id,
df.show_size diskFiles_show_size,
df.file_type diskFiles_file_type,
dfi.url diskFileImage_url
df.id,
df.show_size,
df.file_type,
df.url_path,
dfi.url,
ds.id obj_id,
ds.title,
ds.create_time update_time,
ds.user_name
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
LEFT JOIN disk_catalogue_files dcf ON df.id = dcf.files_id
LEFT JOIN disk_catalogue dc ON dc.id = dcf.catalogue_id
`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
LEFT JOIN disk_catalogue_files dcf ON df.id = dcf.files_id
LEFT JOIN disk_catalogue dc ON dc.id = dcf.catalogue_id
WHERE dc.org_id=#{orgId} AND 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>
<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>
......
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