|
|
@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.dromara.system.domain.AiLabelPost; |
|
|
|
import org.dromara.system.domain.bo.AiLablePostBindBo; |
|
|
|
import org.dromara.system.domain.bo.AiLabelPostBindBo; |
|
|
|
import org.dromara.system.domain.vo.AiLabelPostVo; |
|
|
|
import org.dromara.system.mapper.AiLabelMapper; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -33,7 +33,7 @@ import java.util.Collection; |
|
|
|
public class AiLablePostServiceImpl implements IAiLabelPostService { |
|
|
|
|
|
|
|
private final AiLabelPostMapper baseMapper; |
|
|
|
private final AiLabelMapper aiLabelMapper; |
|
|
|
private final AiLabelPostMapper aiLabelPostMapper; |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询职能-标签关系 |
|
|
@ -128,20 +128,33 @@ public class AiLablePostServiceImpl implements IAiLabelPostService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<AiLabelPost> queryListByLabel(Long postId) { |
|
|
|
LambdaQueryWrapper<AiLabelPost> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
public List<AiLabelPostVo> queryListByLabel(Long postId) { |
|
|
|
return aiLabelPostMapper.queryListByLabel(postId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 保存前的数据校验 |
|
|
|
*/ |
|
|
|
private void delPostId(Long postId){ |
|
|
|
//新增前先删除之前的标签
|
|
|
|
QueryWrapper<AiLabelPost> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("post_id", postId); |
|
|
|
baseMapper.delete(queryWrapper); |
|
|
|
} |
|
|
|
@Override |
|
|
|
public List<AiLabelPost> queryListLabel(Long postId) { |
|
|
|
LambdaQueryWrapper<AiLabelPost> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
wrapper.eq(AiLabelPost::getPostId, postId); |
|
|
|
|
|
|
|
return this.baseMapper.selectList(wrapper); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Boolean insertByBatchBo(AiLablePostBindBo aiLablePostBindBo) { |
|
|
|
public Boolean insertByBatchBo(AiLabelPostBindBo aiLabelPostBindBo) { |
|
|
|
delPostId(aiLabelPostBindBo.getPostId()); |
|
|
|
List<AiLabelPost> resultlist = new ArrayList<>(); |
|
|
|
for (Long labelId : aiLablePostBindBo.getLableIdList()) { |
|
|
|
for (Long labelId : aiLabelPostBindBo.getLableIdList()) { |
|
|
|
AiLabelPost ailabelPost = new AiLabelPost(); |
|
|
|
ailabelPost.setPostId(aiLablePostBindBo.getPostId()); |
|
|
|
ailabelPost.setPostId(aiLabelPostBindBo.getPostId()); |
|
|
|
ailabelPost.setLabelId(labelId); |
|
|
|
resultlist.add(ailabelPost); |
|
|
|
} |
|
|
|