BankReceiptDetailsMapper.xml 3.2 KB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.BankReceiptDetailsMapper">

    <select id="getBankReceiptDetailsList"
            resultType="cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemResp">
        SELECT p.*,m.receipt_no,m.order_id,
        r.order_no,r.tidan_no,a.create_time as create_time_bpm,
        a.update_time as update_time_bpm,a.creator as createBpm
        from ecw_receipt_item p
        left join ecw_receipt m on p.receipt_id=m.id and m.deleted=0
        left join ecw_order r on r.order_id=m.order_id and r.deleted=0
        left join ecw_receipt_approval a on a.bmp_id=p.bmp_id and a.deleted=0
        <include refid="WherePage"/>
        ORDER BY m.receipt_no desc,p.create_time asc limit #{start}, #{pageSize}
    </select>
    <sql id="WherePage">
        <where>
            p.deleted=0
            <if test="status != null and status != ''">
                AND p.status=#{status}
            </if>
            <if test="accountNo != null and accountNo != ''">
                AND p.account_no=#{accountNo}
            </if>
            <if test="receiptNo != null and receiptNo != ''">
                AND m.receipt_no like concat('%',#{receiptNo},'%')
            </if>
            <if test="orderNo != null and orderNo != ''">
                AND m.order_no like concat('%',#{orderNo},'%')
            </if>
            <if test="tidanNo != null and tidanNo != ''">
                AND r.tidan_no like concat('%',#{tidanNo},'%')
            </if>
            <!--银行收款明细创建日期-->
            <if test="sDate1 != null and sDate1 != '' and
             eDate1 != null and eDate1 != ''">
                AND p.create_time BETWEEN #{sDate1} and #{eDate1}
            </if>

            <!--收款明细提交审批日期-->
            <if test="sDate2 != null and sDate2 != '' and
             eDate2 != null and eDate2 != ''">
                AND a.create_time BETWEEN #{sDate2} and #{eDate2}
            </if>

            <!--收款明细提交审批通过日期-->
            <if test="sDate3 != null and sDate3 != '' and
             eDate3 != null and eDate3 != ''">
                AND a.update_time BETWEEN #{sDate3} and #{eDate3}
            </if>

            <!--实收日期 -->
            <if test="sDate4 != null and sDate4 != '' and
             eDate4 != null and eDate4 != ''">
                AND p.amount_date BETWEEN #{sDate4} and #{eDate4}
            </if>

            <!--收款明细创建人-->
            <if test="creator != null and creator != ''">
                AND p.creator in (SELECT id from system_user
                where username like concat('%',#{creator},'%'))
            </if>

        </where>
    </sql>
    <select id="GetCount" resultType="java.lang.Long">
        SELECT count(p.id)
        from ecw_receipt_item p
        left join ecw_receipt m on p.receipt_id=m.id and m.deleted=0
        left join ecw_order r on r.order_id=m.order_id and r.deleted=0
        left join ecw_receipt_approval a on a.bmp_id=m.bmp_id and a.deleted=0
        <include refid="WherePage"/>
    </select>


</mapper>