diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/CommunityController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/CommunityController.java index 34e5d87..dbb2402 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/CommunityController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/CommunityController.java @@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter; import com.mcwl.common.core.domain.R; +import com.mcwl.common.core.page.PageDomain; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.communityCenter.domain.dto.CommunityListPageRes; import com.mcwl.communityCenter.domain.dto.CommunityRes; @@ -39,6 +40,25 @@ public class CommunityController { return communityService.listByPage(communityListPageRes); } + /** + * 我创建的社区 + */ + @ApiOperation(value = "我创建的社区") + @PostMapping("myCreate") + public R getMyCreateCommunity(@RequestBody @Valid PageDomain pageDomain) { + return R.ok(); + } + + + /** + * 我加入的社区 + */ + @ApiOperation(value = "我加入的社区") + @GetMapping("myJoin") + public R getMyJoinCommunity() { + return R.ok(); + } + /** * 添加社区 diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/CommunityListPageRes.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/CommunityListPageRes.java index a3b4056..ab43c07 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/CommunityListPageRes.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/CommunityListPageRes.java @@ -20,4 +20,11 @@ public class CommunityListPageRes extends PageDomain { @ApiModelProperty(value = "社区标签") private Long communityTag; + /** + * 用户id + */ + @ApiModelProperty(value = "用户id") + private Long userId; + + } diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/CommunityMapper.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/CommunityMapper.java index 6a84e4d..b2b5b78 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/CommunityMapper.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/CommunityMapper.java @@ -2,11 +2,14 @@ package com.mcwl.communityCenter.mapper; import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mcwl.communityCenter.domain.Community; +import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import javax.validation.constraints.NotNull; +import java.util.List; import java.util.Map; @Mapper @@ -23,13 +26,18 @@ public interface CommunityMapper extends BaseMapper { * 查询所有社区加入人数, 以map形式返回,key为社区id,value为加入人数 * @return map */ + @MapKey("id") @InterceptorIgnore(tenantLine = "true") - Map selectCommunityJoinNum(); + Map> selectCommunityJoinNum(); /** * 查询所有社区发布数量,以map形式返回,key为社区id,value为发布数量 * @return map */ + @MapKey("id") @InterceptorIgnore(tenantLine = "true") - Map selectCommunityPublishNum(); + Map> selectCommunityPublishNum(); + + @InterceptorIgnore(tenantLine = "true") + List selectPageByCommunityTag(@Param("page") Page page, @Param("communityTag") Long communityTag); } diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/CommunityServiceImpl.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/CommunityServiceImpl.java index 4f52895..0dc4f0f 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/CommunityServiceImpl.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/CommunityServiceImpl.java @@ -43,10 +43,22 @@ public class CommunityServiceImpl extends ServiceImpl communityJoinNumMap = baseMapper.selectCommunityJoinNum(); + Map communityJoinNumMap = new HashMap<>(); + Map> joinMap = baseMapper.selectCommunityJoinNum(); + if (joinMap != null && !joinMap.isEmpty()) { + joinMap.forEach((key, value) -> { + communityJoinNumMap.put(key, Integer.valueOf(value.get("joinNum").toString())); + }); + } // 查询社区发布数,以map形式返回,key为社区id,value为发布数 - Map communityPublishNumMap = baseMapper.selectCommunityPublishNum(); + Map communityPublishNumMap = new HashMap<>(); + Map> publishMap = baseMapper.selectCommunityPublishNum(); + if (publishMap != null && !publishMap.isEmpty()) { + publishMap.forEach((key, value) -> { + communityPublishNumMap.put(key, Integer.valueOf(value.get("publishNum").toString())); + }); + } Page page = new Page<>(communityListPageRes.getPageNum(), communityListPageRes.getPageSize()); @@ -59,10 +71,14 @@ public class CommunityServiceImpl extends ServiceImpl() - .eq(communityListPageRes.getCommunityTag() != null, Community::getCommunityTag, communityListPageRes.getCommunityTag())); + List communityList; + if (Objects.isNull(communityListPageRes.getUserId())) { + communityList = baseMapper.selectPageByCommunityTag(page, communityListPageRes.getCommunityTag()); + } else { + baseMapper.selectPage(page, null); + communityList = page.getRecords(); + } - List communityList = page.getRecords(); List communityVoList = new ArrayList<>(); LocalDate currentLocalDate = LocalDate.now(ZoneId.systemDefault()); diff --git a/mcwl-communityCenter/src/main/resources/mapper/communityCenter/CommunityMapper.xml b/mcwl-communityCenter/src/main/resources/mapper/communityCenter/CommunityMapper.xml index 965d3f8..761f510 100644 --- a/mcwl-communityCenter/src/main/resources/mapper/communityCenter/CommunityMapper.xml +++ b/mcwl-communityCenter/src/main/resources/mapper/communityCenter/CommunityMapper.xml @@ -4,6 +4,16 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + + + + + + + + + + - + select c.id as id, COALESCE(count(*), 0) as join_num from cc_community c join cc_invite i on c.id = i.community_id where c.del_flag = '0' and i.del_flag = '0' group by i.community_id - + select c.id as id, COALESCE(count(*), 0) as publish_num from cc_community c join cc_publish p on c.id = p.community_id join cc_question q on c.id = q.community_id @@ -35,4 +48,26 @@ and q.del_flag = '0' group by p.community_id + \ No newline at end of file diff --git a/mcwl-pay/src/main/java/com/mcwl/pay/service/impl/OrderTradeServiceImpl.java b/mcwl-pay/src/main/java/com/mcwl/pay/service/impl/OrderTradeServiceImpl.java index d85e7a5..ab3db33 100644 --- a/mcwl-pay/src/main/java/com/mcwl/pay/service/impl/OrderTradeServiceImpl.java +++ b/mcwl-pay/src/main/java/com/mcwl/pay/service/impl/OrderTradeServiceImpl.java @@ -123,6 +123,12 @@ public class OrderTradeServiceImpl extends ServiceImpl map = new HashMap<>(); if (productType == 0) { @@ -134,7 +140,7 @@ public class OrderTradeServiceImpl extends ServiceImpl