Explorar el Código

fix:历史委托工作月查询sql修改

ly hace 9 meses
padre
commit
d3a9f82005
Se han modificado 1 ficheros con 6 adiciones y 7 borrados
  1. 6 7
      src/main/resources/mybatis/business/BizWorkOrderMapper.xml

+ 6 - 7
src/main/resources/mybatis/business/BizWorkOrderMapper.xml

@@ -145,7 +145,6 @@
             AND t5.type = 1
             AND t5.start_month != 0
             and t5.deleted = 0
-            and t5.start_month < DATE_FORMAT(CURRENT_DATE (), '%Y-%m-01')
             <if test="fromTenantId != null and fromTenantId != ''">
                 AND t1.from_tenant_id = #{fromTenantId}
             </if>
@@ -153,11 +152,14 @@
                 AND t1.to_tenant_id = #{toTenantId}
             </if>
             <if test="fromCompanyName != null and fromCompanyName != ''">
-
                 AND t7.account_name like concat('%', #{fromCompanyName}, '%')
             </if>
             <if test="date == null">
-                AND t1.work_month &lt;DATE_FORMAT(CURRENT_DATE (), '%Y-%m-01')
+                and t5.start_month &lt; DATE_FORMAT(CURRENT_DATE (), '%Y-%m-01')
+                AND MONTH ( t1.work_month ) &lt;MONTH(CURRENT_DATE ())
+            </if>
+            <if test="date != null">
+                AND t1.work_month = #{date}
             </if>
             <if test="companyName != null and companyName != ''">
                 AND t3.name like concat('%', #{companyName}, '%')
@@ -165,12 +167,9 @@
             <if test="toAccountName != null and toAccountName!=''">
                 AND t2.account_name like concat( '%', #{toAccountName}, '%' )
             </if>
-            <if test="date != null">
-                and t1.work_month = #{date}
-            </if>
         </where>
         ORDER BY
-        t1.work_month DESC
+        t5.start_month DESC
 
     </select>