From 6beceac159bb899be97859de4b64b0d4020add76 Mon Sep 17 00:00:00 2001 From: WenG <450292408@qq.com> Date: Tue, 29 Jun 2021 18:12:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/CommunityBossServiceImpl.java | 19 +++++++++++++++++-- .../communityboss/communityboss-mapper.xml | 17 +++++++++++++---- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/cm/systemcity/service/communityboss/impl/CommunityBossServiceImpl.java b/src/main/java/com/cm/systemcity/service/communityboss/impl/CommunityBossServiceImpl.java index b6ce728..274a951 100755 --- a/src/main/java/com/cm/systemcity/service/communityboss/impl/CommunityBossServiceImpl.java +++ b/src/main/java/com/cm/systemcity/service/communityboss/impl/CommunityBossServiceImpl.java @@ -28,10 +28,13 @@ import com.cm.systemcity.service.communityboss.ICommunityBossService; import com.cm.systemcity.service.dict.IDictService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.sun.jna.platform.win32.OaIdl; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.*; /** @@ -187,12 +190,11 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun @Override public SuccessResultList> listPageCommunityBoss(ListPage page) throws SearchException { PageHelper.startPage(page.getPage(), page.getRows()); - List communityBossDTOs = communityBossDao.listCommunityBoss(page.getParams()); + List communityBossDTOs = listCommunityBoss(page.getParams()); LOG.debug("添加社区/小区/楼宇信息"); setCommunityBossCommunity(communityBossDTOs); setCommunityBossDistrict(communityBossDTOs); setCommunityBossBuilding(communityBossDTOs); - setUserInfo(communityBossDTOs); PageInfo pageInfo = new PageInfo<>(communityBossDTOs); return new SuccessResultList<>(communityBossDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); } @@ -290,6 +292,19 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun @Override public List listCommunityBoss(Map params) throws SearchException { + if (params.get("keywords") != null && !params.get("keywords").toString().isEmpty()) { + List userResourceBOs = userService.listResourceByKeywords(params.get("keywords").toString()); + Set 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 communityBossDTOs = communityBossDao.listCommunityBoss(params); setUserInfo(communityBossDTOs); return communityBossDTOs; diff --git a/src/main/resources/mybatis/mapper/communityboss/communityboss-mapper.xml b/src/main/resources/mybatis/mapper/communityboss/communityboss-mapper.xml index 6be0a4f..98fdbce 100755 --- a/src/main/resources/mybatis/mapper/communityboss/communityboss-mapper.xml +++ b/src/main/resources/mybatis/mapper/communityboss/communityboss-mapper.xml @@ -165,10 +165,6 @@ city_community_boss t1 WHERE t1.is_delete = 0 - - AND - t1.community_boss_name LIKE CONCAT('%', #{keywords}, '%') - AND t1.gmt_create = ]]> #{startTime} @@ -200,6 +196,19 @@ AND t1.community_boss_id = #{communityBossId} + + AND ( + t1.community_boss_user_id IN + + #{communityBossUserIds[${index}]} + + OR + t1.community_boss_parent_user_id IN + + #{communityBossParentUserIds[${index}]} + + ) + AND t1.community_boss_parent_user_id IN