Sfoglia il codice sorgente

时间统一处理

PLF 5 anni fa
parent
commit
5e024bbf6c

+ 3 - 0
src/main/java/com/caimei/modules/club/entity/CmOperationUser.java

@@ -1,6 +1,7 @@
 package com.caimei.modules.club.entity;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
 import java.util.Date;
@@ -29,7 +30,9 @@ public class CmOperationUser implements Serializable {
     private Date bindTime;        // 绑定时间
     private Date updateTime;        // 更新时间
     private Date addTime;        // 添加时间
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date beginAddTime;        // 开始 添加时间
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date endAddTime;        // 结束 添加时间
     private String effectiveFlag;//邀请码是否有效 1有效,2已使用,3已失效
     private String configFlag;//确认标志

+ 4 - 8
src/main/resources/mapper/CmOperationUserMapper.xml

@@ -30,21 +30,17 @@
 
             <if test="mobile != null and mobile != ''">
                 AND a.mobile LIKE
-                <if test="dbName == 'oracle'">'%'||#{mobile}||'%'</if>
-                <if test="dbName == 'mssql'">'%'+#{mobile}+'%'</if>
-                <if test="dbName == 'mysql'">concat('%',#{mobile},'%')</if>
+                concat('%',#{mobile},'%')
             </if>
             <if test="linkName != null and linkName != ''">
                 AND a.linkName LIKE
-                <if test="dbName == 'oracle'">'%'||#{linkName}||'%'</if>
-                <if test="dbName == 'mssql'">'%'+#{linkName}+'%'</if>
-                <if test="dbName == 'mysql'">concat('%',#{linkName},'%')</if>
+                concat('%',#{linkName},'%')
             </if>
             <if test="status != null and status != ''">
                 AND a.status = #{status}
             </if>
-            <if test="beginAddTime != null and endAddTime != null and beginAddTime != '' and endAddTime != ''">
-                AND a.addTime BETWEEN #{beginAddTime} AND #{endAddTime}
+            <if test="beginAddTime != null and endAddTime != null">
+                AND DATE_FORMAT(a.addTime,"%Y-%m-%d") BETWEEN #{beginAddTime} AND #{endAddTime}
             </if>
             <if test="userOrganizeID != null and userOrganizeID != ''">
                 AND a.userOrganizeID = #{userOrganizeID}

+ 1 - 3
src/main/resources/mapper/CmReturnedPurchaseMapper.xml

@@ -118,9 +118,7 @@
             </if>
             <if test="userName != null and userName != ''">
                 AND c.userName like
-                <if test="dbName == 'oracle'">'%'||#{userName}||'%'</if>
-                <if test="dbName == 'mssql'">'%'+#{userName}+'%'</if>
-                <if test="dbName == 'mysql'">concat('%',#{userName},'%')</if>
+                concat('%',#{userName},'%')
             </if>
             <if test="orderNo != null and orderNo != ''">
                 AND b.orderNo = #{orderNo}

+ 2 - 2
src/main/resources/mapper/CmUserMapper.xml

@@ -29,10 +29,10 @@
                 AND c.linkMan LIKE concat('%',#{linkMan},'%')
             </if>
             <if test="startTime != null and startTime != ''">
-                AND a.registerTime <![CDATA[  >=  ]]> #{startTime}
+                AND DATE_FORMAT(a.registerTime,"%Y-%m-%d") <![CDATA[  >=  ]]> #{startTime}
             </if>
             <if test="endTime != null and endTime != ''">
-                AND a.registerTime <![CDATA[   <=  ]]> #{endTime}
+                AND DATE_FORMAT(a.registerTime,"%Y-%m-%d") <![CDATA[   <=  ]]> #{endTime}
             </if>
             <if test="clubStatus != null and clubStatus != ''">
                 AND a.clubStatus = #{clubStatus}

+ 10 - 10
src/main/resources/mapper/HomePageMapper.xml

@@ -13,10 +13,10 @@
           AND organizeID = #{organizeID}
           AND delFlag='0'
         <if test="startTime != null and startTime != ''">
-            AND orderTime <![CDATA[ >= ]]> #{startTime}
+            AND DATE_FORMAT(orderTime,"%Y-%m-%d") <![CDATA[ >= ]]> #{startTime}
         </if>
         <if test="endTime != null and endTime != ''">
-            AND orderTime <![CDATA[ <= ]]> #{endTime}
+            AND DATE_FORMAT(orderTime,"%Y-%m-%d") <![CDATA[ <= ]]> #{endTime}
         </if>
     </select>
 
@@ -30,10 +30,10 @@
           AND organizeID = #{organizeID}
           AND delFlag='0'
         <if test="startTime != null and startTime != ''">
-            AND orderTime <![CDATA[ >= ]]> #{startTime}
+            AND DATE_FORMAT(orderTime,"%Y-%m-%d") <![CDATA[ >= ]]> #{startTime}
         </if>
         <if test="endTime != null and endTime != ''">
-            AND orderTime <![CDATA[ <= ]]> #{endTime}
+            AND DATE_FORMAT(orderTime,"%Y-%m-%d") <![CDATA[ <= ]]> #{endTime}
         </if>
     </select>
 
@@ -49,10 +49,10 @@
           AND cror.relationType = '2'
           AND cror.delFlag = '0'
         <if test="startTime != null and startTime != ''">
-            AND co.orderTime <![CDATA[ >= ]]> #{startTime}
+            AND DATE_FORMAT(co.orderTime,"%Y-%m-%d") <![CDATA[ >= ]]> #{startTime}
         </if>
         <if test="endTime != null and endTime != ''">
-            AND co.orderTime <![CDATA[ <= ]]> #{endTime}
+            AND DATE_FORMAT(co.orderTime,"%Y-%m-%d") <![CDATA[ <= ]]> #{endTime}
         </if>
     </select>
 
@@ -66,10 +66,10 @@
           AND organizeID = #{organizeID}
           AND delFlag = '0'
         <if test="startTime != null and startTime != ''">
-            AND co.orderTime <![CDATA[ >= ]]> #{startTime}
+            AND DATE_FORMAT(orderTime,"%Y-%m-%d") <![CDATA[ >= ]]> #{startTime}
         </if>
         <if test="endTime != null and endTime != ''">
-            AND co.orderTime <![CDATA[ <= ]]> #{endTime}
+            AND DATE_FORMAT(orderTime,"%Y-%m-%d") <![CDATA[ <= ]]> #{endTime}
         </if>
         <if test="receiptStatus != null and receiptStatus != ''">
             AND receiptStatus = #{receiptStatus}
@@ -89,10 +89,10 @@
           AND co.organizeID = #{organizeID}
           AND co.delFlag = '0'
         <if test="startTime != null and startTime != ''">
-            AND co.orderTime <![CDATA[ >= ]]> #{startTime}
+            AND DATE_FORMAT(co.orderTime,"%Y-%m-%d") <![CDATA[ >= ]]> #{startTime}
         </if>
         <if test="endTime != null and endTime != ''">
-            AND co.orderTime <![CDATA[ <= ]]> #{endTime}
+            AND DATE_FORMAT(co.orderTime,"%Y-%m-%d") <![CDATA[ <= ]]> #{endTime}
         </if>
         GROUP BY
           cop.productID