1231123
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.cai.service.impl;
|
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.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.cai.domain.Anchor;
|
import com.ruoyi.cai.domain.Anchor;
|
||||||
@@ -43,6 +44,10 @@ public class AnchorBannerServiceImpl extends ServiceImpl<AnchorBannerMapper, Anc
|
|||||||
if(anchor == null){
|
if(anchor == null){
|
||||||
throw new ServiceException("非主播无法添加首页推荐");
|
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.setUserId(user.getId());
|
||||||
bo.setAnchorId(anchor.getId());
|
bo.setAnchorId(anchor.getId());
|
||||||
this.save(bo);
|
this.save(bo);
|
||||||
|
|||||||
Reference in New Issue
Block a user