片长查询报错问题

This commit is contained in:
WenG 2021-06-29 23:06:31 +08:00
parent 6beceac159
commit 12484e067b
2 changed files with 11 additions and 17 deletions

View File

@ -293,17 +293,16 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun
@Override
public List<CommunityBossDTO> listCommunityBoss(Map<String, Object> params) throws SearchException {
if (params.get("keywords") != null && !params.get("keywords").toString().isEmpty()) {
List<UserResourceBO> userResourceBOs = userService.listResourceByKeywords(params.get("keywords").toString());
Set<String> userIdSet = new HashSet<>();
userResourceBOs.forEach(userResourceBO -> {
userIdSet.add(userResourceBO.getUserId());
});
if (userIdSet.isEmpty()) {
return new ArrayList<>();
}
params.put("communityBossUserIds", new ArrayList<>(userIdSet));
params.put("communityBossParentUserIds", new ArrayList<>(userIdSet));
List<UserResourceBO> userResourceBOs = userService.listResourceByKeywords(params.get("keywords").toString());
Set<String> userIdSet = new HashSet<>();
userResourceBOs.forEach(userResourceBO -> {
userIdSet.add(userResourceBO.getUserId());
});
if (userIdSet.isEmpty()) {
return new ArrayList<>();
}
params.put("communityBossUserIds", new ArrayList<>(userIdSet));
params.remove("keywords");
}
List<CommunityBossDTO> communityBossDTOs = communityBossDao.listCommunityBoss(params);
setUserInfo(communityBossDTOs);

View File

@ -196,17 +196,12 @@
AND
t1.community_boss_id = #{communityBossId}
</if>
<if test="communityBossUserIds != null and communityBossUserIds.size > 0 and communityBossParentUserIds != null and communityBossParentUserIds.size > 0">
<if test="communityBossUserIds != null and communityBossUserIds.size > 0">
AND (
t1.community_boss_user_id IN
<foreach collection="communityBossUserIds" index="index" open="(" separator="," close=")">
#{communityBossUserIds[${index}]}
</foreach>
OR
t1.community_boss_parent_user_id IN
<foreach collection="communityBossParentUserIds" index="index" open="(" separator="," close=")">
#{communityBossParentUserIds[${index}]}
</foreach>
)
</if>
<if test="communityBossParentUserIds != null and communityBossParentUserIds.size > 0">