Bläddra i källkod

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

ly 9 månader sedan
förälder
incheckning
ea4f7aa015
1 ändrade filer med 8 tillägg och 14 borttagningar
  1. 8 14
      src/main/resources/mybatis/business/BizWorkOrderMapper.xml

+ 8 - 14
src/main/resources/mybatis/business/BizWorkOrderMapper.xml

@@ -140,9 +140,6 @@
         left join biz_task_type t4 on t4.id = t1.task_type_id
         LEFT JOIN biz_work_order t5 on t5.id = t1.work_order_id
         LEFT JOIN biz_tenant t7 on t1.from_tenant_id =t7.id
-        --             AND t5.no_contract = 0
-        --             AND t5.is_stop = 0
-
         <where>
             t1.deleted = 0 and t5.id is not null
             AND t5.type = 1
@@ -162,23 +159,20 @@
             <if test="date == null">
                 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}, '%')
             </if>
             <if test="toAccountName != null and toAccountName!=''">
                 AND t2.account_name like concat( '%', #{toAccountName}, '%' )
             </if>
-<!--            <if test="currentMonth != null">AND t5.start_month != 0 AND DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') &gt;=-->
-<!--                (case when t5.task_type_id-->
-<!--                = 1 then DATE_ADD(t5.start_month,interval 1 month) else t5.start_month end) and-->
-<!--                DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') &lt;=-->
-<!--                (case when t5.is_continue=1 then #{currentMonth} when t5.end_month = 0 then DATE_FORMAT(#{currentMonth},-->
-<!--                '%Y-%m-%d') when t5.task_type_id = 1 then-->
-<!--                DATE_ADD(t5.end_month,interval 1 month) else t5.end_month end)-->
-<!--            </if>-->
+            <if test="date != null">AND t5.start_month != 0 AND DATE_FORMAT(#{date}, '%Y-%m-%d') &gt;=
+                (case when t5.task_type_id
+                = 1 then DATE_ADD(t5.start_month,interval 1 month) else t5.start_month end) and
+                DATE_FORMAT(#{date}, '%Y-%m-%d') &lt;=
+                (case when t5.is_continue=1 then #{date} when t5.end_month = 0 then DATE_FORMAT(#{date},
+                '%Y-%m-%d') when t5.task_type_id = 1 then
+                DATE_ADD(t5.end_month,interval 1 month) else t5.end_month end)
+            </if>
         </where>
         ORDER BY
         t1.work_month DESC