Browse Source

[feat]修复图片比对标签查询重复问题

dev
杨威 1 week ago
parent
commit
979f699f2f
  1. 11
      dk-modules/system/src/main/java/org/dromara/system/service/impl/AiLabelServiceImpl.java
  2. 16
      dk-modules/system/src/main/resources/mapper/system/AiLabelPostMapper.xml

11
dk-modules/system/src/main/java/org/dromara/system/service/impl/AiLabelServiceImpl.java

@ -181,17 +181,8 @@ public class AiLabelServiceImpl implements IAiLabelService {
@Override @Override
public List<AiLabelVo> selectLabelList() { public List<AiLabelVo> selectLabelList() {
List<SysPostVo> sysPostVos = sysPostService.selectPostAll();
List<Long> postIdList = Optional.ofNullable(sysPostVos)
.orElse(Collections.emptyList())
.stream()
.map(SysPostVo::getPostId)
.distinct()
.toList();
List<AiLabelPostVo> aiLabelList = aiLabelPostService.getAiLabelList(); List<AiLabelPostVo> aiLabelList = aiLabelPostService.getAiLabelList();
return aiLabelList.stream().filter(p-> postIdList.contains(p.getPostId())) return aiLabelList.stream()
.map(aiLabel -> { .map(aiLabel -> {
AiLabelVo aiLabelVo = new AiLabelVo(); AiLabelVo aiLabelVo = new AiLabelVo();
aiLabelVo.setLabelId(aiLabel.getLabelId()); aiLabelVo.setLabelId(aiLabel.getLabelId());

16
dk-modules/system/src/main/resources/mapper/system/AiLabelPostMapper.xml

@ -13,6 +13,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectAiLabelPost" resultType="org.dromara.system.domain.vo.AiLabelPostVo"> <select id="selectAiLabelPost" resultType="org.dromara.system.domain.vo.AiLabelPostVo">
SELECT *,a.label_cn ,label_en FROM ai_label_post p inner JOIN ai_label a ON p.label_id = a.label_id SELECT
a.label_id labelId,
a.label_en labelEn,
a.label_cn labelCn,
a.ai_name aiName
FROM
ai_label a
WHERE
EXISTS (
SELECT
*
FROM
ai_label_post alp
WHERE
alp.label_id = a.label_id)
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save