<?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.VRsRlzyJyzxMapper">

    <select id="getJyzxglList" parameterType="com.zjrs.zwnw.rlzysc.dto.JyzxglQueryDTO" resultType="HashMap">
        select
        a.rs_rlzy_jyzx_bt as "rsrlzyjyzxbt",
        a.rs_rlzy_jyzx_zw_s as "rsrlzyjyzxzw",
        a.rs_rlzy_jyzx_lx as "rsrlzyjyzxlx",
        a.fbzt as "fbzt",
        (select bae005 from v_rs_rlzy_jyzx where fbzt='1' and rs_rlzy_jyzx_lsh = a.rs_rlzy_jyzx_lsh)  as "fbsj",
        (select b.user_name
        from s_sg_user b
        where a.bae004 = b.id
        and a.fbzt = '1')  as "fbrname",
        (select b.user_name
        from s_sg_user b
        where a.bae004 = b.id)  as "zjxgrname",
        a.bae005 as "zjxgsj",
        a.rs_rlzy_jyzx_lsh as "rsrlzyjyzxlsh",
        a.bae001
        from v_rs_rlzy_jyzx_s a where a.ts_yxbz = '1'
        <if test="dto.fbzt != null and dto.fbzt != ''">
            and a.fbzt = #{dto.fbzt}
        </if>
        order by a.bae005 DESC
    </select>

    <select id="getJyzxXx" parameterType="com.zjrs.zwnw.rlzysc.dto.ZjQueryDTO" resultType="HashMap">
        select
        a.rs_rlzy_jyzx_lsh as "rsrlzyjyzxlsh",
        a.rs_rlzy_jyzx_bt as "rsrlzyjyzxbt",
        a.rs_rlzy_jyzx_lx as "rsrlzyjyzxlx",
        a.rs_rlzy_jyzx_zw_s as "rsrlzyjyzxzw",
        (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_jyzx_s a where  a.rs_rlzy_jyzx_lsh = #{dto.zjlsh} and a.ts_yxbz = '1'
    </select>

</mapper>
