Browse Source

sql优化

zouxuan 1 year ago
parent
commit
4d92a58e44

+ 5 - 5
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml

@@ -354,10 +354,10 @@
                 AND FIND_IN_SET(spo.organ_id_,#{organId})
             </if>
             <if test="orderStartDate != null">
-                AND DATE_FORMAT(spo.create_time_,'%Y-%m-%d') &gt;= #{orderStartDate}
+                AND spo.create_time_ &gt;= CONCAT(#{orderStartDate},' 00:00:00')
             </if>
             <if test="orderEndDate != null">
-                AND DATE_FORMAT(spo.create_time_,'%Y-%m-%d') &lt;= #{orderEndDate}
+                AND spo.create_time_ &lt;= CONCAT(#{orderEndDate},' 23:59:59')
             </if>
             <if test="notGroupType != null and notGroupType != ''">
                 AND spo.group_type_ != #{notGroupType}
@@ -423,13 +423,13 @@
                 AND FIND_IN_SET(spo.organ_id_,#{organId})
             </if>
             <if test="orderStartDate != null">
-                AND DATE_FORMAT(spo.create_time_,'%Y-%m-%d') &gt;= #{orderStartDate}
+                AND spo.create_time_ &gt;= CONCAT(#{orderStartDate},' 00:00:00')
             </if>
             <if test="orderEndDate != null">
-                AND DATE_FORMAT(spo.create_time_,'%Y-%m-%d') &lt;= #{orderEndDate}
+                AND spo.create_time_ &lt;= CONCAT(#{orderEndDate},' 23:59:59')
             </if>
             <if test="month != null and month != ''">
-                AND DATE_FORMAT(spo.create_time_,'%Y-%m') = #{month} AND spo.status_ = 'SUCCESS'
+                AND spo.create_time_ BETWEEN CONCAT(#{month},'-01 00:00:00') AND CONCAT(#{month},'-31 23:59:59') AND spo.status_ = 'SUCCESS'
             </if>
             <if test="notGroupType != null and notGroupType != ''">
                 AND spo.group_type_ != #{notGroupType}