<?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.chinaweal.aiccs.aiccs.abnormal.mapper.GzaiccodeMapper">

<!--    <select id="getStationByOrg" resultType="com.chinaweal.aiccs.aiccs.dict.entity.CascadeTreeNode" >-->
<!--        select orgUnitID as id, orgUnitName as label, orgNumber as value, parentID as SPARENTCODE, '' as shortname-->
<!--        from aicorg.t_orgunits-->
<!--        where orgLevel = '3'-->
<!--        <if test="parentid != null and parentid != ''">-->
<!--            and parentID = #{parentid}-->
<!--        </if>-->
<!--        order by orgNumber asc-->
<!--    </select>-->

    <select id="getNodeByOrg" resultType="com.chinaweal.aiccs.aiccs.dict.entity.CascadeTreeNode" >
        select orgUnitID as id, orgUnitName as label, orgNumber as value, parentID as SPARENTCODE, '' as shortname
        from cxaicorg.t_orgunits
        where orgNumber like '15%'
        and orgNumber = #{org}
    </select>

    <select id="getNameByOrg" resultType="com.chinaweal.aiccs.aiccs.dict.entity.CascadeTreeNode" >
        select orgUnitID as id, orgUnitName as label, orgNumber as value, parentID as SPARENTCODE, '' as shortname
        from cxaicorg.t_orgunits
        where orgNumber = #{org}
    </select>

    <select id="getNodeList" resultType="com.chinaweal.aiccs.aiccs.dict.entity.CascadeTreeNode" >
        select orgUnitID as id, orgUnitName as label, orgNumber as value, parentID as SPARENTCODE, '' as shortname
        from cxaicorg.t_orgunits
        where orgNumber like '15%'
        and unittype = '1' and deleted = '0'
        <if test="parentid != null and parentid != ''">
            and parentID = #{parentid}
        </if>
        <if test="slevel != null and slevel != -99">
            and orgLevel = #{slevel}
        </if>
        order by orgNumber asc

<!--        <where>-->
<!--            <if test="parentid != null and parentid != ''">-->
<!--                and parentID = #{parentid}-->
<!--            </if>-->
<!--            <if test="slevel != null and slevel != -99">-->
<!--                and orgLevel = #{slevel}-->
<!--            </if>-->
<!--        </where>-->
<!--        order by orgNumber asc-->
    </select>

    <select id="getChildStationList" resultType="com.chinaweal.aiccs.aiccs.dict.entity.CascadeTreeNode" >
        select orgUnitID as id, orgUnitName as label, orgNumber as value, parentID as SPARENTCODE, '' as shortname
        from cxaicorg.t_orgunits
        where orgUnitName like '%所'
        <if test="parentid != null and parentid != ''">
            and parentID = #{parentid}
        </if>
        <if test="slevel != null and slevel != -99">
            and orgLevel = #{slevel}
        </if>
        order by orgNumber asc
    </select>
</mapper>
