<?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.tofly.qualitycontrol.mapper.PlanProcessMapper">
    <resultMap id="planProcessMap" type="com.tofly.qualitycontrol.entity.PlanProcess">
        <id property="id" column="ID"/>
        <result property="planId" column="PLAN_ID"/>
        <result property="auditLevel" column="AUDIT_LEVEL"/>
        <result property="auditorId" column="AUDITOR_ID"/>
        <result property="auditorName" column="AUDITOR_NAME"/>
        <result property="auditorDeptId" column="AUDITOR_DEPT_ID"/>
        <result property="auditorDeptName" column="AUDITOR_DEPT_NAME"/>
        <result property="auditResult" column="AUDIT_RESULT"/>
        <result property="auditDesc" column="AUDIT_DESC"/>
        <result property="auditTime" column="AUDIT_TIME"/>
    </resultMap>

    <select id="loadToExamineInfo" resultType="PlanProcess">
        SELECT y.*,c.AUDIT_DESC,c.AUDIT_TIME ,c.AUDIT_RESULT
        FROM TF_YWPN_ZJJHRY_W y
                 LEFT JOIN TF_YWPN_ZJJHGC_W c
                           ON(y.PLAN_ID = c.PLAN_ID and y.AUDIT_LEVEL=c.AUDIT_LEVEL and y.AUDITOR_ID = c.AUDITOR_ID)
        WHERE y.PLAN_ID=#{id}
        ORDER BY c.AUDIT_TIME,y.id
    </select>

</mapper>