提交 e0c3d38e 作者: 925993793@qq.com

智库导出bug修改

上级 c7692e85
...@@ -7,6 +7,7 @@ import cn.hutool.poi.excel.ExcelUtil; ...@@ -7,6 +7,7 @@ import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zzsn.thinktank.entity.ThinktankBasicInfo; import com.zzsn.thinktank.entity.ThinktankBasicInfo;
import com.zzsn.thinktank.service.InfoSourceService;
import com.zzsn.thinktank.service.LeaderCategoryService; import com.zzsn.thinktank.service.LeaderCategoryService;
import com.zzsn.thinktank.service.ThinktankBasicInfoService; import com.zzsn.thinktank.service.ThinktankBasicInfoService;
import com.zzsn.thinktank.util.ExcelExportUtil; import com.zzsn.thinktank.util.ExcelExportUtil;
...@@ -42,6 +43,8 @@ public class ThinktankBasicInfoController { ...@@ -42,6 +43,8 @@ public class ThinktankBasicInfoController {
ThinktankBasicInfoService thinktankBasicInfoService; ThinktankBasicInfoService thinktankBasicInfoService;
@Autowired @Autowired
LeaderCategoryService leaderCategoryService; LeaderCategoryService leaderCategoryService;
@Autowired
private InfoSourceService infoSourceService;
@Value("${cj.url.infoSource.columnDetail:http://1.95.79.85:8823/baseSourceInfo/api/infoSource/columnDetail?columnIds={IDS}}") @Value("${cj.url.infoSource.columnDetail:http://1.95.79.85:8823/baseSourceInfo/api/infoSource/columnDetail?columnIds={IDS}}")
private String CJ_IINFOSOURCE_COLUMNDETAIL; private String CJ_IINFOSOURCE_COLUMNDETAIL;
...@@ -217,10 +220,10 @@ public class ThinktankBasicInfoController { ...@@ -217,10 +220,10 @@ public class ThinktankBasicInfoController {
ExcelExportUtil.exportExcelData(workbook, 0, Arrays.asList(arr), rows, "智库基本信息"); ExcelExportUtil.exportExcelData(workbook, 0, Arrays.asList(arr), rows, "智库基本信息");
//智库栏目采集统计信息 //智库栏目采集统计信息
String[] header = new String[]{"智库机构id", "智库机构编码", "中文全称", "关联信息源数量", "信息采集总量", "关联信息源编码", String[] header = new String[]{"智库机构id", "智库机构编码", "中文全称", "关联信息源栏目数量", "信息采集总量", "关联信息源栏目编码",
"关联信息源名称", "栏目名称", "网址", "启用状态(1-启用;0-禁用)", "信息源采集数量", "信息源近一月采集量", "采集状态"}; "关联信息源名称", "栏目名称", "网址", "启用状态(1-启用;0-禁用)", "信息源采集数量", "信息源近一月采集量", "采集状态"};
List<ThinkTankSourceVO> thinkTankSourceVOS = thinktankBasicInfoService.thinkTankCollectCount(thinkTankBasicInfos); List<ThinkTankSourceVO> thinkTankSourceVOS = thinktankBasicInfoService.thinkTankCollectCount(thinkTankBasicInfos);
//补充信息源采集状态 //补充信息源栏目采集状态
List<String> allIds = thinkTankSourceVOS.stream().map(ThinkTankSourceVO::getSourceId).distinct().collect(Collectors.toList()); List<String> allIds = thinkTankSourceVOS.stream().map(ThinkTankSourceVO::getSourceId).distinct().collect(Collectors.toList());
List<List<String>> groupIdList = CollectionUtil.split(allIds, 300); List<List<String>> groupIdList = CollectionUtil.split(allIds, 300);
Map<String, JSONObject> infoMap = new HashMap<>(); Map<String, JSONObject> infoMap = new HashMap<>();
...@@ -344,7 +347,166 @@ public class ThinktankBasicInfoController { ...@@ -344,7 +347,166 @@ public class ThinktankBasicInfoController {
* @param thinkTankBasicInfos * @param thinkTankBasicInfos
* @param tIds 智库id列表 * @param tIds 智库id列表
*/ */
public void exportBindCount(XSSFWorkbook workbook, int sheetNum, String sheetName, Map<String, JSONObject> infoMap, List<ThinktankBasicInfo> thinkTankBasicInfos, List<String> tIds) { private void exportBindCount(XSSFWorkbook workbook, int sheetNum, String sheetName, Map<String,
JSONObject> infoMap, List<ThinktankBasicInfo> thinkTankBasicInfos, List<String> tIds) {
//查询所有的
List<BindSourceDetailVO> bindSourceDetailList = infoSourceService.bindSourceDetail(tIds);
List<String> headers = new ArrayList<>();
headers.add("智库机构id");
headers.add("智库机构编码");
headers.add("中文全称");
headers.add("中文简称");
headers.add("英文全称");
headers.add("英文简称");
headers.add("国别");
headers.add("影响力及地位");
headers.add("是否展示");
headers.add("栏目数");
Map<String, Integer> columnNum = new HashMap<>();
headers.add("启用数");
Map<String, Integer> enableNum = new HashMap<>();
headers.add("未启用数");
Map<String, Integer> disableNum = new HashMap<>();
headers.add("正常采集");
Map<String, Integer> normalNum = new HashMap<>();
headers.add("访问异常");
Map<String, Integer> errorNum = new HashMap<>();
headers.add("列表页解析异常");
Map<String, Integer> listParseErrorNum = new HashMap<>();
headers.add("详情页配置异常");
Map<String, Integer> detailParseErrorNum = new HashMap<>();
headers.add("详情规则有差异");
Map<String, Integer> detailParseDiffNum = new HashMap<>();
headers.add("信息源漏采");
Map<String, Integer> missNum = new HashMap<>();
headers.add("账号异常");
Map<String, Integer> accountErrorNum = new HashMap<>();
headers.add("微信公众号异堂");
Map<String, Integer> wechatErrorNum = new HashMap<>();
headers.add("待配置");
Map<String, Integer> configNum = new HashMap<>();
headers.add("待验证");
Map<String, Integer> verifyNum = new HashMap<>();
headers.add("验证通过");
Map<String, Integer> verifyPassNum = new HashMap<>();
headers.add("验证不通过");
Map<String, Integer> verifyFailNum = new HashMap<>();
//查询智库列表
List<String> hasInfoIds = bindSourceDetailList.stream().map(BindSourceDetailVO::getThinkTankId).distinct().collect(Collectors.toList());
List<ThinktankBasicInfo> basicInfos = thinkTankBasicInfos.stream().filter(item -> hasInfoIds.contains(item.getId())).collect(Collectors.toList());
for (ThinktankBasicInfo basicInfo : basicInfos) {
String tid = basicInfo.getId();
//查询智库关联的信息源列表
List<String> sourceList = bindSourceDetailList.stream().filter(item -> tid.equals(item.getThinkTankId())).map(BindSourceDetailVO::getSourceId).collect(Collectors.toList());
for (String sourceId : sourceList) {
JSONObject record = infoMap.get(sourceId);
if (record == null) {
continue;
}
countAdd(columnNum, tid);
//是否启用
if ("1".equals(record.getString("enable"))) {
countAdd(enableNum, tid);
} else {
countAdd(disableNum, tid);
}
//采集状态
switch (record.getString("abnormalCode")) {
case "1":
countAdd(normalNum, tid);
break;
case "101":
countAdd(errorNum, tid);
break;
case "201":
countAdd(listParseErrorNum, tid);
break;
case "202":
countAdd(detailParseErrorNum, tid);
break;
case "203":
countAdd(detailParseDiffNum, tid);
break;
case "301":
countAdd(missNum, tid);
break;
case "503":
countAdd(accountErrorNum, tid);
break;
case "601":
countAdd(wechatErrorNum, tid);
break;
}
//状态
switch (record.getString("status")) {
case "1":
countAdd(configNum, tid);
break;
case "2":
countAdd(verifyNum, tid);
break;
case "3":
countAdd(verifyPassNum, tid);
break;
case "4":
countAdd(verifyFailNum, tid);
break;
}
}
}
List<List<String>> rows = new ArrayList<>();
for (ThinktankBasicInfo basicInfo : basicInfos) {
List<String> dataItem = new ArrayList<>();
String id = basicInfo.getId();
//智库机构id
dataItem.add(basicInfo.getId());
//智库机构编码
dataItem.add(basicInfo.getCodeId());
//中文全称
dataItem.add(basicInfo.getChineseWhole());
//中文简称
dataItem.add(basicInfo.getChineseSimple());
//英文全称
dataItem.add(basicInfo.getEnglishWhole());
//英文简称
dataItem.add(basicInfo.getEnglishSimple());
//国别
dataItem.add(basicInfo.getBelongCountry());
//影响力及地位
dataItem.add(basicInfo.getInfluencePosition());
//是否展示
dataItem.add(String.valueOf(basicInfo.getYnDisplay()));
//栏目数
dataItem.add(getMapStr(columnNum, id));
//是否启用
dataItem.add(getMapStr(enableNum, id));
dataItem.add(getMapStr(disableNum, id));
//采集状态
dataItem.add(getMapStr(normalNum, id));
dataItem.add(getMapStr(errorNum, id));
dataItem.add(getMapStr(listParseErrorNum, id));
dataItem.add(getMapStr(detailParseErrorNum, id));
dataItem.add(getMapStr(detailParseDiffNum, id));
dataItem.add(getMapStr(missNum, id));
dataItem.add(getMapStr(accountErrorNum, id));
dataItem.add(getMapStr(wechatErrorNum, id));
//状态
dataItem.add(getMapStr(configNum, id));
dataItem.add(getMapStr(verifyNum, id));
dataItem.add(getMapStr(verifyPassNum, id));
dataItem.add(getMapStr(verifyFailNum, id));
rows.add(dataItem);
}
ExcelExportUtil.exportExcelData(workbook, sheetNum, headers, rows, sheetName);
}
private void exportBindCount_old(XSSFWorkbook workbook, int sheetNum, String sheetName, Map<String,
JSONObject> infoMap, List<ThinktankBasicInfo> thinkTankBasicInfos, List<String> tIds) {
//查询所有的 //查询所有的
List<CountVo> bindAll = thinktankBasicInfoService.bindInfoSource(tIds); List<CountVo> bindAll = thinktankBasicInfoService.bindInfoSource(tIds);
List<String> headers = new ArrayList<>(); List<String> headers = new ArrayList<>();
......
...@@ -120,6 +120,16 @@ public interface InfoSourceMapper extends BaseMapper<InfoSource> { ...@@ -120,6 +120,16 @@ public interface InfoSourceMapper extends BaseMapper<InfoSource> {
* @author lkg * @author lkg
* @date 2025/8/5 * @date 2025/8/5
*/ */
List<BindSourceDetailVO> bindSourceCount(@Param("thinkTankIds") List<String> thinkTankIds); List<BindSourceDetailVO> bindSourceDetail(@Param("thinkTankIds") List<String> thinkTankIds);
/**
* 获取智库绑定信息源的详细信息
*
* @param thinkTankIds 智库id集合
* @author lkg
* @date 2025/8/5
*/
List<ThinkTankSourceVO> bindSourceDetailInfo(@Param("thinkTankIds") List<String> thinkTankIds);
} }
...@@ -111,11 +111,20 @@ public interface InfoSourceService extends IService<InfoSource> { ...@@ -111,11 +111,20 @@ public interface InfoSourceService extends IService<InfoSource> {
JSONObject bindInfoSourceColumnList(String thinkTankId); JSONObject bindInfoSourceColumnList(String thinkTankId);
/** /**
* 获取智库绑定信息源的数量 * 获取智库绑定信息源栏目统计
* *
* @param thinkTankIds 智库id集合 * @param thinkTankIds 智库id集合
* @author lkg * @author lkg
* @date 2025/8/5 * @date 2025/8/5
*/ */
List<BindSourceDetailVO> bindSourceCount(List<String> thinkTankIds); List<BindSourceDetailVO> bindSourceDetail(List<String> thinkTankIds);
/**
* 获取智库绑定信息源栏目的详细信息
*
* @param thinkTankIds 智库id集合
* @author lkg
* @date 2025/8/5
*/
List<ThinkTankSourceVO> bindSourceDetailInfo(List<String> thinkTankIds);
} }
...@@ -343,7 +343,12 @@ public class InfoSourceServiceImpl extends ServiceImpl<InfoSourceMapper, InfoSou ...@@ -343,7 +343,12 @@ public class InfoSourceServiceImpl extends ServiceImpl<InfoSourceMapper, InfoSou
} }
@Override @Override
public List<BindSourceDetailVO> bindSourceCount(List<String> thinkTankIds) { public List<BindSourceDetailVO> bindSourceDetail(List<String> thinkTankIds) {
return baseMapper.bindSourceCount(thinkTankIds); return baseMapper.bindSourceDetail(thinkTankIds);
}
@Override
public List<ThinkTankSourceVO> bindSourceDetailInfo(List<String> thinkTankIds) {
return baseMapper.bindSourceDetailInfo(thinkTankIds);
} }
} }
...@@ -286,7 +286,7 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf ...@@ -286,7 +286,7 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf
//智库id集合 //智库id集合
List<String> groupIds = list.stream().map(ThinktankBasicInfoVo::getId).collect(Collectors.toList()); List<String> groupIds = list.stream().map(ThinktankBasicInfoVo::getId).collect(Collectors.toList());
//智库绑定信息源栏目详细情况 //智库绑定信息源栏目详细情况
List<BindSourceDetailVO> bindSourceDetailList = infoSourceService.bindSourceCount(groupIds); List<BindSourceDetailVO> bindSourceDetailList = infoSourceService.bindSourceDetail(groupIds);
//按智库分组 //按智库分组
Map<String, List<BindSourceDetailVO>> collect = bindSourceDetailList.stream().collect(Collectors.groupingBy(BindSourceDetailVO::getThinkTankId)); Map<String, List<BindSourceDetailVO>> collect = bindSourceDetailList.stream().collect(Collectors.groupingBy(BindSourceDetailVO::getThinkTankId));
//所有绑定的信息源栏目id集合 //所有绑定的信息源栏目id集合
...@@ -466,7 +466,7 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf ...@@ -466,7 +466,7 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf
//智库绑定信息源栏目详细情况 //智库绑定信息源栏目详细情况
List<String> thinkTankIds = new ArrayList<>(); List<String> thinkTankIds = new ArrayList<>();
thinkTankIds.add(id); thinkTankIds.add(id);
List<BindSourceDetailVO> bindSourceDetailList = infoSourceService.bindSourceCount(thinkTankIds); List<BindSourceDetailVO> bindSourceDetailList = infoSourceService.bindSourceDetail(thinkTankIds);
List<String> sidList = bindSourceDetailList.stream().map(BindSourceDetailVO::getSourceId).collect(Collectors.toList()); List<String> sidList = bindSourceDetailList.stream().map(BindSourceDetailVO::getSourceId).collect(Collectors.toList());
//设置分页参数 //设置分页参数
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
...@@ -703,6 +703,60 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf ...@@ -703,6 +703,60 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf
Map<String, ThinktankBasicInfo> map = dataList.stream().collect(Collectors.toMap(ThinktankBasicInfo::getId, Function.identity())); Map<String, ThinktankBasicInfo> map = dataList.stream().collect(Collectors.toMap(ThinktankBasicInfo::getId, Function.identity()));
List<String> idList = new ArrayList<>(); List<String> idList = new ArrayList<>();
dataList.forEach(e -> idList.add(e.getId())); dataList.forEach(e -> idList.add(e.getId()));
//智库绑定信息源栏目详细情况
List<ThinkTankSourceVO> thinkTankSourceVOS = infoSourceService.bindSourceDetailInfo(idList);
//信息源id集合
List<String> sourceIds = thinkTankSourceVOS.stream().map(ThinkTankSourceVO::getSourceId).collect(Collectors.toList());
//查询es
BoolQueryBuilder boolQuerylist = QueryBuilders.boolQuery();
boolQuerylist.must(QueryBuilders.termsQuery("sid", sourceIds));
Map<String, Long> totalCountMap = new HashMap<>();
Map<String, Long> monthlyCountMap = new HashMap<>();
try {
//所有
totalCountMap = esUtil.groupBy("basedata", "sid", boolQuerylist, sourceIds.size());
//近一个月
DateTime yesterday = cn.hutool.core.date.DateUtil.yesterday();
DateTime startTime = cn.hutool.core.date.DateUtil.offsetDay(yesterday, -30);
boolQuerylist.filter(QueryBuilders.rangeQuery("createDate")
.gte(EsDateUtil.esFieldDateFormat(cn.hutool.core.date.DateUtil.format(startTime, "yyyy-MM-dd 00:00:00")))
.lte(EsDateUtil.esFieldDateFormat(cn.hutool.core.date.DateUtil.format(yesterday, "yyyy-MM-dd 23:59:59"))));
monthlyCountMap = esUtil.groupBy("basedata", "sid", boolQuerylist, 100);
} catch (IOException e) {
log.error("ES查询失败",e);
}
//采集量统计
for (ThinkTankSourceVO thinkTankSourceVO : thinkTankSourceVOS) {
String sourceId = thinkTankSourceVO.getSourceId();
Long infoCount = totalCountMap.get(sourceId);
if (infoCount == null) {
infoCount = 0L;
}
thinkTankSourceVO.setInfoCount(infoCount.intValue());
Long infoMonthlyCount = monthlyCountMap.get(sourceId);
if (infoMonthlyCount == null) {
infoMonthlyCount = 0L;
}
thinkTankSourceVO.setInfoMonthlyCount(infoMonthlyCount.intValue());
}
//数据合并
List<ThinkTankSourceVO> list = new ArrayList<>();
Map<String, List<ThinkTankSourceVO>> groupCountMap = thinkTankSourceVOS.stream().collect(Collectors.groupingBy(ThinkTankSourceVO::getGroupId));
for (Map.Entry<String, List<ThinkTankSourceVO>> entry : groupCountMap.entrySet()) {
List<ThinkTankSourceVO> value = entry.getValue();
int groupCount = value.stream().mapToInt(ThinkTankSourceVO::getInfoCount).sum();
ThinkTankSourceVO thinkTankSourceVO = value.get(0);
thinkTankSourceVO.setGroupCount(groupCount);
thinkTankSourceVO.setInfoSourceCount(value.size());
list.addAll(value);
}
return list;
}
public List<ThinkTankSourceVO> thinkTankCollectCount_old(List<ThinktankBasicInfo> dataList) {
Map<String, ThinktankBasicInfo> map = dataList.stream().collect(Collectors.toMap(ThinktankBasicInfo::getId, Function.identity()));
List<String> idList = new ArrayList<>();
dataList.forEach(e -> idList.add(e.getId()));
List<ThinkTankSourceVO> thinkTankSourceVOS = infoSourceGroupMapService.listOfThinkTank(idList); List<ThinkTankSourceVO> thinkTankSourceVOS = infoSourceGroupMapService.listOfThinkTank(idList);
List<String> sourceIds = new ArrayList<>(); List<String> sourceIds = new ArrayList<>();
for (ThinkTankSourceVO thinkTankSourceVO : thinkTankSourceVOS) { for (ThinkTankSourceVO thinkTankSourceVO : thinkTankSourceVOS) {
......
...@@ -456,7 +456,7 @@ ...@@ -456,7 +456,7 @@
</if> </if>
</select> </select>
<select id="bindSourceCount" resultType="com.zzsn.thinktank.vo.BindSourceDetailVO"> <select id="bindSourceDetail" resultType="com.zzsn.thinktank.vo.BindSourceDetailVO">
select a.group_id as thinkTankId,a.source_id from ( select a.group_id as thinkTankId,a.source_id from (
select distinct x.source_id,x.group_id from ( select distinct x.source_id,x.group_id from (
select m.source_id,n.group_id from thinktank_info_source_group_map n select m.source_id,n.group_id from thinktank_info_source_group_map n
...@@ -611,4 +611,163 @@ ...@@ -611,4 +611,163 @@
LEFT JOIN info_source x on(a.source_id = x.id) LEFT JOIN info_source x on(a.source_id = x.id)
where b.source_id is null and x.id is not null where b.source_id is null and x.id is not null
</select> </select>
<select id="bindSourceDetailInfo" resultType="com.zzsn.thinktank.vo.ThinkTankSourceVO">
select x.group_id,z.code_id,z.chinese_whole,x.source_id,y.info_source_code,y.web_site_name,y.site_name,y.site_uri,y.status from (
select a.group_id,a.source_id from (
select distinct x.source_id,x.group_id from (
select m.source_id,n.group_id from thinktank_info_source_group_map n
inner join info_source_group_map m on n.source_id = m.group_id
where n.type = 2
<if test="thinkTankIds != null and thinkTankIds.size() > 0">
and n.group_id in
<foreach collection="thinkTankIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
union
select iso.id as source_id,sim.group_id from
thinktank_info_source_group_map sim
INNER JOIN info_source_main_group_map m ON m.group_id = sim.source_id
INNER JOIN info_source_main im ON im.id = m.source_id
INNER JOIN info_source iso ON im.id = iso.info_source_id
where sim.type = 32
<if test="thinkTankIds != null and thinkTankIds.size() > 0">
and sim.group_id in
<foreach collection="thinkTankIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
union
select sm.source_id,sm.group_id from thinktank_info_source_group_map sm where sm.type = 1
<if test="thinkTankIds != null and thinkTankIds.size() > 0">
and sm.group_id in
<foreach collection="thinkTankIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
union
select iso.id as source_id ,sm.group_id FROM
thinktank_info_source_group_map sm
INNER JOIN info_source_main im ON im.id = sm.source_id
INNER JOIN info_source iso ON im.id = iso.info_source_id
WHERE
sm.type = 31
<if test="thinkTankIds != null and thinkTankIds.size() > 0">
and sm.group_id in
<foreach collection="thinkTankIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
union
select m.entity_code as source_id,n.group_id from thinktank_info_source_group_map n
inner join clb_label_info_source_map m on n.source_id = m.label_code and n.source_item_id = m.label_item_code
where n.type = 12
<if test="thinkTankIds != null and thinkTankIds.size() > 0">
and n.group_id in
<foreach collection="thinkTankIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
union
select isoo.id as source_id,smm.group_id
FROM
thinktank_info_source_group_map smm
INNER JOIN clb_label_main_source_map lam ON smm.source_id = lam.label_code
AND smm.source_item_id = lam.label_item_code
INNER JOIN info_source_main im ON lam.entity_code = im.id
INNER JOIN info_source isoo ON im.id = isoo.info_source_id
WHERE
smm.type = 312
<if test="thinkTankIds != null and thinkTankIds.size() > 0">
and smm.group_id in
<foreach collection="thinkTankIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) x) a
LEFT JOIN
(select distinct x.source_id,x.group_id from (
select m.source_id,n.group_id from thinktank_info_source_group_map n
inner join info_source_group_map m on n.source_id = m.group_id
where n.type = 4
<if test="thinkTankIds != null and thinkTankIds.size() > 0">
and n.group_id in
<foreach collection="thinkTankIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
union
SELECT
iso.id as source_id,sim.group_id
FROM
thinktank_info_source_group_map sim
INNER JOIN info_source_main_group_map m ON m.group_id = sim.source_id
INNER JOIN info_source_main im ON im.id = m.source_id
INNER JOIN info_source iso ON im.id = iso.info_source_id
WHERE
sim.type = 34
<if test="thinkTankIds != null and thinkTankIds.size() > 0">
and sim.group_id in
<foreach collection="thinkTankIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
union
select sm.source_id,sm.group_id from thinktank_info_source_group_map sm where sm.type = 3
<if test="thinkTankIds != null and thinkTankIds.size() > 0">
and sm.group_id in
<foreach collection="thinkTankIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
union
SELECT
iso.id as source_id,sm.group_id
FROM
thinktank_info_source_group_map sm
INNER JOIN info_source_main im ON im.id = sm.source_id
INNER JOIN info_source iso ON im.id = iso.info_source_id
WHERE
sm.type = 33
<if test="thinkTankIds != null and thinkTankIds.size() > 0">
and sm.group_id in
<foreach collection="thinkTankIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
union
select m.entity_code as source_id,n.group_id from thinktank_info_source_group_map n
inner join clb_label_info_source_map m on n.source_id = m.label_code and n.source_item_id = m.label_item_code
where n.type = 14
<if test="thinkTankIds != null and thinkTankIds.size() > 0">
and n.group_id in
<foreach collection="thinkTankIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
union
SELECT
isoo.id as source_id,smm.group_id
FROM
thinktank_info_source_group_map smm
INNER JOIN clb_label_main_source_map lam ON smm.source_id = lam.label_code
AND smm.source_item_id = lam.label_item_code
INNER JOIN info_source_main im ON lam.entity_code = im.id
INNER JOIN info_source isoo ON im.id = isoo.info_source_id
WHERE
smm.type = 314
<if test="thinkTankIds != null and thinkTankIds.size() > 0">
and smm.group_id in
<foreach collection="thinkTankIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) x) b
on (a.group_id = b.group_id and a.source_id = b.source_id)
LEFT JOIN info_source x on(a.source_id = x.id)
where b.source_id is null and x.id is not null
) x inner join info_source y on x.source_id = y.id
inner join thinktank_basic_info z on x.group_id = z.id
</select>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论