Commit 45a18051 by 阳浪

收藏

parent 6649922a
......@@ -30,6 +30,15 @@ public interface StudyCaseClient {
boolean admireStudentCase(@RequestParam("studentCaseId") Long studentCaseId);
/**
* 学习案例是否收藏
*
* @param studentCaseId
* @return
*/
@GetMapping("/studentCase/study/favoriteStudentCase")
boolean favoriteStudentCase(@RequestParam("studentCaseId") Long studentCaseId);
/**
* 学习案例取消点赞
*
* @param studentCaseId
......
......@@ -43,6 +43,12 @@ public class StudyCaseController implements StudyCaseClient {
}
@Override
@GetMapping("/favoriteStudentCase")
public boolean favoriteStudentCase(Long studentCaseId) {
return favoriteService.favoriteStudentCase(studentCaseId);
}
@Override
@GetMapping("/cancelAdmire")
public boolean cancelAdmireStudentCase(Long studentCaseId) {
return admireRecordeService.cancelAdmireStudentCase(studentCaseId);
......
......@@ -26,4 +26,11 @@ public interface IFavoriteService extends IService<Favorite> {
* @return
*/
boolean cancelFavorite(Long studentCaseId);
/**
* 学习案例是否收藏
* @param studentCaseId
* @return
*/
boolean favoriteStudentCase(Long studentCaseId);
}
......@@ -64,4 +64,16 @@ public class FavoriteServiceImpl extends ServiceImpl<FavoriteMapper, Favorite> i
return this.delete(new EntityWrapper<>(favorite));
}
@Override
public boolean favoriteStudentCase(Long studentCaseId){
RequestContext res = ContextHolder.get();
Favorite favorite = new Favorite();
favorite.setBizId(studentCaseId);
favorite.setAccountId(res.getAccountId());
favorite.setState(1);
int count = this.selectCount(new EntityWrapper<>(favorite));
return count>0;
}
}
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