Procházet zdrojové kódy

添加族友圈显示所有所在家族的族友圈信息方法

Alex před 4 roky
rodič
revize
b62881e16a

+ 9 - 2
ruoyi-system/src/main/java/com/ruoyi/app/mapper/TbMyPublishMapper.java

@@ -24,10 +24,17 @@ public interface TbMyPublishMapper extends BaseMapper<TbMyPublish> {
     List<TbMyPublish> pageList(@Param(Constants.WRAPPER) LambdaQueryWrapper<TbMyPublish> wrapper);
 
     /**
-     * 族友圈列表
+     * 指定家族的族友圈列表
      * @param appUserId
      * @param familyId
      * @return
      */
-    List<TbMyPublish> selectPublish(@Param("appUserId") Long appUserId, @Param("familyId") Long familyId);
+    List<TbMyPublish> selectFamilyPublish(@Param("appUserId") Long appUserId, @Param("familyId") Long familyId);
+
+    /**
+     * 所有的族友圈列表
+     * @param appUserId
+     * @return
+     */
+    List<TbMyPublish> selectPublish(@Param("appUserId") Long appUserId);
 }

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/app/service/impl/TbMyPublishServiceImpl.java

@@ -330,7 +330,7 @@ public class TbMyPublishServiceImpl extends ServiceImpl<TbMyPublishMapper, TbMyP
     @Override
     public List<TbMyPublish> selectPublish(Long appUserId, Long familyId) {
         startPage();
-        List<TbMyPublish> list = baseMapper.selectPublish(appUserId, familyId);
+        List<TbMyPublish> list = baseMapper.selectPublish(appUserId);
         if (list.size() <= 0) {
             return new ArrayList<>();
         }

+ 40 - 2
ruoyi-system/src/main/resources/mapper/app/TbMyPublishMapper.xml

@@ -24,8 +24,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         (select count(1) from tb_publish_thumbs t where t.publish_id = p.id) thumbs
         from tb_my_publish p ${ew.customSqlSegment}
     </select>
-<!--    族友圈列表-->
-    <select id="selectPublish" resultType="com.ruoyi.app.domain.TbMyPublish">
+    <!--    指定家族的 族友圈列表-->
+    <select id="selectFamilyPublish" resultType="com.ruoyi.app.domain.TbMyPublish">
         select b.*,(case when message = 'Y' then concat('#给',nick_name,'的留言纪念') else '' end) message_content
          from (
             select a.*,
@@ -62,5 +62,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 left join tb_family_member m on m.app_user_id = a.app_user_id
         ) b
     </select>
+    <!--    所在家族的 族友圈列表-->
+    <select id="selectPublish" resultType="com.ruoyi.app.domain.TbMyPublish">
+        select b.*,(case when message = 'Y' then concat('#给',nick_name,'的留言纪念') else '' end) message_content
+        from (
+        select a.*,
+        m.id member_id,
+        m.name,
+        u.nick_name nick_name,
+        u.avatar avatar,
+        (select max(family_id) from tb_member_middle mi where mi.member_id = m.id and mi.acquiesce = 'Y') family_id,
+        (select nick_name from tb_app_user us where us.id = a.message_user_id)message_user,
+        (select avatar from tb_app_user us where us.id = a.message_user_id)message_user_avatar,
+        (select count(1)  from tb_publish_thumbs where publish_id = a.id)thumbs
+        from (
+        select p.* from tb_my_publish p
+        where deleted = 'N' and app_user_id = #{appUserId}
+        union
+        select p.* from tb_my_publish p
+        where deleted = 'N' and app_user_id in (
+        select f.app_user_id uid from tb_my_friends f where friends_user_id = #{appUserId} and status = 2
+        union all
+        select g.friends_user_id uid from tb_my_friends g  where app_user_id = #{appUserId} and status = 2
+        )
+
+        union
+
+        select p.* from tb_my_publish p
+        where deleted = 'N' and app_user_id in (
+        select u.id from tb_app_user u
+        left join tb_family_member m on u.id = m.app_user_id
+        left join tb_member_middle mi on m.id = mi.member_id
+        where deleted = 'N' and mi.status = 2
+        )
+        ) a
+        left join tb_app_user u on u.id = a.app_user_id
+        left join tb_family_member m on m.app_user_id = a.app_user_id
+        ) b
+    </select>
 
 </mapper>