DiskFilesLogController.java 3.54 KB
Newer Older
284718418@qq.com committed
1 2
package cn.timer.api.controller.disk;

3 4 5 6 7 8
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;
9
import cn.timer.api.dto.disk.DiskFilesDto;
10 11 12 13 14 15 16 17
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;
284718418@qq.com committed
18
import io.swagger.annotations.Api;
19 20 21 22
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
284718418@qq.com committed
23 24

import javax.transaction.Transactional;
25
import java.util.List;
284718418@qq.com committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40


/**
 * 云盘-文件浏览记录表
 * 
 * @author wuqingjun
 * @email 284718418@qq.com
 * @date 2021-12-27 10:05:49
 */
@Api(tags = "云盘")
@Transactional(rollbackOn = Exception.class)
@RestController
@RequestMapping("diskfileslog")
public class DiskFilesLogController{

41 42 43 44 45 46 47 48 49 50 51 52
    @Autowired
    private DiskFilesLogMapper diskFilesLogMapper;

    /**
     * 云盘-最近查看列表
     *
     * @param userBean
     * @return
     */
    @GetMapping(value = "/recent_file_list")
    @ApiOperation(value = "11.最近查看", httpMethod = "GET", notes = "云盘-最近查看列表")
    @ApiOperationSupport(order = 11)
53
    public Result<List<DiskFilesDto>> recentFileList(@CurrentUser UserBean userBean,
54 55 56 57 58
                                                     @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();
龙于生 committed
59
        Integer orgCode = userBean.getOrgCode();
60 61 62 63 64 65 66 67

        DiskFilesLog diskFilesLog = new DiskFilesLog();
        diskFilesLog.setTitle(query);
        diskFilesLog.setUserId(empNum);
        try{
            diskFilesLog.setType(Integer.valueOf(type));
        }catch(Exception e){}

68
        List<DiskFilesDto> diskFilesLogs = diskFilesLogMapper.queryDiskFilesLog(diskFilesLog,orgCode,pageNum,pageSize);
69 70 71 72

        long total = PageHelper.count(new ISelect() {
            @Override
            public void doSelect() {
龙于生 committed
73
                diskFilesLogMapper.queryDiskFilesLog(diskFilesLog,orgCode,pageNum,pageSize);
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
            }
        });

        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();
    }

284718418@qq.com committed
92
}