文档库--订阅

This commit is contained in:
zhn
2022-02-24 09:29:34 +08:00
parent e28bfa11a6
commit 128eadbe3e
3 changed files with 75 additions and 0 deletions
@@ -314,6 +314,42 @@ public class BussDocumentLibraryEOController extends JeroController<BussDocument
return Result.OK("取消收藏成功");
}
/**
* 添加订阅
* @param id
* @return
*/
@AutoLog(value = "添加订阅")
@ApiOperation(value="添加订阅", notes="添加订阅")
@GetMapping(value = "/addSubscribe")
public Result<?> addSubscribe(String id) {
try {
bussDocumentLibraryEOService.addSubscribe(id);
} catch (Exception e) {
return Result.error("订阅失败");
}
return Result.OK("订阅成功");
}
/**
* 取消订阅
* @param id
* @return
*/
@AutoLog(value = "取消订阅")
@ApiOperation(value="取消订阅", notes="取消订阅")
@GetMapping(value = "/cancelSubscribe")
public Result<?> cancelSubscribe(String id) {
try {
bussDocumentLibraryEOService.cancelSubscribe(id);
} catch (Exception e) {
return Result.error("取消订阅失败");
}
return Result.OK("取消订阅成功");
}
}
@@ -119,5 +119,17 @@ public interface IBussDocumentLibraryEOService extends IService<BussDocumentLibr
*/
void cancelCollect(String id);
/**
* 添加订阅
* @param id
*/
void addSubscribe(String id);
/**
* 取消订阅
* @param id
*/
void cancelSubscribe(String id);
}
@@ -18,6 +18,8 @@ import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.subscribe.entity.OnlCgformSubscribe;
import com.jero.modules.subscribe.service.IOnlCgformSubscribeService;
import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import com.jero.modules.tag.entity.OnlCgformArea;
@@ -59,6 +61,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
private SysDictItemServiceImpl sysDictItemServiceImpl;
@Autowired
private IOnlCgformCollectionService iOnlCgformCollectionService;
@Autowired
private IOnlCgformSubscribeService iOnlCgformSubscribeService;
/**
@@ -745,6 +749,9 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
onlCgformCollection.setDocumentId(id);
iOnlCgformCollectionService.add(onlCgformCollection);
//订阅表中添加数据
OnlCgformSubscribe onlCgformSubscribe = new OnlCgformSubscribe();
onlCgformSubscribe.setDocumentId(id);
iOnlCgformSubscribeService.add(onlCgformSubscribe);
}
@Override
@@ -754,5 +761,25 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
lambdaQueryWrapper.in(OnlCgformCollection::getDocumentId,id);
iOnlCgformCollectionService.remove(lambdaQueryWrapper);
//订阅表中删除数据
LambdaQueryWrapper<OnlCgformSubscribe> wrapper = new LambdaQueryWrapper<>();
wrapper.in(OnlCgformSubscribe::getDocumentId,id);
iOnlCgformSubscribeService.remove(wrapper);
}
@Override
public void addSubscribe(String id) {
//订阅表中添加数据
OnlCgformSubscribe onlCgformSubscribe = new OnlCgformSubscribe();
onlCgformSubscribe.setDocumentId(id);
iOnlCgformSubscribeService.add(onlCgformSubscribe);
}
@Override
public void cancelSubscribe(String id) {
//订阅表中删除数据
LambdaQueryWrapper<OnlCgformSubscribe> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(OnlCgformSubscribe::getDocumentId,id);
iOnlCgformSubscribeService.remove(lambdaQueryWrapper);
}
}