xuhy
2025-02-12 10fbab11ba9f3179ffa5ec5d3c6dc1c0eefec075
ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
@@ -88,15 +88,32 @@
        AND t3.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
    </select>
    <select id="contractExportList" resultType="com.ruoyi.system.model.TContract">
        select t1.*,t2.contract_number as contractNumber,t3.resident_name as residentName,t3.phone as phone
        from t_bill t1
                 left join t_contract t2 on t1.contract_id = t2.id
                 left join t_resident t3 on t2.tenant_id = t3.id
        where t2.id = #{query.id}
          and (t1.pay_fees_status = 1 or t1.pay_fees_status = 4)
          AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
          AND t2.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
          AND t3.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        select t1.* from t_contract t1
        <where>
            <if test="query.ids != null and query.ids.size()>0">
                AND t1.id IN
                <foreach collection="query.ids" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
            <if test="query.ids == null and query.ids.size()=0">
                <if test="query.partyTwoName != null and query.partyTwoName != ''">
                    and t1.party_two_name like concat('%',#{query.partyTwoName},'%')
                </if>
                <if test="query.contractNumber != null and query.contractNumber != ''">
                    and t1.contract_number like concat('%',#{query.contractNumber},'%')
                </if>
                <if test="query.contractName != null and query.contractName != ''">
                    and t1.contract_name like concat('%',#{query.contractName},'%')
                </if>
                <if test="query.status != null">
                    and t1.status = #{query.status}
                </if>
            </if>
            AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
    </select>
</mapper>