<?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.ggfw.rlzysc.entity.PbszMapper">

    <select id="queryPbszList" parameterType="com.zjrs.ggfw.rlzysc.dto.GrqzPbszQueryDTO" resultType="com.zjrs.ggfw.rlzysc.dto.GrqzPbszListDTO">
        select * from (
        select d.*,g.aae004 as "lxr" from (
        select a.RS_RLZY_PBSZ_LSH rsrlzypbszlsh,
        b.rs_rlzy_qyxx_lsh rsrlzyqyxxlsh,
        b.RS_YHLSH qyxx_yhlsh,
        a.rs_yhlsh rsyhlsh,
        a.ts_cjsj tscjsj,
        b.gsmc,
        '0' pbzt
        from v_RS_RLZY_QYXX b left join (select * from v_RS_RLZY_PBSZ where rs_yhlsh= #{dto.rsyhlsh}) a on
        a.rs_rlzy_qyxx_lsh = b.rs_rlzy_qyxx_lsh
        where b.qyxx_shzt = '1'
        )d,v_rs_ggfw_user e,v_ab01 g
        where d.qyxx_YHLSH = e.userid
        and e.ztid = g.ztid
        ) where 1=1
        <if test="dto.pbzt != null and dto.pbzt != ''">
            and pbzt = #{dto.pbzt}
        </if>
    </select>

</mapper>
