<?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.gather.script.mapper.PqScriptDtlsMapper">


    <select id="selectMaxIndex" resultType="java.lang.Integer">

        SELECT IFNULL(max(t.Script_Index), -1) AS num
        FROM pq_script_dtls t
        WHERE Script_Id = #{scriptId}

    </select>

    <select id="getScriptDtlsDataList"    resultType="com.njcn.gather.script.pojo.vo.PqScriptDtlDataVO" >
        SELECT
            t2.CODE scriptCode,
            t2.NAME scriptName,
            t1.*
        FROM
            pq_script_dtls t1,
            sys_dict_tree t2
        WHERE
            t1.Script_Type = t2.Id
          AND t1.Script_Id = #{scriptId}
          AND t1.ENABLE = 1
        ORDER BY
            t1.Script_Index ASC,t1.HarmNum ASC
    </select>
</mapper>

