소스 검색

完成 查看回复

weiximei 6 년 전
부모
커밋
b4689effa3

+ 13
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionReplyMapper.java 파일 보기

@@ -1,7 +1,12 @@
1 1
 package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.TpTransactionReply;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
4 6
 
7
+import java.util.List;
8
+
9
+@Mapper
5 10
 public interface TpTransactionReplyMapper {
6 11
     int deleteByPrimaryKey(Integer id);
7 12
 
@@ -14,4 +19,12 @@ public interface TpTransactionReplyMapper {
14 19
     int updateByPrimaryKeySelective(TpTransactionReply record);
15 20
 
16 21
     int updateByPrimaryKey(TpTransactionReply record);
22
+
23
+    /**
24
+     * 根据 小区id 和 帖子id
25
+     * @param communityId
26
+     * @param transactionId
27
+     * @return
28
+     */
29
+    List<TpTransactionReply> getCommunityIdAndTransactionId(@Param("communityId") Integer communityId, @Param("transactionId") Integer transactionId);
17 30
 }

+ 11
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpTransaction.java 파일 보기

@@ -44,6 +44,9 @@ public class TpTransaction {
44 44
 
45 45
     private  String roleName;
46 46
 
47
+    // 帖子的回复集合
48
+    private List<TpTransactionReply> replies;
49
+
47 50
     public String getRoleName() {
48 51
         return roleName;
49 52
     }
@@ -184,4 +187,12 @@ public class TpTransaction {
184 187
     public void setCreateUserName(String createUserName) {
185 188
         this.createUserName = createUserName;
186 189
     }
190
+
191
+    public List<TpTransactionReply> getReplies() {
192
+        return replies;
193
+    }
194
+
195
+    public void setReplies(List<TpTransactionReply> replies) {
196
+        this.replies = replies;
197
+    }
187 198
 }

+ 6
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java 파일 보기

@@ -83,6 +83,10 @@ public class SocialServiceImpl implements SocialServiceI {
83 83
 
84 84
     @Autowired
85 85
     private ToCommunitiesMapper  toCommunitiesMapper;
86
+
87
+    @Autowired
88
+    private TpTransactionReplyMapper tpTransactionReplyMapper;
89
+
86 90
     @Override
87 91
     @Transactional
88 92
     public TpAnnouncement findAnnouncementDetail(Integer id, Integer communityId, Integer userId) {
@@ -713,7 +717,8 @@ public class SocialServiceImpl implements SocialServiceI {
713 717
         tpTransaction.setImgList(imgList);
714 718
 
715 719
         // 查询回复信息
716
-
720
+        List<TpTransactionReply> transactionReplies = tpTransactionReplyMapper.getCommunityIdAndTransactionId(communityId, tpTransaction.getId());
721
+        tpTransaction.setReplies(transactionReplies);
717 722
 
718 723
         return tpTransaction;
719 724
 

+ 6
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionReplyMapper.xml 파일 보기

@@ -139,4 +139,10 @@
139 139
       create_date = #{createDate,jdbcType=TIMESTAMP}
140 140
     where id = #{id,jdbcType=INTEGER}
141 141
   </update>
142
+  <select id="getCommunityIdAndTransactionId" resultMap="BaseResultMap">
143
+    select
144
+    <include refid="Base_Column_List"/>
145
+    from tp_transaction_reply
146
+    where community_id = #{communityId,jdbcType=INTEGER} and transaction_id = #{transactionId,jdbcType=INTEGER}
147
+  </select>
142 148
 </mapper>