<?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.tofly.feesapi.bmgl.mapper.BmCbpqMapper">
    <select id="selectMaxId" resultType="decimal">
        SELECT NVL(MAX(to_number(CBPQBM)), 0)
        FROM BM_CBPQ
    </select>
    <resultMap id="bmCbpqMap" type="com.tofly.feesapi.bmgl.entity.BmCbpq">
        <id property="cbpqbm" column="CBPQBM"/>
        <result property="cbpqmc" column="CBPQMC"/>
        <result property="ssgs" column="SSGS"/>
        <result property="bz" column="BZ"/>
        <result property="cdate" column="CDATE"/>
        <result property="xdate" column="XDATE"/>
        <result property="xgry" column="XGRY"/>
        <result property="lxdh" column="LXDH"/>
    </resultMap>

    <select id="getPage" resultType="com.tofly.feesapi.bmgl.entity.dto.BmCbpqSelect">
        SELECT * FROM BM_CBPQ a
        WHERE 1 = 1

        <if test="filter.cbpqbm != null and filter.cbpqbm != ''">
            AND a.cbpqbm like '%${filter.cbpqbm}%'
        </if>

        <if test="filter.cbpqmc != null and filter.cbpqmc != ''">
            AND a.cbpqmc like '%${filter.cbpqmc}%'
        </if>

        <if test="filter.searchText != null and filter.searchText != ''">
            AND (a.cbpqmc like '%${filter.searchText}%' or a.cbpqbm like '%${filter.searchText}%' or a.bz like
            '%${filter.searchText}%')
        </if>

        <if test="filter.ssgs != null and filter.ssgs != ''">
            AND a.ssgs=#{filter.ssgs}
        </if>
    </select>

</mapper>
