魏熙美 5 anos atrás
pai
commit
0164f02570
1 arquivos alterados com 11 adições e 4 exclusões
  1. 11
    4
      src/main/resources/mapper/TaPersonMapper.xml

+ 11
- 4
src/main/resources/mapper/TaPersonMapper.xml Ver arquivo

@@ -235,17 +235,17 @@ FROM
235 235
                   DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum WEEK ), '%Y-%m-%d' ) AS date
236 236
               </if>
237 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 239
               </if>
240 240
             FROM
241 241
               sequence a
242 242
 
243 243
               <trim prefix="where">
244 244
                   <if test="startDate != null or endDate != null">
245
-                      a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
245
+                      a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
246 246
                   </if>
247 247
                   <if test="startDate == null or endDate == null">
248
-                      a.rownum <![CDATA[ <= ]]> 7
248
+                      a.rownum <![CDATA[ < ]]> 7
249 249
                   </if>
250 250
               </trim>
251 251
 
@@ -260,7 +260,14 @@ FROM
260 260
             ( SELECT * FROM ta_person_visit_record GROUP BY  person_id  ) as tpvr
261 261
             ON tp.person_id = tpvr.person_id
262 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 271
     </select>
265 272
 
266 273
     <select id="selectNewsUserCount" resultType="map">