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

    <select id="getSylbtpglList" parameterType="com.zjrs.zwnw.rlzysc.dto.SylbtpglQueryDTO" resultType="HashMap">
        select
        a.rs_tycc_lsh as "rstycclsh",
        a.rs_rlzy_lbgg_mc as "rsrlzylbggmc",
        a.rs_rlzy_lbgg_fwdz as "rsrlzylbggfwdz",
        a.rs_rlzy_lbgg_lsh as "rsrlzylbgglsh",
        (select user_name from v_rs_sy_org_area where user_id = a.bae004) as "bae004",
        a.bae005 as "bae005"
        from v_rs_rlzy_lbgg a where a.ts_yxbz = '1'
        <if test="dto.rsrlzylbggmc != null and dto.rsrlzylbggmc != ''">
            and a.rs_rlzy_lbgg_mc like '%${ dto.rsrlzylbggmc }%'
        </if>
        order by a.zdzt desc nulls last,a.zdsj desc,a.bae005 DESC
    </select>

    <select id="getSylbtpglXx" parameterType="com.zjrs.zwnw.rlzysc.dto.ZjQueryDTO" resultType="HashMap">
        select
        a.rs_rlzy_lbgg_mc as "rsrlzylbggmc",
        a.rs_rlzy_lbgg_fwdz as "rsrlzylbggfwdz",
        a.rs_tycc_lsh as "rstycclsh",
        a.rs_rlzy_lbgg_bz as "rsrlzylbggbz",
        a.rs_rlzy_lbgg_lsh as "rsrlzylbgglsh",
        (select user_name from v_rs_sy_org_area where user_id = a.bae002) as "bae002",
        a.bae003 as "bae003",
        (select max(org_name) from v_rs_sy_org_area where org_id = a.bae001) as "bae001",
        (select user_name from v_rs_sy_org_area where user_id = a.bae004) as "bae004",
        a.bae005 as "bae005",
        (select max(org_name) from v_rs_sy_org_area where org_id = a.bae006) as "bae006"
        from v_rs_rlzy_lbgg a where  a.rs_rlzy_lbgg_lsh = #{dto.zjlsh} and a.ts_yxbz = '1'
    </select>

</mapper>
