cloudroam
2024-12-04 6c823dd44dbde79f008001a2a11e7bf9bc6bf8cc
src/main/resources/mapper/wallet/WalletBillRecordMapper.xml
@@ -26,8 +26,9 @@
        <result column="open_id" property="openId" />
    </resultMap>
    <select id="getPage" resultType="com.mzl.flower.dto.response.wallet.WalletBillRecordVO">
        select *
        select wbr.*, u.nick_name AS approveName
        from t_wallet_bill_record wbr
        LEFT JOIN t_user u ON wbr.approve_by = u.id
        where wbr.DELETED=0
        <if test="dto.supplierId != null and dto.supplierId != ''">
            and wbr.supplier_id= #{dto.supplierId}
@@ -42,8 +43,9 @@
    </select>
    <select id="getPageByDesc" resultType="com.mzl.flower.dto.response.wallet.WalletBillRecordVO">
        select *
        select wbr.*, u.nick_name AS approveName
        from t_wallet_bill_record wbr
        LEFT JOIN t_user u ON wbr.approve_by = u.id
        where wbr.DELETED=0
        <if test="dto.supplierId != null and dto.supplierId != ''">
            and wbr.supplier_id= #{dto.supplierId}
@@ -57,12 +59,22 @@
        order by wbr.create_time desc
    </select>
    <select id="queryPage" resultType="com.mzl.flower.dto.response.wallet.WalletBillRecordVO">
        select t.* ,s.name supplierName ,w.approve_time as approveTime  from t_wallet_bill_record t
        left join t_supplier_info s on t.supplier_id = s.id
        left join t_wallet_withdraw_record w on t.withdraw_record_id = w.id
        where t.deleted= 0
--         select t.* ,s.name supplierName ,w.approve_time as approveTime ,u.nick_name AS approveName from t_wallet_bill_record t
--         left join t_supplier_info s on t.supplier_id = s.id
--         left join t_wallet_withdraw_record w on t.withdraw_record_id = w.id
--         LEFT JOIN t_user u ON t.approve_by = u.id
--         where t.deleted= 0
        SELECT
        t.*,
        (SELECT s.name FROM t_supplier_info s WHERE s.id = t.supplier_id) AS supplierName,
        (SELECT w.approve_time FROM t_wallet_withdraw_record w WHERE w.id = t.withdraw_record_id) AS approveTime,
        (SELECT u.nick_name FROM t_user u WHERE u.id = t.approve_by) AS approveName
        FROM
        t_wallet_bill_record t
        WHERE
        t.deleted = 0
        <if test="dto.supplierName != null and dto.supplierName != ''">
            and s.name like concat('%', #{dto.supplierName}, '%')
            AND (SELECT s.name FROM t_supplier_info s WHERE s.id = t.supplier_id) LIKE CONCAT('%', #{dto.supplierName}, '%')
        </if>
        <if test="dto.supplierId != null and dto.supplierId != ''">
            and t.supplier_id = #{dto.supplierId}
@@ -74,24 +86,25 @@
            and t.order_no  like concat('%', #{dto.orderNo}, '%')
        </if>
        <if test="dto.createStartDate!=null ">
            AND DATE_FORMAT(w.create_time, '%Y-%m-%d') &gt;= #{dto.createStartDate}
            AND DATE_FORMAT(t.create_time, '%Y-%m-%d') &gt;= #{dto.createStartDate}
        </if>
        <if test="dto.endEndDate!=null ">
            AND DATE_FORMAT(w.create_time, '%Y-%m-%d') &lt;= #{dto.endEndDate}
            AND DATE_FORMAT(t.create_time, '%Y-%m-%d') &lt;= #{dto.endEndDate}
        </if>
        <if test="dto.approveStartDate!=null ">
            AND DATE_FORMAT(w.approve_time, '%Y-%m-%d') &gt;= #{dto.approveStartDate}
            AND DATE_FORMAT((SELECT w.approve_time FROM t_wallet_withdraw_record w WHERE w.id = t.withdraw_record_id), '%Y-%m-%d') &gt;= #{dto.approveStartDate}
        </if>
        <if test="dto.approveEndDate!=null ">
            AND DATE_FORMAT(w.approve_time, '%Y-%m-%d') &lt;= #{dto.approveEndDate}
            AND DATE_FORMAT((SELECT w.approve_time FROM t_wallet_withdraw_record w WHERE w.id = t.withdraw_record_id), '%Y-%m-%d')  &lt;= #{dto.approveEndDate}
        </if>
        order by t.create_time
        order by t.create_time desc
    </select>
    <select id="queryWalletBillRecordList" resultType="com.mzl.flower.dto.response.wallet.WalletBillRecordVO">
        select t.* , s.name supplierName, w.approve_time as approveTime from t_wallet_bill_record t
        select t.* , s.name supplierName, w.approve_time as approveTime, u.nick_name AS approveName from t_wallet_bill_record t
        left join t_supplier_info s on t.supplier_id = s.id
        left join t_wallet_withdraw_record w on t.withdraw_record_id = w.id
        LEFT JOIN t_user u ON t.approve_by = u.id
        where t.deleted= 0
        <if test="dto.supplierName != null and dto.supplierName != ''">
            and s.name like concat('%', #{dto.supplierName}, '%')
@@ -106,10 +119,10 @@
            and t.order_no  like concat('%', #{dto.orderNo}, '%')
        </if>
        <if test="dto.createStartDate!=null ">
            AND DATE_FORMAT(w.create_time, '%Y-%m-%d') &gt;= #{dto.createStartDate}
            AND DATE_FORMAT(t.create_time, '%Y-%m-%d') &gt;= #{dto.createStartDate}
        </if>
        <if test="dto.endEndDate!=null ">
            AND DATE_FORMAT(w.create_time, '%Y-%m-%d') &lt;= #{dto.endEndDate}
            AND DATE_FORMAT(t.create_time, '%Y-%m-%d') &lt;= #{dto.endEndDate}
        </if>
        <if test="dto.approveStartDate!=null ">
            AND DATE_FORMAT(w.approve_time, '%Y-%m-%d') &gt;= #{dto.approveStartDate}