From 160b87f6c1b93e5061f9556984c07c9cb45d04a6 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期四, 03 四月 2025 09:46:05 +0800
Subject: [PATCH] Merge branch 'dev' of http://120.76.84.145:10101/gitblit/r/java/xizang

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

diff --git a/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
index 1b7f6ac..b482d7d 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
@@ -130,16 +130,21 @@
     <select id="getCurrentMonthRentCount" resultType="java.lang.Integer">
         SELECT COUNT(DISTINCT tc.tenant_id) AS new_tenant_count
         FROM t_contract tc
-        WHERE
-        -- 筛选本月签订的合同
-        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
-        FROM t_contract tc_hist
-        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")
-        )
+        <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")
+            -- 且租户在本月前从未签订过任何合同
+            AND NOT EXISTS (
+            SELECT 1
+            FROM t_contract tc_hist
+            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")
+            )
+        </where>
+
     </select>
 
 </mapper>

--
Gitblit v1.7.1