<?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.device.pq.mapper.SuperDataMapper">


    <select id="getPointSuper" resultType="com.njcn.device.pq.pojo.param.SuperDataParam">
        SELECT pl.`Name`  AS "mName",
               pl1.`Name` AS "pName",
               pl2.`Name` AS "devName",
               pl3.`Name` AS "subName",
               pl4.`Name` AS "urbanName"
        FROM pq_line pl
                 LEFT JOIN pq_line pl1 ON pl.Pid = pl1.Id
                 LEFT JOIN pq_line pl2 ON pl1.Pid = pl2.Id
                 LEFT JOIN pq_line pl3 ON pl2.Pid = pl3.Id
                 LEFT JOIN pq_line pl4 ON pl3.Pid = pl4.Id
        WHERE pl.Id = #{id}
    </select>
    <select id="getDeviceSuper" resultType="com.njcn.device.pq.pojo.param.SuperDataParam">
            SELECT
                pl.`Name` AS "devName",
                pl1.`Name` AS "subName",
                pl2.`Name` AS "urbanName"
            FROM
                pq_line pl
                    LEFT JOIN pq_line pl1 ON pl.Pid = pl1.Id
                    LEFT JOIN pq_line pl2 ON pl1.Pid = pl2.Id
            WHERE
                pl.Id = #{id}
    </select>

    <select id="getBaseReam" resultType="com.njcn.device.pq.pojo.param.BaseReamParam">
        SELECT cdm.Line_Id "id",cdm.Base_Meal_Id "baseMealId",cdm.Ream_Meal_Id "extendMealId",cfm.`Name` "baseMealName",cfm1.`Name` "extendMealName",cfm.Flow "baseMealFlow",cfm1.Flow "extendMealFlow"
        FROM cld_dev_meal cdm

                 left join cld_flow_meal cfm on cdm.Base_Meal_Id = cfm.Id
                 left join cld_flow_meal cfm1 on cdm.Ream_Meal_Id = cfm1.Id
        where cdm.Line_Id = #{id}
    </select>


</mapper>
