<?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.BmYslxMapper">
    <select id="selectMaxId" resultType="decimal">
        SELECT NVL(MAX(to_number(CODE)), 0)
        FROM BM_YSLX
    </select>
    <select id="selectListMap" resultType="java.util.Map">
        select *
        from BM_YSLX
        where 1 = 1
    </select>
    <resultMap id="bmYslxMap" type="com.tofly.feesapi.bmgl.entity.BmYslx">
        <id property="code" column="CODE"/>
        <result property="name" column="NAME"/>
        <result property="znj" column="ZNJ"/>
        <result property="znjbm" column="ZNJBM"/>
        <result property="znjday" column="ZNJDAY"/>
        <result property="ssgs" column="SSGS"/>
        <result property="bz" column="BZ"/>
        <result property="czry" column="CZRY"/>
        <result property="czsj" column="CZSJ"/>
    </resultMap>

    <sql id="querySql">
        select * from(SELECT a.*,
        b.name as znjname
        FROM BM_YSLX a
        left join bm_znjsq b on a.znjbm=b.code
        )
        WHERE 1=1
        <!--模糊查询 -->
        <if test="filter.searchText!=null">
            AND (code like '%${filter.searchText}%'
            OR name like '%${filter.searchText}%')
        </if>
        <!--所属公司-->
        <if test="filter.ssgs!=null">
            AND ssgs=#{filter.ssgs}
        </if>
        <if test="filter.isdisabled!=null">
            AND isdisabled=#{filter.isdisabled}
        </if>
    </sql>
    <select id="getPage" resultType="com.tofly.feesapi.bmgl.entity.vo.BmYslxSelect">
        <include refid="querySql"></include>
    </select>

</mapper>
