提交 ae92a653 作者: yanxin

支撑根据分组查询绑定标签字典

上级 f398883f
......@@ -22,29 +22,29 @@ public interface SubjectDictMapMapper extends BaseMapper<SubjectDictMap> {
/**
* 专题绑定的数据字典信息
*
* @param subjectId 专题id
* @param subjectIdList 专题id
* @author lkg
* @date 2025/3/28
*/
List<DictVO> boundList(@Param("subjectId") String subjectId);
List<DictVO> boundList(@Param("subjectIdList") List<String> subjectIdList);
List<String> boundIdList(@Param("subjectId") String subjectId);
List<String> boundIdList(@Param("subjectIdList") List<String> subjectIdList);
/**
* 流程中标签模型绑定的数据字典信息
*
* @param subjectId
* @param subjectIdList
* @return
*/
List<DictVO> boundArrangeList(@Param("subjectId") String subjectId);
List<DictVO> boundArrangeList(@Param("subjectIdList") List<String> subjectIdList);
/**
* 老逻辑中标签模型绑定的数据字典信息
*
* @param subjectId
* @param subjectIdList
* @return
*/
List<DictVO> boundOldList(@Param("subjectId") String subjectId);
List<DictVO> boundOldList(@Param("subjectIdList") List<String> subjectIdList);
/**
* 查询非数据字典的标签类型
......
......@@ -125,4 +125,6 @@ public interface SubjectMapper extends BaseMapper<Subject> {
List<String> getBindSubjectIds(@Param("id") String id);
String getMinCreateTime(@Param("subjectIdList") List<String> subjectIdList);
List<String> getIdListByType(@Param("typeId") String typeId);
}
......@@ -16,12 +16,18 @@
select d.id,d.dict_code as code,d.dict_name as name,'bind' as type
from subject_dict_map m
inner join clb_system.sys_dict d on m.dict_id = d.id
where m.subject_id = #{subjectId}
where m.subject_id in
<foreach collection="subjectIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="boundIdList" resultType="String">
select dict_id
from subject_dict_map
where subject_id = #{subjectId}
where subject_id in
<foreach collection="subjectIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="boundArrangeList" resultType="com.zzsn.event.vo.DictVO">
......@@ -39,7 +45,11 @@
WHERE
arrange_id IN
(SELECT DISTINCT arrange_id FROM clb_model_arrange_subject_map
WHERE subject_id = #{subjectId} AND del_flag = 0 )
WHERE subject_id in
<foreach collection="subjectIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
AND del_flag = 0 )
AND del_flag = 0
AND base_node_id = '1872120615905812482')
and (label_id is not null or dict_code is not null)
......@@ -53,7 +63,11 @@
WHERE
type = 3 AND id IN
(SELECT DISTINCT model_id FROM subject_model_map
WHERE subject_id = #{subjectId} AND type = 3)
WHERE subject_id in
<foreach collection="subjectIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
AND type = 3)
</select>
<select id="findLabelType" resultType="com.zzsn.event.vo.DictVO">
......
......@@ -329,4 +329,8 @@
</foreach>
</if>
</select>
<select id="getIdListByType" resultType="java.lang.String">
select DISTINCT subject_id from subject_type_map where type_id = #{typeId}
</select>
</mapper>
......@@ -212,4 +212,11 @@ public interface SubjectService extends IService<Subject> {
Subject getSubjectOrEventById(String id);
/**根据编码查询专题或者事件*/
Subject getSubjectOrEvent(String subjectCode);
/**
* 根据分组获取专题id列表
* @param typeId
* @return
*/
List<String> getIdListByType(String typeId);
}
......@@ -3,19 +3,19 @@ package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.Subject;
import com.zzsn.event.entity.SubjectDictMap;
import com.zzsn.event.service.SubjectDictMapService;
import com.zzsn.event.mapper.SubjectDictMapMapper;
import com.zzsn.event.service.SubjectService;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.DictVO;
import com.zzsn.event.vo.SubjectBindLabelParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.TreeSet;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -27,6 +27,9 @@ import java.util.stream.Stream;
@Service
public class SubjectDictMapServiceImpl extends ServiceImpl<SubjectDictMapMapper, SubjectDictMap> implements SubjectDictMapService{
@Autowired
private SubjectService subjectService;
@Override
public void modify(SubjectBindLabelParam bindLabelParam) {
String subjectId = bindLabelParam.getSubjectId();
......@@ -49,9 +52,18 @@ public class SubjectDictMapServiceImpl extends ServiceImpl<SubjectDictMapMapper,
@Override
public List<DictVO> boundList(String subjectId) {
Subject byId = subjectService.getById(subjectId);
List<String> subjectIdList = Collections.singletonList(subjectId);
if(byId == null){
//不是专题时,根据分组获取专题列表
subjectIdList = subjectService.getIdListByType(subjectId);
}
if(subjectIdList.isEmpty()){
return new ArrayList<>();
}
//直接绑定的字典
List<DictVO> dictVOS = baseMapper.boundList(subjectId);
List<String> boundIds = baseMapper.boundIdList(subjectId);
List<DictVO> dictVOS = baseMapper.boundList(subjectIdList);
List<String> boundIds = baseMapper.boundIdList(subjectIdList);
if(boundIds.size()>dictVOS.size()){
List<String> ids = dictVOS.stream().map(DictVO::getId).collect(Collectors.toList());
List<String> lids = new ArrayList<>(boundIds);
......@@ -64,11 +76,11 @@ public class SubjectDictMapServiceImpl extends ServiceImpl<SubjectDictMapMapper,
dictVOS.addAll(baseMapper.findLeaderLabelType(boundIds));
}
//流程中标签模型绑定字典
List<DictVO> dictArrange = baseMapper.boundArrangeList(subjectId);
List<DictVO> dictArrange = baseMapper.boundArrangeList(subjectIdList);
dictVOS.addAll(dictArrange);
if(dictArrange.isEmpty()){
//未绑定流程的(可能)查询老逻辑保定的字典
List<DictVO> dictOld = baseMapper.boundOldList(subjectId);
List<DictVO> dictOld = baseMapper.boundOldList(subjectIdList);
dictVOS.addAll(dictOld);
}
dictVOS.forEach(dictVO -> {
......
......@@ -1545,6 +1545,12 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
}
}
@Override
public List<String> getIdListByType(String typeId) {
return this.baseMapper.getIdListByType(typeId);
}
@Override
public Subject getSubjectOrEventById(String id) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论