dingxin 6 lat temu
rodzic
commit
83d33a25dd

+ 0
- 9
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java Wyświetl plik

@@ -444,15 +444,6 @@ public class SocialController extends BaseController {
444 444
         return response;
445 445
     }
446 446
 
447
-    @ApiOperation(value = "查询点赞次数", notes = "查询点赞次数")
448
-    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "id", value = "帖子id")})
449
-    @RequestMapping(value = "/transactionLikeList/{id}", method = RequestMethod.GET)
450
-    public ResponseBean transactionLikeList(@PathVariable("id") Integer id,HttpSession session) {
451
-        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
452
-        ResponseBean transactionLike = socialServiceI.transactionLikeList(id,userElement);
453
-        return transactionLike;
454
-    }
455
-
456 447
     @ApiOperation(value = "添加点赞", notes = "添加点赞")
457 448
     @ApiImplicitParams({
458 449
             @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =

+ 2
- 4
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionLikeMapper.java Wyświetl plik

@@ -21,19 +21,17 @@ public interface TpTransactionLikeMapper {
21 21
      * 点赞
22 22
      * @param invitationId
23 23
      * @param communityId
24
-     * @param userId
25 24
      * @return
26 25
      */
27
-    Integer likeCount(@Param("invitationId") Integer invitationId, @Param("communityId") Integer communityId, @Param("userId") Integer userId);
26
+    Integer likeCount(@Param("invitationId") Integer invitationId, @Param("communityId") Integer communityId);
28 27
 
29 28
     /**
30 29
      * 踩
31 30
      * @param invitationId
32 31
      * @param communityId
33
-     * @param userId
34 32
      * @return
35 33
      */
36
-    Integer nolikeCount(@Param("invitationId") Integer invitationId, @Param("communityId") Integer communityId, @Param("userId") Integer userId);
34
+    Integer nolikeCount(@Param("invitationId") Integer invitationId, @Param("communityId") Integer communityId);
37 35
 
38 36
     /**
39 37
      * 查询当前人是否存在数据

+ 37
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpTransaction.java Wyświetl plik

@@ -44,6 +44,20 @@ public class TpTransaction {
44 44
 
45 45
     private  String roleName;
46 46
 
47
+    /**
48
+     * 顶赞的次数
49
+     */
50
+    private Integer likeCount;
51
+    /**
52
+     * 踩的人数
53
+     */
54
+    private Integer noLikeCount;
55
+
56
+    /**
57
+     * 是否已点赞或者踩
58
+     */
59
+    private Boolean bel;
60
+
47 61
 
48 62
     public String getRoleName() {
49 63
         return roleName;
@@ -186,4 +200,27 @@ public class TpTransaction {
186 200
         this.createUserName = createUserName;
187 201
     }
188 202
 
203
+    public Integer getLikeCount() {
204
+        return likeCount;
205
+    }
206
+
207
+    public void setLikeCount(Integer likeCount) {
208
+        this.likeCount = likeCount;
209
+    }
210
+
211
+    public Integer getNoLikeCount() {
212
+        return noLikeCount;
213
+    }
214
+
215
+    public void setNoLikeCount(Integer noLikeCount) {
216
+        this.noLikeCount = noLikeCount;
217
+    }
218
+
219
+    public Boolean getBel() {
220
+        return bel;
221
+    }
222
+
223
+    public void setBel(Boolean bel) {
224
+        this.bel = bel;
225
+    }
189 226
 }

+ 0
- 8
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java Wyświetl plik

@@ -187,14 +187,6 @@ public interface SocialServiceI {
187 187
 	 */
188 188
     ResponseBean addTransactionReply(String paramets, UserElement userElement);
189 189
 
190
-	/**
191
-	 * 查询表帖子的点赞次数
192
-	 * @param id
193
-	 * @param userElement
194
-	 * @return
195
-	 */
196
-	ResponseBean transactionLikeList(Integer id, UserElement userElement);
197
-
198 190
 	/**
199 191
 	 * 添加点赞
200 192
 	 * @param paramets

+ 19
- 20
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java Wyświetl plik

@@ -604,26 +604,6 @@ public class SocialServiceImpl implements SocialServiceI {
604 604
         return response;
605 605
     }
606 606
 
607
-    @Override
608
-    public ResponseBean transactionLikeList(Integer invitationId, UserElement userElement) {
609
-        ResponseBean response= new ResponseBean();
610
-        TpTransactionLike tpTransactionLike= new TpTransactionLike();
611
-        //统计点赞人数的次数
612
-        Integer likeCount= tpTransactionLikeMapper.likeCount(invitationId,userElement.getCommunityId(),userElement.getId());
613
-        //不喜欢的人数
614
-        Integer noLikeCount= tpTransactionLikeMapper.nolikeCount(invitationId,userElement.getCommunityId(),userElement.getId());
615
-
616
-        tpTransactionLike.setLikeCount(likeCount);
617
-        tpTransactionLike.setNoLikeCount(noLikeCount);
618
-        // 查看点前用户是否点赞或踩
619
-        TpTransactionLike isUser= tpTransactionLikeMapper.getinvitationId(invitationId,userElement.getCommunityId(),userElement.getId());
620
-        if (null!=isUser){
621
-            tpTransactionLike.setBel(false);
622
-        }
623
-        response.addSuccess(tpTransactionLike);
624
-        return response;
625
-    }
626
-
627 607
     @Override
628 608
     public ResponseBean addTransactionLike(String paramets, UserElement userElement) {
629 609
       ResponseBean response = new ResponseBean();
@@ -772,6 +752,25 @@ public class SocialServiceImpl implements SocialServiceI {
772 752
         List<String> imgList = tdImagesList.stream().map(e->new String(e.getImageUrl())).collect(Collectors.toList());
773 753
         tpTransaction.setImgList(imgList);
774 754
 
755
+        /**
756
+         * 查询点赞和踩的次数
757
+         */
758
+
759
+
760
+        //统计点赞人数的次数
761
+        Integer likeCount= tpTransactionLikeMapper.likeCount(activityId, communityId);
762
+        //不喜欢的人数
763
+        Integer noLikeCount= tpTransactionLikeMapper.nolikeCount(activityId, communityId);
764
+        tpTransaction.setLikeCount(likeCount == null ? 0 : likeCount);
765
+        tpTransaction.setNoLikeCount(noLikeCount == null ? 0 : noLikeCount);
766
+
767
+        // 默认没有点赞或者踩
768
+        tpTransaction.setBel(false);
769
+        TpTransactionLike isUser= tpTransactionLikeMapper.getinvitationId(activityId,communityId, userId);
770
+        if (null!=isUser){
771
+            tpTransaction.setBel(true);
772
+        }
773
+
775 774
         return tpTransaction;
776 775
 
777 776
     }

+ 2
- 4
CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionLikeMapper.xml Wyświetl plik

@@ -118,8 +118,7 @@
118 118
     SELECT COUNT(transaction_id) FROM
119 119
     tp_transaction_like
120 120
     WHERE like_status = 1
121
-    and   community_id = #{communityId,jdbcType=INTEGER},
122
-    and   ta_user_id = #{userId,jdbcType=INTEGER},
121
+    and   community_id = #{communityId,jdbcType=INTEGER}
123 122
     and   transaction_id = #{invitationId,jdbcType=INTEGER}
124 123
   </select>
125 124
 
@@ -127,8 +126,7 @@
127 126
     SELECT COUNT(transaction_id) FROM
128 127
     tp_transaction_like
129 128
     WHERE like_status = 2
130
-    and   community_id = #{communityId,jdbcType=INTEGER},
131
-    and   ta_user_id = #{userId,jdbcType=INTEGER},
129
+    and   community_id = #{communityId,jdbcType=INTEGER}
132 130
     and   transaction_id = #{invitationId,jdbcType=INTEGER}
133 131
   </select>
134 132