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/TBillMapper.xml | 323 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 319 insertions(+), 4 deletions(-) diff --git a/ruoyi-system/src/main/resources/mapper/system/TBillMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TBillMapper.xml index a027bc6..abbc7ab 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TBillMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TBillMapper.xml @@ -38,11 +38,94 @@ b.*, t.resident_name as residentName, t.phone, - t.account + t.account, + h.house_name as houseName FROM t_bill b - LEFT JOIN t_contract c ON c.contract_number = b.contract_number - LEFT JOIN t_tenant t ON t.id = c.tenant_id + LEFT JOIN t_contract c ON c.contract_number = b.contract_number and c.disabled=0 + LEFT JOIN t_house h ON h.id = c.house_id and h.disabled=0 + LEFT JOIN t_tenant t ON t.id = c.tenant_id and t.disabled=0 + LEFT JOIN t_bill_type_sort_weight sw on sw.code=b.pay_fees_status + <where> + b.disabled=0 + <if test="query.payFeesStatus != null"> + and b.pay_fees_status = #{query.payFeesStatus} + </if> + <if test="query.phone != null and query.phone !=''"> + and t.phone = #{query.phone} + </if> + <if test="query.residentName != null and query.residentName !=''"> + and t.resident_name like concat('%',#{query.residentName},'%') + </if> + <if test="query.contractNumber != null and query.contractNumber !=''"> + and b.contract_number = #{query.contractNumber} + </if> + <if test="query.userId != null and query.userId !=''"> + and t.id = #{query.userId} + </if> + <if test='query.businessDeptId != null and query.businessDeptId != "" and query.businessDeptId!=0'> + and b.business_dept_id = #{query.businessDeptId} + </if> + <if test="query.billType != null"> + and b.bill_type = #{query.billType} + </if> + </where> + order by sw.sort_weight desc,b.payable_fees_time asc +<!-- order by b.payable_fees_time desc,b.create_time desc--> + </select> + + <select id="pageForApplet" resultType="com.ruoyi.system.dto.TBillDto"> + SELECT + b.*, + t.resident_name as residentName, + t.phone, + t.account, + h.house_name as houseName + FROM + t_bill b + LEFT JOIN t_contract c ON c.contract_number = b.contract_number and c.disabled=0 + LEFT JOIN t_house h ON h.id = c.house_id and h.disabled=0 + LEFT JOIN t_tenant t ON t.id = c.tenant_id and t.disabled=0 + LEFT JOIN t_bill_type_sort_weight sw on sw.code=b.pay_fees_status + <where> + b.disabled=0 + <if test="query.payFeesStatus != null"> + and b.pay_fees_status = #{query.payFeesStatus} + </if> + <if test="query.phone != null and query.phone !=''"> + and t.phone = #{query.phone} + </if> + <if test="query.residentName != null and query.residentName !=''"> + and t.resident_name like concat('%',#{query.residentName},'%') + </if> + <if test="query.contractNumber != null and query.contractNumber !=''"> + and b.contract_number = #{query.contractNumber} + </if> + <if test="query.userId != null and query.userId !=''"> + and t.id = #{query.userId} + </if> + <if test='query.businessDeptId != null and query.businessDeptId != "" and query.businessDeptId!="0"'> + and b.business_dept_id = #{query.businessDeptId} + </if> + <if test="query.billType != null"> + and b.bill_type = #{query.billType} + </if> + </where> + order by sw.sort_weight desc,b.payable_fees_time asc + </select> + + <select id="getBillList" resultType="com.ruoyi.system.dto.TBillDto"> + SELECT + b.*, + t.resident_name as residentName, + t.phone, + t.account, + h.house_name as houseName + FROM + t_bill b + LEFT JOIN t_contract c ON c.contract_number = b.contract_number and c.disabled=0 + LEFT JOIN t_house h ON h.id = c.house_id and h.disabled=0 + LEFT JOIN t_tenant t ON t.id = c.tenant_id and t.disabled=0 <where> <if test="query.payFeesStatus != null"> and b.pay_fees_status = #{query.payFeesStatus} @@ -54,7 +137,239 @@ and t.resident_name like concat('%',#{query.residentName},'%') </if> <if test="query.contractNumber != null and query.contractNumber !=''"> - and b.contract_number = #{contractNumber} + and b.contract_number = #{query.contractNumber} + </if> + <if test="query.userId != null and query.userId !=''"> + and t.id = #{query.userId} + </if> + <if test="query.billType != null"> + and b.bill_type = #{query.billType} + </if> + and b.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} + </where> + order by b.bill_type,b.payable_fees_time + </select> + <select id="invoiceList" resultType="com.ruoyi.system.dto.TBillDto"> + SELECT + b.*, + t.resident_name as residentName, + t.phone, + t.account, + h.house_name as houseName + FROM + t_bill b + LEFT JOIN t_contract c ON c.contract_number = b.contract_number and c.disabled=0 + LEFT JOIN t_house h ON h.id = c.house_id and h.disabled=0 + LEFT JOIN t_tenant t ON t.id = c.tenant_id and t.disabled=0 + LEFT JOIN t_invoice_to_bill tb ON b.id = tb.bill_id + <where> + <if test="query.phone != null and query.phone !=''"> + and t.phone = #{query.phone} + </if> + <if test="query.residentName != null and query.residentName !=''"> + and t.resident_name like concat('%',#{query.residentName},'%') + </if> + <if test="query.contractNumber != null and query.contractNumber !=''"> + and b.contract_number = #{query.contractNumber} + </if> + <if test="query.userId != null and query.userId !=''"> + and t.id = #{query.userId} + </if> + and b.pay_fees_status = 3 + and tb.invoice_id IS NULL + and b.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} + </where> + order by b.pay_fees_time + </select> + + <select id="selectDetailByBillId" resultType="com.ruoyi.system.dto.TBillDto"> + SELECT + b.*, + t.resident_name as residentName, + t.email, + t.phone, + t.account, + h.house_name as houseName, + c.contract_name,c.pay_type,c.party_two_name,c.total_year,c.deposit + FROM + t_bill b + LEFT JOIN t_contract c ON c.contract_number = b.contract_number and c.disabled=0 + LEFT JOIN t_house h ON h.id = c.house_id and h.disabled=0 + LEFT JOIN t_tenant t ON t.id = c.tenant_id and t.disabled=0 + where b.id = #{billId} + </select> + + <select id="statisticsAllRent" resultType="java.math.BigDecimal"> + SELECT ifnull(sum(payable_fees_money),0) as amount FROM t_bill b + LEFT JOIN t_contract c ON c.contract_number = b.contract_number and c.disabled=0 + LEFT JOIN t_house h ON h.id = c.house_id and h.disabled=0 + LEFT JOIN t_tenant t ON t.id = c.tenant_id and t.disabled=0 + <where> + b.disabled=0 and b.pay_fees_status!='5' + <if test="query.payFeesStatus != null"> + and b.pay_fees_status = #{query.payFeesStatus} + </if> + <if test="query.phone != null and query.phone !=''"> + and t.phone = #{query.phone} + </if> + <if test="query.residentName != null and query.residentName !=''"> + and t.resident_name like concat('%',#{query.residentName},'%') + </if> + <if test="query.contractNumber != null and query.contractNumber !=''"> + and b.contract_number = #{query.contractNumber} + </if> + <if test="query.userId != null and query.userId !=''"> + and t.id = #{query.userId} + </if> + <if test='query.businessDeptId != null and query.businessDeptId != "" and query.businessDeptId!="0"'> + and b.business_dept_id = #{query.businessDeptId} + </if> + <if test="query.billType != null"> + and b.bill_type = #{query.billType} + </if> + </where> + + </select> + + <select id="statisticsNoPay" resultType="java.math.BigDecimal"> + SELECT ifnull(sum(outstanding_money),0) as amount FROM t_bill b + LEFT JOIN t_contract c ON c.contract_number = b.contract_number and c.disabled=0 + LEFT JOIN t_house h ON h.id = c.house_id and h.disabled=0 + LEFT JOIN t_tenant t ON t.id = c.tenant_id and t.disabled=0 + <where> + b.disabled=0 and b.pay_fees_status!='3' and b.pay_fees_status!='5' + <if test="query.payFeesStatus != null"> + and b.pay_fees_status = #{query.payFeesStatus} + </if> + <if test="query.phone != null and query.phone !=''"> + and t.phone = #{query.phone} + </if> + <if test="query.residentName != null and query.residentName !=''"> + and t.resident_name like concat('%',#{query.residentName},'%') + </if> + <if test="query.contractNumber != null and query.contractNumber !=''"> + and b.contract_number = #{query.contractNumber} + </if> + <if test="query.userId != null and query.userId !=''"> + and t.id = #{query.userId} + </if> + <if test='query.businessDeptId != null and query.businessDeptId != "" and query.businessDeptId!="0"'> + and b.business_dept_id = #{query.businessDeptId} + </if> + <if test="query.billType != null"> + and b.bill_type = #{query.billType} + </if> + </where> + </select> + + <select id="statisticsPayed" resultType="java.math.BigDecimal"> + SELECT ifnull(sum(pay_fees_money),0) as amount FROM t_bill b + LEFT JOIN t_contract c ON c.contract_number = b.contract_number and c.disabled=0 + LEFT JOIN t_house h ON h.id = c.house_id and h.disabled=0 + LEFT JOIN t_tenant t ON t.id = c.tenant_id and t.disabled=0 + <where> + b.disabled=0 and b.pay_fees_status!='5' + <if test="query.payFeesStatus != null"> + and b.pay_fees_status = #{query.payFeesStatus} + </if> + <if test="query.phone != null and query.phone !=''"> + and t.phone = #{query.phone} + </if> + <if test="query.residentName != null and query.residentName !=''"> + and t.resident_name like concat('%',#{query.residentName},'%') + </if> + <if test="query.contractNumber != null and query.contractNumber !=''"> + and b.contract_number = #{query.contractNumber} + </if> + <if test="query.userId != null and query.userId !=''"> + and t.id = #{query.userId} + </if> + <if test='query.businessDeptId != null and query.businessDeptId != "" and query.businessDeptId!="0"'> + and b.business_dept_id = #{query.businessDeptId} + </if> + <if test="query.billType != null"> + and b.bill_type = #{query.billType} + </if> + </where> + </select> + + <select id="statisticsOverdue" resultType="java.math.BigDecimal"> + SELECT ifnull(sum(outstanding_money),0) as amount FROM t_bill b + LEFT JOIN t_contract c ON c.contract_number = b.contract_number and c.disabled=0 + LEFT JOIN t_house h ON h.id = c.house_id and h.disabled=0 + LEFT JOIN t_tenant t ON t.id = c.tenant_id and t.disabled=0 + <where> + b.disabled=0 and b.pay_fees_status='4' + <if test="query.payFeesStatus != null"> + and b.pay_fees_status = #{query.payFeesStatus} + </if> + <if test="query.phone != null and query.phone !=''"> + and t.phone = #{query.phone} + </if> + <if test="query.residentName != null and query.residentName !=''"> + and t.resident_name like concat('%',#{query.residentName},'%') + </if> + <if test="query.contractNumber != null and query.contractNumber !=''"> + and b.contract_number = #{query.contractNumber} + </if> + <if test="query.userId != null and query.userId !=''"> + and t.id = #{query.userId} + </if> + <if test='query.businessDeptId != null and query.businessDeptId != "" and query.businessDeptId!="0"'> + and b.business_dept_id = #{query.businessDeptId} + </if> + <if test="query.billType != null"> + and b.bill_type = #{query.billType} + </if> + </where> + </select> + <select id="batchBillCount" resultType="java.lang.Integer"> + SELECT + count(b.id) + FROM + t_bill b + LEFT JOIN t_contract c ON c.contract_number = b.contract_number and c.disabled=0 + LEFT JOIN t_house h ON h.id = c.house_id and h.disabled=0 + LEFT JOIN t_tenant t ON t.id = c.tenant_id and t.disabled=0 + <where> + <if test="userId != null and userId !=''"> + AND t.id = #{userId} + </if> + <if test="billIds != null and billIds.size() > 0"> + AND b.id NOT IN + <foreach collection="billIds" item="item" index="index" open="(" separator="," close=")"> + #{item} + </foreach> + </if> + AND b.bill_type = 3 + AND b.pay_fees_status != 3 + </where> + </select> + <select id="getStreetRentRank" resultType="com.ruoyi.system.vo.ScreenRentRankVO"> + SELECT + ts.street_name,ROUND(COALESCE(SUM(tb.pay_fees_money),0) /10000,2) AS rentAmount + FROM + t_street ts + LEFT JOIN t_house th ON ts.id = th.street_id + LEFT JOIN t_contract tc ON tc.house_id = th.id AND tc.pay_type = 2 + LEFT JOIN t_bill tb ON tc.id = tb.contract_id AND tb.pay_fees_status != 5 + <where> + <if test="businessDeptId != 0"> + AND th.business_dept_id = #{businessDeptId} + </if> + </where> + GROUP BY ts.id + ORDER BY rentAmount DESC + </select> + <select id="getJiFuBillList" resultType="com.ruoyi.system.model.TBill" parameterType="java.lang.String"> + SELECT tb.* FROM t_bill tb LEFT JOIN t_contract tt ON tb.contract_id = tt.id + <where> + tt.pay_type = 2 AND tb.bill_type = ${@com.ruoyi.common.enums.BillTypeEnum@Zujin.getCode()} AND tb.pay_fees_status != 5 + <if test="businessDeptId != null and businessDeptId != 0"> + AND tb.business_dept_id = #{businessDeptId} + </if> + <if test="first!=null and last !=null"> + AND tb.payable_fees_time BETWEEN #{first} AND #{last} </if> </where> </select> -- Gitblit v1.7.1