Browse Source

修改收票任务sql慢的bug

rainwer 7 months ago
parent
commit
e14fe61d4b

+ 3 - 5
src/main/resources/mybatis/business/BizFinancialReceiveTicketMapper.xml

@@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join biz_entrust t7 on t7.work_order_id = t1.work_order_id and t7.deleted = 0 and  date_format(t7.current_month, '%Y%m') = concat(#{year}, #{month})
         left join biz_tenant t8 on t8.id = t7.to_tenant_id
         WHERE
-        t1.deleted = 0 and t2.deleted = 0
+        t1.deleted = 0 and t1.is_stop = 0 and t2.deleted = 0
         <if test="id != null">
             AND t1.id = #{id}
         </if>
@@ -80,12 +80,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 )
             </if>
             <if test="status != null and status != 0">
-                AND exists (select 1 from biz_financial_receive_ticket_detail fsd where fsd.financial_receive_ticket_id = t1.id and
-                fsd.month = #{month} and fsd.year = #{year} and fsd.status = #{status} <include refid="detailConditionSql" />)
+                and t5.status = #{status}
             </if>
             <if test="status != null and status == 0">
-                AND not exists (select 1 from biz_financial_receive_ticket_detail fsd where fsd.financial_receive_ticket_id = t1.id and
-                fsd.month = #{month} and fsd.year = #{year})
+                and  t5.id is null
             </if>
         </if>
     </select>