魏超 5 年前
父节点
当前提交
589bf6f44e
共有 1 个文件被更改,包括 13 次插入51 次删除
  1. 13
    51
      src/main/resources/mapper/statistic/TaActivityStaticMapper.xml

+ 13
- 51
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml 查看文件

@@ -1810,7 +1810,7 @@
1810 1810
         left join ta_recommend_customer c on c.person_id = t.person_id
1811 1811
         left join ta_person d on c.recommend_person = d.person_id
1812 1812
         left join ta_person e on t.share_person = e.person_id
1813
-        left join ta_person f on t.share_person = f.user_id
1813
+        left join ta_user f on t.share_person = f.user_id
1814 1814
         WHERE t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id =
1815 1815
         #{orgId} and t.status = 1
1816 1816
         and t.is_first_time = 1
@@ -1828,29 +1828,6 @@
1828 1828
         <if test="buildingId != null and buildingId != ''">
1829 1829
             and c.building_id = #{buildingId}
1830 1830
         </if>
1831
-        <if test="userId != null and userId != ''">
1832
-            and (d.create_user = #{userId} or c.create_user = #{userId})
1833
-        </if>
1834
-        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
1835
-            AND
1836
-            (a.building_id in
1837
-            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
1838
-                #{taPersonBuildings.buildingId}
1839
-            </foreach>
1840
-            or
1841
-            b.building_id in
1842
-            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
1843
-                #{taPersonBuildings.buildingId}
1844
-            </foreach>
1845
-            or
1846
-            e.building_id in
1847
-            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
1848
-                #{taPersonBuildings.buildingId}
1849
-            </foreach>
1850
-            or d.create_user = #{userId}
1851
-            or c.create_user = #{userId}
1852
-            )
1853
-        </if>
1854 1831
         group by t.person_id
1855 1832
     </select>
1856 1833
 
@@ -1872,7 +1849,7 @@
1872 1849
         left join ta_recommend_customer c on c.person_id = t.person_id
1873 1850
         left join ta_person d on c.recommend_person = d.person_id
1874 1851
         left join ta_person e on t.share_person = e.person_id
1875
-        left join ta_person f on t.share_person = f.user_id
1852
+        left join ta_user f on t.share_person = f.user_id
1876 1853
         WHERE t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id =
1877 1854
         #{orgId} and t.status = 1
1878 1855
         and t.is_first_time = 1
@@ -1890,29 +1867,6 @@
1890 1867
         <if test="buildingId != null and buildingId != ''">
1891 1868
             and c.building_id = #{buildingId}
1892 1869
         </if>
1893
-        <if test="userId != null and userId != ''">
1894
-            and (d.create_user = #{userId} or c.create_user = #{userId})
1895
-        </if>
1896
-        <if test="taPersonBuildings != null and taPersonBuildings.size > 0">
1897
-            AND
1898
-            (a.building_id in
1899
-            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
1900
-                #{taPersonBuildings.buildingId}
1901
-            </foreach>
1902
-            or
1903
-            b.building_id in
1904
-            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
1905
-                #{taPersonBuildings.buildingId}
1906
-            </foreach>
1907
-            or
1908
-            e.building_id in
1909
-            <foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
1910
-                #{taPersonBuildings.buildingId}
1911
-            </foreach>
1912
-            or d.create_user = #{userId}
1913
-            or c.create_user = #{userId}
1914
-            )
1915
-        </if>
1916 1870
         group by t.person_id
1917 1871
     </select>
1918 1872
 
@@ -2037,7 +1991,7 @@
2037 1991
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
2038 1992
         a.province,
2039 1993
         b1.scene_alias as personFrom,
2040
-        d.user_name as realtyConsultant,
1994
+        GROUP_CONCAT(d.user_name) as realtyConsultant,
2041 1995
         d.phone as realtyConsultantPhone,
2042 1996
         t.create_date as visitDate,
2043 1997
         ifnull(e.nickName, f.user_name) as sharePersonName,
@@ -2092,6 +2046,7 @@
2092 2046
                 and d.phone like concat('%', #{realtyConsultantPhone},'%')
2093 2047
             </if>
2094 2048
         </where>
2049
+        group by t.person_id
2095 2050
         order by t.create_date desc
2096 2051
     </select>
2097 2052
 
@@ -2102,7 +2057,7 @@
2102 2057
         if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
2103 2058
         a.province,
2104 2059
         b1.scene_alias as personFrom,
2105
-        d.user_name as realtyConsultant,
2060
+        GROUP_CONCAT(d.user_name) as realtyConsultant,
2106 2061
         d.phone as realtyConsultantPhone,
2107 2062
         t.create_date as visitDate,
2108 2063
         ifnull(e.nickName, f.user_name) as sharePersonName,
@@ -2157,9 +2112,10 @@
2157 2112
                 and d.phone like concat('%', #{realtyConsultantPhone},'%')
2158 2113
             </if>
2159 2114
         </where>
2115
+        group by t.person_id
2160 2116
         order by t.create_date desc
2161 2117
     </select>
2162
-    
2118
+
2163 2119
     <select id="selectActivityVisitPersonNumByPersonId"
2164 2120
             resultType="com.huiju.estateagents.excel.ActivityStatistics.VisitPersonNum">
2165 2121
         select
@@ -2170,6 +2126,7 @@
2170 2126
         d.user_name as realtyConsultant,
2171 2127
         d.phone as realtyConsultantPhone,
2172 2128
         t.create_date as visitDate,
2129
+        ifnull(e.nickName, f.user_name) as sharePersonName,
2173 2130
         t.visitNum
2174 2131
         From (
2175 2132
         SELECT count(1) as visitNum, t.person_id, t.create_date
@@ -2191,6 +2148,8 @@
2191 2148
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
2192 2149
         LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
2193 2150
         left join ta_user d on c.realty_consultant = d.user_id
2151
+        left join ta_person e on e.person_id = c.recommend_person
2152
+        left join ta_user f on f.user_id = c.recommend_person
2194 2153
     </select>
2195 2154
 
2196 2155
     <select id="selectActivityVisitNumByPersonId" resultType="com.huiju.estateagents.excel.ActivityStatistics.VisitNum">
@@ -2234,6 +2193,7 @@
2234 2193
         d.user_name as realtyConsultant,
2235 2194
         d.phone as realtyConsultantPhone,
2236 2195
         t.create_date as visitDate,
2196
+        ifnull(e.nickName, f.user_name) as sharePersonName,
2237 2197
         t.visitNum
2238 2198
         From (
2239 2199
         SELECT count(1) as visitNum, t.person_id, t.create_date
@@ -2255,6 +2215,8 @@
2255 2215
         left join td_wx_dict b1 on b.scene_id = b1.scene_id
2256 2216
         LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
2257 2217
         left join ta_user d on c.realty_consultant = d.user_id
2218
+        left join ta_person e on e.person_id = c.recommend_person
2219
+        left join ta_user f on f.user_id = c.recommend_person
2258 2220
     </select>
2259 2221
 
2260 2222
     <select id="selectActivityVisitNumExportByPersonId"