顾绍勇 4 лет назад
Родитель
Сommit
b9f5b185f8

+ 6
- 0
src/main/java/com/huiju/estateagents/redpack/entity/TaRedPacketPerson.java Просмотреть файл

@@ -111,5 +111,11 @@ public class TaRedPacketPerson implements Serializable {
111 111
     @TableField(exist = false)
112 112
     private String avatarurl;
113 113
 
114
+    /**
115
+     * 被助力次数
116
+     */
117
+    @TableField(exist = false)
118
+    private Integer helpNum;
119
+
114 120
 
115 121
 }

+ 17
- 13
src/main/resources/mapper/redpack/TaRedPacketPersonMapper.xml Просмотреть файл

@@ -8,10 +8,11 @@
8 8
             t2.phone,
9 9
             t2.NAME,
10 10
             t2.nickname nickname,
11
-            t2.avatarurl
11
+            t2.avatarurl,
12
+        (select count(*) from ta_red_packet_history th where th.target_miniapp_person = t.miniapp_person_id and th.activity_id = #{activityId} and th.org_id = #{orgId}) helpNum
12 13
         FROM
13
-            ta_red_packet_person t
14
-            LEFT JOIN ta_person t2 ON t.miniapp_person_id = t2.person_id
14
+          ta_red_packet_person t
15
+          LEFT JOIN ta_person t2 ON t.miniapp_person_id = t2.person_id
15 16
         WHERE
16 17
             t.activity_id = #{activityId}
17 18
             AND t.org_id = #{orgId}
@@ -20,7 +21,8 @@
20 21
                 AND t2.phone like concat('%',#{phone},'%')
21 22
             </if>
22 23
         ORDER BY
23
-            t.votes DESC,t.create_date DESC
24
+            helpNum DESC,
25
+            t.create_date DESC
24 26
     </select>
25 27
 
26 28
     <select id="exportRedPacketRankingList" resultType="com.huiju.estateagents.excel.redPacket.RedPacketRankingListExport">
@@ -30,19 +32,21 @@
30 32
             t2.phone,
31 33
             t2.NAME,
32 34
             t2.nickname nickname,
33
-            t2.avatarurl
35
+            t2.avatarurl,
36
+            (select count(*) from ta_red_packet_history th where th.target_miniapp_person = t.miniapp_person_id and th.activity_id = #{activityId} and th.org_id = #{orgId}) votes
34 37
         FROM
35 38
             ta_red_packet_person t
36
-            LEFT JOIN ta_person t2 ON t.miniapp_person_id = t2.person_id
39
+        LEFT JOIN ta_person t2 ON t.miniapp_person_id = t2.person_id
37 40
         WHERE
38
-            t.activity_id = #{activityId}
39
-            AND t.org_id = #{orgId}
40
-            AND t.is_signed_up = TRUE
41
-            <if test = "phone != null and phone != ''">
42
-                AND t2.phone like concat('%',#{phone},'%')
43
-            </if>
41
+        t.activity_id = #{activityId}
42
+        AND t.org_id = #{orgId}
43
+        AND t.is_signed_up = TRUE
44
+        <if test = "phone != null and phone != ''">
45
+            AND t2.phone like concat('%',#{phone},'%')
46
+        </if>
44 47
         ORDER BY
45
-            t.votes DESC,t.create_date DESC
48
+        votes DESC,
49
+        t.create_date DESC
46 50
     </select>
47 51
 
48 52
 </mapper>