魏熙美 5 年之前
父節點
當前提交
0164f02570
共有 1 個檔案被更改,包括 11 行新增4 行删除
  1. 11
    4
      src/main/resources/mapper/TaPersonMapper.xml

+ 11
- 4
src/main/resources/mapper/TaPersonMapper.xml 查看文件

235
                   DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum WEEK ), '%Y-%m-%d' ) AS date
235
                   DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum WEEK ), '%Y-%m-%d' ) AS date
236
               </if>
236
               </if>
237
               <if test="dateType == 'month'.toString()">
237
               <if test="dateType == 'month'.toString()">
238
-                  DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum MONTH ), '%Y-%m-%d' ) AS date
238
+                  DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum MONTH ), '%Y-%m' ) AS date
239
               </if>
239
               </if>
240
             FROM
240
             FROM
241
               sequence a
241
               sequence a
242
 
242
 
243
               <trim prefix="where">
243
               <trim prefix="where">
244
                   <if test="startDate != null or endDate != null">
244
                   <if test="startDate != null or endDate != null">
245
-                      a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
245
+                      a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
246
                   </if>
246
                   </if>
247
                   <if test="startDate == null or endDate == null">
247
                   <if test="startDate == null or endDate == null">
248
-                      a.rownum <![CDATA[ <= ]]> 7
248
+                      a.rownum <![CDATA[ < ]]> 7
249
                   </if>
249
                   </if>
250
               </trim>
250
               </trim>
251
 
251
 
260
             ( SELECT * FROM ta_person_visit_record GROUP BY  person_id  ) as tpvr
260
             ( SELECT * FROM ta_person_visit_record GROUP BY  person_id  ) as tpvr
261
             ON tp.person_id = tpvr.person_id
261
             ON tp.person_id = tpvr.person_id
262
              where ifnull(tp.person_type, '') != #{personType}
262
              where ifnull(tp.person_type, '') != #{personType}
263
-        ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
263
+        ) AS temp ON
264
+        <if test="dateType == 'month'.toString()">
265
+            temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m' ) ORDER BY temp_date.date
266
+        </if>
267
+        <if test="dateType != 'month'.toString()">
268
+            temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' ) ORDER BY temp_date.date
269
+        </if>
270
+
264
     </select>
271
     </select>
265
 
272
 
266
     <select id="selectNewsUserCount" resultType="map">
273
     <select id="selectNewsUserCount" resultType="map">