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

    <select id="getJgxxwhList" resultType="HashMap" parameterType="com.zjrs.zwnw.dbgl.dto.DbrwglJgxxwhQueryDTO">
        select a.id       as "id",

        a.AREA_ID  as "areaid",
        a.ORG_NAME as "orgname",
        (select user_name from v_rs_sy_org_area where user_id = b.jgfzr)  as "jgfzr",
        (select user_name from v_rs_sy_org_area where user_id = b.fgld)    as "fgld",
        b.qtbmszqx as "qtbmszqx"
        from v_s_sg_org a
        left join v_s_sg_org_ex b
        on a.ID = b.id
        where a.IS_VALID='1'
        <if test="dto.id != null and dto.id != ''">
            and a.id = #{dto.id}
        </if>
        order by a.AREA_ID,a.ORG_CODE

    </select>
    <select id="getJgxxwh" resultType="HashMap" parameterType="com.zjrs.zwnw.dbgl.dto.DbrwglCommDTO">
        select a.id       as "id",
        a.AREA_ID  as "areaid",
        a.ORG_NAME as"orgname",
        b.jgfzr    as "jgfzr",
        b.fgld     as "fgld",
        b.qtbmszqx as "qtbmszqx"
        from v_s_sg_org a
        left join v_s_sg_org_ex b
        on a.ID = b.id
        where a.id = #{dto.ids}
    </select>

</mapper>
