<?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="com.gxwebsoft.shop.mapper.ShopDealerWithdrawMapper">

    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM shop_dealer_withdraw a
        <where>
            <if test="param.id != null">
                AND a.id = #{param.id}
            </if>
            <if test="param.userId != null">
                AND a.user_id = #{param.userId}
            </if>
            <if test="param.money != null">
                AND a.money = #{param.money}
            </if>
            <if test="param.payType != null">
                AND a.pay_type = #{param.payType}
            </if>
            <if test="param.alipayName != null">
                AND a.alipay_name LIKE CONCAT('%', #{param.alipayName}, '%')
            </if>
            <if test="param.alipayAccount != null">
                AND a.alipay_account LIKE CONCAT('%', #{param.alipayAccount}, '%')
            </if>
            <if test="param.bankName != null">
                AND a.bank_name LIKE CONCAT('%', #{param.bankName}, '%')
            </if>
            <if test="param.bankAccount != null">
                AND a.bank_account LIKE CONCAT('%', #{param.bankAccount}, '%')
            </if>
            <if test="param.bankCard != null">
                AND a.bank_card LIKE CONCAT('%', #{param.bankCard}, '%')
            </if>
            <if test="param.applyStatus != null">
                AND a.apply_status = #{param.applyStatus}
            </if>
            <if test="param.auditTime != null">
                AND a.audit_time = #{param.auditTime}
            </if>
            <if test="param.rejectReason != null">
                AND a.reject_reason LIKE CONCAT('%', #{param.rejectReason}, '%')
            </if>
            <if test="param.platform != null">
                AND a.platform LIKE CONCAT('%', #{param.platform}, '%')
            </if>
            <if test="param.createTimeStart != null">
                AND a.create_time &gt;= #{param.createTimeStart}
            </if>
            <if test="param.createTimeEnd != null">
                AND a.create_time &lt;= #{param.createTimeEnd}
            </if>
            <if test="param.keywords != null">
                AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
                )
              </if>
        </where>
    </sql>

    <!-- 分页查询 -->
    <select id="selectPageRel" resultType="com.gxwebsoft.shop.entity.ShopDealerWithdraw">
        <include refid="selectSql"></include>
    </select>

    <!-- 查询全部 -->
    <select id="selectListRel" resultType="com.gxwebsoft.shop.entity.ShopDealerWithdraw">
        <include refid="selectSql"></include>
    </select>

</mapper>
