<?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.bomaos.settings.mapper.PaysMapper">

    <!-- 关联查询sql -->
    <sql id="relSelect">
        SELECT a.*
        FROM sys_pays a
        <where>
            <if test="page!=null and page.pageData!=null">
                <if test="page.pageData.id != null">
                    AND a.id = #{page.pageData.id}
                </if>
                <if test="page.pageData.driver != null">
                    AND a.driver LIKE CONCAT('%', #{page.pageData.driver}, '%')
                </if>
                <if test="page.pageData.config != null">
                    AND a.config LIKE CONCAT('%', #{page.pageData.config}, '%')
                </if>
                <if test="page.pageData.comment != null">
                    AND a.comment LIKE CONCAT('%', #{page.pageData.comment}, '%')
                </if>
                <if test="page.pageData.isMobile != null">
                    AND a.is_mobile = #{page.pageData.isMobile}
                </if>
                <if test="page.pageData.isPc != null">
                    AND a.is_pc = #{page.pageData.isPc}
                </if>
                <if test="page.pageData.isHandlingFee != null">
                    AND a.is_handling_fee = #{page.pageData.isHandlingFee}
                </if>
                <if test="page.pageData.handlingFee != null">
                    AND a.handling_fee = #{page.pageData.handlingFee}
                </if>
                <if test="page.pageData.createdAt != null">
                    AND a.created_at LIKE CONCAT('%', #{page.pageData.createdAt}, '%')
                </if>
                <if test="page.pageData.updatedAt != null">
                    AND a.updated_at LIKE CONCAT('%', #{page.pageData.updatedAt}, '%')
                </if>
            </if>
        </where>
    </sql>

    <!-- 分页查询 -->
    <select id="listPage" resultType="com.bomaos.settings.entity.Pays">
        <include refid="relSelect"></include>
    </select>

    <!-- 查询全部 -->
    <select id="listAll" resultType="com.bomaos.settings.entity.Pays">
        <include refid="relSelect"></include>
    </select>

</mapper>
