<?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.zjrs.zwnw.dbgl.entity.DbrwgzMapper">

    <select id="getDbrwList" resultType="HashMap" parameterType="com.zjrs.zwnw.dbgl.dto.DbrwglDbrwQueryDTO">
        select
        d.RS_DBGL_DBRW_LSH AS "rsdbgldbrwlsh",
        d.dbbh as "dbbh",
        d.rwly as "rwly",
        d.rwlyfl as "rwlyfl",
        '' as "qtbm",
        '' as "xbbm",
        d.tbzq as "tbzq",
        f_dbgl_getBctbrqByRwlsh(d.RS_DBGL_DBRW_LSH) as "jzrq",
        f_dbgl_getSysxByRwlsh(d.RS_DBGL_DBRW_LSH) as "sysx",
        d.sdpj AS "sdpj",
        d.zlpj AS "zlpj",
        d.bae001 AS "bae001",
        d.bae003 AS "bae003"
        FROM
        V_RS_DBGL_DBRW_YX d
        where d.rwzt = '0'
        and d.PFZT = '1'
        <if test="dto.rwzt != null and dto.rwzt != ''">
            and d.rwzt = #{dto.rwzt}
        </if>
        <if test="dto.pfzt != null and dto.pfzt != ''">
            and d.pfzt = #{dto.pfzt}
        </if>
        <if test="dto.sdpj != null and dto.sdpj != ''">
            and d.sdpj = #{dto.sdpj}
        </if>
        <if test="dto.zlpj != null and dto.zlpj != ''">
            and d.zlpj = #{dto.zlpj}
        </if>
        order by d.dbbh desc
    </select>
</mapper>
