<?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.njcn.mapper.configuration.RPTreeMapper'>
    <resultMap type="RPTree" id="resultMap" autoMapping="true">
        <id column="node" property="nodeIndex"/>
        <id column="RD_Name" property="name"/>
        <id column="RD_Index" property="rdIndex"/>
        <result column="parentNode" property="pId"/>
    </resultMap>
    <select id='getfirstData' resultMap='resultMap'>
		select 
			*
		from PQS_RptData 
		where parentnode=0 and State = 1 and datatype = #{dataType}
	    order by Sort
	</select>

    <select id='getsecondData' resultMap='resultMap'>
        select
        *
        from PQS_RptData
        where State = 1 and datatype = #{dataType} and parentnode in
        <foreach collection="first" item="item" open="(" close=")" separator=",">
            #{item}
        </foreach>
        order by Sort
    </select>

    <select id="getExcelSetting" resultType="RptData">
        select rd_index rdIndex,rd_name rdName,RD_DESCRIBE rdDescribe,createtime createTime,parentguid parentGUID from pqs_rptdata
        where state = 1 and datatype = 2 order by createtime asc
    </select>
</mapper>