傅行帆 5 lat temu
rodzic
commit
80451c1a33

+ 3
- 1
src/main/java/com/huiju/estateagents/controller/TaChannelController.java Wyświetl plik

@@ -266,8 +266,10 @@ public class TaChannelController extends BaseController {
266 266
                                                      @RequestParam(value = "targetType", required = false)String targetType,
267 267
                                                      @RequestParam(value = "buildingId", required = false)String buildingId,
268 268
                                                      @RequestParam(value = "channelId") Integer channelId,
269
+                                                     @RequestParam(value = "sortField", required = false) String sortField,
270
+                                                     @RequestParam(value = "sortOrder", required = false) String sortOrder,
269 271
                                                      HttpServletRequest request) {
270
-        return taChannelService.getChannelIntroductionList(pageNum, pageSize, getOrgId(request), startDate, endDate, targetType, buildingId, channelId);
272
+        return taChannelService.getChannelIntroductionList(pageNum, pageSize, getOrgId(request), startDate, endDate, targetType, buildingId, channelId,sortField,sortOrder);
271 273
     }
272 274
 
273 275
     /**

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaChannelMapper.java Wyświetl plik

@@ -56,7 +56,7 @@ public interface TaChannelMapper extends BaseMapper<TaChannel> {
56 56
      * @param buildingId
57 57
      * @return
58 58
      */
59
-    IPage<TsActivityDaily> getChannelIntroductionList(IPage<TsActivityDaily> pg,@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("channelType") String channelType,@Param("buildingId") String buildingId,@Param("channelId") Integer channelId);
59
+    IPage<TsActivityDaily> getChannelIntroductionList(IPage<TsActivityDaily> pg,@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("channelType") String channelType,@Param("buildingId") String buildingId,@Param("channelId") Integer channelId,@Param("sortField") String sortField,@Param("orderType") String orderType);
60 60
 
61 61
     IPage<ChannelAddRegistNum> getChannelNewuserList(IPage<ChannelAddRegistNum> iPage, @Param("orgId") Integer orgId, @Param("channelId") Integer channelId, @Param("activityId") String activityId, @Param("activityType") String activityType, @Param("buildingId") String buildingId);
62 62
 

+ 1
- 1
src/main/java/com/huiju/estateagents/service/TaChannelService.java Wyświetl plik

@@ -32,7 +32,7 @@ public interface TaChannelService extends IService<TaChannel> {
32 32
      * @param buildingId
33 33
      * @return
34 34
      */
35
-    ResponseBean getChannelIntroductionList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId);
35
+    ResponseBean getChannelIntroductionList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId,String sortField,String sortOrder);
36 36
 
37 37
     /**
38 38
      * 获取注册用户列表

+ 13
- 2
src/main/java/com/huiju/estateagents/service/impl/TaChannelServiceImpl.java Wyświetl plik

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6 6
 import com.huiju.estateagents.base.ResponseBean;
7
+import com.huiju.estateagents.common.StringUtils;
7 8
 import com.huiju.estateagents.entity.TaChannel;
8 9
 import com.huiju.estateagents.entity.TsActivityDaily;
9 10
 import com.huiju.estateagents.excel.ActivityStatistics.*;
@@ -42,9 +43,19 @@ public class TaChannelServiceImpl extends ServiceImpl<TaChannelMapper, TaChannel
42 43
      * @return
43 44
      */
44 45
     @Override
45
-    public ResponseBean getChannelIntroductionList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId) {
46
+    public ResponseBean getChannelIntroductionList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId,String sortField,String sortOrder) {
46 47
         IPage<TsActivityDaily> pg = new Page<>(pageNum, pageSize);
47
-        IPage<TsActivityDaily> data = taChannelMapper.getChannelIntroductionList(pg, orgId,startDate,endDate,channelType,buildingId, channelId);
48
+        String orderType = "asc";
49
+        if ("descend".equals(sortOrder)){
50
+            orderType = "desc";
51
+        }else if ("ascend".equals(sortOrder)){
52
+            orderType = "asc";
53
+        }
54
+        if(StringUtils.isEmpty(sortField)){
55
+            sortField = "new_customers";
56
+            orderType = "desc";
57
+        }
58
+        IPage<TsActivityDaily> data = taChannelMapper.getChannelIntroductionList(pg, orgId,startDate,endDate,channelType,buildingId, channelId, sortField, orderType);
48 59
         return ResponseBean.success(data);
49 60
     }
50 61
 

+ 20
- 1
src/main/resources/mapper/TaChannelMapper.xml Wyświetl plik

@@ -70,7 +70,22 @@
70 70
 
71 71
     <select id="getChannelIntroductionList" resultType="com.huiju.estateagents.entity.TsActivityDaily">
72 72
         SELECT
73
-            *
73
+            serial_no,
74
+            statis_date,
75
+            org_id,
76
+            building_id,
77
+            building_name,
78
+            target_id,
79
+            target_type,
80
+            target_name,
81
+            sum( share_num ) AS share_num,
82
+            sum( share_persons ) AS share_persons,
83
+            sum( visit_num ) AS visit_num,
84
+            sum( visit_persons ) AS visit_persons,
85
+            sum( new_persons ) AS new_persons,
86
+            sum( new_customers ) AS new_customers,
87
+            qr_code_id,
88
+            channel_id
74 89
         FROM
75 90
             ts_channel_daily
76 91
         WHERE
@@ -85,6 +100,10 @@
85 100
         <if test="buildingId != null and buildingId != ''">
86 101
             and building_id = #{buildingId}
87 102
         </if>
103
+        GROUP BY   target_id, target_type
104
+        <if test="sortField != null and sortField != ''">
105
+            ORDER BY ${sortField} ${orderType}
106
+        </if>
88 107
     </select>
89 108
     <select id="getChannelNewuserList"
90 109
             resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum">