陶杰
2024-11-01 a37210e77b883fbffc67050eb890cd6a0a3c7014
src/main/resources/mapper/wallet/WalletBillRecordMapper.xml
@@ -13,11 +13,110 @@
        <result column="supplier_id" property="supplierId" />
        <result column="wallet_id" property="walletId" />
        <result column="type" property="type" />
        <result column="withdraw_type" property="withdrawType" />
        <result column="type_detail" property="typeDetail" />
        <result column="transfer_id" property="transferId" />
        <result column="method" property="method" />
        <result column="original_amount" property="originalAmount" />
        <result column="change_amount" property="changeAmount" />
        <result column="balance" property="balance" />
        <result column="transfer_detail_id" property="transferDetailId" />
        <result column="open_id" property="openId" />
    </resultMap>
    <select id="getPage" resultType="com.mzl.flower.dto.response.wallet.WalletBillRecordVO">
        select *
        from t_wallet_bill_record wbr
        where wbr.DELETED=0
        <if test="dto.supplierId != null and dto.supplierId != ''">
            and wbr.supplier_id= #{dto.supplierId}
        </if>
        <if test="dto.startDate != null">
            and DATE_FORMAT(wbr.create_time, '%Y-%m-%d') &gt;= #{dto.startDate}
        </if>
        <if test="dto.endDate != null">
            and DATE_FORMAT(wbr.create_time, '%Y-%m-%d') &lt;= #{dto.endDate}
        </if>
        order by wbr.create_time asc
    </select>
    <select id="getPageByDesc" resultType="com.mzl.flower.dto.response.wallet.WalletBillRecordVO">
        select *
        from t_wallet_bill_record wbr
        where wbr.DELETED=0
        <if test="dto.supplierId != null and dto.supplierId != ''">
            and wbr.supplier_id= #{dto.supplierId}
        </if>
        <if test="dto.startDate != null">
            and DATE_FORMAT(wbr.create_time, '%Y-%m-%d') &gt;= #{dto.startDate}
        </if>
        <if test="dto.endDate != null">
            and DATE_FORMAT(wbr.create_time, '%Y-%m-%d') &lt;= #{dto.endDate}
        </if>
        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
        <if test="dto.supplierName != null and dto.supplierName != ''">
            and s.name like concat('%', #{dto.supplierName}, '%')
        </if>
        <if test="dto.supplierId != null and dto.supplierId != ''">
            and t.supplier_id = #{dto.supplierId}
        </if>
        <if test="dto.type != null and dto.type != ''">
            and t.type = #{dto.type}
        </if>
        <if test="dto.orderNo != null and dto.orderNo != ''">
            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}
        </if>
        <if test="dto.endEndDate!=null ">
            AND DATE_FORMAT(w.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}
        </if>
        <if test="dto.approveEndDate!=null ">
            AND DATE_FORMAT(w.approve_time, '%Y-%m-%d') &lt;= #{dto.approveEndDate}
        </if>
        order by t.create_time
    </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
        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
        <if test="dto.supplierName != null and dto.supplierName != ''">
            and s.name like concat('%', #{dto.supplierName}, '%')
        </if>
        <if test="dto.supplierId != null and dto.supplierId != ''">
            and t.supplier_id = #{dto.supplierId}
        </if>
        <if test="dto.type != null and dto.type != ''">
            and t.type = #{dto.type}
        </if>
        <if test="dto.orderNo != null and dto.orderNo != ''">
            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}
        </if>
        <if test="dto.endEndDate!=null ">
            AND DATE_FORMAT(w.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}
        </if>
        <if test="dto.approveEndDate!=null ">
            AND DATE_FORMAT(w.approve_time, '%Y-%m-%d') &lt;= #{dto.approveEndDate}
        </if>
        order by t.create_time
    </select>
</mapper>