dingxin 6 年之前
父節點
當前提交
fb8aea8fbe

+ 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
 }

+ 4
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java 查看文件

@@ -86,7 +86,7 @@ public class SocialServiceImpl implements SocialServiceI {
86 86
     private ToCommunitiesMapper  toCommunitiesMapper;
87 87
 
88 88
     @Autowired
89
-    private TpTransactionReportMapper  tpTransactionReportMapper;
89
+    private TpTransactionReplyMapper tpTransactionReplyMapper;
90 90
 
91 91
     @Override
92 92
     @Transactional
@@ -591,6 +591,7 @@ public class SocialServiceImpl implements SocialServiceI {
591 591
         //获取被回复的姓名
592 592
         tpTransactionReply.setReplyTaUserName( taUserMapper.selectByPrimaryKey(tpTransactionReply.getReplyTaUserId()).getUserName());
593 593
         tpTransactionReply.setCreateDate(new Date());
594
+        tpTransactionReplyMapper.insert(tpTransactionReply);
594 595
         response.addSuccess("成功");
595 596
         return response;
596 597
     }
@@ -732,7 +733,8 @@ public class SocialServiceImpl implements SocialServiceI {
732 733
         tpTransaction.setImgList(imgList);
733 734
 
734 735
         // 查询回复信息
735
-
736
+        List<TpTransactionReply> transactionReplies = tpTransactionReplyMapper.getCommunityIdAndTransactionId(communityId, tpTransaction.getId());
737
+        tpTransaction.setReplies(transactionReplies);
736 738
 
737 739
         return tpTransaction;
738 740
 

+ 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>