From 6bfd9e219ef6e51cd89f77a4cb6e5fb37779e9fe Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期四, 03 四月 2025 10:27:58 +0800
Subject: [PATCH] bug修改

---
 ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
index b482d7d..05cd43c 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
@@ -131,11 +131,8 @@
         SELECT COUNT(DISTINCT tc.tenant_id) AS new_tenant_count
         FROM t_contract tc
         <where>
-            <if test="businessDeptId!=0">
-                AND tc.business_dept_id = #{businessDeptId}
-            </if>
             -- 筛选本月签订的合同
-            AND DATE_FORMAT(tc.sign_time, '%Y%m') = DATE_FORMAT(CURDATE(), '%Y%m') AND tc.status IN ("4", "5", "6", "7", "8", "9")
+            DATE_FORMAT(tc.sign_time, '%Y%m') = DATE_FORMAT(CURDATE(), '%Y%m') AND tc.status IN ("4", "5", "6", "7", "8", "9")
             -- 且租户在本月前从未签订过任何合同
             AND NOT EXISTS (
             SELECT 1
@@ -143,6 +140,9 @@
             WHERE tc_hist.tenant_id = tc.tenant_id
             AND tc_hist.sign_time <![CDATA[ < ]]> DATE_FORMAT(CURDATE(), '%Y-%m-01') AND tc_hist.status IN ("4", "5", "6", "7", "8", "9")
             )
+            <if test="businessDeptId!=0">
+                AND tc.business_dept_id = #{businessDeptId}
+            </if>
         </where>
 
     </select>

--
Gitblit v1.7.1