BankReceiptDetailsMapper.xml 3.2 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3 4 5 6 7
<?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,
lanbaoming's avatar
lanbaoming committed
8
        r.order_no,r.tidan_no,a.create_time as create_time_bpm,
lanbaoming's avatar
lanbaoming committed
9
        a.update_time as update_time_bpm,a.creator as createBpm
lanbaoming's avatar
lanbaoming committed
10 11 12
        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
lanbaoming's avatar
lanbaoming committed
13
        left join ecw_receipt_approval a on a.bmp_id=p.bmp_id and a.deleted=0
lanbaoming's avatar
lanbaoming committed
14
        <include refid="WherePage"/>
lanbaoming's avatar
lanbaoming committed
15
        ORDER BY m.receipt_no desc,p.create_time asc limit #{start}, #{pageSize}
lanbaoming's avatar
lanbaoming committed
16 17 18 19
    </select>
    <sql id="WherePage">
        <where>
            p.deleted=0
lanbaoming's avatar
lanbaoming committed
20 21 22
            <if test="status != null and status != ''">
                AND p.status=#{status}
            </if>
lanbaoming's avatar
lanbaoming committed
23 24 25
            <if test="accountNo != null and accountNo != ''">
                AND p.account_no=#{accountNo}
            </if>
lanbaoming's avatar
lanbaoming committed
26
            <if test="receiptNo != null and receiptNo != ''">
lanbaoming's avatar
lanbaoming committed
27 28
                AND m.receipt_no like concat('%',#{receiptNo},'%')
            </if>
lanbaoming's avatar
lanbaoming committed
29
            <if test="orderNo != null and orderNo != ''">
lanbaoming's avatar
lanbaoming committed
30 31
                AND m.order_no like concat('%',#{orderNo},'%')
            </if>
lanbaoming's avatar
lanbaoming committed
32 33 34 35 36 37 38 39 40 41 42 43
            <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 != ''">
lanbaoming's avatar
lanbaoming committed
44
                AND a.create_time BETWEEN #{sDate2} and #{eDate2}
lanbaoming's avatar
lanbaoming committed
45 46 47 48 49
            </if>

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

lanbaoming's avatar
lanbaoming committed
53
            <!--实收日期 -->
lanbaoming's avatar
lanbaoming committed
54 55 56
            <if test="sDate4 != null and sDate4 != '' and
             eDate4 != null and eDate4 != ''">
                AND p.amount_date BETWEEN #{sDate4} and #{eDate4}
lanbaoming's avatar
lanbaoming committed
57 58 59 60 61 62 63
            </if>

            <!--收款明细创建人-->
            <if test="creator != null and creator != ''">
                AND p.creator in (SELECT id from system_user
                where username like concat('%',#{creator},'%'))
            </if>
lanbaoming's avatar
lanbaoming committed
64 65 66 67 68 69 70 71

        </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
lanbaoming's avatar
lanbaoming committed
72
        left join ecw_receipt_approval a on a.bmp_id=m.bmp_id and a.deleted=0
lanbaoming's avatar
lanbaoming committed
73 74 75 76 77
        <include refid="WherePage"/>
    </select>


</mapper>