<?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.icd.mapping.mapper.CsDevTypeMapper">

    <select id="selectDeviceTypeCheckList"
            resultType="com.njcn.gather.icd.mapping.pojo.vo.MmsDeviceTypeVO">
        SELECT
            d.id AS id,
            d.name AS name,
            d.icd AS icdId,
            p.Name AS icdName,
            p.Path AS icdPath,
            p.Result AS icdResult,
            p.Msg AS icdMsg,
            d.report_name AS reportName,
            CASE WHEN d.icd IS NOT NULL AND d.icd != '' AND p.ID IS NOT NULL THEN 1 ELSE 0 END AS canCheckIcd,
            0 AS canCheckPqdif
        FROM cs_dev_type d
        LEFT JOIN cs_icd_path p ON d.icd = p.ID
        WHERE d.State = 1
        ORDER BY d.Update_Time DESC, d.Create_Time DESC
    </select>

</mapper>
