|
@@ -912,7 +912,7 @@
|
912
|
912
|
and a.building_id = #{buildingId}
|
913
|
913
|
</if>
|
914
|
914
|
<if test="activityName != null and activityName != '' ">
|
915
|
|
- and a.title = #{activityName}
|
|
915
|
+ and a.title like concat('%', #{activityName}, '%')
|
916
|
916
|
</if>
|
917
|
917
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
918
|
918
|
and a.building_id in
|
|
@@ -927,7 +927,7 @@
|
927
|
927
|
and b.building_id = #{buildingId}
|
928
|
928
|
</if>
|
929
|
929
|
<if test="activityName != null and activityName != '' ">
|
930
|
|
- and b.title = #{activityName}
|
|
930
|
+ and b.title like concat('%', #{activityName}, '%')
|
931
|
931
|
</if>
|
932
|
932
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
933
|
933
|
and b.building_id in
|
|
@@ -943,7 +943,7 @@
|
943
|
943
|
and c.building_id = #{buildingId}
|
944
|
944
|
</if>
|
945
|
945
|
<if test="activityName != null and activityName != '' ">
|
946
|
|
- and c.activity_name = #{activityName}
|
|
946
|
+ and c.activity_name like concat('%', #{activityName}, '%')
|
947
|
947
|
</if>
|
948
|
948
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
949
|
949
|
and c.building_id in
|
|
@@ -958,10 +958,10 @@
|
958
|
958
|
and d.building_id = #{buildingId}
|
959
|
959
|
</if>
|
960
|
960
|
<if test="activityName != null and activityName != '' ">
|
961
|
|
- and d.name = #{activityName}
|
|
961
|
+ and d.name like concat('%', #{activityName}, '%')
|
962
|
962
|
</if>
|
963
|
963
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
964
|
|
- and c.building_id in
|
|
964
|
+ and d.building_id in
|
965
|
965
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
966
|
966
|
#{taPersonBuilding.buildingId}
|
967
|
967
|
</foreach>
|
|
@@ -974,7 +974,7 @@
|
974
|
974
|
and e.building_id = #{buildingId}
|
975
|
975
|
</if>
|
976
|
976
|
<if test="activityName != null and activityName != '' ">
|
977
|
|
- and e.live_activity_title = #{activityName}
|
|
977
|
+ and e.live_activity_title like concat('%', #{activityName}, '%')
|
978
|
978
|
</if>
|
979
|
979
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
980
|
980
|
and e.building_id in
|
|
@@ -1001,7 +1001,7 @@
|
1001
|
1001
|
<if test="startDate == null or endDate == null ">
|
1002
|
1002
|
AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
1003
|
1003
|
</if>
|
1004
|
|
- group by a.be_share
|
|
1004
|
+ group by a.be_share,a.tagert_type
|
1005
|
1005
|
) as shareNum on shareNum.be_share = activity.activityId and shareNum.tagert_type = activity.activityType
|
1006
|
1006
|
|
1007
|
1007
|
left join (
|
|
@@ -1027,10 +1027,10 @@
|
1027
|
1027
|
activity.activityType
|
1028
|
1028
|
|
1029
|
1029
|
left join (
|
1030
|
|
- select count(*) as visitNum, a.target_id, case when a.target_type = 'dynamic' then 'activity' else a.target_type end as target_type
|
|
1030
|
+ select count(*) as visitNum, a.target_id, case when a.target_type = 'dynamic' then 'activity' when a.target_type is null then 'h5' else a.target_type end as target_type
|
1031
|
1031
|
From ta_person_visit_record a where a.event_type in
|
1032
|
1032
|
('activity','group','h5','help') and a.`event` = 'detail' and a.org_id = #{orgId}
|
1033
|
|
- <if test="targetType != null and targetType != ''">
|
|
1033
|
+ <if test="targetType != null and targetType != '' and targetType != 'h5'">
|
1034
|
1034
|
and (case when #{targetType} = 'activity' then a.target_type = 'dynamic' else a.target_type = #{targetType}
|
1035
|
1035
|
end)
|
1036
|
1036
|
</if>
|
|
@@ -1043,14 +1043,14 @@
|
1043
|
1043
|
<if test="startDate == null or endDate == null ">
|
1044
|
1044
|
AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
1045
|
1045
|
</if>
|
1046
|
|
- group by a.target_id, a.event_type
|
|
1046
|
+ group by a.target_id, a.target_type
|
1047
|
1047
|
) as visitNum on visitNum.target_id = activity.activityId and visitNum.target_type = activity.activityType
|
1048
|
1048
|
|
1049
|
1049
|
left join (
|
1050
|
|
- SELECT count(DISTINCT(a.person_id)) as visitPersonNum , a.target_id, case when a.target_type = 'dynamic' then 'activity' else a.target_type end as event_type
|
|
1050
|
+ SELECT count(DISTINCT(a.person_id)) as visitPersonNum , a.target_id, case when a.target_type = 'dynamic' then 'activity' when a.target_type is null then 'h5' else a.target_type end as event_type
|
1051
|
1051
|
From ta_person_visit_record a where a.event_type in ('activity','group','h5','help') and a.`event` =
|
1052
|
1052
|
'detail' and a.org_id = #{orgId}
|
1053
|
|
- <if test="targetType != null and targetType != ''">
|
|
1053
|
+ <if test="targetType != null and targetType != '' and targetType != 'h5'">
|
1054
|
1054
|
and (case when #{targetType} = 'activity' then a.target_type = 'dynamic' else a.target_type = #{targetType}
|
1055
|
1055
|
end)
|
1056
|
1056
|
</if>
|
|
@@ -1063,7 +1063,7 @@
|
1063
|
1063
|
<if test="startDate == null or endDate == null ">
|
1064
|
1064
|
AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
1065
|
1065
|
</if>
|
1066
|
|
- group by a.target_id, a.event_type
|
|
1066
|
+ group by a.target_id, a.target_type
|
1067
|
1067
|
) as visitPersonNum on visitPersonNum.target_id = activity.activityId and visitPersonNum.event_type =
|
1068
|
1068
|
activity.activityType
|
1069
|
1069
|
|
|
@@ -1073,7 +1073,7 @@
|
1073
|
1073
|
'help_share', 'live_share', 'group_share' ) and a.org_id = #{orgId}
|
1074
|
1074
|
and a.status = 1
|
1075
|
1075
|
and a.is_first_time = 1
|
1076
|
|
- <if test="targetType != null and targetType != ''">
|
|
1076
|
+ <if test="targetType != null and targetType != '' and targetType != 'h5'">
|
1077
|
1077
|
and a.target_type = #{targetType}
|
1078
|
1078
|
</if>
|
1079
|
1079
|
<if test="startDate != null ">
|
|
@@ -1104,13 +1104,7 @@
|
1104
|
1104
|
<select id="selectActivityStatisDetailExport"
|
1105
|
1105
|
resultType="com.huiju.estateagents.excel.ActivityStatistics.ActivityDetailShareRecord">
|
1106
|
1106
|
select
|
1107
|
|
- activity.activityId, activity.activityName,
|
1108
|
|
- case when activity.activityType = 'activity' then '报名活动'
|
1109
|
|
- when activity.activityType = 'help' then '助力活动'
|
1110
|
|
- when activity.activityType = 'group' then '拼团活动'
|
1111
|
|
- when activity.activityType = 'h5' then 'H5活动'
|
1112
|
|
- when activity.activityType = 'live' then '直播活动'
|
1113
|
|
- end as activityType,
|
|
1107
|
+ activity.*,
|
1114
|
1108
|
ifnull(shareNum.shareNum, 0) as shareNum,
|
1115
|
1109
|
ifnull(sharePersonNum.sharePersonNum, 0) as sharePersonNum,
|
1116
|
1110
|
ifnull(visitNum.visitNum, 0) as visitNum,
|
|
@@ -1201,28 +1195,34 @@
|
1201
|
1195
|
FROM ta_share_count a where a.tagert_type in (
|
1202
|
1196
|
'activity', 'group','h5','help','liveApp','livePost')
|
1203
|
1197
|
and a.org_id = #{orgId}
|
|
1198
|
+ <if test="targetType != null and targetType != ''">
|
|
1199
|
+ and a.tagert_type = #{targetType}
|
|
1200
|
+ </if>
|
1204
|
1201
|
<if test="startDate != null ">
|
1205
|
|
- and a.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
1202
|
+ and a.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
1206
|
1203
|
</if>
|
1207
|
1204
|
<if test="endDate != null ">
|
1208
|
|
- and a.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
1205
|
+ and a.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
1209
|
1206
|
</if>
|
1210
|
1207
|
<if test="startDate == null or endDate == null ">
|
1211
|
1208
|
AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
1212
|
1209
|
</if>
|
1213
|
|
- group by a.be_share
|
|
1210
|
+ group by a.be_share,a.tagert_type
|
1214
|
1211
|
) as shareNum on shareNum.be_share = activity.activityId and shareNum.tagert_type = activity.activityType
|
1215
|
1212
|
|
1216
|
1213
|
left join (
|
1217
|
|
- select count(*) as sharePersonNum ,sharePersonNum.be_share, sharePersonNum.tagert_type,
|
1218
|
|
- sharePersonNum.create_date from (
|
1219
|
|
- SELECT a.be_share, a.create_date ,case when a.tagert_type = 'liveApp' then 'live' when a.tagert_type = 'livePost' then 'live' else a.tagert_type end as tagert_type From ta_share_count a where a.tagert_type in ( 'activity', 'group','h5','help','liveApp','livePost')
|
|
1214
|
+ SELECT count(*) as sharePersonNum ,sharePersonNum.be_share, sharePersonNum.tagert_type, sharePersonNum.create_date from (
|
|
1215
|
+ SELECT a.be_share, a.create_date ,case when a.tagert_type = 'liveApp' then 'live' when a.tagert_type = 'livePost' then 'live' else a.tagert_type end as tagert_type
|
|
1216
|
+ From ta_share_count a where a.tagert_type in ( 'activity', 'group','h5','help','liveApp','livePost')
|
1220
|
1217
|
and a.org_id = #{orgId}
|
|
1218
|
+ <if test="targetType != null and targetType != ''">
|
|
1219
|
+ and a.tagert_type = #{targetType}
|
|
1220
|
+ </if>
|
1221
|
1221
|
<if test="startDate != null ">
|
1222
|
|
- and a.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
1222
|
+ and a.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
1223
|
1223
|
</if>
|
1224
|
1224
|
<if test="endDate != null ">
|
1225
|
|
- and a.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
1225
|
+ and a.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
1226
|
1226
|
</if>
|
1227
|
1227
|
<if test="startDate == null or endDate == null ">
|
1228
|
1228
|
AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -1233,37 +1233,43 @@
|
1233
|
1233
|
activity.activityType
|
1234
|
1234
|
|
1235
|
1235
|
left join (
|
1236
|
|
- select * from (
|
1237
|
|
- select count(*) as visitNum, a.target_id, a.event_type From ta_person_visit_record a where a.event_type in
|
|
1236
|
+ select count(*) as visitNum, a.target_id, case when a.target_type = 'dynamic' then 'activity' when a.target_type is null then 'h5' else a.target_type end as target_type
|
|
1237
|
+ From ta_person_visit_record a where a.event_type in
|
1238
|
1238
|
('activity','group','h5','help') and a.`event` = 'detail' and a.org_id = #{orgId}
|
|
1239
|
+ <if test="targetType != null and targetType != '' and targetType != 'h5'">
|
|
1240
|
+ and (case when #{targetType} = 'activity' then a.target_type = 'dynamic' else a.target_type = #{targetType}
|
|
1241
|
+ end)
|
|
1242
|
+ </if>
|
1239
|
1243
|
<if test="startDate != null">
|
1240
|
|
- and a.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
1244
|
+ and a.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
1241
|
1245
|
</if>
|
1242
|
1246
|
<if test="endDate != null">
|
1243
|
|
- and a.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
1247
|
+ and a.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
1244
|
1248
|
</if>
|
1245
|
1249
|
<if test="startDate == null or endDate == null ">
|
1246
|
1250
|
AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
1247
|
1251
|
</if>
|
1248
|
|
- group by a.target_id, a.event_type
|
1249
|
|
- ) as a
|
1250
|
|
- ) as visitNum on visitNum.target_id = activity.activityId and visitNum.event_type = activity.activityType
|
|
1252
|
+ group by a.target_id, a.target_type
|
|
1253
|
+ ) as visitNum on visitNum.target_id = activity.activityId and visitNum.target_type = activity.activityType
|
1251
|
1254
|
|
1252
|
1255
|
left join (
|
1253
|
|
- select count(*) as visitPersonNum ,visitPersonNum.target_id, visitPersonNum.event_type from (
|
1254
|
|
- select a.* From ta_person_visit_record a where a.event_type in ('activity','group','h5','help') and a.`event` =
|
|
1256
|
+ SELECT count(DISTINCT(a.person_id)) as visitPersonNum , a.target_id, case when a.target_type = 'dynamic' then 'activity' when a.target_type is null then 'h5' else a.target_type end as event_type
|
|
1257
|
+ From ta_person_visit_record a where a.event_type in ('activity','group','h5','help') and a.`event` =
|
1255
|
1258
|
'detail' and a.org_id = #{orgId}
|
|
1259
|
+ <if test="targetType != null and targetType != '' and targetType != 'h5'">
|
|
1260
|
+ and (case when #{targetType} = 'activity' then a.target_type = 'dynamic' else a.target_type = #{targetType}
|
|
1261
|
+ end)
|
|
1262
|
+ </if>
|
1256
|
1263
|
<if test="startDate != null">
|
1257
|
|
- and a.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
1264
|
+ and a.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
1258
|
1265
|
</if>
|
1259
|
1266
|
<if test="endDate != null">
|
1260
|
|
- and a.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
1267
|
+ and a.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
1261
|
1268
|
</if>
|
1262
|
1269
|
<if test="startDate == null or endDate == null ">
|
1263
|
1270
|
AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
1264
|
1271
|
</if>
|
1265
|
|
- group by a.person_id, a.target_id, a.event_type
|
1266
|
|
- ) as visitPersonNum group by visitPersonNum.target_id, visitPersonNum.event_type
|
|
1272
|
+ group by a.target_id, a.target_type
|
1267
|
1273
|
) as visitPersonNum on visitPersonNum.target_id = activity.activityId and visitPersonNum.event_type =
|
1268
|
1274
|
activity.activityType
|
1269
|
1275
|
|
|
@@ -1273,11 +1279,14 @@
|
1273
|
1279
|
'help_share', 'live_share', 'group_share' ) and a.org_id = #{orgId}
|
1274
|
1280
|
and a.status = 1
|
1275
|
1281
|
and a.is_first_time = 1
|
|
1282
|
+ <if test="targetType != null and targetType != '' and targetType != 'h5'">
|
|
1283
|
+ and a.target_type = #{targetType}
|
|
1284
|
+ </if>
|
1276
|
1285
|
<if test="startDate != null ">
|
1277
|
|
- and a.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
1286
|
+ and a.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
1278
|
1287
|
</if>
|
1279
|
1288
|
<if test="endDate != null ">
|
1280
|
|
- and a.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
1289
|
+ and a.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
1281
|
1290
|
</if>
|
1282
|
1291
|
<if test="startDate == null or endDate == null">
|
1283
|
1292
|
AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -1294,7 +1303,7 @@
|
1294
|
1303
|
order by sharePersonNum.create_date desc
|
1295
|
1304
|
</if>
|
1296
|
1305
|
<if test="colKey != null and colKey != ''">
|
1297
|
|
- ORDER BY ${colKey} ${sort}
|
|
1306
|
+ ORDER BY ${colKey} ${sortType}
|
1298
|
1307
|
</if>
|
1299
|
1308
|
</select>
|
1300
|
1309
|
|
|
@@ -1863,7 +1872,7 @@
|
1863
|
1872
|
and t.target_id = #{activityId}
|
1864
|
1873
|
</if>
|
1865
|
1874
|
<if test="activityType != null and activityType != ''">
|
1866
|
|
- and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{activityType}
|
|
1875
|
+ and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' when #{activityType} = 'h5' then t.event_type = 'h5' else t.target_type = #{activityType}
|
1867
|
1876
|
end)
|
1868
|
1877
|
</if>
|
1869
|
1878
|
<if test="buildingId != null and buildingId != ''">
|
|
@@ -1925,7 +1934,7 @@
|
1925
|
1934
|
and t.target_id = #{activityId}
|
1926
|
1935
|
</if>
|
1927
|
1936
|
<if test="activityType != null and activityType != ''">
|
1928
|
|
- and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{activityType}
|
|
1937
|
+ and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' when #{activityType} = 'h5' then t.event_type = 'h5' else t.target_type = #{activityType}
|
1929
|
1938
|
end)
|
1930
|
1939
|
</if>
|
1931
|
1940
|
<if test="buildingId != null and buildingId != ''">
|
|
@@ -1993,7 +2002,7 @@
|
1993
|
2002
|
and t.target_id = #{activityId}
|
1994
|
2003
|
</if>
|
1995
|
2004
|
<if test="activityType != null and activityType != ''">
|
1996
|
|
- and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{activityType}
|
|
2005
|
+ and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' when #{activityType} = 'h5' then t.event_type = 'h5' else t.target_type = #{activityType}
|
1997
|
2006
|
end)
|
1998
|
2007
|
</if>
|
1999
|
2008
|
<if test="buildingId != null and buildingId != ''">
|
|
@@ -2060,7 +2069,7 @@
|
2060
|
2069
|
and t.target_id = #{activityId}
|
2061
|
2070
|
</if>
|
2062
|
2071
|
<if test="activityType != null and activityType != ''">
|
2063
|
|
- and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{activityType}
|
|
2072
|
+ and (case when #{activityType} = 'activity' then t.target_type = 'dynamic' when #{activityType} = 'h5' then t.event_type = 'h5' else t.target_type = #{activityType}
|
2064
|
2073
|
end)
|
2065
|
2074
|
</if>
|
2066
|
2075
|
<if test="buildingId != null and buildingId != ''">
|
|
@@ -2140,8 +2149,8 @@
|
2140
|
2149
|
if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
|
2141
|
2150
|
a.province,
|
2142
|
2151
|
b1.scene_alias as personFrom,
|
2143
|
|
- d.user_name as realtyConsultant,
|
2144
|
|
- d.phone as realtyConsultantPhone,
|
|
2152
|
+ GROUP_CONCAT(d.user_name) as realtyConsultant,
|
|
2153
|
+ GROUP_CONCAT(d.phone) as realtyConsultantPhone,
|
2145
|
2154
|
t.create_date as visitDate,
|
2146
|
2155
|
ifnull(e.nickname, f.user_name) as sharePersonName,
|
2147
|
2156
|
ifnull(e.phone, f.phone) as sharePersonPhone
|
|
@@ -2225,8 +2234,8 @@
|
2225
|
2234
|
if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
|
2226
|
2235
|
a.province,
|
2227
|
2236
|
b1.scene_alias as personFrom,
|
2228
|
|
- d.user_name as realtyConsultant,
|
2229
|
|
- d.phone as realtyConsultantPhone,
|
|
2237
|
+ GROUP_CONCAT(d.user_name) as realtyConsultant,
|
|
2238
|
+ GROUP_CONCAT(d.phone) as realtyConsultantPhone,
|
2230
|
2239
|
t.create_date as visitDate,
|
2231
|
2240
|
ifnull(e.nickname, f.user_name) as sharePersonName,
|
2232
|
2241
|
ifnull(e.phone, f.phone) as sharePersonPhone
|