| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- package com.doc.biz.service.impl;
- import com.doc.biz.domain.DocInfo;
- import com.doc.biz.domain.DocRecent;
- import com.doc.biz.mapper.DocRecentMapper;
- import com.doc.biz.service.IDocInfoService;
- import com.doc.biz.service.IDocRecentService;
- import com.doc.common.utils.DateUtils;
- import org.springframework.stereotype.Service;
- import javax.annotation.Resource;
- import java.util.List;
- /**
- * 最近文件Service业务层处理
- *
- * @author wukai
- * @date 2023-08-15
- */
- @Service
- public class DocRecentServiceImpl implements IDocRecentService {
- @Resource
- private DocRecentMapper docRecentMapper;
- @Resource
- private IDocInfoService infoService;
- /**
- * 查询最近文件
- *
- * @param recentId 最近文件主键
- * @return 最近文件
- */
- @Override
- public DocRecent selectDocRecentByRecentId(Long recentId) {
- return docRecentMapper.selectDocRecentByRecentId(recentId);
- }
- /**
- * 查询最近文件列表
- *
- * @param docRecent 最近文件
- * @return 最近文件
- */
- @Override
- public List<DocRecent> selectDocRecentList(DocRecent docRecent) {
- return docRecentMapper.selectDocRecentList(docRecent);
- }
- /**
- * 新增最近文件
- *
- * @param docRecent 最近文件
- * @return 结果
- */
- @Override
- public int insertDocRecent(DocRecent docRecent) {
- docRecent.setCreateTime(DateUtils.getNowDate());
- return docRecentMapper.insertDocRecent(docRecent);
- }
- /**
- * @param uid 用户ID
- * @param fileId 文件ID
- * @return
- */
- @Override
- public int insertDocRecent(Long uid, String fileId) {
- DocInfo info = infoService.selectDocInfoByFileId(fileId);
- if (info != null) {
- //插入最近访问记录
- //如果info=null,则代表是查看历史版本文件,不需要记录
- DocRecent recent = new DocRecent();
- recent.setIsFolder("N");
- recent.setOwner(uid);
- recent.setRelaId(info.getDocId());
- return insertDocRecent(recent);
- }
- return 0;
- }
- /**
- * 修改最近文件
- *
- * @param docRecent 最近文件
- * @return 结果
- */
- @Override
- public int updateDocRecent(DocRecent docRecent) {
- docRecent.setUpdateTime(DateUtils.getNowDate());
- return docRecentMapper.updateDocRecent(docRecent);
- }
- /**
- * 批量删除最近文件
- *
- * @param recentIds 需要删除的最近文件主键
- * @return 结果
- */
- @Override
- public int deleteDocRecentByRecentIds(Long[] recentIds) {
- return docRecentMapper.deleteDocRecentByRecentIds(recentIds);
- }
- /**
- * 删除最近文件信息
- *
- * @param recentId 最近文件主键
- * @return 结果
- */
- @Override
- public int deleteDocRecentByRecentId(Long recentId) {
- return docRecentMapper.deleteDocRecentByRecentId(recentId);
- }
- }
|