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

    <!--获取终端等级信息-->
    <select id="getDeviceLevelData" resultType="com.njcn.device.pq.pojo.vo.DeviceRunExceptionVO">
        SELECT
        device.id AS devId,
        min( sdd.Algo_Describe ) AS algoDescribe
        FROM
        pq_line AS device
        INNER JOIN pq_line AS voltage ON device.id = voltage.pid
        INNER JOIN pq_line AS line ON voltage.id = line.pid
        INNER JOIN pq_line_detail AS pld ON line.id = pld.id
        LEFT JOIN sys_dict_data AS sdd ON pld.Line_Grade = sdd.id
        WHERE
        <if test="searchBeginTime != null and searchBeginTime != ''"><!-- 开始创建时间 -->
            date_format(device.update_Time,'%y%m%d') &gt;= date_format(#{searchBeginTime},'%y%m%d')
        </if>
        <if test="searchEndTime != null and searchEndTime != ''"><!--  -->
            and date_format(device.update_Time,'%y%m%d') &lt;= date_format(#{searchEndTime},'%y%m%d')
        </if>
        GROUP BY
        device.id,
        device.NAME,
        sdd.Algo_Describe
    </select>


</mapper>