dingxin 6 vuotta sitten
vanhempi
commit
fb8aea8fbe

+ 13
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionReplyMapper.java Näytä tiedosto

1
 package com.community.huiju.dao;
1
 package com.community.huiju.dao;
2
 
2
 
3
 import com.community.huiju.model.TpTransactionReply;
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
 public interface TpTransactionReplyMapper {
10
 public interface TpTransactionReplyMapper {
6
     int deleteByPrimaryKey(Integer id);
11
     int deleteByPrimaryKey(Integer id);
7
 
12
 
14
     int updateByPrimaryKeySelective(TpTransactionReply record);
19
     int updateByPrimaryKeySelective(TpTransactionReply record);
15
 
20
 
16
     int updateByPrimaryKey(TpTransactionReply record);
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 Näytä tiedosto

44
 
44
 
45
     private  String roleName;
45
     private  String roleName;
46
 
46
 
47
+    // 帖子的回复集合
48
+    private List<TpTransactionReply> replies;
49
+
47
     public String getRoleName() {
50
     public String getRoleName() {
48
         return roleName;
51
         return roleName;
49
     }
52
     }
184
     public void setCreateUserName(String createUserName) {
187
     public void setCreateUserName(String createUserName) {
185
         this.createUserName = createUserName;
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 Näytä tiedosto

86
     private ToCommunitiesMapper  toCommunitiesMapper;
86
     private ToCommunitiesMapper  toCommunitiesMapper;
87
 
87
 
88
     @Autowired
88
     @Autowired
89
-    private TpTransactionReportMapper  tpTransactionReportMapper;
89
+    private TpTransactionReplyMapper tpTransactionReplyMapper;
90
 
90
 
91
     @Override
91
     @Override
92
     @Transactional
92
     @Transactional
591
         //获取被回复的姓名
591
         //获取被回复的姓名
592
         tpTransactionReply.setReplyTaUserName( taUserMapper.selectByPrimaryKey(tpTransactionReply.getReplyTaUserId()).getUserName());
592
         tpTransactionReply.setReplyTaUserName( taUserMapper.selectByPrimaryKey(tpTransactionReply.getReplyTaUserId()).getUserName());
593
         tpTransactionReply.setCreateDate(new Date());
593
         tpTransactionReply.setCreateDate(new Date());
594
+        tpTransactionReplyMapper.insert(tpTransactionReply);
594
         response.addSuccess("成功");
595
         response.addSuccess("成功");
595
         return response;
596
         return response;
596
     }
597
     }
732
         tpTransaction.setImgList(imgList);
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
         return tpTransaction;
739
         return tpTransaction;
738
 
740
 

+ 6
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionReplyMapper.xml Näytä tiedosto

139
       create_date = #{createDate,jdbcType=TIMESTAMP}
139
       create_date = #{createDate,jdbcType=TIMESTAMP}
140
     where id = #{id,jdbcType=INTEGER}
140
     where id = #{id,jdbcType=INTEGER}
141
   </update>
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
 </mapper>
148
 </mapper>