From db7e077ea8f2d995e922bc11b77dc149592a7455 Mon Sep 17 00:00:00 2001
From: yupeng <roc__yu@163.com>
Date: 星期三, 09 四月 2025 12:35:49 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into xizang-changyun

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

diff --git a/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
index 422e1d3..81dc703 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
@@ -68,7 +68,7 @@
                     #{item}
                 </foreach>
             </if>
-            <if test="businessDeptId!=null and businessDeptId !='' and businessDeptId != '0'">
+            <if test="businessDeptId!=null and businessDeptId !='' and businessDeptId != 0">
                 and t1.business_dept_id = #{businessDeptId}
             </if>
             AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
@@ -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>
+            -- 筛选本月签订的合同
+            DATE_FORMAT(tc.sign_time, '%Y%m') = DATE_FORMAT(CURDATE(), '%Y%m') AND tc.status IN ("4", "5", "6", "7", "8", "9") AND tc.pay_type = 2
+            -- 且租户在本月前从未签订过任何合同
+            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")
+            )
+            <if test="businessDeptId!=0">
+                AND tc.business_dept_id = #{businessDeptId}
+            </if>
+        </where>
+
     </select>
 
     <select id="page" resultType="com.ruoyi.system.model.TContract">

--
Gitblit v1.7.1