修改问题

This commit is contained in:
WenG 2021-06-29 18:12:53 +08:00
parent 81846da8eb
commit 6beceac159
2 changed files with 30 additions and 6 deletions

View File

@ -28,10 +28,13 @@ import com.cm.systemcity.service.communityboss.ICommunityBossService;
import com.cm.systemcity.service.dict.IDictService; import com.cm.systemcity.service.dict.IDictService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.sun.jna.platform.win32.OaIdl;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.*; import java.util.*;
/** /**
@ -187,12 +190,11 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun
@Override @Override
public SuccessResultList<List<CommunityBossDTO>> listPageCommunityBoss(ListPage page) throws SearchException { public SuccessResultList<List<CommunityBossDTO>> listPageCommunityBoss(ListPage page) throws SearchException {
PageHelper.startPage(page.getPage(), page.getRows()); PageHelper.startPage(page.getPage(), page.getRows());
List<CommunityBossDTO> communityBossDTOs = communityBossDao.listCommunityBoss(page.getParams()); List<CommunityBossDTO> communityBossDTOs = listCommunityBoss(page.getParams());
LOG.debug("添加社区/小区/楼宇信息"); LOG.debug("添加社区/小区/楼宇信息");
setCommunityBossCommunity(communityBossDTOs); setCommunityBossCommunity(communityBossDTOs);
setCommunityBossDistrict(communityBossDTOs); setCommunityBossDistrict(communityBossDTOs);
setCommunityBossBuilding(communityBossDTOs); setCommunityBossBuilding(communityBossDTOs);
setUserInfo(communityBossDTOs);
PageInfo<CommunityBossDTO> pageInfo = new PageInfo<>(communityBossDTOs); PageInfo<CommunityBossDTO> pageInfo = new PageInfo<>(communityBossDTOs);
return new SuccessResultList<>(communityBossDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); return new SuccessResultList<>(communityBossDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
} }
@ -290,6 +292,19 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun
@Override @Override
public List<CommunityBossDTO> listCommunityBoss(Map<String, Object> params) throws SearchException { 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<CommunityBossDTO> communityBossDTOs = communityBossDao.listCommunityBoss(params); List<CommunityBossDTO> communityBossDTOs = communityBossDao.listCommunityBoss(params);
setUserInfo(communityBossDTOs); setUserInfo(communityBossDTOs);
return communityBossDTOs; return communityBossDTOs;

View File

@ -165,10 +165,6 @@
city_community_boss t1 city_community_boss t1
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND
t1.community_boss_name LIKE CONCAT('%', #{keywords}, '%')
</if>
<if test="startTime != null and startTime != ''"> <if test="startTime != null and startTime != ''">
AND AND
t1.gmt_create <![CDATA[ >= ]]> #{startTime} t1.gmt_create <![CDATA[ >= ]]> #{startTime}
@ -200,6 +196,19 @@
AND AND
t1.community_boss_id = #{communityBossId} t1.community_boss_id = #{communityBossId}
</if> </if>
<if test="communityBossUserIds != null and communityBossUserIds.size > 0 and communityBossParentUserIds != null and communityBossParentUserIds.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"> <if test="communityBossParentUserIds != null and communityBossParentUserIds.size > 0">
AND AND
t1.community_boss_parent_user_id IN t1.community_boss_parent_user_id IN