瀏覽代碼

新需求

魏超 5 年之前
父節點
當前提交
065394f20e
共有 1 個文件被更改,包括 39 次插入40 次删除
  1. 39
    40
      src/main/resources/mapper/statistic/TaActivityStaticMapper.xml

+ 39
- 40
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml 查看文件

@@ -152,48 +152,47 @@
152 152
         *
153 153
         FROM
154 154
         (
155
-        SELECT
156
-        DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
157
-        FROM
158
-        sequence a
159
-        <trim prefix="where">
160
-            <if test="startDate != null or endDate != null">
161
-                a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
162
-            </if>
163
-        </trim>
155
+            SELECT
156
+            DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
157
+            FROM
158
+            sequence a
159
+            <trim prefix="where">
160
+                <if test="startDate != null or endDate != null">
161
+                    a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
162
+                </if>
163
+            </trim>
164 164
         ) AS temp_date
165 165
         LEFT JOIN (
166
-        SELECT
167
-        COUNT( 1 ) AS user_count,
168
-        t.create_date AS create_date
169
-        FROM
170
-        ta_share_count t
171
-        left join ta_help_activity a on t.be_share = a.help_activity_id
172
-        left join ta_share_activity b on t.be_share = b.share_id
173
-        left join ta_live_activity c on t.be_share = c.live_activity_id
174
-        left join ta_drainage d on t.be_share = d.drainage_id
175
-        left join ta_building_dynamic e on t.be_share = e.dynamic_id
176
-        left join ta_person f on t.person_id = f.person_id
177
-        WHERE
178
-        t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and f.org_id = #{orgId}
179
-        <if test="buildingId != null and buildingId != ''">
180
-            and (a.building_id = #{buildingId} or b.building_id = #{buildingId} or c.building_id = #{buildingId} or d.building_id = #{buildingId} or e.building_id = #{buildingId})
181
-        </if>
182
-        <if test="targetType != null and targetType != ''">
183
-            and t.tagert_type = #{targetType}
184
-        </if>
185
-        <if test="startDate != null ">
186
-            and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
187
-        </if>
188
-        <if test="endDate != null ">
189
-            and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
190
-        </if>
191
-        <if test="startDate == null or endDate == null ">
192
-            AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
193
-        </if>
194
-        GROUP BY
195
-        DATE_FORMAT( t.create_date, '%Y-%m-%d' ), t.person_id
196
-        ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
166
+                select temp1.user_count, temp1.create_date from (
167
+                SELECT COUNT( 1 ) AS user_count, t.create_date AS create_date, t.person_id
168
+                FROM
169
+                ta_share_count t
170
+                left join ta_help_activity a on t.be_share = a.help_activity_id
171
+                left join ta_share_activity b on t.be_share = b.share_id
172
+                left join ta_live_activity c on t.be_share = c.live_activity_id
173
+                left join ta_drainage d on t.be_share = d.drainage_id
174
+                left join ta_building_dynamic e on t.be_share = e.dynamic_id
175
+                left join ta_person f on t.person_id = f.person_id
176
+                WHERE
177
+                t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
178
+                <if test="buildingId != null and buildingId != ''">
179
+                    and (a.building_id = #{buildingId} or b.building_id = #{buildingId} or c.building_id = #{buildingId} or d.building_id = #{buildingId} or e.building_id = #{buildingId})
180
+                </if>
181
+                <if test="targetType != null and targetType != ''">
182
+                    and t.tagert_type = #{targetType}
183
+                </if>
184
+                <if test="startDate != null ">
185
+                    and t.create_date &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
186
+                </if>
187
+                <if test="endDate != null ">
188
+                    and t.create_date &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
189
+                </if>
190
+                <if test="startDate == null or endDate == null ">
191
+                    AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
192
+                </if>
193
+                GROUP BY t.person_id
194
+                ) as temp1
195
+            ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
197 196
         ) AS share_person_count_table
198 197
 
199 198
         group by date order by date