From 5fa6e6f8410ef9d057174bcff2a3c5038c54a551 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期日, 27 四月 2025 18:41:20 +0800 Subject: [PATCH] bug修改 --- ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml | 71 +++++++++++++++++++++++++++++++++-- 1 files changed, 66 insertions(+), 5 deletions(-) diff --git a/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml index 05b10d4..81dc703 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml @@ -9,7 +9,6 @@ <result column="contract_name" property="contractName" /> <result column="start_time" property="startTime" /> <result column="end_time" property="endTime" /> - <result column="month_rent" property="monthRent" /> <result column="deposit" property="deposit" /> <result column="pay_type" property="payType" /> <result column="first_pay_time" property="firstPayTime" /> @@ -41,9 +40,9 @@ <!-- 通用查询结果列 --> <sql id="Base_Column_List"> - id, contract_number, contract_name, start_time, end_time, total_rent, deposit, pay_type, first_pay_time, isIncreasing, isIncreasing_deposit, + id, contract_number, contract_name, start_time, end_time, deposit, pay_type, first_pay_time, isIncreasing, isIncreasing_deposit, proportion, house_id, party_one_name, party_one_person, party_one_phone, tenant_id, party_two_name, party_two_person, party_two_phone, - memory, contract_file_name, signature, terminate_remark, total_year + memory, contract_file_name, signature, terminate_remark, total_year,status </sql> <select id="contractList" resultType="com.ruoyi.system.model.TContract"> select t1.* from t_contract t1 @@ -60,9 +59,21 @@ <if test="query.status != null"> and t1.status = #{query.status} </if> + <if test="query.tenantId != null"> + and t1.tenant_id = #{query.tenantId} + </if> + <if test="query.statuses != null and query.statuses.size()>0"> + and t1.status in + <foreach collection="query.statuses" item="item" open="(" separator="," close=")"> + #{item} + </foreach> + </if> + <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()} - </where> + order by t1.create_time desc </select> <select id="contractAppletList" resultType="com.ruoyi.system.model.TContract"> select t1.* from t_contract t1 @@ -97,7 +108,7 @@ #{item} </foreach> </if> - <if test="query.ids == null and query.ids.size()=0"> + <if test="query.ids == null or query.ids.size()==0"> <if test="query.partyTwoName != null and query.partyTwoName != ''"> and t1.party_two_name like concat('%',#{query.partyTwoName},'%') </if> @@ -116,5 +127,55 @@ </where> </select> + <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 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"> + select * from t_contract + <where> + <if test="query.partyTwoName != null and query.partyTwoName != ''"> + and party_two_name like concat('%',#{query.partyTwoName},'%') + </if> + <if test="query.contractNumber != null and query.contractNumber != ''"> + and contract_number like concat('%',#{query.contractNumber},'%') + </if> + <if test="query.contractName != null and query.contractName != ''"> + and contract_name like concat('%',#{query.contractName},'%') + </if> + <if test="query.status != null"> + and status = #{query.status} + </if> + <if test="query.tenantId != null"> + and tenant_id = #{query.tenantId} + </if> + <if test="query.statuses != null and query.statuses.size()>0"> + and status in + <foreach collection="query.statuses" item="item" open="(" separator="," close=")"> + #{item} + </foreach> + </if> + <if test='query.businessDeptId!=null and query.businessDeptId !="" and query.businessDeptId != "0"'> + and business_dept_id = #{query.businessDeptId} + </if> + AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} + </where> + order by create_time desc + </select> </mapper> -- Gitblit v1.7.1