Przeglądaj źródła

作者:张哲
时间:2023/02/16
类型:优化
描述:里程碑(2)管理端回复列表

ZizgZh 2 lat temu
rodzic
commit
fb701822a9

+ 4 - 0
src/main/java/com/redxun/knowledge/album/mapper/AlbumYelpMapper.java

@@ -66,4 +66,8 @@ public interface AlbumYelpMapper extends BaseDao<AlbumYelp> {
      * @param yelp
      */
     void deleteByIds(String yelp);
+
+
+    List<AlbumYelp> findListAllRepliesByYelpId(@Param("albumId")String albumId,@Param("userId") String userId,@Param("yelp") String yelp);
+
 }

+ 28 - 1
src/main/java/com/redxun/knowledge/album/service/AlbumYelpServiceImpl.java

@@ -379,8 +379,35 @@ public class AlbumYelpServiceImpl extends SuperServiceImpl<AlbumYelpMapper, Albu
         Map<String, Object> params = queryFilter.getParams();
         String albumId = (String) params.get("albumId");
         String type = (String) params.get("type");
+        String yelpId = (String) params.get("yelpId");
+        List<AlbumYelp> listAllReplies;
+        if ("1".equals(type)){
+            //全部回复
+            listAllReplies = albumYelpMapper.findListAllReplies(albumId, userId, yelpId);
+        } else {
+            //与我相关的回复(带点评Id)
+            listAllReplies = albumYelpMapper.findListAllRepliesByYelpId(albumId, userId, yelpId);
+
+        }
+        return getPage(queryFilter, listAllReplies);
+    }
 
-        return null;
+    /**
+     * PC查询回复信息封装
+     * @param queryFilter
+     * @param listAllReplies
+     * @return
+     */
+    private IPage getPage(QueryFilter queryFilter, List<AlbumYelp> listAllReplies) {
+        List<AlbumYelpListPcVo> albumYelpListPcVos = listAllReplies.parallelStream().map(e -> {
+            AlbumYelpListPcVo albumYelpListPcVo = new AlbumYelpListPcVo();
+            BeanUtils.copyProperties(e, albumYelpListPcVo);
+            albumYelpListPcVo.setCreateName(userService.queryOsUserDto(e.getCreateBy()).getFullName());
+            albumYelpListPcVo.setCreatePhoto((String) userService.querySexAndPhoto(e.getCreateBy()).get("photo"));
+            return albumYelpListPcVo;
+        }).collect(Collectors.toList());
+        Page pages = PageListUtils.getPages(queryFilter.getPage().getCurrent(), queryFilter.getPage().getSize(), albumYelpListPcVos);
+        return pages;
     }
 
     /**

+ 15 - 4
src/main/resources/mapper/knowledge/album/AlbumYelpMapper.xml

@@ -57,7 +57,7 @@
         <where>
             (STATE = 1 or CREATE_BY_ = #{userId}) and ALBUM_ID = #{albumId} and TYPE = 1 and IS_DEL = 0
         </where>
-        order by CREATE_TIME_
+        order by CREATE_TIME_ desc
     </select>
 
     <select id="findListAllReplies" resultType="com.redxun.knowledge.album.entity.dao.AlbumYelp">
@@ -68,7 +68,7 @@
         <where>
             (STATE = 1 or CREATE_BY_ = #{userId}) and ALBUM_ID = #{albumId} and TYPE = 2 and YELP_ID = #{pkId} and IS_DEL = 0
         </where>
-        order by CREATE_TIME_
+        order by CREATE_TIME_ desc
     </select>
 
     <select id="findListAllYelpInfoById" resultType="com.redxun.knowledge.album.entity.dao.AlbumYelp">
@@ -79,7 +79,7 @@
         <where>
             CREATE_BY_ = #{userId} and ALBUM_ID = #{albumId} and TYPE = 1 and IS_DEL = 0
         </where>
-        order by CREATE_TIME_
+        order by CREATE_TIME_ desc
     </select>
 
     <select id="findListAllRepliesById" resultType="com.redxun.knowledge.album.entity.dao.AlbumYelp">
@@ -90,7 +90,7 @@
         <where>
             CREATE_BY_ = #{userId} and ALBUM_ID = #{albumId} and TYPE = 2 and IS_DEL = 0
         </where>
-        order by CREATE_TIME_
+        order by CREATE_TIME_ desc
     </select>
 
     <delete id="deleteByYelpId">
@@ -105,6 +105,17 @@
         where PK_ID = #{pkId}
     </delete>
 
+    <select id="findListAllRepliesByYelpId" resultType="com.redxun.knowledge.album.entity.dao.AlbumYelp">
+        select
+        distinct PK_ID,ALBUM_ID,TYPE,CONTENT,YELP_ID,STATE,IS_DEL,COMPANY_ID_,CREATE_DEP_ID_,TENANT_ID_,CREATE_BY_,CREATE_TIME_,
+        UPDATE_BY_,UPDATE_TIME_,APPROVAL_STATE
+        from KM_ALBUM_YELP
+        <where>
+            CREATE_BY_ = #{userId} and ALBUM_ID = #{albumId} and YELP_ID = #{yelp} and TYPE = 2 and IS_DEL = 0
+        </where>
+        order by CREATE_TIME_ desc
+    </select>
+
 
 </mapper>