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.dto.disk.DiskFilesDto; 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 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; /** * 云盘-文件浏览记录表 * * @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{ @Autowired private DiskFilesLogMapper diskFilesLogMapper; /** * 云盘-最近查看列表 * * @param userBean * @return */ @GetMapping(value = "/recent_file_list") @ApiOperation(value = "11.最近查看", httpMethod = "GET", notes = "云盘-最近查看列表") @ApiOperationSupport(order = 11) 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, @ApiParam("类型:0查看,1下载,2创建") @RequestParam(required = false) String type) { Integer empNum = userBean.getEmpNum(); Integer orgCode = userBean.getOrgCode(); DiskFilesLog diskFilesLog = new DiskFilesLog(); diskFilesLog.setTitle(query); diskFilesLog.setUserId(empNum); try{ diskFilesLog.setType(Integer.valueOf(type)); }catch(Exception e){} List<DiskFilesDto> diskFilesLogs = diskFilesLogMapper.queryDiskFilesLog(diskFilesLog,orgCode,pageNum,pageSize); long total = PageHelper.count(new ISelect() { @Override public void doSelect() { diskFilesLogMapper.queryDiskFilesLog(diskFilesLog,orgCode,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(); } }