Browse Source

sql优化

zouxuan 1 year ago
parent
commit
c4c0cbffba

+ 3 - 3
mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml

@@ -567,7 +567,7 @@
             </foreach>
     </select>
     <select id="exportCloudCoachActivationDetails" resultType="com.ym.mec.biz.dal.dto.CloudCoachActivationDetailsDto">
-        select o.name_ organName,cto.amount_ amount,cto.student_id_ studentId,cto.create_time_ createTime,su.username_ studentName,
+        select o.name_ organName,cto.amount_ amount,cto.student_id_ studentId,cto.start_time_ createTime,su.username_ studentName,
         CASE WHEN cto.type_ = 'MONTH' THEN CONCAT(cto.time_,'月')
         WHEN cto.type_ = 'YEAR' THEN CONCAT(cto.time_ * 12,'月')
         WHEN cto.type_ = 'YEAR_HALF' THEN CONCAT(cto.time_ * 6,'月')
@@ -581,8 +581,8 @@
             AND FIND_IN_SET(cto.organ_id_,#{organId})
         </if>
         <if test="month != null and month != ''">
-            AND DATE_FORMAT(cto.create_time_,'%Y-%m') = #{month}
+            AND DATE_FORMAT(cto.start_time_,'%Y-%m') = #{month}
         </if>
-        ORDER BY o.id_ DESC,cto.create_time_ DESC
+        ORDER BY o.id_ DESC,cto.start_time_ DESC
     </select>
 </mapper>

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/FinancialExpenditureMapper.xml

@@ -216,7 +216,7 @@
         FROM financial_expenditure
         WHERE payment_time_ >= #{startTime}
           AND payment_time_ <= #{endTime}
-          AND del_flag_ = 0 and tenant_id_ = #{tenantId}
+          AND del_flag_ = 0 and tenant_id_ = #{tenantId} AND organ_id_ IS NOT NULL
         GROUP BY organ_id_, cooperation_organ_id_, type_
         ]]></select>