This commit is contained in:
77
2024-07-07 23:19:25 +08:00
parent cf66c432d3
commit 8c8a4a268d

View File

@@ -1,5 +1,6 @@
package com.ruoyi.cai.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.cai.domain.Anchor;
@@ -43,6 +44,10 @@ public class AnchorBannerServiceImpl extends ServiceImpl<AnchorBannerMapper, Anc
if(anchor == null){
throw new ServiceException("非主播无法添加首页推荐");
}
boolean exists = this.exists(Wrappers.lambdaQuery(AnchorBanner.class).eq(AnchorBanner::getUserId, user.getId()));
if(exists){
throw new ServiceException("该主播已加入首页推荐,无法重复推荐");
}
bo.setUserId(user.getId());
bo.setAnchorId(anchor.getId());
this.save(bo);