提交 162c1b14 作者: obcy

【通用信息源标签绑定接口-研究中心使用】

上级 ce70b2fb
......@@ -883,6 +883,19 @@ public class SubjectManageController {
List<InfoSourceLabelVO> bindList = clbLabelService.bindInfoSourceLabelInfo(subjectId);
return Result.OK(bindList);
}
/**
* 专题绑定的信息源标签列表
*
* @param subjectId 专题id
* @author lkg
* @date 2025/1/13
*/
@GetMapping("/subjectBindMainLabelList")
public Result<?> subjectBindMainLabelList(@RequestParam String subjectId) {
// List<InfoSourceLabelVO> bindList = clbLabelService.subjectBindMainLabelList(subjectId);
List<String> bindList = clbLabelService.subjectBindMainLabelList(subjectId);
return Result.OK(bindList);
}
/**
* 更新subject的数据范围
......@@ -945,6 +958,48 @@ public class SubjectManageController {
return Result.OK();
}
/**
* 绑定信息源标签数据
*
* @param infoSourceMainLabelVO 参数
* @author lkg
* @date 2025/1/3
*/
@PostMapping("/bindInfoSourceMainLabel")
public Result<?> bindInfoSourceMainLabel(@RequestBody InfoSourceMainLabelVO infoSourceMainLabelVO) {
String subjectId = infoSourceMainLabelVO.getSubjectId();
if (StringUtils.isEmpty(subjectId)) {
return Result.FAIL("专题id不能为空");
}
//支持全部删除
//不管有没有传值,先删后增
LambdaQueryWrapper<SubjectInfoSourceMap> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(SubjectInfoSourceMap::getSubjectId, subjectId).eq(SubjectInfoSourceMap::getType, 312);
int count = subjectInfoSourceMapService.count(queryWrapper);
if (count > 0) {
subjectInfoSourceMapService.remove(queryWrapper);
}
List<String> labelList = infoSourceMainLabelVO.getInfoSourceLabelItemList();
String labelCode = infoSourceMainLabelVO.getLabelCode();
List<SubjectInfoSourceMap> dataList = new ArrayList<>();
for (String labelItemCode : labelList) {
SubjectInfoSourceMap subjectInfoSourceMap = new SubjectInfoSourceMap();
subjectInfoSourceMap.setSubjectId(subjectId);
subjectInfoSourceMap.setSourceId(labelCode);
subjectInfoSourceMap.setSourceItemId(labelItemCode);
subjectInfoSourceMap.setType(312);
dataList.add(subjectInfoSourceMap);
}
if (CollectionUtils.isNotEmpty(dataList)) {
subjectInfoSourceMapService.saveBatch(dataList);
}
//同步配置到采集
configurationMessageService.bindInfoSourceSend(subjectId);
return Result.OK();
}
/**
* 专题已绑定的定向信息源分页列表(专题绑定定向信息源时使用-研究中心)
......
......@@ -36,4 +36,6 @@ public interface ClbLabelMapper extends BaseMapper<ClbLabel> {
* @date 2025/1/2
*/
List<InfoSourceLabelVO> labelInfoByType(@Param("labelTypeId") String labelTypeId);
List<String> subjectBindMainLabelList(@Param("subjectId") String subjectId);
}
......@@ -25,4 +25,10 @@
where label.label_type_id = #{labelTypeId}
order by label.order_no,item.order_no
</select>
<select id="subjectBindMainLabelList" resultType="java.lang.String">
select m.source_item_id
from subject_info_source_map m
where m.subject_id = #{subjectId} and m.type = 312
</select>
</mapper>
\ No newline at end of file
......@@ -33,4 +33,6 @@ public interface ClbLabelService extends IService<ClbLabel> {
* @date 2025/1/2
*/
List<InfoSourceLabelVO> labelInfoByType(String labelTypeId);
List<String> subjectBindMainLabelList(String subjectId);
}
......@@ -30,4 +30,9 @@ public class ClbLabelServiceImpl extends ServiceImpl<ClbLabelMapper, ClbLabel> i
public List<InfoSourceLabelVO> labelInfoByType(String labelTypeId) {
return baseMapper.labelInfoByType(labelTypeId);
}
@Override
public List<String> subjectBindMainLabelList(String subjectId) {
return baseMapper.subjectBindMainLabelList(subjectId);
}
}
package com.zzsn.event.vo;
import lombok.Data;
import java.util.List;
/**
* 信息源标签对象信息
*
* @author lkg
* @date 2025/1/2
*/
@Data
public class InfoSourceMainLabelVO {
/**专题id*/
private String subjectId;
/**信息源标签编码*/
private String labelCode;
/**信息源标签名称*/
private String labelName;
/**信息源标签下的标签值列表*/
private List<String> infoSourceLabelItemList;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论